Skip to content

Commit

Permalink
Auto merge of #48520 - Manishearth:rollup, r=Manishearth
Browse files Browse the repository at this point in the history
Rollup of 15 pull requests

- Successful merges: #47689, #48110, #48197, #48296, #48386, #48392, #48404, #48415, #48441, #48448, #48452, #48481, #48490, #48499, #48503
- Failed merges:
  • Loading branch information
bors committed Feb 25, 2018
2 parents 28a1e4f + 52047f0 commit 026339e
Show file tree
Hide file tree
Showing 57 changed files with 941 additions and 546 deletions.
6 changes: 3 additions & 3 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ impl Step for TestHelpers {
type Output = ();

fn should_run(run: ShouldRun) -> ShouldRun {
run.path("src/rt/rust_test_helpers.c")
run.path("src/test/auxiliary/rust_test_helpers.c")
}

fn make_run(run: RunConfig) {
Expand All @@ -326,7 +326,7 @@ impl Step for TestHelpers {
let build = builder.build;
let target = self.target;
let dst = build.test_helpers_out(target);
let src = build.src.join("src/rt/rust_test_helpers.c");
let src = build.src.join("src/test/auxiliary/rust_test_helpers.c");
if up_to_date(&src, &dst.join("librust_test_helpers.a")) {
return
}
Expand All @@ -353,7 +353,7 @@ impl Step for TestHelpers {
.opt_level(0)
.warnings(false)
.debug(false)
.file(build.src.join("src/rt/rust_test_helpers.c"))
.file(build.src.join("src/test/auxiliary/rust_test_helpers.c"))
.compile("rust_test_helpers");
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/doc/book
Submodule book updated 31 files
+1 −1 .travis.yml
+3 −0 first-edition/book.toml
+56 −0 first-edition/src/theme/first-edition.css
+27 −0 first-edition/src/theme/header.hbs
+22 −8 index.md
+2 −2 redirects/getting-started.md
+1 −1 redirects/release-channels.md
+1 −0 second-edition/dictionary.txt
+208 −536 second-edition/nostarch/chapter01.md
+1 −1 second-edition/nostarch/chapter10.md
+875 −941 second-edition/nostarch/chapter20.md
+169 −0 second-edition/nostarch/introduction.md
+7 −7 second-edition/src/SUMMARY.md
+1 −1 second-edition/src/appendix-05-translation.md
+10 −32 second-edition/src/appendix-07-nightly-rust.md
+39 −3 second-edition/src/ch00-00-introduction.md
+12 −0 second-edition/src/ch01-00-getting-started.md
+55 −50 second-edition/src/ch01-01-installation.md
+50 −302 second-edition/src/ch01-02-hello-world.md
+265 −0 second-edition/src/ch01-03-hello-cargo.md
+1 −1 second-edition/src/ch02-00-guessing-game-tutorial.md
+2 −2 second-edition/src/ch10-02-traits.md
+22 −19 second-edition/src/ch20-00-final-project-a-web-server.md
+273 −227 second-edition/src/ch20-01-single-threaded.md
+1,230 −0 second-edition/src/ch20-02-multithreaded.md
+0 −110 second-edition/src/ch20-02-slow-requests.md
+0 −284 second-edition/src/ch20-03-designing-the-interface.md
+128 −124 second-edition/src/ch20-03-graceful-shutdown-and-cleanup.md
+0 −248 second-edition/src/ch20-04-storing-threads.md
+0 −516 second-edition/src/ch20-05-sending-requests-via-channels.md
+0 −276 second-edition/theme/index.hbs
7 changes: 1 addition & 6 deletions src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,6 @@ impl<T: ?Sized> Box<T> {
/// Simple usage:
///
/// ```
/// #![feature(box_leak)]
///
/// fn main() {
/// let x = Box::new(41);
/// let static_ref: &'static mut usize = Box::leak(x);
Expand All @@ -372,17 +370,14 @@ impl<T: ?Sized> Box<T> {
/// Unsized data:
///
/// ```
/// #![feature(box_leak)]
///
/// fn main() {
/// let x = vec![1, 2, 3].into_boxed_slice();
/// let static_ref = Box::leak(x);
/// static_ref[0] = 4;
/// assert_eq!(*static_ref, [4, 2, 3]);
/// }
/// ```
#[unstable(feature = "box_leak", reason = "needs an FCP to stabilize",
issue = "46179")]
#[stable(feature = "box_leak", since = "1.26.0")]
#[inline]
pub fn leak<'a>(b: Box<T>) -> &'a mut T
where
Expand Down
12 changes: 6 additions & 6 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2956,7 +2956,7 @@ impl<'a> LoweringContext<'a> {

// Desugar ExprIfLet
// From: `if let <pat> = <sub_expr> <body> [<else_opt>]`
ExprKind::IfLet(ref pat, ref sub_expr, ref body, ref else_opt) => {
ExprKind::IfLet(ref pats, ref sub_expr, ref body, ref else_opt) => {
// to:
//
// match <sub_expr> {
Expand All @@ -2970,8 +2970,8 @@ impl<'a> LoweringContext<'a> {
{
let body = self.lower_block(body, false);
let body_expr = P(self.expr_block(body, ThinVec::new()));
let pat = self.lower_pat(pat);
arms.push(self.arm(hir_vec![pat], body_expr));
let pats = pats.iter().map(|pat| self.lower_pat(pat)).collect();
arms.push(self.arm(pats, body_expr));
}

// _ => [<else_opt>|()]
Expand Down Expand Up @@ -3000,7 +3000,7 @@ impl<'a> LoweringContext<'a> {

// Desugar ExprWhileLet
// From: `[opt_ident]: while let <pat> = <sub_expr> <body>`
ExprKind::WhileLet(ref pat, ref sub_expr, ref body, opt_label) => {
ExprKind::WhileLet(ref pats, ref sub_expr, ref body, opt_label) => {
// to:
//
// [opt_ident]: loop {
Expand All @@ -3021,8 +3021,8 @@ impl<'a> LoweringContext<'a> {
// `<pat> => <body>`
let pat_arm = {
let body_expr = P(self.expr_block(body, ThinVec::new()));
let pat = self.lower_pat(pat);
self.arm(hir_vec![pat], body_expr)
let pats = pats.iter().map(|pat| self.lower_pat(pat)).collect();
self.arm(pats, body_expr)
};

// `_ => break`
Expand Down
15 changes: 13 additions & 2 deletions src/librustc/ich/impls_ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,19 @@ for ty::subst::Kind<'gcx> {
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) {
self.as_type().hash_stable(hcx, hasher);
self.as_region().hash_stable(hcx, hasher);
self.unpack().hash_stable(hcx, hasher);
}
}

impl<'gcx> HashStable<StableHashingContext<'gcx>>
for ty::subst::UnpackedKind<'gcx> {
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) {
match self {
ty::subst::UnpackedKind::Lifetime(lt) => lt.hash_stable(hcx, hasher),
ty::subst::UnpackedKind::Type(ty) => ty.hash_stable(hcx, hasher),
}
}
}

Expand Down
7 changes: 4 additions & 3 deletions src/librustc/infer/anon_types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use traits::{self, PredicateObligation};
use ty::{self, Ty};
use ty::fold::{BottomUpFolder, TypeFoldable};
use ty::outlives::Component;
use ty::subst::{Kind, Substs};
use ty::subst::{Kind, UnpackedKind, Substs};
use util::nodemap::DefIdMap;

pub type AnonTypeMap<'tcx> = DefIdMap<AnonTypeDecl<'tcx>>;
Expand Down Expand Up @@ -321,7 +321,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
let index = region_def.index as usize;

// Get the value supplied for this region from the substs.
let subst_arg = anon_defn.substs[index].as_region().unwrap();
let subst_arg = anon_defn.substs.region_at(index);

// Compute the least upper bound of it with the other regions.
debug!("constrain_anon_types: least_region={:?}", least_region);
Expand Down Expand Up @@ -466,7 +466,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
// All other regions, we map them appropriately to their adjusted
// indices, erroring if we find any lifetimes that were not mapped
// into the new set.
_ => if let Some(r1) = map.get(&Kind::from(r)).and_then(|k| k.as_region()) {
_ => if let Some(UnpackedKind::Lifetime(r1)) = map.get(&r.into())
.map(|k| k.unpack()) {
r1
} else {
// No mapping was found. This means that
Expand Down
14 changes: 7 additions & 7 deletions src/librustc/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub enum IntercrateMode {
/// either identifying an `impl` (e.g., `impl Eq for int`) that
/// provides the required vtable, or else finding a bound that is in
/// scope. The eventual result is usually a `Selection` (defined below).
#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq, Hash)]
pub struct Obligation<'tcx, T> {
pub cause: ObligationCause<'tcx>,
pub param_env: ty::ParamEnv<'tcx>,
Expand All @@ -85,7 +85,7 @@ pub type PredicateObligation<'tcx> = Obligation<'tcx, ty::Predicate<'tcx>>;
pub type TraitObligation<'tcx> = Obligation<'tcx, ty::PolyTraitPredicate<'tcx>>;

/// Why did we incur this obligation? Used for error reporting.
#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct ObligationCause<'tcx> {
pub span: Span,

Expand Down Expand Up @@ -113,7 +113,7 @@ impl<'tcx> ObligationCause<'tcx> {
}
}

#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub enum ObligationCauseCode<'tcx> {
/// Not well classified or should be obvious from span.
MiscObligation,
Expand Down Expand Up @@ -215,7 +215,7 @@ pub enum ObligationCauseCode<'tcx> {
BlockTailExpression(ast::NodeId),
}

#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct DerivedObligationCause<'tcx> {
/// The trait reference of the parent obligation that led to the
/// current obligation. Note that only trait obligations lead to
Expand Down Expand Up @@ -304,7 +304,7 @@ pub type SelectionResult<'tcx, T> = Result<Option<T>, SelectionError<'tcx>>;
/// ### The type parameter `N`
///
/// See explanation on `VtableImplData`.
#[derive(Clone, RustcEncodable, RustcDecodable)]
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)]
pub enum Vtable<'tcx, N> {
/// Vtable identifying a particular impl.
VtableImpl(VtableImplData<'tcx, N>),
Expand Down Expand Up @@ -374,13 +374,13 @@ pub struct VtableClosureData<'tcx, N> {
pub nested: Vec<N>
}

#[derive(Clone, RustcEncodable, RustcDecodable)]
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)]
pub struct VtableAutoImplData<N> {
pub trait_def_id: DefId,
pub nested: Vec<N>
}

#[derive(Clone, RustcEncodable, RustcDecodable)]
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)]
pub struct VtableBuiltinData<N> {
pub nested: Vec<N>
}
Expand Down
Loading

0 comments on commit 026339e

Please sign in to comment.