From fe9c68a0511eb827b2d5a4a3490b5f9c2168a05d Mon Sep 17 00:00:00 2001 From: gaurikholkar Date: Sun, 6 Aug 2017 04:09:43 +0530 Subject: [PATCH 01/50] Adding E0623 for structs --- .../error_reporting/anon_anon_conflict.rs | 222 +++++++++++++----- .../error_reporting/named_anon_conflict.rs | 86 +++---- src/librustc/infer/error_reporting/util.rs | 73 ++++-- .../ex2b-push-no-existing-names.stderr | 23 +- .../ex3-both-anon-regions-2.stderr | 2 +- .../ex3-both-anon-regions-3.rs | 5 +- .../ex3-both-anon-regions-3.stderr | 20 +- .../ex3-both-anon-regions-4.stderr | 20 -- ...x3-both-anon-regions-both-are-structs-2.rs | 19 ++ ...oth-anon-regions-both-are-structs-2.stderr | 10 + ...x3-both-anon-regions-both-are-structs-3.rs | 19 ++ ...oth-anon-regions-both-are-structs-3.stderr | 12 + ...x3-both-anon-regions-both-are-structs-4.rs | 19 ++ ...oth-anon-regions-both-are-structs-4.stderr | 12 + ...ex3-both-anon-regions-both-are-structs.rs} | 13 +- ...-both-anon-regions-both-are-structs.stderr | 10 + .../ex3-both-anon-regions-one-is-struct-2.rs | 17 ++ ...3-both-anon-regions-one-is-struct-2.stderr | 12 + .../ex3-both-anon-regions-one-is-struct-3.rs | 17 ++ ...3-both-anon-regions-one-is-struct-3.stderr | 12 + .../ex3-both-anon-regions-one-is-struct-4.rs | 17 ++ ...3-both-anon-regions-one-is-struct-4.stderr | 10 + .../ex3-both-anon-regions-one-is-struct.rs | 20 ++ ...ex3-both-anon-regions-one-is-struct.stderr | 10 + ...3-both-anon-regions-return-type-is-anon.rs | 22 ++ ...th-anon-regions-return-type-is-anon.stderr | 23 ++ .../ex3-both-anon-regions-self-is-anon.rs | 22 ++ .../ex3-both-anon-regions-self-is-anon.stderr | 23 ++ .../ex3-both-anon-regions-using-impl-items.rs | 18 ++ ...-both-anon-regions-using-impl-items.stderr | 10 + .../lifetime-errors/ex3-both-anon-regions.rs | 2 +- .../ex3-both-anon-regions.stderr | 2 +- 32 files changed, 623 insertions(+), 179 deletions(-) delete mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-4.stderr create mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.rs create mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr create mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.rs create mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr create mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.rs create mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr rename src/test/ui/lifetime-errors/{ex3-both-anon-regions-4.rs => ex3-both-anon-regions-both-are-structs.rs} (71%) create mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr create mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.rs create mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr create mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs create mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr create mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs create mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr create mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.rs create mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr create mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.rs create mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr create mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs create mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr create mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.rs create mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr diff --git a/src/librustc/infer/error_reporting/anon_anon_conflict.rs b/src/librustc/infer/error_reporting/anon_anon_conflict.rs index 2e910968818..3821bf766b9 100644 --- a/src/librustc/infer/error_reporting/anon_anon_conflict.rs +++ b/src/librustc/infer/error_reporting/anon_anon_conflict.rs @@ -27,65 +27,83 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // { x.push(y); }. // The example gives // fn foo(x: &mut Vec<&u8>, y: &u8) { - // --- --- these references must have the same lifetime + // --- --- these references are declared with different lifetimes... // x.push(y); - // ^ data from `y` flows into `x` here - // It will later be extended to trait objects and structs. + // ^ ...but data from `y` flows into `x` here + // It has been extended for the case of structs too. + // Consider the example + // struct Ref<'a> { x: &'a u32 } + // fn foo(mut x: Vec, y: Ref) { + // --- --- these structs are declared with different lifetimes... + // x.push(y); + // ^ ...but data from `y` flows into `x` here + // } + // It will later be extended to trait objects. pub fn try_report_anon_anon_conflict(&self, error: &RegionResolutionError<'tcx>) -> bool { - let (span, sub, sup) = match *error { ConcreteFailure(ref origin, sub, sup) => (origin.span(), sub, sup), _ => return false, // inapplicable }; // Determine whether the sub and sup consist of both anonymous (elided) regions. - let (ty1, ty2) = if self.is_suitable_anonymous_region(sup).is_some() && - self.is_suitable_anonymous_region(sub).is_some() { - if let (Some(anon_reg1), Some(anon_reg2)) = - (self.is_suitable_anonymous_region(sup), self.is_suitable_anonymous_region(sub)) { - let ((_, br1), (_, br2)) = (anon_reg1, anon_reg2); - if self.find_anon_type(sup, &br1).is_some() && - self.find_anon_type(sub, &br2).is_some() { - (self.find_anon_type(sup, &br1).unwrap(), - self.find_anon_type(sub, &br2).unwrap()) + let (ty_sup, ty_sub, scope_def_id_sup, scope_def_id_sub, bregion_sup, bregion_sub) = + if let (Some(anon_reg_sup), Some(anon_reg_sub)) = + (self.is_suitable_anonymous_region(sup, true), + self.is_suitable_anonymous_region(sub, true)) { + let ((def_id_sup, br_sup), (def_id_sub, br_sub)) = (anon_reg_sup, anon_reg_sub); + if let (Some(anonarg_sup), Some(anonarg_sub)) = + (self.find_anon_type(sup, &br_sup), self.find_anon_type(sub, &br_sub)) { + (anonarg_sup, anonarg_sub, def_id_sup, def_id_sub, br_sup, br_sub) } else { return false; } } else { return false; - } - } else { - return false; // inapplicable - }; + }; - if let (Some(sup_arg), Some(sub_arg)) = + let (label1, label2) = if let (Some(sup_arg), Some(sub_arg)) = (self.find_arg_with_anonymous_region(sup, sup), self.find_arg_with_anonymous_region(sub, sub)) { - let ((anon_arg1, _, _, _), (anon_arg2, _, _, _)) = (sup_arg, sub_arg); - let span_label_var1 = if let Some(simple_name) = anon_arg1.pat.simple_name() { - format!(" from `{}` ", simple_name) + let ((anon_arg_sup, _, _, is_first_sup), (anon_arg_sub, _, _, is_first_sub)) = + (sup_arg, sub_arg); + if self.is_self_anon(is_first_sup, scope_def_id_sup) || + self.is_self_anon(is_first_sub, scope_def_id_sub) { + return false; + } + + if self.is_return_type_anon(scope_def_id_sup, bregion_sup) || + self.is_return_type_anon(scope_def_id_sub, bregion_sub) { + return false; + } + + if anon_arg_sup == anon_arg_sub { + (format!(" with one lifetime"), format!(" into the other")) } else { - format!(" ") - }; + let span_label_var1 = if let Some(simple_name) = anon_arg_sup.pat.simple_name() { + format!(" from `{}`", simple_name) + } else { + format!("") + }; - let span_label_var2 = if let Some(simple_name) = anon_arg2.pat.simple_name() { - format!(" into `{}` ", simple_name) - } else { - format!(" ") - }; + let span_label_var2 = if let Some(simple_name) = anon_arg_sub.pat.simple_name() { + format!(" into `{}`", simple_name) + } else { + format!("") + }; - struct_span_err!(self.tcx.sess, span, E0623, "lifetime mismatch") - .span_label(ty1.span, - format!("these references are not declared with the same lifetime...")) - .span_label(ty2.span, format!("")) - .span_label(span, - format!("...but data{}flows{}here", span_label_var1, span_label_var2)) - .emit(); + (span_label_var1, span_label_var2) + } } else { return false; - } + }; + struct_span_err!(self.tcx.sess, span, E0623, "lifetime mismatch") + .span_label(ty_sup.span, + format!("these two types are declared with different lifetimes...")) + .span_label(ty_sub.span, format!("")) + .span_label(span, format!("...but data{} flows{} here", label1, label2)) + .emit(); return true; } @@ -94,7 +112,6 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { /// contains the anonymous type. /// /// # Arguments - /// /// region - the anonymous region corresponding to the anon_anon conflict /// br - the bound region corresponding to the above region which is of type `BrAnon(_)` /// @@ -105,8 +122,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { /// ``` /// The function returns the nested type corresponding to the anonymous region /// for e.g. `&u8` and Vec<`&u8`. - fn find_anon_type(&self, region: Region<'tcx>, br: &ty::BoundRegion) -> Option<&hir::Ty> { - if let Some(anon_reg) = self.is_suitable_anonymous_region(region) { + pub fn find_anon_type(&self, region: Region<'tcx>, br: &ty::BoundRegion) -> Option<&hir::Ty> { + if let Some(anon_reg) = self.is_suitable_anonymous_region(region, true) { let (def_id, _) = anon_reg; if let Some(node_id) = self.tcx.hir.as_local_node_id(def_id) { let ret_ty = self.tcx.type_of(def_id); @@ -117,19 +134,33 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { .inputs .iter() .filter_map(|arg| { - let mut nested_visitor = FindNestedTypeVisitor { - infcx: &self, - hir_map: &self.tcx.hir, - bound_region: *br, - found_type: None, - }; - nested_visitor.visit_ty(&**arg); - if nested_visitor.found_type.is_some() { - nested_visitor.found_type - } else { - None - } - }) + self.find_component_for_bound_region(&**arg, + br) + }) + .next(); + } + } else if let hir_map::NodeTraitItem(it) = self.tcx.hir.get(node_id) { + if let hir::TraitItemKind::Method(ref fndecl, _) = it.node { + return fndecl + .decl + .inputs + .iter() + .filter_map(|arg| { + self.find_component_for_bound_region(&**arg, + br) + }) + .next(); + } + } else if let hir_map::NodeImplItem(it) = self.tcx.hir.get(node_id) { + if let hir::ImplItemKind::Method(ref fndecl, _) = it.node { + return fndecl + .decl + .inputs + .iter() + .filter_map(|arg| { + self.find_component_for_bound_region(&**arg, + br) + }) .next(); } } @@ -138,6 +169,22 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } None } + + // This method creates a FindNestedTypeVisitor which returns the type corresponding + // to the anonymous region. + fn find_component_for_bound_region(&self, + arg: &'gcx hir::Ty, + br: &ty::BoundRegion) + -> Option<(&'gcx hir::Ty)> { + let mut nested_visitor = FindNestedTypeVisitor { + infcx: &self, + hir_map: &self.tcx.hir, + bound_region: *br, + found_type: None, + }; + nested_visitor.visit_ty(arg); + nested_visitor.found_type + } } // The FindNestedTypeVisitor captures the corresponding `hir::Ty` of the @@ -176,8 +223,8 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for FindNestedTypeVisitor<'a, 'gcx, 'tcx> { hir::TyRptr(ref lifetime, _) => { match self.infcx.tcx.named_region_map.defs.get(&lifetime.id) { // the lifetime of the TyRptr - Some(&rl::Region::LateBoundAnon(debuijn_index, anon_index)) => { - if debuijn_index.depth == 1 && anon_index == br_index { + Some(&rl::Region::LateBoundAnon(debruijn_index, anon_index)) => { + if debruijn_index.depth == 1 && anon_index == br_index { self.found_type = Some(arg); return; // we can stop visiting now } @@ -191,6 +238,20 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for FindNestedTypeVisitor<'a, 'gcx, 'tcx> { } } } + // Checks if it is of type `hir::TyPath` which corresponds to a struct. + hir::TyPath(_) => { + let subvisitor = &mut TyPathVisitor { + infcx: self.infcx, + found_it: false, + bound_region: self.bound_region, + hir_map: self.hir_map, + }; + intravisit::walk_ty(subvisitor, arg); // call walk_ty; as visit_ty is empty, + // this will visit only outermost type + if subvisitor.found_it { + self.found_type = Some(arg); + } + } _ => {} } // walk the embedded contents: e.g., if we are visiting `Vec<&Foo>`, @@ -198,3 +259,56 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for FindNestedTypeVisitor<'a, 'gcx, 'tcx> { intravisit::walk_ty(self, arg); } } + +// The visitor captures the corresponding `hir::Ty` of the anonymous region +// in the case of structs ie. `hir::TyPath`. +// This visitor would be invoked for each lifetime corresponding to a struct, +// and would walk the types like Vec in the above example and Ref looking for the HIR +// where that lifetime appears. This allows us to highlight the +// specific part of the type in the error message. +struct TyPathVisitor<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { + infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, + hir_map: &'a hir::map::Map<'gcx>, + found_it: bool, + bound_region: ty::BoundRegion, +} + +impl<'a, 'gcx, 'tcx> Visitor<'gcx> for TyPathVisitor<'a, 'gcx, 'tcx> { + fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'gcx> { + NestedVisitorMap::OnlyBodies(&self.hir_map) + } + + fn visit_lifetime(&mut self, lifetime: &hir::Lifetime) { + let br_index = match self.bound_region { + ty::BrAnon(index) => index, + _ => return, + }; + + match self.infcx.tcx.named_region_map.defs.get(&lifetime.id) { + // the lifetime of the TyPath! + Some(&rl::Region::LateBoundAnon(debruijn_index, anon_index)) => { + if debruijn_index.depth == 1 && anon_index == br_index { + self.found_it = true; + } + } + Some(&rl::Region::Static) | + Some(&rl::Region::EarlyBound(_, _)) | + Some(&rl::Region::LateBound(_, _)) | + Some(&rl::Region::Free(_, _)) | + None => { + debug!("no arg found"); + } + } + } + + fn visit_ty(&mut self, arg: &'gcx hir::Ty) { + // ignore nested types + // + // If you have a type like `Foo<'a, &Ty>` we + // are only interested in the immediate lifetimes ('a). + // + // Making `visit_ty` empty will ignore the `&Ty` embedded + // inside, it will get reached by the outer visitor. + debug!("`Ty` corresponding to a struct is {:?}", arg); + } +} diff --git a/src/librustc/infer/error_reporting/named_anon_conflict.rs b/src/librustc/infer/error_reporting/named_anon_conflict.rs index 491079a1f92..f46855502ea 100644 --- a/src/librustc/infer/error_reporting/named_anon_conflict.rs +++ b/src/librustc/infer/error_reporting/named_anon_conflict.rs @@ -11,7 +11,6 @@ //! Error Reporting for Anonymous Region Lifetime Errors //! where one region is named and the other is anonymous. use infer::InferCtxt; -use ty; use infer::region_inference::RegionResolutionError::*; use infer::region_inference::RegionResolutionError; @@ -31,63 +30,42 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // only introduced anonymous regions in parameters) as well as a // version new_ty of its type where the anonymous region is replaced // with the named one. - let (named, (arg, new_ty, br, is_first), (scope_def_id, _)) = - if sub.is_named_region() && self.is_suitable_anonymous_region(sup).is_some() { - (sub, - self.find_arg_with_anonymous_region(sup, sub).unwrap(), - self.is_suitable_anonymous_region(sup).unwrap()) - } else if sup.is_named_region() && self.is_suitable_anonymous_region(sub).is_some() { - (sup, - self.find_arg_with_anonymous_region(sub, sup).unwrap(), - self.is_suitable_anonymous_region(sub).unwrap()) - } else { - return false; // inapplicable - }; - - // Here, we check for the case where the anonymous region - // is in the return type. - // FIXME(#42703) - Need to handle certain cases here. - let ret_ty = self.tcx.type_of(scope_def_id); - match ret_ty.sty { - ty::TyFnDef(_, _) => { - let sig = ret_ty.fn_sig(self.tcx); - let late_bound_regions = self.tcx - .collect_referenced_late_bound_regions(&sig.output()); - if late_bound_regions.iter().any(|r| *r == br) { - return false; - } - } - _ => {} - } - - // Here we check for the case where anonymous region - // corresponds to self and if yes, we display E0312. - // FIXME(#42700) - Need to format self properly to - // enable E0621 for it. - if is_first && - self.tcx - .opt_associated_item(scope_def_id) - .map(|i| i.method_has_self_argument) - .unwrap_or(false) { - return false; - } - - let (error_var, span_label_var) = if let Some(simple_name) = arg.pat.simple_name() { - (format!("the type of `{}`", simple_name), format!("the type of `{}`", simple_name)) + let (named, (arg, new_ty, br, is_first), (scope_def_id, _)) = if + sub.is_named_region() && self.is_suitable_anonymous_region(sup, false).is_some() { + (sub, + self.find_arg_with_anonymous_region(sup, sub).unwrap(), + self.is_suitable_anonymous_region(sup, false).unwrap()) + } else if + sup.is_named_region() && self.is_suitable_anonymous_region(sub, false).is_some() { + (sup, + self.find_arg_with_anonymous_region(sub, sup).unwrap(), + self.is_suitable_anonymous_region(sub, false).unwrap()) } else { - ("parameter type".to_owned(), "type".to_owned()) + return false; // inapplicable }; - struct_span_err!(self.tcx.sess, - span, - E0621, - "explicit lifetime required in {}", - error_var) - .span_label(arg.pat.span, - format!("consider changing {} to `{}`", span_label_var, new_ty)) - .span_label(span, format!("lifetime `{}` required", named)) - .emit(); + if self.is_return_type_anon(scope_def_id, br) || self.is_self_anon(is_first, scope_def_id) { + return false; + } else { + let (error_var, span_label_var) = if let Some(simple_name) = arg.pat.simple_name() { + (format!("the type of `{}`", simple_name), format!("the type of `{}`", simple_name)) + } else { + ("parameter type".to_owned(), "type".to_owned()) + }; + + struct_span_err!(self.tcx.sess, + span, + E0621, + "explicit lifetime required in {}", + error_var) + .span_label(arg.pat.span, + format!("consider changing {} to `{}`", span_label_var, new_ty)) + .span_label(span, format!("lifetime `{}` required", named)) + .emit(); + + + } return true; } } diff --git a/src/librustc/infer/error_reporting/util.rs b/src/librustc/infer/error_reporting/util.rs index 14fe8e699c7..21a6e8e050a 100644 --- a/src/librustc/infer/error_reporting/util.rs +++ b/src/librustc/infer/error_reporting/util.rs @@ -79,22 +79,26 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // This method returns whether the given Region is Anonymous // and returns the DefId and the BoundRegion corresponding to the given region. + // The is_anon_anon is set true when we are dealing with cases where + // both the regions are anonymous i.e. E0623. pub fn is_suitable_anonymous_region(&self, - region: Region<'tcx>) + region: Region<'tcx>, + is_anon_anon: bool) -> Option<(DefId, ty::BoundRegion)> { if let ty::ReFree(ref free_region) = *region { - if let ty::BrAnon(..) = free_region.bound_region{ - let anonymous_region_binding_scope = free_region.scope; - let node_id = self.tcx - .hir - .as_local_node_id(anonymous_region_binding_scope) - .unwrap(); - match self.tcx.hir.find(node_id) { - Some(hir_map::NodeItem(..)) | - Some(hir_map::NodeTraitItem(..)) => { - // Success -- proceed to return Some below - } - Some(hir_map::NodeImplItem(..)) => { + if let ty::BrAnon(..) = free_region.bound_region { + let anonymous_region_binding_scope = free_region.scope; + let node_id = self.tcx + .hir + .as_local_node_id(anonymous_region_binding_scope) + .unwrap(); + match self.tcx.hir.find(node_id) { + Some(hir_map::NodeItem(..)) | + Some(hir_map::NodeTraitItem(..)) => { + // Success -- proceed to return Some below + } + Some(hir_map::NodeImplItem(..)) => { + if !is_anon_anon { let container_id = self.tcx .associated_item(anonymous_region_binding_scope) .container @@ -108,13 +112,48 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // FIXME(#42706) -- in some cases, we could do better here. return None; } + } else { } - _ => return None, // inapplicable - // we target only top-level functions } - return Some((anonymous_region_binding_scope, free_region.bound_region)); + _ => return None, // inapplicable + // we target only top-level functions + } + return Some((anonymous_region_binding_scope, free_region.bound_region)); + } + } + None + } + + // Here, we check for the case where the anonymous region + // is in the return type. + // FIXME(#42703) - Need to handle certain cases here. + pub fn is_return_type_anon(&self, scope_def_id: DefId, br: ty::BoundRegion) -> bool { + let ret_ty = self.tcx.type_of(scope_def_id); + match ret_ty.sty { + ty::TyFnDef(_, _) => { + let sig = ret_ty.fn_sig(self.tcx); + let late_bound_regions = self.tcx + .collect_referenced_late_bound_regions(&sig.output()); + if late_bound_regions.iter().any(|r| *r == br) { + return true; } } - None + _ => {} } + false + } + // Here we check for the case where anonymous region + // corresponds to self and if yes, we display E0312. + // FIXME(#42700) - Need to format self properly to + // enable E0621 for it. + pub fn is_self_anon(&self, is_first: bool, scope_def_id: DefId) -> bool { + if is_first && + self.tcx + .opt_associated_item(scope_def_id) + .map(|i| i.method_has_self_argument) + .unwrap_or(false) { + return true; + } + false + } } diff --git a/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.stderr b/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.stderr index 6764c58f4bb..1ee00997997 100644 --- a/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.stderr +++ b/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.stderr @@ -1,25 +1,10 @@ -error[E0308]: mismatched types +error[E0623]: lifetime mismatch --> $DIR/ex2b-push-no-existing-names.rs:16:12 | +15 | fn foo(x: &mut Vec>, y: Ref) { + | -------- -------- these two types are declared with different lifetimes... 16 | x.push(y); - | ^ lifetime mismatch - | - = note: expected type `Ref<'_, _>` - found type `Ref<'_, _>` -note: the anonymous lifetime #3 defined on the function body at 15:1... - --> $DIR/ex2b-push-no-existing-names.rs:15:1 - | -15 | / fn foo(x: &mut Vec>, y: Ref) { -16 | | x.push(y); -17 | | } - | |_^ -note: ...does not necessarily outlive the anonymous lifetime #2 defined on the function body at 15:1 - --> $DIR/ex2b-push-no-existing-names.rs:15:1 - | -15 | / fn foo(x: &mut Vec>, y: Ref) { -16 | | x.push(y); -17 | | } - | |_^ + | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.stderr index 4c878f3c0dc..74a40c87c2f 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.stderr @@ -2,7 +2,7 @@ error[E0623]: lifetime mismatch --> $DIR/ex3-both-anon-regions-2.rs:12:9 | 11 | fn foo((v, w): (&u8, &u8), x: &u8) { - | --- --- these references are not declared with the same lifetime... + | --- --- these two types are declared with different lifetimes... 12 | v = x; | ^ ...but data from `x` flows here diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.rs index 7bd5ebf805f..51271243bdf 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.rs @@ -8,8 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn foo((v, w): (&u8, &u8), (x, y): (&u8, &u8)) { - v = x; +fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { + z.push((x,y)); } fn main() { } + diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.stderr index 08506b8befa..898866c75f2 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.stderr @@ -1,10 +1,18 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-3.rs:12:9 + --> $DIR/ex3-both-anon-regions-3.rs:12:13 | -11 | fn foo((v, w): (&u8, &u8), (x, y): (&u8, &u8)) { - | --- --- these references are not declared with the same lifetime... -12 | v = x; - | ^ ...but data flows here +11 | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { + | --- --- these two types are declared with different lifetimes... +12 | z.push((x,y)); + | ^ ...but data flows into `z` here -error: aborting due to previous error +error[E0623]: lifetime mismatch + --> $DIR/ex3-both-anon-regions-3.rs:12:15 + | +11 | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { + | --- --- these two types are declared with different lifetimes... +12 | z.push((x,y)); + | ^ ...but data flows into `z` here + +error: aborting due to 2 previous errors diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-4.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-4.stderr deleted file mode 100644 index 9c2630fc811..00000000000 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-4.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0601]: main function not found - -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-4.rs:12:13 - | -11 | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { - | --- --- these references are not declared with the same lifetime... -12 | z.push((x,y)); - | ^ ...but data flows into `z` here - -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-4.rs:12:15 - | -11 | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { - | --- --- these references are not declared with the same lifetime... -12 | z.push((x,y)); - | ^ ...but data flows into `z` here - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.rs new file mode 100644 index 00000000000..2fbf31aead5 --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.rs @@ -0,0 +1,19 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +struct Ref<'a, 'b> { + a: &'a u32, + b: &'b u32, +} + +fn foo(mut x: Ref, y: Ref) { + x.b = y.b; +} + +fn main() {} diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr new file mode 100644 index 00000000000..26f31defc9e --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr @@ -0,0 +1,10 @@ +error[E0623]: lifetime mismatch + --> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:16:11 + | +15 | fn foo(mut x: Ref, y: Ref) { + | --- --- these two types are declared with different lifetimes... +16 | x.b = y.b; + | ^^^ ...but data from `y` flows into `x` here + +error: aborting due to previous error + diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.rs new file mode 100644 index 00000000000..120a7ca74ae --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.rs @@ -0,0 +1,19 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +struct Ref<'a, 'b> { + a: &'a u32, + b: &'b u32, +} + +fn foo(mut x: Ref) { + x.a = x.b; +} + +fn main() {} \ No newline at end of file diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr new file mode 100644 index 00000000000..5ec4511372a --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr @@ -0,0 +1,12 @@ +error[E0623]: lifetime mismatch + --> $DIR/ex3-both-anon-regions-both-are-structs-3.rs:16:11 + | +15 | fn foo(mut x: Ref) { + | --- + | | + | these two types are declared with different lifetimes... +16 | x.a = x.b; + | ^^^ ...but data with one lifetime flows into the other here + +error: aborting due to previous error + diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.rs new file mode 100644 index 00000000000..606e611865f --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.rs @@ -0,0 +1,19 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +struct Ref<'a, 'b> { + a: &'a u32, + b: &'b u32, +} + +fn foo(mut x: Ref) { + x.a = x.b; +} + +fn main() {} diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr new file mode 100644 index 00000000000..2ef1cd507f1 --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr @@ -0,0 +1,12 @@ +error[E0623]: lifetime mismatch + --> $DIR/ex3-both-anon-regions-both-are-structs-4.rs:16:11 + | +15 | fn foo(mut x: Ref) { + | --- + | | + | these two types are declared with different lifetimes... +16 | x.a = x.b; + | ^^^ ...but data with one lifetime flows into the other here + +error: aborting due to previous error + diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-4.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.rs similarity index 71% rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-4.rs rename to src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.rs index fdb010a04f4..67ba8ee532a 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-4.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.rs @@ -1,4 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -7,7 +7,12 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. - -fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { - z.push((x,y)); +struct Ref<'a> { + x: &'a u32, } + +fn foo(mut x: Vec, y: Ref) { + x.push(y); +} + +fn main() {} diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr new file mode 100644 index 00000000000..6ad795400b3 --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr @@ -0,0 +1,10 @@ +error[E0623]: lifetime mismatch + --> $DIR/ex3-both-anon-regions-both-are-structs.rs:15:12 + | +14 | fn foo(mut x: Vec, y: Ref) { + | --- --- these two types are declared with different lifetimes... +15 | x.push(y); + | ^ ...but data from `y` flows into `x` here + +error: aborting due to previous error + diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.rs new file mode 100644 index 00000000000..a8b1f53fc98 --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.rs @@ -0,0 +1,17 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Ref<'a, 'b> { a: &'a u32, b: &'b u32 } + +fn foo(mut x: Ref, y: &u32) { + y = x.b; +} + +fn main() { } diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr new file mode 100644 index 00000000000..31c7ebf6504 --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr @@ -0,0 +1,12 @@ +error[E0623]: lifetime mismatch + --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:14:9 + | +13 | fn foo(mut x: Ref, y: &u32) { + | --- ---- + | | + | these two types are declared with different lifetimes... +14 | y = x.b; + | ^^^ ...but data from `x` flows into `y` here + +error: aborting due to previous error + diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs new file mode 100644 index 00000000000..026b4e90c4e --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs @@ -0,0 +1,17 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Ref<'a, 'b> { a: &'a u32, b: &'b u32 } + +fn foo(mut y: Ref, x: &u32) { + x = y.b; +} + +fn main() { } diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr new file mode 100644 index 00000000000..8f1cff9c4a8 --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr @@ -0,0 +1,12 @@ +error[E0623]: lifetime mismatch + --> $DIR/ex3-both-anon-regions-one-is-struct-3.rs:14:9 + | +13 | fn foo(mut y: Ref, x: &u32) { + | --- ---- + | | + | these two types are declared with different lifetimes... +14 | x = y.b; + | ^^^ ...but data from `y` flows into `x` here + +error: aborting due to previous error + diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs new file mode 100644 index 00000000000..4933dbb7e7a --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs @@ -0,0 +1,17 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Ref<'a, 'b> { a: &'a u32, b: &'b u32 } + +fn foo(mut y: Ref, x: &u32) { + y.b = x; +} + +fn main() { } diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr new file mode 100644 index 00000000000..40f026bcb1b --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr @@ -0,0 +1,10 @@ +error[E0623]: lifetime mismatch + --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:14:11 + | +13 | fn foo(mut y: Ref, x: &u32) { + | --- ---- these two types are declared with different lifetimes... +14 | y.b = x; + | ^ ...but data from `x` flows into `y` here + +error: aborting due to previous error + diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.rs new file mode 100644 index 00000000000..e1594b1a277 --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.rs @@ -0,0 +1,20 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Ref<'a, 'b> { + a: &'a u32, + b: &'b u32, +} + +fn foo(mut x: Ref, y: &u32) { + x.b = y; +} + +fn main() {} diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr new file mode 100644 index 00000000000..bb7b9ea6843 --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr @@ -0,0 +1,10 @@ +error[E0623]: lifetime mismatch + --> $DIR/ex3-both-anon-regions-one-is-struct.rs:17:11 + | +16 | fn foo(mut x: Ref, y: &u32) { + | --- ---- these two types are declared with different lifetimes... +17 | x.b = y; + | ^ ...but data from `y` flows into `x` here + +error: aborting due to previous error + diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.rs new file mode 100644 index 00000000000..0dc257ac092 --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.rs @@ -0,0 +1,22 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Foo { + field: i32 +} + +impl Foo { + fn foo<'a>(&self, x: &i32) -> &i32 { + x + } +} + +fn main() { } + diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr new file mode 100644 index 00000000000..890f9b311e7 --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr @@ -0,0 +1,23 @@ +error[E0312]: lifetime of reference outlives lifetime of borrowed content... + --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:17:5 + | +17 | x + | ^ + | +note: ...the reference is valid for the anonymous lifetime #1 defined on the method body at 16:3... + --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:16:3 + | +16 | / fn foo<'a>(&self, x: &i32) -> &i32 { +17 | | x +18 | | } + | |___^ +note: ...but the borrowed content is only valid for the anonymous lifetime #2 defined on the method body at 16:3 + --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:16:3 + | +16 | / fn foo<'a>(&self, x: &i32) -> &i32 { +17 | | x +18 | | } + | |___^ + +error: aborting due to previous error + diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs new file mode 100644 index 00000000000..0940ce15d1e --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs @@ -0,0 +1,22 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Foo { + field: i32, +} + +impl Foo { + fn foo<'a>(&self, x: &Foo) -> &Foo { + if true { x } else { self } + } +} + +fn main() {} + diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr new file mode 100644 index 00000000000..43f00c32c62 --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr @@ -0,0 +1,23 @@ +error[E0312]: lifetime of reference outlives lifetime of borrowed content... + --> $DIR/ex3-both-anon-regions-self-is-anon.rs:17:19 + | +17 | if true { x } else { self } + | ^ + | +note: ...the reference is valid for the anonymous lifetime #1 defined on the method body at 16:5... + --> $DIR/ex3-both-anon-regions-self-is-anon.rs:16:5 + | +16 | / fn foo<'a>(&self, x: &Foo) -> &Foo { +17 | | if true { x } else { self } +18 | | } + | |_____^ +note: ...but the borrowed content is only valid for the anonymous lifetime #2 defined on the method body at 16:5 + --> $DIR/ex3-both-anon-regions-self-is-anon.rs:16:5 + | +16 | / fn foo<'a>(&self, x: &Foo) -> &Foo { +17 | | if true { x } else { self } +18 | | } + | |_____^ + +error: aborting due to previous error + diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.rs new file mode 100644 index 00000000000..3a7ba415c0d --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.rs @@ -0,0 +1,18 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +trait Foo { + fn foo<'a>(x: &mut Vec<&u8>, y: &u8); +} +impl Foo for () { + fn foo(x: &mut Vec<&u8>, y: &u8) { + x.push(y); + } +} +fn main() {} diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr new file mode 100644 index 00000000000..9591df8e8aa --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr @@ -0,0 +1,10 @@ +error[E0623]: lifetime mismatch + --> $DIR/ex3-both-anon-regions-using-impl-items.rs:15:16 + | +14 | fn foo(x: &mut Vec<&u8>, y: &u8) { + | --- --- these two types are declared with different lifetimes... +15 | x.push(y); + | ^ ...but data from `y` flows into `x` here + +error: aborting due to previous error + diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions.rs index 9ebff511876..be48d07b94e 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions.rs @@ -1,4 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions.stderr index a183d1fffc0..d3291063859 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions.stderr @@ -2,7 +2,7 @@ error[E0623]: lifetime mismatch --> $DIR/ex3-both-anon-regions.rs:12:12 | 11 | fn foo(x: &mut Vec<&u8>, y: &u8) { - | --- --- these references are not declared with the same lifetime... + | --- --- these two types are declared with different lifetimes... 12 | x.push(y); | ^ ...but data from `y` flows into `x` here From b1cee113c7ecc6eac0d9898d5e5870ad15f70f77 Mon Sep 17 00:00:00 2001 From: gaurikholkar Date: Thu, 17 Aug 2017 22:15:18 +0530 Subject: [PATCH 02/50] code review fixes --- .../error_reporting/anon_anon_conflict.rs | 4 +-- .../error_reporting/named_anon_conflict.rs | 6 +++- src/librustc/infer/error_reporting/util.rs | 30 +++++++++++++++---- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/librustc/infer/error_reporting/anon_anon_conflict.rs b/src/librustc/infer/error_reporting/anon_anon_conflict.rs index 3821bf766b9..c5e26f43120 100644 --- a/src/librustc/infer/error_reporting/anon_anon_conflict.rs +++ b/src/librustc/infer/error_reporting/anon_anon_conflict.rs @@ -65,8 +65,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { (self.find_arg_with_anonymous_region(sup, sup), self.find_arg_with_anonymous_region(sub, sub)) { - let ((anon_arg_sup, _, _, is_first_sup), (anon_arg_sub, _, _, is_first_sub)) = - (sup_arg, sub_arg); + let (anon_arg_sup, is_first_sup, anon_arg_sub, is_first_sub) = + (sup_arg.arg, sup_arg.is_first, sub_arg.arg, sub_arg.is_first); if self.is_self_anon(is_first_sup, scope_def_id_sup) || self.is_self_anon(is_first_sub, scope_def_id_sub) { return false; diff --git a/src/librustc/infer/error_reporting/named_anon_conflict.rs b/src/librustc/infer/error_reporting/named_anon_conflict.rs index f46855502ea..005eb900c11 100644 --- a/src/librustc/infer/error_reporting/named_anon_conflict.rs +++ b/src/librustc/infer/error_reporting/named_anon_conflict.rs @@ -30,7 +30,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // only introduced anonymous regions in parameters) as well as a // version new_ty of its type where the anonymous region is replaced // with the named one. - let (named, (arg, new_ty, br, is_first), (scope_def_id, _)) = if + let (named, anon_arg_info, (scope_def_id, _)) = if sub.is_named_region() && self.is_suitable_anonymous_region(sup, false).is_some() { (sub, self.find_arg_with_anonymous_region(sup, sub).unwrap(), @@ -44,6 +44,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { return false; // inapplicable }; + let (arg, new_ty, br, is_first) = (anon_arg_info.arg, + anon_arg_info.arg_ty, + anon_arg_info.bound_region, + anon_arg_info.is_first); if self.is_return_type_anon(scope_def_id, br) || self.is_self_anon(is_first, scope_def_id) { return false; } else { diff --git a/src/librustc/infer/error_reporting/util.rs b/src/librustc/infer/error_reporting/util.rs index 21a6e8e050a..902e388ca7b 100644 --- a/src/librustc/infer/error_reporting/util.rs +++ b/src/librustc/infer/error_reporting/util.rs @@ -16,6 +16,20 @@ use ty::{self, Region}; use hir::def_id::DefId; use hir::map as hir_map; +// The struct contains the information about the anonymous region +// we are searching for. +pub struct AnonymousArgInfo<'tcx> { + // the argument corresponding to the anonymous region + pub arg: &'tcx hir::Arg, + // the type corresponding to the anonymopus region argument + pub arg_ty: ty::Ty<'tcx>, + // the ty::BoundRegion corresponding to the anonymous region + pub bound_region: ty::BoundRegion, + // corresponds to id the argument is the first parameter + // in the declaration + pub is_first: bool, +} + impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // This method walks the Type of the function body arguments using // `fold_regions()` function and returns the @@ -28,11 +42,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // i32, which is the type of y but with the anonymous region replaced // with 'a, the corresponding bound region and is_first which is true if // the hir::Arg is the first argument in the function declaration. - pub fn find_arg_with_anonymous_region - (&self, - anon_region: Region<'tcx>, - replace_region: Region<'tcx>) - -> Option<(&hir::Arg, ty::Ty<'tcx>, ty::BoundRegion, bool)> { + pub fn find_arg_with_anonymous_region(&self, + anon_region: Region<'tcx>, + replace_region: Region<'tcx>) + -> Option { if let ty::ReFree(ref free_region) = *anon_region { @@ -57,7 +70,12 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { }); if found_anon_region { let is_first = index == 0; - Some((arg, new_arg_ty, free_region.bound_region, is_first)) + Some(AnonymousArgInfo { + arg: arg, + arg_ty: new_arg_ty, + bound_region: free_region.bound_region, + is_first: is_first, + }) } else { None } From 8b89f3168d593e4bfd3babc0a37b624e9593aec1 Mon Sep 17 00:00:00 2001 From: gaurikholkar Date: Fri, 18 Aug 2017 00:15:30 +0530 Subject: [PATCH 03/50] code review fixes --- .../error_reporting/anon_anon_conflict.rs | 7 +++- .../error_reporting/named_anon_conflict.rs | 37 ++++++++++--------- src/librustc/infer/error_reporting/util.rs | 16 +++++++- 3 files changed, 38 insertions(+), 22 deletions(-) diff --git a/src/librustc/infer/error_reporting/anon_anon_conflict.rs b/src/librustc/infer/error_reporting/anon_anon_conflict.rs index c5e26f43120..4a2b751f5e8 100644 --- a/src/librustc/infer/error_reporting/anon_anon_conflict.rs +++ b/src/librustc/infer/error_reporting/anon_anon_conflict.rs @@ -50,7 +50,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { if let (Some(anon_reg_sup), Some(anon_reg_sub)) = (self.is_suitable_anonymous_region(sup, true), self.is_suitable_anonymous_region(sub, true)) { - let ((def_id_sup, br_sup), (def_id_sub, br_sub)) = (anon_reg_sup, anon_reg_sub); + let (def_id_sup, br_sup, def_id_sub, br_sub) = (anon_reg_sup.def_id, + anon_reg_sup.boundregion, + anon_reg_sub.def_id, + anon_reg_sub.boundregion); if let (Some(anonarg_sup), Some(anonarg_sub)) = (self.find_anon_type(sup, &br_sup), self.find_anon_type(sub, &br_sub)) { (anonarg_sup, anonarg_sub, def_id_sup, def_id_sub, br_sup, br_sub) @@ -124,7 +127,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { /// for e.g. `&u8` and Vec<`&u8`. pub fn find_anon_type(&self, region: Region<'tcx>, br: &ty::BoundRegion) -> Option<&hir::Ty> { if let Some(anon_reg) = self.is_suitable_anonymous_region(region, true) { - let (def_id, _) = anon_reg; + let def_id = anon_reg.def_id; if let Some(node_id) = self.tcx.hir.as_local_node_id(def_id) { let ret_ty = self.tcx.type_of(def_id); if let ty::TyFnDef(_, _) = ret_ty.sty { diff --git a/src/librustc/infer/error_reporting/named_anon_conflict.rs b/src/librustc/infer/error_reporting/named_anon_conflict.rs index 005eb900c11..7fa1eca5535 100644 --- a/src/librustc/infer/error_reporting/named_anon_conflict.rs +++ b/src/librustc/infer/error_reporting/named_anon_conflict.rs @@ -29,25 +29,26 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // where the anonymous region appears (there must always be one; we // only introduced anonymous regions in parameters) as well as a // version new_ty of its type where the anonymous region is replaced - // with the named one. - let (named, anon_arg_info, (scope_def_id, _)) = if - sub.is_named_region() && self.is_suitable_anonymous_region(sup, false).is_some() { - (sub, - self.find_arg_with_anonymous_region(sup, sub).unwrap(), - self.is_suitable_anonymous_region(sup, false).unwrap()) - } else if - sup.is_named_region() && self.is_suitable_anonymous_region(sub, false).is_some() { - (sup, - self.find_arg_with_anonymous_region(sub, sup).unwrap(), - self.is_suitable_anonymous_region(sub, false).unwrap()) - } else { - return false; // inapplicable - }; + // with the named one.//scope_def_id + let (named, anon_arg_info, region_info) = + if sub.is_named_region() && self.is_suitable_anonymous_region(sup, false).is_some() { + (sub, + self.find_arg_with_anonymous_region(sup, sub).unwrap(), + self.is_suitable_anonymous_region(sup, false).unwrap()) + } else if sup.is_named_region() && + self.is_suitable_anonymous_region(sub, false).is_some() { + (sup, + self.find_arg_with_anonymous_region(sub, sup).unwrap(), + self.is_suitable_anonymous_region(sub, false).unwrap()) + } else { + return false; // inapplicable + }; - let (arg, new_ty, br, is_first) = (anon_arg_info.arg, - anon_arg_info.arg_ty, - anon_arg_info.bound_region, - anon_arg_info.is_first); + let (arg, new_ty, br, is_first, scope_def_id) = (anon_arg_info.arg, + anon_arg_info.arg_ty, + anon_arg_info.bound_region, + anon_arg_info.is_first, + region_info.def_id); if self.is_return_type_anon(scope_def_id, br) || self.is_self_anon(is_first, scope_def_id) { return false; } else { diff --git a/src/librustc/infer/error_reporting/util.rs b/src/librustc/infer/error_reporting/util.rs index 902e388ca7b..84429fea86e 100644 --- a/src/librustc/infer/error_reporting/util.rs +++ b/src/librustc/infer/error_reporting/util.rs @@ -30,6 +30,15 @@ pub struct AnonymousArgInfo<'tcx> { pub is_first: bool, } +// This struct contains information regarding the +// Refree((FreeRegion) corresponding to lifetime conflict +pub struct FreeRegionInfo { + // def id corresponding to FreeRegion + pub def_id: DefId, + // the bound region corresponding to FreeRegion + pub boundregion: ty::BoundRegion, +} + impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // This method walks the Type of the function body arguments using // `fold_regions()` function and returns the @@ -102,7 +111,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { pub fn is_suitable_anonymous_region(&self, region: Region<'tcx>, is_anon_anon: bool) - -> Option<(DefId, ty::BoundRegion)> { + -> Option { if let ty::ReFree(ref free_region) = *region { if let ty::BrAnon(..) = free_region.bound_region { let anonymous_region_binding_scope = free_region.scope; @@ -136,7 +145,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { _ => return None, // inapplicable // we target only top-level functions } - return Some((anonymous_region_binding_scope, free_region.bound_region)); + return Some(FreeRegionInfo { + def_id: anonymous_region_binding_scope, + boundregion: free_region.bound_region, + }); } } None From c8d58a306e9cc9afcc125a0b00fe110033bb7a49 Mon Sep 17 00:00:00 2001 From: Jouan Amate Date: Fri, 18 Aug 2017 09:38:52 -0700 Subject: [PATCH 04/50] Add links for impls Implements a solution for issue #23552 --- src/librustdoc/html/render.rs | 8 +++++++- src/librustdoc/html/static/rustdoc.css | 4 ++++ src/librustdoc/html/static/styles/main.css | 3 --- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 4e3181759f9..41700cbaae1 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -2925,7 +2925,13 @@ fn render_deref_methods(w: &mut fmt::Formatter, cx: &Context, impl_: &Impl, fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLink, render_mode: RenderMode, outer_version: Option<&str>) -> fmt::Result { if render_mode == RenderMode::Normal { - write!(w, "

{}", i.inner_impl())?; + let id = derive_id(match i.inner_impl().trait_ { + Some(ref t) => format!("impl-{}", Escape(&format!("{:#}", t))), + None => "impl".to_string(), + }); + write!(w, "

{}", + id, i.inner_impl())?; + write!(w, "", id)?; write!(w, "")?; let since = i.impl_item.stability.as_ref().map(|s| &s.since[..]); if let Some(l) = (Item { item: &i.impl_item, cx: cx }).src_href() { diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index ee94f0baeb9..c3ac01bbe0c 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -441,6 +441,10 @@ a { .small-section-header:hover > .anchor { display: initial; } + +.in-band:hover > .anchor { + display: initial; +} .anchor { display: none; } diff --git a/src/librustdoc/html/static/styles/main.css b/src/librustdoc/html/static/styles/main.css index 08bf5a10fe9..9c88c12086e 100644 --- a/src/librustdoc/html/static/styles/main.css +++ b/src/librustdoc/html/static/styles/main.css @@ -26,9 +26,6 @@ h1.fqn { h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod) { border-bottom-color: #DDDDDD; } -.in-band { - background-color: white; -} .docblock code, .docblock-short code { background-color: #F5F5F5; From 2ff1734c612094f009a1eff0c2f0bc58baa46a34 Mon Sep 17 00:00:00 2001 From: gaurikholkar Date: Sun, 20 Aug 2017 17:55:07 +0530 Subject: [PATCH 05/50] code review fixes --- .../error_reporting/anon_anon_conflict.rs | 59 ++++++++----------- 1 file changed, 23 insertions(+), 36 deletions(-) diff --git a/src/librustc/infer/error_reporting/anon_anon_conflict.rs b/src/librustc/infer/error_reporting/anon_anon_conflict.rs index 4a2b751f5e8..1432294f67f 100644 --- a/src/librustc/infer/error_reporting/anon_anon_conflict.rs +++ b/src/librustc/infer/error_reporting/anon_anon_conflict.rs @@ -131,42 +131,29 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { if let Some(node_id) = self.tcx.hir.as_local_node_id(def_id) { let ret_ty = self.tcx.type_of(def_id); if let ty::TyFnDef(_, _) = ret_ty.sty { - if let hir_map::NodeItem(it) = self.tcx.hir.get(node_id) { - if let hir::ItemFn(ref fndecl, _, _, _, _, _) = it.node { - return fndecl - .inputs - .iter() - .filter_map(|arg| { - self.find_component_for_bound_region(&**arg, - br) - }) - .next(); - } - } else if let hir_map::NodeTraitItem(it) = self.tcx.hir.get(node_id) { - if let hir::TraitItemKind::Method(ref fndecl, _) = it.node { - return fndecl - .decl - .inputs - .iter() - .filter_map(|arg| { - self.find_component_for_bound_region(&**arg, - br) - }) - .next(); - } - } else if let hir_map::NodeImplItem(it) = self.tcx.hir.get(node_id) { - if let hir::ImplItemKind::Method(ref fndecl, _) = it.node { - return fndecl - .decl - .inputs - .iter() - .filter_map(|arg| { - self.find_component_for_bound_region(&**arg, - br) - }) - .next(); - } - } + let inputs: &[_] = + match self.tcx.hir.get(node_id) { + hir_map::NodeItem(&hir::Item { + node: hir::ItemFn(ref fndecl, ..), .. + }) => &fndecl.inputs, + hir_map::NodeTraitItem(&hir::TraitItem { + node: hir::TraitItemKind::Method(ref fndecl, ..), + .. + }) => &fndecl.decl.inputs, + hir_map::NodeImplItem(&hir::ImplItem { + node: hir::ImplItemKind::Method(ref fndecl, ..), + .. + }) => &fndecl.decl.inputs, + + _ => &[], + }; + + return inputs + .iter() + .filter_map(|arg| { + self.find_component_for_bound_region(&**arg, br) + }) + .next(); } } } From 4729f22f8b3cc9faaf147909c6fbec3f9e434d4c Mon Sep 17 00:00:00 2001 From: Jouan Amate Date: Tue, 22 Aug 2017 09:24:18 -0700 Subject: [PATCH 06/50] Fixed changes to .in-band CSS :target will specifically override .in-band background --- src/librustdoc/html/static/styles/main.css | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/librustdoc/html/static/styles/main.css b/src/librustdoc/html/static/styles/main.css index 9c88c12086e..c5f4272b932 100644 --- a/src/librustdoc/html/static/styles/main.css +++ b/src/librustdoc/html/static/styles/main.css @@ -27,6 +27,10 @@ h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.t border-bottom-color: #DDDDDD; } +.in-band { + background-color: white; +} + .docblock code, .docblock-short code { background-color: #F5F5F5; } @@ -80,6 +84,11 @@ pre { } :target { background: #FDFFD3; } + +:target > .in-band { + background: #FDFFD3; +} + .content .highlighted { color: #000 !important; background-color: #ccc; From 0981211c629d0d9f59c5164d8e2c42974d9449e2 Mon Sep 17 00:00:00 2001 From: "Zack M. Davis" Date: Tue, 15 Aug 2017 16:21:28 -0700 Subject: [PATCH 07/50] hard feature-gate for #[must_use] on functions We'll actually want a new "soft" warning-only gate to maintain backwards-compatibility, but it's cleaner to start out with the established, well-understood gate before implementing the alternative warn-only behavior in a later commit. This is in the matter of #43302. --- src/librustc_lint/unused.rs | 34 +++++++++++-------- src/libsyntax/feature_gate.rs | 9 ++++- .../compile-fail/feature-gate-fn_must_use.rs | 14 ++++++++ .../issue-43106-gating-of-builtin-attrs.rs | 1 + src/test/ui/lint/fn_must_use.rs | 1 + src/test/ui/lint/fn_must_use.stderr | 12 +++---- 6 files changed, 49 insertions(+), 22 deletions(-) create mode 100644 src/test/compile-fail/feature-gate-fn_must_use.rs diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs index 195bd2acce0..cbc4ebe90fd 100644 --- a/src/librustc_lint/unused.rs +++ b/src/librustc_lint/unused.rs @@ -160,21 +160,25 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults { }; let mut fn_warned = false; - let maybe_def = match expr.node { - hir::ExprCall(ref callee, _) => { - match callee.node { - hir::ExprPath(ref qpath) => Some(cx.tables.qpath_def(qpath, callee.hir_id)), - _ => None - } - }, - hir::ExprMethodCall(..) => { - cx.tables.type_dependent_defs().get(expr.hir_id).cloned() - }, - _ => { None } - }; - if let Some(def) = maybe_def { - let def_id = def.def_id(); - fn_warned = check_must_use(cx, def_id, s.span, "return value of "); + if cx.tcx.sess.features.borrow().fn_must_use { + let maybe_def = match expr.node { + hir::ExprCall(ref callee, _) => { + match callee.node { + hir::ExprPath(ref qpath) => { + Some(cx.tables.qpath_def(qpath, callee.hir_id)) + }, + _ => None + } + }, + hir::ExprMethodCall(..) => { + cx.tables.type_dependent_defs().get(expr.hir_id).cloned() + }, + _ => None + }; + if let Some(def) = maybe_def { + let def_id = def.def_id(); + fn_warned = check_must_use(cx, def_id, s.span, "return value of "); + } } if !(ty_warned || fn_warned) { diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 801343689b7..ee791609e8f 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -372,6 +372,9 @@ declare_features! ( // #[doc(cfg(...))] (active, doc_cfg, "1.21.0", Some(43781)), + + // allow `#[must_use]` on functions (RFC 1940) + (active, fn_must_use, "1.21.0", Some(43302)), ); declare_features! ( @@ -1014,7 +1017,7 @@ pub fn emit_feature_err(sess: &ParseSess, feature: &str, span: Span, issue: Gate } pub fn feature_err<'a>(sess: &'a ParseSess, feature: &str, span: Span, issue: GateIssue, - explain: &str) -> DiagnosticBuilder<'a> { + explain: &str) -> DiagnosticBuilder<'a> { let diag = &sess.span_diagnostic; let issue = match issue { @@ -1234,6 +1237,10 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { function may change over time, for now \ a top-level `fn main()` is required"); } + if attr::contains_name(&i.attrs[..], "must_use") { + gate_feature_post!(&self, fn_must_use, i.span, + "`#[must_use]` on functions is experimental"); + } } ast::ItemKind::Struct(..) => { diff --git a/src/test/compile-fail/feature-gate-fn_must_use.rs b/src/test/compile-fail/feature-gate-fn_must_use.rs new file mode 100644 index 00000000000..7bb533251dc --- /dev/null +++ b/src/test/compile-fail/feature-gate-fn_must_use.rs @@ -0,0 +1,14 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[must_use] +fn need_to_use_it() -> bool { true } //~ ERROR `#[must_use]` on functions is experimental + +fn main() {} diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-builtin-attrs.rs b/src/test/compile-fail/feature-gate/issue-43106-gating-of-builtin-attrs.rs index 29a2b0609fc..021daf88420 100644 --- a/src/test/compile-fail/feature-gate/issue-43106-gating-of-builtin-attrs.rs +++ b/src/test/compile-fail/feature-gate/issue-43106-gating-of-builtin-attrs.rs @@ -680,6 +680,7 @@ mod must_use { mod inner { #![must_use="1400"] } #[must_use = "1400"] fn f() { } + //~^ ERROR `#[must_use]` on functions is experimental #[must_use = "1400"] struct S; diff --git a/src/test/ui/lint/fn_must_use.rs b/src/test/ui/lint/fn_must_use.rs index 5aea5f2ca06..c549ded4db2 100644 --- a/src/test/ui/lint/fn_must_use.rs +++ b/src/test/ui/lint/fn_must_use.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(fn_must_use)] #![warn(unused_must_use)] struct MyStruct { diff --git a/src/test/ui/lint/fn_must_use.stderr b/src/test/ui/lint/fn_must_use.stderr index 20eb7452aea..242837793a0 100644 --- a/src/test/ui/lint/fn_must_use.stderr +++ b/src/test/ui/lint/fn_must_use.stderr @@ -1,18 +1,18 @@ warning: unused return value of `need_to_use_this_value` which must be used: it's important - --> $DIR/fn_must_use.rs:30:5 + --> $DIR/fn_must_use.rs:31:5 | -30 | need_to_use_this_value(); +31 | need_to_use_this_value(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/fn_must_use.rs:11:9 + --> $DIR/fn_must_use.rs:12:9 | -11 | #![warn(unused_must_use)] +12 | #![warn(unused_must_use)] | ^^^^^^^^^^^^^^^ warning: unused return value of `MyStruct::need_to_use_this_method_value` which must be used - --> $DIR/fn_must_use.rs:33:5 + --> $DIR/fn_must_use.rs:34:5 | -33 | m.need_to_use_this_method_value(); +34 | m.need_to_use_this_method_value(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ From 7b6e9b4b8424e8ef722a3fa6388fe3bc8414bab0 Mon Sep 17 00:00:00 2001 From: "Zack M. Davis" Date: Tue, 15 Aug 2017 18:52:04 -0700 Subject: [PATCH 08/50] correct comment re feature-checking tooling The featureck.py that this comment referred to was removed in 9dd3c54a (March 2016). --- src/libsyntax/feature_gate.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index ee791609e8f..c82f0554393 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -112,8 +112,8 @@ macro_rules! declare_features { // was set. This is most important for knowing when a particular feature became // stable (active). // -// NB: The featureck.py script parses this information directly out of the source -// so take care when modifying it. +// NB: tools/tidy/src/features.rs parses this information directly out of the +// source, so take care when modifying it. declare_features! ( (active, asm, "1.0.0", Some(29722)), From 4d7dfc140733c462f4b20ca7a23013af100e4786 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 22 Aug 2017 19:42:28 -0700 Subject: [PATCH 09/50] appveyor: Use InnoSetup from our mirror Chocolatey has been pretty flaky, so let's not rely on it. Closes #43985 --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index f81e4ba8266..f548d6694c8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -145,7 +145,8 @@ install: # - set PATH=%PATH%;%CD% -- this already happens above for sccache # Install InnoSetup to get `iscc` used to produce installers - - appveyor-retry choco install -y InnoSetup + - appveyor-retry appveyor DownloadFile https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-08-22-is.exe + - 2017-08-22-is.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP- - set PATH="C:\Program Files (x86)\Inno Setup 5";%PATH% # Help debug some handle issues on AppVeyor From 8492ad2479379d2e07ccf2d3439ec29b19d164b8 Mon Sep 17 00:00:00 2001 From: "Zack M. Davis" Date: Tue, 22 Aug 2017 16:05:01 -0700 Subject: [PATCH 10/50] "soft" (warn instead of error) feature-gate for #[must_use] on functions Before `#[must_use]` for functions was implemented, a `#[must_use]` attribute on a function was a no-op. To avoid a breaking change in this behavior, we add an option for "this-and-such feature is experimental" feature-gate messages to be a mere warning rather than a compilation-halting failure (so old code that used to have a useless no-op `#[must_use]` attribute now warns rather than breaking). When we're on stable, we add a help note to clarify that the feature isn't "on." This is in support of #43302. --- src/libsyntax/feature_gate.rs | 60 +++++++++++++++---- .../compile-fail/feature-gate-fn_must_use.rs | 16 ++++- .../issue-43106-gating-of-builtin-attrs.rs | 2 +- 3 files changed, 64 insertions(+), 14 deletions(-) diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index c82f0554393..79f15f2fe19 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -918,20 +918,27 @@ struct Context<'a> { } macro_rules! gate_feature_fn { - ($cx: expr, $has_feature: expr, $span: expr, $name: expr, $explain: expr) => {{ - let (cx, has_feature, span, name, explain) = ($cx, $has_feature, $span, $name, $explain); + ($cx: expr, $has_feature: expr, $span: expr, $name: expr, $explain: expr, $level: expr) => {{ + let (cx, has_feature, span, + name, explain, level) = ($cx, $has_feature, $span, $name, $explain, $level); let has_feature: bool = has_feature(&$cx.features); debug!("gate_feature(feature = {:?}, span = {:?}); has? {}", name, span, has_feature); if !has_feature && !span.allows_unstable() { - emit_feature_err(cx.parse_sess, name, span, GateIssue::Language, explain); + leveled_feature_err(cx.parse_sess, name, span, GateIssue::Language, explain, level) + .emit(); } }} } macro_rules! gate_feature { ($cx: expr, $feature: ident, $span: expr, $explain: expr) => { - gate_feature_fn!($cx, |x:&Features| x.$feature, $span, stringify!($feature), $explain) - } + gate_feature_fn!($cx, |x:&Features| x.$feature, $span, + stringify!($feature), $explain, GateStrength::Hard) + }; + ($cx: expr, $feature: ident, $span: expr, $explain: expr, $level: expr) => { + gate_feature_fn!($cx, |x:&Features| x.$feature, $span, + stringify!($feature), $explain, $level) + }; } impl<'a> Context<'a> { @@ -941,7 +948,7 @@ impl<'a> Context<'a> { for &(n, ty, ref gateage) in BUILTIN_ATTRIBUTES { if name == n { if let Gated(_, name, desc, ref has_feature) = *gateage { - gate_feature_fn!(self, has_feature, attr.span, name, desc); + gate_feature_fn!(self, has_feature, attr.span, name, desc, GateStrength::Hard); } debug!("check_attribute: {:?} is builtin, {:?}, {:?}", attr.path, ty, gateage); return; @@ -1011,6 +1018,14 @@ pub enum GateIssue { Library(Option) } +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub enum GateStrength { + /// A hard error. (Most feature gates should use this.) + Hard, + /// Only a warning. (Use this only as backwards-compatibility demands.) + Soft, +} + pub fn emit_feature_err(sess: &ParseSess, feature: &str, span: Span, issue: GateIssue, explain: &str) { feature_err(sess, feature, span, issue, explain).emit(); @@ -1018,6 +1033,11 @@ pub fn emit_feature_err(sess: &ParseSess, feature: &str, span: Span, issue: Gate pub fn feature_err<'a>(sess: &'a ParseSess, feature: &str, span: Span, issue: GateIssue, explain: &str) -> DiagnosticBuilder<'a> { + leveled_feature_err(sess, feature, span, issue, explain, GateStrength::Hard) +} + +fn leveled_feature_err<'a>(sess: &'a ParseSess, feature: &str, span: Span, issue: GateIssue, + explain: &str, level: GateStrength) -> DiagnosticBuilder<'a> { let diag = &sess.span_diagnostic; let issue = match issue { @@ -1025,10 +1045,15 @@ pub fn feature_err<'a>(sess: &'a ParseSess, feature: &str, span: Span, issue: Ga GateIssue::Library(lib) => lib, }; - let mut err = if let Some(n) = issue { - diag.struct_span_err(span, &format!("{} (see issue #{})", explain, n)) + let explanation = if let Some(n) = issue { + format!("{} (see issue #{})", explain, n) } else { - diag.struct_span_err(span, explain) + explain.to_owned() + }; + + let mut err = match level { + GateStrength::Hard => diag.struct_span_err(span, &explanation), + GateStrength::Soft => diag.struct_span_warn(span, &explanation), }; // #23973: do not suggest `#![feature(...)]` if we are in beta/stable @@ -1038,7 +1063,15 @@ pub fn feature_err<'a>(sess: &'a ParseSess, feature: &str, span: Span, issue: Ga feature)); } + // If we're on stable and only emitting a "soft" warning, add a note to + // clarify that the feature isn't "on" (rather than being on but + // warning-worthy). + if !sess.unstable_features.is_nightly_build() && level == GateStrength::Soft { + err.help("a nightly build of the compiler is required to enable this feature"); + } + err + } const EXPLAIN_BOX_SYNTAX: &'static str = @@ -1095,6 +1128,12 @@ macro_rules! gate_feature_post { if !span.allows_unstable() { gate_feature!(cx.context, $feature, span, $explain) } + }}; + ($cx: expr, $feature: ident, $span: expr, $explain: expr, $level: expr) => {{ + let (cx, span) = ($cx, $span); + if !span.allows_unstable() { + gate_feature!(cx.context, $feature, span, $explain, $level) + } }} } @@ -1239,7 +1278,8 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { } if attr::contains_name(&i.attrs[..], "must_use") { gate_feature_post!(&self, fn_must_use, i.span, - "`#[must_use]` on functions is experimental"); + "`#[must_use]` on functions is experimental", + GateStrength::Soft); } } diff --git a/src/test/compile-fail/feature-gate-fn_must_use.rs b/src/test/compile-fail/feature-gate-fn_must_use.rs index 7bb533251dc..a222f366145 100644 --- a/src/test/compile-fail/feature-gate-fn_must_use.rs +++ b/src/test/compile-fail/feature-gate-fn_must_use.rs @@ -8,7 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[must_use] -fn need_to_use_it() -> bool { true } //~ ERROR `#[must_use]` on functions is experimental +#![feature(rustc_attrs)] -fn main() {} +#[must_use] +fn need_to_use_it() -> bool { true } //~ WARN `#[must_use]` on functions is experimental + + +// Feature gates are tidy-required to have a specially named (or +// comment-annotated) compile-fail test (which MUST fail), but for +// backwards-compatibility reasons, we want `#[must_use]` on functions to be +// compilable even if the `fn_must_use` feature is absent, thus necessitating +// the usage of `#[rustc_error]` here, pragmatically if awkwardly solving this +// dilemma until a superior solution can be devised. +#[rustc_error] +fn main() {} //~ ERROR compilation successful diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-builtin-attrs.rs b/src/test/compile-fail/feature-gate/issue-43106-gating-of-builtin-attrs.rs index 021daf88420..204190d64ac 100644 --- a/src/test/compile-fail/feature-gate/issue-43106-gating-of-builtin-attrs.rs +++ b/src/test/compile-fail/feature-gate/issue-43106-gating-of-builtin-attrs.rs @@ -680,7 +680,7 @@ mod must_use { mod inner { #![must_use="1400"] } #[must_use = "1400"] fn f() { } - //~^ ERROR `#[must_use]` on functions is experimental + //~^ WARN `#[must_use]` on functions is experimental #[must_use = "1400"] struct S; From 35c449419cfbd2bc1abc81077c95ef43ed766f97 Mon Sep 17 00:00:00 2001 From: "Zack M. Davis" Date: Tue, 22 Aug 2017 17:27:00 -0700 Subject: [PATCH 11/50] fn_must_use soft feature-gate warning on methods too, not only functions This continues to be in the matter of #43302. --- src/libsyntax/feature_gate.rs | 12 +++++++++++- src/test/compile-fail/feature-gate-fn_must_use.rs | 7 +++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 79f15f2fe19..09574d5ba12 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -1318,7 +1318,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { and possibly buggy"); } - ast::ItemKind::Impl(_, polarity, defaultness, _, _, _, _) => { + ast::ItemKind::Impl(_, polarity, defaultness, _, _, _, ref impl_items) => { if polarity == ast::ImplPolarity::Negative { gate_feature_post!(&self, optin_builtin_traits, i.span, @@ -1331,6 +1331,16 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { i.span, "specialization is unstable"); } + + for impl_item in impl_items { + if let ast::ImplItemKind::Method(..) = impl_item.node { + if attr::contains_name(&impl_item.attrs[..], "must_use") { + gate_feature_post!(&self, fn_must_use, impl_item.span, + "`#[must_use]` on methods is experimental", + GateStrength::Soft); + } + } + } } ast::ItemKind::MacroDef(ast::MacroDef { legacy: false, .. }) => { diff --git a/src/test/compile-fail/feature-gate-fn_must_use.rs b/src/test/compile-fail/feature-gate-fn_must_use.rs index a222f366145..2dd6b904072 100644 --- a/src/test/compile-fail/feature-gate-fn_must_use.rs +++ b/src/test/compile-fail/feature-gate-fn_must_use.rs @@ -10,6 +10,13 @@ #![feature(rustc_attrs)] +struct MyStruct; + +impl MyStruct { + #[must_use] + fn need_to_use_method() -> bool { true } //~ WARN `#[must_use]` on methods is experimental +} + #[must_use] fn need_to_use_it() -> bool { true } //~ WARN `#[must_use]` on functions is experimental From e13090e8b2f8adce9277f2ebfa37efa75c8837a8 Mon Sep 17 00:00:00 2001 From: Alexey Tarasov Date: Sun, 20 Aug 2017 21:35:00 +1000 Subject: [PATCH 12/50] Fixes issue #43205: ICE in Rvalue::Len evaluation. - fixes evaluation of array length for zero-sized type referenced by rvalue operand. - adds test to verify fix. Cause of the issue. Zero-sized aggregates are handled as operands, not lvalues. Therefore while visiting Assign statement by LocalAnalyser, mark_as_lvalue() is not called for related Local. This behaviour is controlled by rvalue_creates_operand() method. As result it causes error later, when rvalue operand is evaluated in trans_rvalue_operand() while handling Rvalue::Len case. Array length evaluation invokes trans_lvalue() which expects referenced Local to be value, not operand. How it is fixed. In certain cases result of Rvalue::Len can be evaluated without calling trans_lvalue(). Method evaluate_array_len() is introduced to handle length evaluation for zero-sized types referenced by Locals. --- src/librustc_trans/mir/rvalue.rs | 26 +++++++++++++++++++++++--- src/test/run-pass/issue-43205.rs | 14 ++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 src/test/run-pass/issue-43205.rs diff --git a/src/librustc_trans/mir/rvalue.rs b/src/librustc_trans/mir/rvalue.rs index 8051e04060a..096f43e44ab 100644 --- a/src/librustc_trans/mir/rvalue.rs +++ b/src/librustc_trans/mir/rvalue.rs @@ -29,7 +29,7 @@ use type_of; use tvec; use value::Value; -use super::MirContext; +use super::{MirContext, LocalRef}; use super::constant::const_scalar_checked_binop; use super::operand::{OperandRef, OperandValue}; use super::lvalue::LvalueRef; @@ -381,9 +381,9 @@ impl<'a, 'tcx> MirContext<'a, 'tcx> { } mir::Rvalue::Len(ref lvalue) => { - let tr_lvalue = self.trans_lvalue(&bcx, lvalue); + let size = self.evaluate_array_len(&bcx, lvalue); let operand = OperandRef { - val: OperandValue::Immediate(tr_lvalue.len(bcx.ccx)), + val: OperandValue::Immediate(size), ty: bcx.tcx().types.usize, }; (bcx, operand) @@ -512,6 +512,26 @@ impl<'a, 'tcx> MirContext<'a, 'tcx> { } } + fn evaluate_array_len(&mut self, + bcx: &Builder<'a, 'tcx>, + lvalue: &mir::Lvalue<'tcx>) -> ValueRef + { + // ZST are passed as operands and require special handling + // because trans_lvalue() panics if Local is operand. + if let mir::Lvalue::Local(index) = *lvalue { + if let LocalRef::Operand(Some(op)) = self.locals[index] { + if common::type_is_zero_size(bcx.ccx, op.ty) { + if let ty::TyArray(_, n) = op.ty.sty { + return common::C_uint(bcx.ccx, n); + } + } + } + } + // use common size calculation for non zero-sized types + let tr_value = self.trans_lvalue(&bcx, lvalue); + return tr_value.len(bcx.ccx); + } + pub fn trans_scalar_binop(&mut self, bcx: &Builder<'a, 'tcx>, op: mir::BinOp, diff --git a/src/test/run-pass/issue-43205.rs b/src/test/run-pass/issue-43205.rs new file mode 100644 index 00000000000..0e613ac0727 --- /dev/null +++ b/src/test/run-pass/issue-43205.rs @@ -0,0 +1,14 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + &&[()][0]; + println!("{:?}", &[(),()][1]); +} From 90ab9d9a6d93743bd282f71c867740f5a6674fe0 Mon Sep 17 00:00:00 2001 From: gaurikholkar Date: Wed, 23 Aug 2017 18:40:28 +0530 Subject: [PATCH 13/50] code review fixes --- .../error_reporting/anon_anon_conflict.rs | 20 +++-- .../error_reporting/named_anon_conflict.rs | 24 +++--- src/librustc/infer/error_reporting/util.rs | 83 +++++++++---------- ...oth-anon-regions-both-are-structs-3.stderr | 2 +- ...x3-both-anon-regions-both-are-structs-4.rs | 19 ----- ...oth-anon-regions-both-are-structs-4.stderr | 12 --- .../ex3-both-anon-regions-one-is-struct-3.rs | 2 +- ...3-both-anon-regions-one-is-struct-3.stderr | 10 +-- .../ex3-both-anon-regions-one-is-struct-4.rs | 17 ---- ...3-both-anon-regions-one-is-struct-4.stderr | 10 --- 10 files changed, 73 insertions(+), 126 deletions(-) delete mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.rs delete mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr delete mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs delete mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr diff --git a/src/librustc/infer/error_reporting/anon_anon_conflict.rs b/src/librustc/infer/error_reporting/anon_anon_conflict.rs index 1432294f67f..08be7587cb4 100644 --- a/src/librustc/infer/error_reporting/anon_anon_conflict.rs +++ b/src/librustc/infer/error_reporting/anon_anon_conflict.rs @@ -48,8 +48,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // Determine whether the sub and sup consist of both anonymous (elided) regions. let (ty_sup, ty_sub, scope_def_id_sup, scope_def_id_sub, bregion_sup, bregion_sub) = if let (Some(anon_reg_sup), Some(anon_reg_sub)) = - (self.is_suitable_anonymous_region(sup, true), - self.is_suitable_anonymous_region(sub, true)) { + (self.is_suitable_anonymous_region(sup), self.is_suitable_anonymous_region(sub)) { let (def_id_sup, br_sup, def_id_sub, br_sub) = (anon_reg_sup.def_id, anon_reg_sup.boundregion, anon_reg_sub.def_id, @@ -64,7 +63,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { return false; }; - let (label1, label2) = if let (Some(sup_arg), Some(sub_arg)) = + let (main_label, label1, label2) = if let (Some(sup_arg), Some(sub_arg)) = (self.find_arg_with_anonymous_region(sup, sup), self.find_arg_with_anonymous_region(sub, sub)) { @@ -81,7 +80,9 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } if anon_arg_sup == anon_arg_sub { - (format!(" with one lifetime"), format!(" into the other")) + (format!("this type was declared with multiple lifetimes..."), + format!(" with one lifetime"), + format!(" into the other")) } else { let span_label_var1 = if let Some(simple_name) = anon_arg_sup.pat.simple_name() { format!(" from `{}`", simple_name) @@ -95,15 +96,18 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { format!("") }; - (span_label_var1, span_label_var2) + let span_label = + format!("these two types are declared with different lifetimes...",); + + (span_label, span_label_var1, span_label_var2) } } else { return false; }; + struct_span_err!(self.tcx.sess, span, E0623, "lifetime mismatch") - .span_label(ty_sup.span, - format!("these two types are declared with different lifetimes...")) + .span_label(ty_sup.span, main_label) .span_label(ty_sub.span, format!("")) .span_label(span, format!("...but data{} flows{} here", label1, label2)) .emit(); @@ -126,7 +130,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { /// The function returns the nested type corresponding to the anonymous region /// for e.g. `&u8` and Vec<`&u8`. pub fn find_anon_type(&self, region: Region<'tcx>, br: &ty::BoundRegion) -> Option<&hir::Ty> { - if let Some(anon_reg) = self.is_suitable_anonymous_region(region, true) { + if let Some(anon_reg) = self.is_suitable_anonymous_region(region) { let def_id = anon_reg.def_id; if let Some(node_id) = self.tcx.hir.as_local_node_id(def_id) { let ret_ty = self.tcx.type_of(def_id); diff --git a/src/librustc/infer/error_reporting/named_anon_conflict.rs b/src/librustc/infer/error_reporting/named_anon_conflict.rs index 7fa1eca5535..0aae008396a 100644 --- a/src/librustc/infer/error_reporting/named_anon_conflict.rs +++ b/src/librustc/infer/error_reporting/named_anon_conflict.rs @@ -31,24 +31,28 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // version new_ty of its type where the anonymous region is replaced // with the named one.//scope_def_id let (named, anon_arg_info, region_info) = - if sub.is_named_region() && self.is_suitable_anonymous_region(sup, false).is_some() { + if sub.is_named_region() && self.is_suitable_anonymous_region(sup).is_some() { (sub, self.find_arg_with_anonymous_region(sup, sub).unwrap(), - self.is_suitable_anonymous_region(sup, false).unwrap()) - } else if sup.is_named_region() && - self.is_suitable_anonymous_region(sub, false).is_some() { + self.is_suitable_anonymous_region(sup).unwrap()) + } else if sup.is_named_region() && self.is_suitable_anonymous_region(sub).is_some() { (sup, self.find_arg_with_anonymous_region(sub, sup).unwrap(), - self.is_suitable_anonymous_region(sub, false).unwrap()) + self.is_suitable_anonymous_region(sub).unwrap()) } else { return false; // inapplicable }; - let (arg, new_ty, br, is_first, scope_def_id) = (anon_arg_info.arg, - anon_arg_info.arg_ty, - anon_arg_info.bound_region, - anon_arg_info.is_first, - region_info.def_id); + let (arg, new_ty, br, is_first, scope_def_id, is_impl_item) = (anon_arg_info.arg, + anon_arg_info.arg_ty, + anon_arg_info.bound_region, + anon_arg_info.is_first, + region_info.def_id, + region_info.is_impl_item); + if is_impl_item { + return false; + } + if self.is_return_type_anon(scope_def_id, br) || self.is_self_anon(is_first, scope_def_id) { return false; } else { diff --git a/src/librustc/infer/error_reporting/util.rs b/src/librustc/infer/error_reporting/util.rs index 84429fea86e..3d5dcf37c48 100644 --- a/src/librustc/infer/error_reporting/util.rs +++ b/src/librustc/infer/error_reporting/util.rs @@ -37,6 +37,8 @@ pub struct FreeRegionInfo { pub def_id: DefId, // the bound region corresponding to FreeRegion pub boundregion: ty::BoundRegion, + // checks if bound region is in Impl Item + pub is_impl_item: bool, } impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { @@ -106,48 +108,15 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // This method returns whether the given Region is Anonymous // and returns the DefId and the BoundRegion corresponding to the given region. - // The is_anon_anon is set true when we are dealing with cases where - // both the regions are anonymous i.e. E0623. - pub fn is_suitable_anonymous_region(&self, - region: Region<'tcx>, - is_anon_anon: bool) - -> Option { + pub fn is_suitable_anonymous_region(&self, region: Region<'tcx>) -> Option { if let ty::ReFree(ref free_region) = *region { if let ty::BrAnon(..) = free_region.bound_region { let anonymous_region_binding_scope = free_region.scope; - let node_id = self.tcx - .hir - .as_local_node_id(anonymous_region_binding_scope) - .unwrap(); - match self.tcx.hir.find(node_id) { - Some(hir_map::NodeItem(..)) | - Some(hir_map::NodeTraitItem(..)) => { - // Success -- proceed to return Some below - } - Some(hir_map::NodeImplItem(..)) => { - if !is_anon_anon { - let container_id = self.tcx - .associated_item(anonymous_region_binding_scope) - .container - .id(); - if self.tcx.impl_trait_ref(container_id).is_some() { - // For now, we do not try to target impls of traits. This is - // because this message is going to suggest that the user - // change the fn signature, but they may not be free to do so, - // since the signature must match the trait. - // - // FIXME(#42706) -- in some cases, we could do better here. - return None; - } - } else { - } - } - _ => return None, // inapplicable - // we target only top-level functions - } return Some(FreeRegionInfo { def_id: anonymous_region_binding_scope, boundregion: free_region.bound_region, + is_impl_item: + self.is_bound_region_in_impl_item(anonymous_region_binding_scope), }); } } @@ -177,12 +146,42 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // FIXME(#42700) - Need to format self properly to // enable E0621 for it. pub fn is_self_anon(&self, is_first: bool, scope_def_id: DefId) -> bool { - if is_first && - self.tcx - .opt_associated_item(scope_def_id) - .map(|i| i.method_has_self_argument) - .unwrap_or(false) { - return true; + is_first && + self.tcx + .opt_associated_item(scope_def_id) + .map(|i| i.method_has_self_argument) == Some(true) + } + + // Here we check if the bound region is in Impl Item. + pub fn is_bound_region_in_impl_item(&self, anonymous_region_binding_scope: DefId) -> bool { + let node_id = self.tcx + .hir + .as_local_node_id(anonymous_region_binding_scope) + .unwrap(); + match self.tcx.hir.find(node_id) { + + Some(hir_map::NodeItem(..)) | + Some(hir_map::NodeTraitItem(..)) => { + // Success -- proceed to return Some below + } + Some(hir_map::NodeImplItem(..)) => { + let container_id = self.tcx + .associated_item(anonymous_region_binding_scope) + .container + .id(); + if self.tcx.impl_trait_ref(container_id).is_some() { + // For now, we do not try to target impls of traits. This is + // because this message is going to suggest that the user + // change the fn signature, but they may not be free to do so, + // since the signature must match the trait. + // + // FIXME(#42706) -- in some cases, we could do better here. + return true; + } + } + _ => { + return false; + } } false } diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr index 5ec4511372a..1b5ac7c7b57 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr @@ -4,7 +4,7 @@ error[E0623]: lifetime mismatch 15 | fn foo(mut x: Ref) { | --- | | - | these two types are declared with different lifetimes... + | this type was declared with multiple lifetimes... 16 | x.a = x.b; | ^^^ ...but data with one lifetime flows into the other here diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.rs deleted file mode 100644 index 606e611865f..00000000000 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -struct Ref<'a, 'b> { - a: &'a u32, - b: &'b u32, -} - -fn foo(mut x: Ref) { - x.a = x.b; -} - -fn main() {} diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr deleted file mode 100644 index 2ef1cd507f1..00000000000 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-both-are-structs-4.rs:16:11 - | -15 | fn foo(mut x: Ref) { - | --- - | | - | these two types are declared with different lifetimes... -16 | x.a = x.b; - | ^^^ ...but data with one lifetime flows into the other here - -error: aborting due to previous error - diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs index 026b4e90c4e..4933dbb7e7a 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs @@ -11,7 +11,7 @@ struct Ref<'a, 'b> { a: &'a u32, b: &'b u32 } fn foo(mut y: Ref, x: &u32) { - x = y.b; + y.b = x; } fn main() { } diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr index 8f1cff9c4a8..40f026bcb1b 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr @@ -1,12 +1,10 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-one-is-struct-3.rs:14:9 + --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:14:11 | 13 | fn foo(mut y: Ref, x: &u32) { - | --- ---- - | | - | these two types are declared with different lifetimes... -14 | x = y.b; - | ^^^ ...but data from `y` flows into `x` here + | --- ---- these two types are declared with different lifetimes... +14 | y.b = x; + | ^ ...but data from `x` flows into `y` here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs deleted file mode 100644 index 4933dbb7e7a..00000000000 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -struct Ref<'a, 'b> { a: &'a u32, b: &'b u32 } - -fn foo(mut y: Ref, x: &u32) { - y.b = x; -} - -fn main() { } diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr deleted file mode 100644 index 40f026bcb1b..00000000000 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:14:11 - | -13 | fn foo(mut y: Ref, x: &u32) { - | --- ---- these two types are declared with different lifetimes... -14 | y.b = x; - | ^ ...but data from `x` flows into `y` here - -error: aborting due to previous error - From b569094d94ca5bd572cf5b776e203eafe65e80a8 Mon Sep 17 00:00:00 2001 From: gaurikholkar Date: Wed, 23 Aug 2017 19:43:05 +0530 Subject: [PATCH 14/50] minor fix --- .../ex3-both-anon-regions-one-is-struct-3.stderr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr index 40f026bcb1b..d54b526aef9 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:14:11 + --> $DIR/ex3-both-anon-regions-one-is-struct-3.rs:14:11 | 13 | fn foo(mut y: Ref, x: &u32) { | --- ---- these two types are declared with different lifetimes... From cb563a93dcb076f2afe97d272591d71486906fc2 Mon Sep 17 00:00:00 2001 From: gaurikholkar Date: Thu, 24 Aug 2017 01:18:20 +0530 Subject: [PATCH 15/50] adding macro, cleaning up code --- .../error_reporting/anon_anon_conflict.rs | 28 ++++++++----------- src/librustc/infer/error_reporting/mod.rs | 4 ++- src/librustc/infer/error_reporting/util.rs | 10 ++++++- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/librustc/infer/error_reporting/anon_anon_conflict.rs b/src/librustc/infer/error_reporting/anon_anon_conflict.rs index 08be7587cb4..c80ce3c96f1 100644 --- a/src/librustc/infer/error_reporting/anon_anon_conflict.rs +++ b/src/librustc/infer/error_reporting/anon_anon_conflict.rs @@ -46,22 +46,17 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { }; // Determine whether the sub and sup consist of both anonymous (elided) regions. - let (ty_sup, ty_sub, scope_def_id_sup, scope_def_id_sub, bregion_sup, bregion_sub) = - if let (Some(anon_reg_sup), Some(anon_reg_sub)) = - (self.is_suitable_anonymous_region(sup), self.is_suitable_anonymous_region(sub)) { - let (def_id_sup, br_sup, def_id_sub, br_sub) = (anon_reg_sup.def_id, - anon_reg_sup.boundregion, - anon_reg_sub.def_id, - anon_reg_sub.boundregion); - if let (Some(anonarg_sup), Some(anonarg_sub)) = - (self.find_anon_type(sup, &br_sup), self.find_anon_type(sub, &br_sub)) { - (anonarg_sup, anonarg_sub, def_id_sup, def_id_sub, br_sup, br_sub) - } else { - return false; - } - } else { - return false; - }; + let anon_reg_sup = or_false!(self.is_suitable_anonymous_region(sup)); + + let anon_reg_sub = or_false!(self.is_suitable_anonymous_region(sub)); + let scope_def_id_sup = anon_reg_sup.def_id; + let bregion_sup = anon_reg_sup.boundregion; + let scope_def_id_sub = anon_reg_sub.def_id; + let bregion_sub = anon_reg_sub.boundregion; + + let ty_sup = or_false!(self.find_anon_type(sup, &bregion_sup)); + + let ty_sub = or_false!(self.find_anon_type(sub, &bregion_sub)); let (main_label, label1, label2) = if let (Some(sup_arg), Some(sub_arg)) = (self.find_arg_with_anonymous_region(sup, sup), @@ -105,7 +100,6 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { return false; }; - struct_span_err!(self.tcx.sess, span, E0623, "lifetime mismatch") .span_label(ty_sup.span, main_label) .span_label(ty_sub.span, format!("")) diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index 9f70b4834dd..195609992f7 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -75,8 +75,10 @@ use errors::{DiagnosticBuilder, DiagnosticStyledString}; mod note; mod need_type_info; -mod util; + mod named_anon_conflict; +#[macro_use] +mod util; mod anon_anon_conflict; impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { diff --git a/src/librustc/infer/error_reporting/util.rs b/src/librustc/infer/error_reporting/util.rs index 3d5dcf37c48..635d0e8eb27 100644 --- a/src/librustc/infer/error_reporting/util.rs +++ b/src/librustc/infer/error_reporting/util.rs @@ -16,6 +16,15 @@ use ty::{self, Region}; use hir::def_id::DefId; use hir::map as hir_map; +macro_rules! or_false { + ($v:expr) => { + match $v { + Some(v) => v, + None => return false, + } + } +} + // The struct contains the information about the anonymous region // we are searching for. pub struct AnonymousArgInfo<'tcx> { @@ -59,7 +68,6 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { -> Option { if let ty::ReFree(ref free_region) = *anon_region { - let id = free_region.scope; let hir = &self.tcx.hir; if let Some(node_id) = hir.as_local_node_id(id) { From 2cd13189ce328af88b61393cd567b6eb3db9ca2b Mon Sep 17 00:00:00 2001 From: gaurikholkar Date: Thu, 24 Aug 2017 02:34:05 +0530 Subject: [PATCH 16/50] build fixes --- src/librustc/infer/error_reporting/util.rs | 60 +++++++++++----------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/librustc/infer/error_reporting/util.rs b/src/librustc/infer/error_reporting/util.rs index 635d0e8eb27..f9ff2d2e2a5 100644 --- a/src/librustc/infer/error_reporting/util.rs +++ b/src/librustc/infer/error_reporting/util.rs @@ -120,11 +120,27 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { if let ty::ReFree(ref free_region) = *region { if let ty::BrAnon(..) = free_region.bound_region { let anonymous_region_binding_scope = free_region.scope; + let node_id = self.tcx + .hir + .as_local_node_id(anonymous_region_binding_scope) + .unwrap(); + let mut is_impl_item = false; + match self.tcx.hir.find(node_id) { + + Some(hir_map::NodeItem(..)) | + Some(hir_map::NodeTraitItem(..)) => { + // Success -- proceed to return Some below + } + Some(hir_map::NodeImplItem(..)) => { + is_impl_item = + self.is_bound_region_in_impl_item(anonymous_region_binding_scope); + } + _ => return None, + } return Some(FreeRegionInfo { def_id: anonymous_region_binding_scope, boundregion: free_region.bound_region, - is_impl_item: - self.is_bound_region_in_impl_item(anonymous_region_binding_scope), + is_impl_item: is_impl_item, }); } } @@ -162,34 +178,18 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // Here we check if the bound region is in Impl Item. pub fn is_bound_region_in_impl_item(&self, anonymous_region_binding_scope: DefId) -> bool { - let node_id = self.tcx - .hir - .as_local_node_id(anonymous_region_binding_scope) - .unwrap(); - match self.tcx.hir.find(node_id) { - - Some(hir_map::NodeItem(..)) | - Some(hir_map::NodeTraitItem(..)) => { - // Success -- proceed to return Some below - } - Some(hir_map::NodeImplItem(..)) => { - let container_id = self.tcx - .associated_item(anonymous_region_binding_scope) - .container - .id(); - if self.tcx.impl_trait_ref(container_id).is_some() { - // For now, we do not try to target impls of traits. This is - // because this message is going to suggest that the user - // change the fn signature, but they may not be free to do so, - // since the signature must match the trait. - // - // FIXME(#42706) -- in some cases, we could do better here. - return true; - } - } - _ => { - return false; - } + let container_id = self.tcx + .associated_item(anonymous_region_binding_scope) + .container + .id(); + if self.tcx.impl_trait_ref(container_id).is_some() { + // For now, we do not try to target impls of traits. This is + // because this message is going to suggest that the user + // change the fn signature, but they may not be free to do so, + // since the signature must match the trait. + // + // FIXME(#42706) -- in some cases, we could do better here. + return true; } false } From b4a32434c0cb859315a4395d003c625f87080e8f Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 18 Aug 2017 00:08:12 +0200 Subject: [PATCH 17/50] Remove duplicates in rustdoc --- src/librustdoc/clean/mod.rs | 4 ++++ src/librustdoc/html/render.rs | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index f4aef8ab377..1df0ac337a7 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -323,6 +323,10 @@ impl Item { pub fn is_union(&self) -> bool { self.type_() == ItemType::Union } + pub fn is_import(&self) -> bool { + self.type_() == ItemType::Import + } + pub fn is_stripped(&self) -> bool { match self.inner { StrippedItem(..) => true, _ => false } } diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 6593d6dfd6c..e113165b9ab 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1764,6 +1764,37 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context, } indices.sort_by(|&i1, &i2| cmp(&items[i1], &items[i2], i1, i2)); + // This call is to remove reexport duplicates in cases such as: + // + // ``` + // pub mod foo { + // pub mod bar { + // pub trait Double { fn foo(); } + // } + // } + // + // pub use foo::bar::*; + // pub use foo::*; + // ``` + // + // `Double` will appear twice in the generated docs. + // + // FIXME: This code is quite ugly and could be improved. Small issue: DefId + // can be identical even if the elements are different (mostly in imports). + // So in case this is an import, we keep everything by adding a "unique id" + // (which is the position in the vector). + indices.dedup_by_key(|i| (items[*i].def_id, + if items[*i].name.as_ref().is_some() { + Some(full_path(cx, &items[*i]).clone()) + } else { + None + }, + items[*i].type_(), + if items[*i].is_import() { + *i + } else { + 0 + })); debug!("{:?}", indices); let mut curty = None; From 5d71280c64e92c8526b6933c591456377acd8dc7 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 23 Aug 2017 22:47:17 +0200 Subject: [PATCH 18/50] Add duplicate test --- src/test/rustdoc/remove-duplicates.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/test/rustdoc/remove-duplicates.rs diff --git a/src/test/rustdoc/remove-duplicates.rs b/src/test/rustdoc/remove-duplicates.rs new file mode 100644 index 00000000000..6c4f6d0700a --- /dev/null +++ b/src/test/rustdoc/remove-duplicates.rs @@ -0,0 +1,24 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name = "foo"] + +mod foo { + pub use bar::*; + pub mod bar { + pub trait Foo { + fn foo(); + } + } +} + +// @count foo/index.html '//*[@class="trait"]' 1 +pub use foo::bar::*; +pub use foo::*; From 49ee9f3f08ba4583bc722a663e43551067ace271 Mon Sep 17 00:00:00 2001 From: lukaramu Date: Thu, 24 Aug 2017 17:33:36 +0200 Subject: [PATCH 19/50] Fix inconsistent doc headings This fixes headings reading "Unsafety" and "Example", they should be "Safety" and "Examples" according to RFC 1574. --- src/liballoc/allocator.rs | 24 ++++++++++++------------ src/liballoc/boxed.rs | 2 +- src/liballoc/slice.rs | 18 +++++++++--------- src/liballoc/str.rs | 2 +- src/libcore/cell.rs | 4 ++-- src/libcore/fmt/builders.rs | 10 +++++----- src/libcore/mem.rs | 2 +- src/libstd/io/mod.rs | 4 ++-- src/libstd/memchr.rs | 4 ++-- src/libstd/sys/redox/ext/mod.rs | 2 +- src/libstd/sys/unix/ext/mod.rs | 2 +- src/libstd/thread/mod.rs | 2 +- 12 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/liballoc/allocator.rs b/src/liballoc/allocator.rs index fc6585a9f95..f14f2702324 100644 --- a/src/liballoc/allocator.rs +++ b/src/liballoc/allocator.rs @@ -110,7 +110,7 @@ impl Layout { /// Creates a layout, bypassing all checks. /// - /// # Unsafety + /// # Safety /// /// This function is unsafe as it does not verify that `align` is /// a power-of-two that is also less than or equal to 2^31, nor @@ -485,7 +485,7 @@ pub unsafe trait Alloc { /// behavior, e.g. to ensure initialization to particular sets of /// bit patterns.) /// - /// # Unsafety + /// # Safety /// /// This function is unsafe because undefined behavior can result /// if the caller does not ensure that `layout` has non-zero size. @@ -513,7 +513,7 @@ pub unsafe trait Alloc { /// Deallocate the memory referenced by `ptr`. /// - /// # Unsafety + /// # Safety /// /// This function is unsafe because undefined behavior can result /// if the caller does not ensure all of the following: @@ -617,7 +617,7 @@ pub unsafe trait Alloc { /// behavior is well-defined (though underspecified) when this /// constraint is violated; further discussion below. /// - /// # Unsafety + /// # Safety /// /// This function is unsafe because undefined behavior can result /// if the caller does not ensure all of the following: @@ -688,7 +688,7 @@ pub unsafe trait Alloc { /// Behaves like `alloc`, but also ensures that the contents /// are set to zero before being returned. /// - /// # Unsafety + /// # Safety /// /// This function is unsafe for the same reasons that `alloc` is. /// @@ -714,7 +714,7 @@ pub unsafe trait Alloc { /// the returned block. For some `layout` inputs, like arrays, this /// may include extra storage usable for additional data. /// - /// # Unsafety + /// # Safety /// /// This function is unsafe for the same reasons that `alloc` is. /// @@ -736,7 +736,7 @@ pub unsafe trait Alloc { /// the returned block. For some `layout` inputs, like arrays, this /// may include extra storage usable for additional data. /// - /// # Unsafety + /// # Safety /// /// This function is unsafe for the same reasons that `realloc` is. /// @@ -770,7 +770,7 @@ pub unsafe trait Alloc { /// memory block referenced by `ptr` has not been transferred, and /// the contents of the memory block are unaltered. /// - /// # Unsafety + /// # Safety /// /// This function is unsafe because undefined behavior can result /// if the caller does not ensure all of the following: @@ -827,7 +827,7 @@ pub unsafe trait Alloc { /// the memory block has not been transferred, and the contents of /// the memory block are unaltered. /// - /// # Unsafety + /// # Safety /// /// This function is unsafe because undefined behavior can result /// if the caller does not ensure all of the following: @@ -920,7 +920,7 @@ pub unsafe trait Alloc { /// /// Captures a common usage pattern for allocators. /// - /// # Unsafety + /// # Safety /// /// This function is unsafe because undefined behavior can result /// if the caller does not ensure both: @@ -993,7 +993,7 @@ pub unsafe trait Alloc { /// The returned block is suitable for passing to the /// `alloc`/`realloc` methods of this allocator. /// - /// # Unsafety + /// # Safety /// /// This function is unsafe because undefined behavior can result /// if the caller does not ensure all of the following: @@ -1037,7 +1037,7 @@ pub unsafe trait Alloc { /// /// Captures a common usage pattern for allocators. /// - /// # Unsafety + /// # Safety /// /// This function is unsafe because undefined behavior can result /// if the caller does not ensure both: diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index c0d43d9c527..82aac4dbf63 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -633,7 +633,7 @@ impl FusedIterator for Box {} /// that `FnBox` may be deprecated in the future if `Box` /// closures become directly usable.) /// -/// ### Example +/// # Examples /// /// Here is a snippet of code which creates a hashmap full of boxed /// once closures and then removes them one by one, calling each diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs index 356ca7a5f5e..fd60e8aaded 100644 --- a/src/liballoc/slice.rs +++ b/src/liballoc/slice.rs @@ -171,7 +171,7 @@ mod hack { impl [T] { /// Returns the number of elements in the slice. /// - /// # Example + /// # Examples /// /// ``` /// let a = [1, 2, 3]; @@ -185,7 +185,7 @@ impl [T] { /// Returns `true` if the slice has a length of 0. /// - /// # Example + /// # Examples /// /// ``` /// let a = [1, 2, 3]; @@ -523,7 +523,7 @@ impl [T] { /// Reverses the order of elements in the slice, in place. /// - /// # Example + /// # Examples /// /// ``` /// let mut v = [1, 2, 3]; @@ -580,7 +580,7 @@ impl [T] { /// /// Panics if `size` is 0. /// - /// # Example + /// # Examples /// /// ``` /// let slice = ['r', 'u', 's', 't']; @@ -613,7 +613,7 @@ impl [T] { /// /// Panics if `size` is 0. /// - /// # Example + /// # Examples /// /// ``` /// let slice = ['l', 'o', 'r', 'e', 'm']; @@ -1040,7 +1040,7 @@ impl [T] { /// `Err` is returned, containing the index where a matching /// element could be inserted while maintaining sorted order. /// - /// # Example + /// # Examples /// /// Looks up a series of four elements. The first is found, with a /// uniquely determined position; the second and third are not @@ -1074,7 +1074,7 @@ impl [T] { /// `Err` is returned, containing the index where a matching /// element could be inserted while maintaining sorted order. /// - /// # Example + /// # Examples /// /// Looks up a series of four elements. The first is found, with a /// uniquely determined position; the second and third are not @@ -1419,7 +1419,7 @@ impl [T] { /// /// This function will panic if the two slices have different lengths. /// - /// # Example + /// # Examples /// /// ``` /// let mut dst = [0, 0, 0]; @@ -1445,7 +1445,7 @@ impl [T] { /// /// This function will panic if the two slices have different lengths. /// - /// # Example + /// # Examples /// /// ``` /// let mut dst = [0, 0, 0]; diff --git a/src/liballoc/str.rs b/src/liballoc/str.rs index 80317cd763b..79b2bbce2af 100644 --- a/src/liballoc/str.rs +++ b/src/liballoc/str.rs @@ -1714,7 +1714,7 @@ impl str { /// /// [`Err`]: str/trait.FromStr.html#associatedtype.Err /// - /// # Example + /// # Examples /// /// Basic usage /// diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index dc0905e2972..e0a3b8d52f4 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -998,7 +998,7 @@ impl<'b, T: ?Sized> Ref<'b, T> { /// A method would interfere with methods of the same name on the contents /// of a `RefCell` used through `Deref`. /// - /// # Example + /// # Examples /// /// ``` /// use std::cell::{RefCell, Ref}; @@ -1040,7 +1040,7 @@ impl<'b, T: ?Sized> RefMut<'b, T> { /// `RefMut::map(...)`. A method would interfere with methods of the same /// name on the contents of a `RefCell` used through `Deref`. /// - /// # Example + /// # Examples /// /// ``` /// use std::cell::{RefCell, RefMut}; diff --git a/src/libcore/fmt/builders.rs b/src/libcore/fmt/builders.rs index 8125097d7d1..b594c886b64 100644 --- a/src/libcore/fmt/builders.rs +++ b/src/libcore/fmt/builders.rs @@ -58,7 +58,7 @@ impl<'a, 'b: 'a> fmt::Write for PadAdapter<'a, 'b> { /// [`Formatter::debug_struct`](struct.Formatter.html#method.debug_struct) /// method. /// -/// # Example +/// # Examples /// /// ``` /// use std::fmt; @@ -153,7 +153,7 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> { /// [`Formatter::debug_tuple`](struct.Formatter.html#method.debug_tuple) /// method. /// -/// # Example +/// # Examples /// /// ``` /// use std::fmt; @@ -290,7 +290,7 @@ impl<'a, 'b: 'a> DebugInner<'a, 'b> { /// [`Formatter::debug_set`](struct.Formatter.html#method.debug_set) /// method. /// -/// # Example +/// # Examples /// /// ``` /// use std::fmt; @@ -361,7 +361,7 @@ impl<'a, 'b: 'a> DebugSet<'a, 'b> { /// [`Formatter::debug_list`](struct.Formatter.html#method.debug_list) /// method. /// -/// # Example +/// # Examples /// /// ``` /// use std::fmt; @@ -432,7 +432,7 @@ impl<'a, 'b: 'a> DebugList<'a, 'b> { /// [`Formatter::debug_map`](struct.Formatter.html#method.debug_map) /// method. /// -/// # Example +/// # Examples /// /// ``` /// use std::fmt; diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 6f7adbe1e7a..4b866cab1ea 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -901,7 +901,7 @@ impl ManuallyDrop { /// Manually drops the contained value. /// - /// # Unsafety + /// # Safety /// /// This function runs the destructor of the contained value and thus the wrapped value /// now represents uninitialized data. It is up to the user of this method to ensure the diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 0fff833e7d8..074ab3ebd8f 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -522,7 +522,7 @@ pub trait Read { /// `Read`er - the method only takes `&self` so that it can be used through /// trait objects. /// - /// # Unsafety + /// # Safety /// /// This method is unsafe because a `Read`er could otherwise return a /// non-zeroing `Initializer` from another `Read` type without an `unsafe` @@ -903,7 +903,7 @@ impl Initializer { /// Returns a new `Initializer` which will not zero out buffers. /// - /// # Unsafety + /// # Safety /// /// This may only be called by `Read`ers which guarantee that they will not /// read from buffers passed to `Read` methods, and that the return value of diff --git a/src/libstd/memchr.rs b/src/libstd/memchr.rs index 98642f86f4d..240e82069ff 100644 --- a/src/libstd/memchr.rs +++ b/src/libstd/memchr.rs @@ -20,7 +20,7 @@ /// magnitude faster than `haystack.iter().position(|&b| b == needle)`. /// (See benchmarks.) /// -/// # Example +/// # Examples /// /// This shows how to find the first position of a byte in a byte string. /// @@ -40,7 +40,7 @@ pub fn memchr(needle: u8, haystack: &[u8]) -> Option { /// Returns the index corresponding to the last occurrence of `needle` in /// `haystack`, or `None` if one is not found. /// -/// # Example +/// # Examples /// /// This shows how to find the last position of a byte in a byte string. /// diff --git a/src/libstd/sys/redox/ext/mod.rs b/src/libstd/sys/redox/ext/mod.rs index 259cda5bcb3..9fd8d6c9186 100644 --- a/src/libstd/sys/redox/ext/mod.rs +++ b/src/libstd/sys/redox/ext/mod.rs @@ -13,7 +13,7 @@ //! For now, this module is limited to extracting file descriptors, //! but its functionality will grow over time. //! -//! # Example +//! # Examples //! //! ```no_run //! use std::fs::File; diff --git a/src/libstd/sys/unix/ext/mod.rs b/src/libstd/sys/unix/ext/mod.rs index 67fe46cc9c7..98bc90dd4e1 100644 --- a/src/libstd/sys/unix/ext/mod.rs +++ b/src/libstd/sys/unix/ext/mod.rs @@ -13,7 +13,7 @@ //! For now, this module is limited to extracting file descriptors, //! but its functionality will grow over time. //! -//! # Example +//! # Examples //! //! ```no_run //! use std::fs::File; diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index ee103c803f5..6354e746af2 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -807,7 +807,7 @@ pub fn park_timeout_ms(ms: u32) { /// Platforms which do not support nanosecond precision for sleeping will have /// `dur` rounded up to the nearest granularity of time they can sleep for. /// -/// # Example +/// # Examples /// /// Waiting for the complete expiration of the timeout: /// From 8e95b3a939d73e1bc0bd65b136dda3e5b2a23425 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 12 Aug 2017 15:37:28 -0700 Subject: [PATCH 20/50] rustc: Capture diagnostics from all queries This commit alters the `rustc::ty::maps` implementation to ensure that all output diagnostics from the compiler are tracked for the duration of each query. These are then intended to be replayed back the first time a cached value is loaded, and otherwise the cache should operate the same as it does today. Closes #42513 --- src/librustc/ty/maps.rs | 82 +++++++++++++++++------ src/librustc_errors/diagnostic_builder.rs | 13 ++-- src/librustc_errors/lib.rs | 23 ++++++- 3 files changed, 90 insertions(+), 28 deletions(-) diff --git a/src/librustc/ty/maps.rs b/src/librustc/ty/maps.rs index 6e02e38aee1..f1c624a94e3 100644 --- a/src/librustc/ty/maps.rs +++ b/src/librustc/ty/maps.rs @@ -9,6 +9,7 @@ // except according to those terms. use dep_graph::{DepConstructor, DepNode, DepNodeIndex}; +use errors::{Diagnostic, DiagnosticBuilder}; use hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use hir::def::Def; use hir; @@ -32,7 +33,7 @@ use util::common::{profq_msg, ProfileQueriesMsg}; use rustc_data_structures::indexed_vec::IndexVec; use rustc_data_structures::fx::FxHashMap; -use std::cell::{RefCell, RefMut}; +use std::cell::{RefCell, RefMut, Cell}; use std::fmt::Debug; use std::hash::Hash; use std::marker::PhantomData; @@ -188,7 +189,18 @@ impl<'tcx> Value<'tcx> for ty::SymbolName { struct QueryMap { phantom: PhantomData, - map: FxHashMap, + map: FxHashMap>, +} + +struct QueryValue { + value: T, + index: DepNodeIndex, + diagnostics: Option>, +} + +struct QueryDiagnostics { + diagnostics: Vec, + emitted_diagnostics: Cell, } impl QueryMap { @@ -618,10 +630,20 @@ macro_rules! define_maps { ) ); - if let Some(&(ref result, dep_node_index)) = tcx.maps.$name.borrow().map.get(&key) { - tcx.dep_graph.read_index(dep_node_index); + if let Some(value) = tcx.maps.$name.borrow().map.get(&key) { + if let Some(ref d) = value.diagnostics { + if !d.emitted_diagnostics.get() { + d.emitted_diagnostics.set(true); + let handle = tcx.sess.diagnostic(); + for diagnostic in d.diagnostics.iter() { + DiagnosticBuilder::new_diagnostic(handle, diagnostic.clone()) + .emit(); + } + } + } profq_msg!(tcx, ProfileQueriesMsg::CacheHit); - return Ok(f(result)); + tcx.dep_graph.read_index(value.index); + return Ok(f(&value.value)); } // else, we are going to run the provider: profq_msg!(tcx, ProfileQueriesMsg::ProviderBegin); @@ -633,36 +655,52 @@ macro_rules! define_maps { span = key.default_span(tcx) } - let (result, dep_node_index) = tcx.cycle_check(span, Query::$name(key), || { + let res = tcx.cycle_check(span, Query::$name(key), || { let dep_node = Self::to_dep_node(tcx, &key); - if dep_node.kind.is_anon() { - tcx.dep_graph.with_anon_task(dep_node.kind, || { - let provider = tcx.maps.providers[key.map_crate()].$name; - provider(tcx.global_tcx(), key) - }) - } else { - fn run_provider<'a, 'tcx, 'lcx>(tcx: TyCtxt<'a, 'tcx, 'lcx>, - key: $K) - -> $V { - let provider = tcx.maps.providers[key.map_crate()].$name; - provider(tcx.global_tcx(), key) - } + tcx.sess.diagnostic().track_diagnostics(|| { + if dep_node.kind.is_anon() { + tcx.dep_graph.with_anon_task(dep_node.kind, || { + let provider = tcx.maps.providers[key.map_crate()].$name; + provider(tcx.global_tcx(), key) + }) + } else { + fn run_provider<'a, 'tcx, 'lcx>(tcx: TyCtxt<'a, 'tcx, 'lcx>, + key: $K) + -> $V { + let provider = tcx.maps.providers[key.map_crate()].$name; + provider(tcx.global_tcx(), key) + } - tcx.dep_graph.with_task(dep_node, tcx, key, run_provider) - } + tcx.dep_graph.with_task(dep_node, tcx, key, run_provider) + } + }) })?; profq_msg!(tcx, ProfileQueriesMsg::ProviderEnd); + let ((result, dep_node_index), diagnostics) = res; tcx.dep_graph.read_index(dep_node_index); + let value = QueryValue { + value: result, + index: dep_node_index, + diagnostics: if diagnostics.len() == 0 { + None + } else { + Some(Box::new(QueryDiagnostics { + diagnostics, + emitted_diagnostics: Cell::new(true), + })) + }, + }; + Ok(f(&tcx.maps .$name .borrow_mut() .map .entry(key) - .or_insert((result, dep_node_index)) - .0)) + .or_insert(value) + .value)) } pub fn try_get(tcx: TyCtxt<'a, $tcx, 'lcx>, span: Span, key: $K) diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs index 8d7ce4eb4f6..0a811989350 100644 --- a/src/librustc_errors/diagnostic_builder.rs +++ b/src/librustc_errors/diagnostic_builder.rs @@ -98,7 +98,7 @@ impl<'a> DiagnosticBuilder<'a> { } }; - self.handler.emitter.borrow_mut().emit(&self); + self.handler.emit_db(&self); self.cancel(); if is_error { @@ -178,10 +178,13 @@ impl<'a> DiagnosticBuilder<'a> { code: Option, message: &str) -> DiagnosticBuilder<'a> { - DiagnosticBuilder { - handler, - diagnostic: Diagnostic::new_with_code(level, code, message) - } + let diagnostic = Diagnostic::new_with_code(level, code, message); + DiagnosticBuilder::new_diagnostic(handler, diagnostic) + } + + /// Creates a new `DiagnosticBuilder` with an already constructed diagnostic. + pub fn new_diagnostic(handler: &'a Handler, diagnostic: Diagnostic) -> DiagnosticBuilder<'a> { + DiagnosticBuilder { handler, diagnostic } } } diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 12b5ccf4837..a51e6022350 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -35,8 +35,9 @@ use emitter::{Emitter, EmitterWriter}; use std::borrow::Cow; use std::cell::{RefCell, Cell}; -use std::{error, fmt}; +use std::mem; use std::rc::Rc; +use std::{error, fmt}; mod diagnostic; mod diagnostic_builder; @@ -275,6 +276,7 @@ pub struct Handler { treat_err_as_bug: bool, continue_after_error: Cell, delayed_span_bug: RefCell>, + tracked_diagnostics: RefCell>>, } impl Handler { @@ -298,6 +300,7 @@ impl Handler { treat_err_as_bug, continue_after_error: Cell::new(true), delayed_span_bug: RefCell::new(None), + tracked_diagnostics: RefCell::new(None), } } @@ -547,6 +550,24 @@ impl Handler { self.abort_if_errors(); } } + + pub fn track_diagnostics(&self, f: F) -> (R, Vec) + where F: FnOnce() -> R + { + let prev = mem::replace(&mut *self.tracked_diagnostics.borrow_mut(), + Some(Vec::new())); + let ret = f(); + let diagnostics = mem::replace(&mut *self.tracked_diagnostics.borrow_mut(), prev) + .unwrap(); + (ret, diagnostics) + } + + fn emit_db(&self, db: &DiagnosticBuilder) { + if let Some(ref mut list) = *self.tracked_diagnostics.borrow_mut() { + list.push((**db).clone()); + } + self.emitter.borrow_mut().emit(db); + } } From b8d8dc3c23a8d364672bfd25330e17885273b1bc Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Fri, 25 Aug 2017 16:08:03 +0200 Subject: [PATCH 21/50] Fix #43457 (and avoid some unneeded lookups to boot, woo). --- src/librustc_mir/hair/cx/block.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/librustc_mir/hair/cx/block.rs b/src/librustc_mir/hair/cx/block.rs index 0324552cd56..61d128fc847 100644 --- a/src/librustc_mir/hair/cx/block.rs +++ b/src/librustc_mir/hair/cx/block.rs @@ -22,10 +22,7 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Block { // We have to eagerly translate the "spine" of the statements // in order to get the lexical scoping correctly. let stmts = mirror_stmts(cx, self.id, &*self.stmts); - let opt_def_id = cx.tcx.hir.opt_local_def_id(self.id); - let opt_destruction_extent = opt_def_id.and_then(|def_id| { - cx.tcx.region_maps(def_id).opt_destruction_extent(self.id) - }); + let opt_destruction_extent = cx.region_maps.opt_destruction_extent(self.id); Block { targeted_by_break: self.targeted_by_break, extent: CodeExtent::Misc(self.id), @@ -42,11 +39,8 @@ fn mirror_stmts<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, stmts: &'tcx [hir::Stmt]) -> Vec> { let mut result = vec![]; - let opt_def_id = cx.tcx.hir.opt_local_def_id(block_id); for (index, stmt) in stmts.iter().enumerate() { - let opt_dxn_ext = opt_def_id.and_then(|def_id| { - cx.tcx.region_maps(def_id).opt_destruction_extent(stmt.node.id()) - }); + let opt_dxn_ext = cx.region_maps.opt_destruction_extent(stmt.node.id()); match stmt.node { hir::StmtExpr(ref expr, id) | hir::StmtSemi(ref expr, id) => { From d1a15cdfb119b42e5333a56f0345d657d7cbd60d Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Fri, 25 Aug 2017 16:35:42 +0200 Subject: [PATCH 22/50] Regression test. --- src/test/mir-opt/issue-43457.rs | 55 +++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/test/mir-opt/issue-43457.rs diff --git a/src/test/mir-opt/issue-43457.rs b/src/test/mir-opt/issue-43457.rs new file mode 100644 index 00000000000..708784df317 --- /dev/null +++ b/src/test/mir-opt/issue-43457.rs @@ -0,0 +1,55 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -Z identify_regions -Z span_free_formats +// ignore-tidy-linelength + +// Regression test for #43457: an `EndRegion` was missing from output +// because compiler was using a faulty means for region map lookup. + +use std::cell::RefCell; + +fn rc_refcell_test(r: RefCell) { + r.borrow_mut(); +} + +fn main() { } + +// END RUST SOURCE +// START rustc.node5.SimplifyCfg-qualify-consts.after.mir +// +// fn rc_refcell_test(_1: std::cell::RefCell) -> () { +// let mut _0: (); +// scope 1 { +// let _2: std::cell::RefCell; +// } +// let mut _3: std::cell::RefMut<'17dce, i32>; +// let mut _4: &'17dce std::cell::RefCell; +// +// bb0: { +// StorageLive(_2); +// _2 = _1; +// StorageLive(_4); +// _4 = &'17dce _2; +// _3 = const >::borrow_mut(_4) -> bb1; +// } +// +// bb1: { +// drop(_3) -> bb2; +// } +// +// bb2: { +// StorageDead(_4); +// EndRegion('17dce); +// _0 = (); +// StorageDead(_2); +// return; +// } +// } From e13f02eb2e188a3d8c2a5f7ba20823a85ab14307 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 25 Aug 2017 10:10:27 -0700 Subject: [PATCH 23/50] rustbuild: Automatically enable Ninja on MSVC Discovered in #43767 it turns out the default MSBuild generator in CMake for whatever reason isn't supporting many of the configuration options we give to LLVM. To improve the contributor experience automatically enable Ninja if we find it to ensure that "flavorful" configurations of LLVM work by default in more situations. Closes #43767 --- src/bootstrap/sanity.rs | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs index a64a6130929..54208d8bb57 100644 --- a/src/bootstrap/sanity.rs +++ b/src/bootstrap/sanity.rs @@ -93,10 +93,27 @@ pub fn check(build: &mut Build) { } // Ninja is currently only used for LLVM itself. - // Some Linux distros rename `ninja` to `ninja-build`. - // CMake can work with either binary name. - if building_llvm && build.config.ninja && cmd_finder.maybe_have("ninja-build").is_none() { - cmd_finder.must_have("ninja"); + if building_llvm { + if build.config.ninja { + // Some Linux distros rename `ninja` to `ninja-build`. + // CMake can work with either binary name. + if cmd_finder.maybe_have("ninja-build").is_none() { + cmd_finder.must_have("ninja"); + } + } + + // If ninja isn't enabled but we're building for MSVC then we try + // doubly hard to enable it. It was realized in #43767 that the msbuild + // CMake generator for MSVC doesn't respect configuration options like + // disabling LLVM assertions, which can often be quite important! + // + // In these cases we automatically enable Ninja if we find it in the + // environment. + if !build.config.ninja && build.config.build.contains("msvc") { + if cmd_finder.maybe_have("ninja").is_some() { + build.config.ninja = true; + } + } } build.config.python = build.config.python.take().map(|p| cmd_finder.must_have(p)) From 6a721317ff0621a97690dc573ced88274d860e84 Mon Sep 17 00:00:00 2001 From: kennytm Date: Fri, 25 Aug 2017 23:27:42 +0800 Subject: [PATCH 24/50] Allow htmldocck to run using Python 3. --- src/etc/htmldocck.py | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/etc/htmldocck.py b/src/etc/htmldocck.py index a5449b748dd..7e8fde20346 100644 --- a/src/etc/htmldocck.py +++ b/src/etc/htmldocck.py @@ -29,7 +29,7 @@ showing the expected renderings. In order to avoid one-off dependencies for this task, this script uses a reasonably working HTML parser and the existing XPath implementation -from Python 2's standard library. Hopefully we won't render +from Python's standard library. Hopefully we won't render non-well-formed HTML. # Commands @@ -110,11 +110,17 @@ import os.path import re import shlex from collections import namedtuple -from HTMLParser import HTMLParser +try: + from html.parser import HTMLParser +except ImportError: + from HTMLParser import HTMLParser from xml.etree import cElementTree as ET # ⇤/⇥ are not in HTML 4 but are in HTML 5 -from htmlentitydefs import entitydefs +try: + from html.entities import entitydefs +except ImportError: + from htmlentitydefs import entitydefs entitydefs['larrb'] = u'\u21e4' entitydefs['rarrb'] = u'\u21e5' entitydefs['nbsp'] = ' ' @@ -123,6 +129,11 @@ entitydefs['nbsp'] = ' ' VOID_ELEMENTS = set(['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']) +# Python 2 -> 3 compatibility +try: + unichr +except NameError: + unichr = chr class CustomHTMLParser(HTMLParser): """simplified HTML parser. @@ -184,12 +195,8 @@ def concat_multi_lines(f): # strip the common prefix from the current line if needed if lastline is not None: - maxprefix = 0 - for i in xrange(min(len(line), len(lastline))): - if line[i] != lastline[i]: - break - maxprefix += 1 - line = line[maxprefix:].lstrip() + common_prefix = os.path.commonprefix([line, lastline]) + line = line[len(common_prefix):].lstrip() firstlineno = firstlineno or lineno if line.endswith('\\'): @@ -213,7 +220,7 @@ LINE_PATTERN = re.compile(r''' def get_commands(template): - with open(template, 'rUb') as f: + with open(template, 'rU') as f: for lineno, line in concat_multi_lines(f): m = LINE_PATTERN.search(line) if not m: @@ -372,7 +379,7 @@ def check_command(c, cache): cache.get_file(c.args[0]) ret = True except FailedCheck as err: - cerr = err.message + cerr = str(err) ret = False elif len(c.args) == 2: # @has/matches = string test cerr = "`PATTERN` did not match" @@ -413,9 +420,9 @@ def check_command(c, cache): except FailedCheck as err: message = '@{}{} check failed'.format('!' if c.negated else '', c.cmd) - print_err(c.lineno, c.context, err.message, message) + print_err(c.lineno, c.context, str(err), message) except InvalidCheck as err: - print_err(c.lineno, c.context, err.message) + print_err(c.lineno, c.context, str(err)) def check(target, commands): cache = CachedFiles(target) From 5a71e1235137fdcdef124b3af914ef06a24d65c4 Mon Sep 17 00:00:00 2001 From: est31 Date: Fri, 25 Aug 2017 12:25:22 +0200 Subject: [PATCH 25/50] Fix a byte/char confusion issue in the error emitter Fixes #44078. Fixes #44023. The start_col member is given in chars, while the code previously assumed it was given in bytes. The more basic issue #44080 doesn't get fixed. --- src/librustc_errors/emitter.rs | 4 +++- src/test/ui/issue-44023.rs | 16 ++++++++++++++++ src/test/ui/issue-44023.stderr | 13 +++++++++++++ src/test/ui/issue-44078.rs | 13 +++++++++++++ src/test/ui/issue-44078.stderr | 10 ++++++++++ 5 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 src/test/ui/issue-44023.rs create mode 100644 src/test/ui/issue-44023.stderr create mode 100644 src/test/ui/issue-44078.rs create mode 100644 src/test/ui/issue-44078.stderr diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 3b1414ef83a..53d90531cc9 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -311,7 +311,9 @@ impl EmitterWriter { if line.annotations.len() == 1 { if let Some(ref ann) = line.annotations.get(0) { if let AnnotationType::MultilineStart(depth) = ann.annotation_type { - if source_string[0..ann.start_col].trim() == "" { + if source_string.chars() + .take(ann.start_col) + .all(|c| c.is_whitespace()) { let style = if ann.is_primary { Style::UnderlinePrimary } else { diff --git a/src/test/ui/issue-44023.rs b/src/test/ui/issue-44023.rs new file mode 100644 index 00000000000..295d4808289 --- /dev/null +++ b/src/test/ui/issue-44023.rs @@ -0,0 +1,16 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(non_ascii_idents)] + +pub fn main () {} + +fn საჭმელად_გემრიელი_სადილი ( ) -> isize { +} diff --git a/src/test/ui/issue-44023.stderr b/src/test/ui/issue-44023.stderr new file mode 100644 index 00000000000..a17512ba4ab --- /dev/null +++ b/src/test/ui/issue-44023.stderr @@ -0,0 +1,13 @@ +error[E0308]: mismatched types + --> $DIR/issue-44023.rs:15:42 + | +15 | fn საჭმელად_გემრიელი_სადილი ( ) -> isize { + | __________________________________________^ +16 | | } + | |_^ expected isize, found () + | + = note: expected type `isize` + found type `()` + +error: aborting due to previous error + diff --git a/src/test/ui/issue-44078.rs b/src/test/ui/issue-44078.rs new file mode 100644 index 00000000000..ef47214f2b3 --- /dev/null +++ b/src/test/ui/issue-44078.rs @@ -0,0 +1,13 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + "😊""; +} diff --git a/src/test/ui/issue-44078.stderr b/src/test/ui/issue-44078.stderr new file mode 100644 index 00000000000..389f3b2479a --- /dev/null +++ b/src/test/ui/issue-44078.stderr @@ -0,0 +1,10 @@ +error: unterminated double quote string + --> $DIR/issue-44078.rs:12:8 + | +12 | "😊""; + | ________^ +13 | | } + | |__^ + +error: aborting due to previous error + From f2fb45723ac7a1bfa897802256452d603a7adb2a Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sun, 20 Aug 2017 08:22:46 -0700 Subject: [PATCH 26/50] syntax: remove unused field --- src/libsyntax/test.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs index eeb8bf72144..438eb2b8174 100644 --- a/src/libsyntax/test.rs +++ b/src/libsyntax/test.rs @@ -56,7 +56,6 @@ struct Test { } struct TestCtxt<'a> { - sess: &'a ParseSess, span_diagnostic: &'a errors::Handler, path: Vec, ext_cx: ExtCtxt<'a>, @@ -273,7 +272,6 @@ fn generate_test_harness(sess: &ParseSess, let mark = Mark::fresh(Mark::root()); let mut cx: TestCtxt = TestCtxt { - sess, span_diagnostic: sd, ext_cx: ExtCtxt::new(sess, ExpansionConfig::default("test".to_string()), resolver), path: Vec::new(), From 0463566f27dfc5979b5b12eb7cea670a4e3f991c Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sun, 20 Aug 2017 08:40:07 -0700 Subject: [PATCH 27/50] syntax: clarify field name The value of this field is meant to indicate whether or not the crate is rustc's libtest itself - not whether or not it is a test crate generally. --- src/libsyntax/test.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs index 438eb2b8174..35dc9819529 100644 --- a/src/libsyntax/test.rs +++ b/src/libsyntax/test.rs @@ -61,7 +61,7 @@ struct TestCtxt<'a> { ext_cx: ExtCtxt<'a>, testfns: Vec, reexport_test_harness_main: Option, - is_test_crate: bool, + is_libtest: bool, ctxt: SyntaxContext, // top-level re-export submodule, filled out after folding is finished @@ -271,13 +271,15 @@ fn generate_test_harness(sess: &ParseSess, let krate = cleaner.fold_crate(krate); let mark = Mark::fresh(Mark::root()); + let mut cx: TestCtxt = TestCtxt { span_diagnostic: sd, ext_cx: ExtCtxt::new(sess, ExpansionConfig::default("test".to_string()), resolver), path: Vec::new(), testfns: Vec::new(), reexport_test_harness_main, - is_test_crate: is_test_crate(&krate), + // NB: doesn't consider the value of `--crate-name` passed on the command line. + is_libtest: attr::find_crate_name(&krate.attrs).map(|s| s == "test").unwrap_or(false), toplevel_reexport: None, ctxt: SyntaxContext::empty().apply_mark(mark), }; @@ -452,7 +454,7 @@ mod __test { fn mk_std(cx: &TestCtxt) -> P { let id_test = Ident::from_str("test"); let sp = ignored_span(cx, DUMMY_SP); - let (vi, vis, ident) = if cx.is_test_crate { + let (vi, vis, ident) = if cx.is_libtest { (ast::ItemKind::Use( P(nospan(ast::ViewPathSimple(id_test, path_node(vec![id_test]))))), @@ -606,13 +608,6 @@ fn mk_tests(cx: &TestCtxt) -> P { test_descs) } -fn is_test_crate(krate: &ast::Crate) -> bool { - match attr::find_crate_name(&krate.attrs) { - Some(s) if "test" == s.as_str() => true, - _ => false - } -} - fn mk_test_descs(cx: &TestCtxt) -> P { debug!("building test vector from {} tests", cx.testfns.len()); From b3f50caee0e2f2f4d44e1c83bf73a112c2a398b1 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sat, 19 Aug 2017 16:54:17 -0700 Subject: [PATCH 28/50] *: remove crate_{name,type} attributes Fixes #41701. --- src/liballoc/lib.rs | 2 -- src/liballoc_jemalloc/lib.rs | 2 -- src/liballoc_system/lib.rs | 2 -- src/libarena/lib.rs | 3 --- src/libcollections/lib.rs | 2 -- src/libcore/lib.rs | 2 -- src/libfmt_macros/lib.rs | 3 --- src/libgetopts/lib.rs | 3 --- src/libgraphviz/lib.rs | 3 --- src/libpanic_abort/lib.rs | 2 -- src/libpanic_unwind/lib.rs | 2 -- src/libproc_macro/lib.rs | 3 --- src/libprofiler_builtins/lib.rs | 2 -- src/librand/lib.rs | 2 -- src/librustc/lib.rs | 3 --- src/librustc_apfloat/lib.rs | 1 - src/librustc_back/lib.rs | 3 --- src/librustc_bitflags/lib.rs | 2 -- src/librustc_borrowck/lib.rs | 3 --- src/librustc_const_eval/lib.rs | 3 --- src/librustc_const_math/lib.rs | 3 --- src/librustc_data_structures/lib.rs | 3 --- src/librustc_driver/lib.rs | 3 --- src/librustc_errors/lib.rs | 3 --- src/librustc_incremental/lib.rs | 3 --- src/librustc_lint/lib.rs | 3 --- src/librustc_llvm/lib.rs | 3 --- src/librustc_metadata/lib.rs | 3 --- src/librustc_mir/lib.rs | 3 --- src/librustc_passes/lib.rs | 3 --- src/librustc_platform_intrinsics/lib.rs | 3 --- src/librustc_plugin/lib.rs | 3 --- src/librustc_privacy/lib.rs | 3 --- src/librustc_resolve/lib.rs | 3 --- src/librustc_save_analysis/lib.rs | 3 --- src/librustc_trans/lib.rs | 3 --- src/librustc_trans_utils/lib.rs | 3 --- src/librustc_typeck/lib.rs | 3 --- src/librustdoc/lib.rs | 3 --- src/libserialize/lib.rs | 3 --- src/libstd/lib.rs | 3 --- src/libstd_unicode/lib.rs | 2 -- src/libsyntax/lib.rs | 3 --- src/libsyntax_ext/lib.rs | 3 --- src/libsyntax_pos/lib.rs | 3 --- src/libterm/lib.rs | 3 --- src/libtest/lib.rs | 5 +++-- src/libunwind/lib.rs | 2 -- src/test/run-make/alloc-extern-crates/Makefile | 2 +- 49 files changed, 4 insertions(+), 130 deletions(-) diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 4e91be365e2..2d41ed64810 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -60,8 +60,6 @@ //! The [`heap`](heap/index.html) module defines the low-level interface to the //! default global allocator. It is not compatible with the libc allocator API. -#![crate_name = "alloc"] -#![crate_type = "rlib"] #![allow(unused_attributes)] #![unstable(feature = "alloc", reason = "this library is unlikely to be stabilized in its current \ diff --git a/src/liballoc_jemalloc/lib.rs b/src/liballoc_jemalloc/lib.rs index 3a9cc1dd5a6..513b299fcf3 100644 --- a/src/liballoc_jemalloc/lib.rs +++ b/src/liballoc_jemalloc/lib.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![crate_name = "alloc_jemalloc"] -#![crate_type = "rlib"] #![no_std] #![unstable(feature = "alloc_jemalloc", reason = "this library is unlikely to be stabilized in its current \ diff --git a/src/liballoc_system/lib.rs b/src/liballoc_system/lib.rs index 9a7cba21e3c..1defe308713 100644 --- a/src/liballoc_system/lib.rs +++ b/src/liballoc_system/lib.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![crate_name = "alloc_system"] -#![crate_type = "rlib"] #![no_std] #![deny(warnings)] #![unstable(feature = "alloc_system", diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index 8e3b3f2074d..96fcc81e8e6 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -18,9 +18,6 @@ //! This crate implements `TypedArena`, a simple arena that can only hold //! objects of a single type. -#![crate_name = "arena"] -#![crate_type = "rlib"] -#![crate_type = "dylib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/", diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index 38143593eb1..55316db3d5a 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![crate_name = "collections"] -#![crate_type = "rlib"] #![allow(unused_attributes)] #![unstable(feature = "collections", reason = "this library is unlikely to be stabilized in its current \ diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 546d2a21939..c270c6ae0db 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -51,9 +51,7 @@ // Since libcore defines many fundamental lang items, all tests live in a // separate crate, libcoretest, to avoid bizarre issues. -#![crate_name = "core"] #![stable(feature = "core", since = "1.6.0")] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/", diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index 43345c6d097..24430b2e377 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -14,9 +14,6 @@ //! Parsing does not happen at runtime: structures of `std::fmt::rt` are //! generated instead. -#![crate_name = "fmt_macros"] -#![crate_type = "rlib"] -#![crate_type = "dylib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/", diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index 83f2de54023..a0eacc817ca 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -77,9 +77,6 @@ //! } //! ``` -#![crate_name = "getopts"] -#![crate_type = "rlib"] -#![crate_type = "dylib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/", diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index 4ee0c3d92bd..5b1cf2dee9a 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -283,9 +283,6 @@ //! //! * [DOT language](http://www.graphviz.org/doc/info/lang.html) -#![crate_name = "graphviz"] -#![crate_type = "rlib"] -#![crate_type = "dylib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/", diff --git a/src/libpanic_abort/lib.rs b/src/libpanic_abort/lib.rs index 348180a48dc..8be6f647023 100644 --- a/src/libpanic_abort/lib.rs +++ b/src/libpanic_abort/lib.rs @@ -14,8 +14,6 @@ //! simpler! That being said, it's not quite as versatile, but here goes! #![no_std] -#![crate_name = "panic_abort"] -#![crate_type = "rlib"] #![unstable(feature = "panic_abort", issue = "32837")] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", diff --git a/src/libpanic_unwind/lib.rs b/src/libpanic_unwind/lib.rs index 90f4b364482..5a340f1323d 100644 --- a/src/libpanic_unwind/lib.rs +++ b/src/libpanic_unwind/lib.rs @@ -23,8 +23,6 @@ //! module. #![no_std] -#![crate_name = "panic_unwind"] -#![crate_type = "rlib"] #![unstable(feature = "panic_unwind", issue = "32837")] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", diff --git a/src/libproc_macro/lib.rs b/src/libproc_macro/lib.rs index 38665b403d6..3f425c24a91 100644 --- a/src/libproc_macro/lib.rs +++ b/src/libproc_macro/lib.rs @@ -23,10 +23,7 @@ //! //! See [the book](../book/first-edition/procedural-macros.html) for more. -#![crate_name = "proc_macro"] #![stable(feature = "proc_macro_lib", since = "1.15.0")] -#![crate_type = "rlib"] -#![crate_type = "dylib"] #![deny(warnings)] #![deny(missing_docs)] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", diff --git a/src/libprofiler_builtins/lib.rs b/src/libprofiler_builtins/lib.rs index 1fb2c6b7dbb..6d0d6d115b7 100644 --- a/src/libprofiler_builtins/lib.rs +++ b/src/libprofiler_builtins/lib.rs @@ -14,7 +14,5 @@ #![unstable(feature = "profiler_runtime_lib", reason = "internal implementation detail of rustc right now", issue = "0")] -#![crate_name = "profiler_builtins"] -#![crate_type = "rlib"] #![allow(unused_features)] #![feature(staged_api)] diff --git a/src/librand/lib.rs b/src/librand/lib.rs index a3c4f6a4b1d..90b3020fff9 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -16,8 +16,6 @@ //! is not recommended to use this library directly, but rather the official //! interface through `std::rand`. -#![crate_name = "rand"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/", diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 5b0760e561e..03dc2f3c1ac 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -14,9 +14,6 @@ //! //! This API is completely unstable and subject to change. -#![crate_name = "rustc"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] diff --git a/src/librustc_apfloat/lib.rs b/src/librustc_apfloat/lib.rs index d9dbf787856..d4a02065761 100644 --- a/src/librustc_apfloat/lib.rs +++ b/src/librustc_apfloat/lib.rs @@ -39,7 +39,6 @@ //! //! This API is completely unstable and subject to change. -#![crate_name = "rustc_apfloat"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] diff --git a/src/librustc_back/lib.rs b/src/librustc_back/lib.rs index 55b39f22670..6a9833d3784 100644 --- a/src/librustc_back/lib.rs +++ b/src/librustc_back/lib.rs @@ -21,9 +21,6 @@ //! one that doesn't; the one that doesn't might get decent parallel //! build speedups. -#![crate_name = "rustc_back"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] diff --git a/src/librustc_bitflags/lib.rs b/src/librustc_bitflags/lib.rs index 73125655792..eb47144d1f9 100644 --- a/src/librustc_bitflags/lib.rs +++ b/src/librustc_bitflags/lib.rs @@ -9,8 +9,6 @@ // except according to those terms. -#![crate_name = "rustc_bitflags"] -#![crate_type = "rlib"] #![no_std] #![deny(warnings)] diff --git a/src/librustc_borrowck/lib.rs b/src/librustc_borrowck/lib.rs index 7a77939faa3..e7f4f9caee3 100644 --- a/src/librustc_borrowck/lib.rs +++ b/src/librustc_borrowck/lib.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![crate_name = "rustc_borrowck"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] diff --git a/src/librustc_const_eval/lib.rs b/src/librustc_const_eval/lib.rs index 3483752d4ff..9fedee80d46 100644 --- a/src/librustc_const_eval/lib.rs +++ b/src/librustc_const_eval/lib.rs @@ -14,9 +14,6 @@ //! //! This API is completely unstable and subject to change. -#![crate_name = "rustc_const_eval"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] diff --git a/src/librustc_const_math/lib.rs b/src/librustc_const_math/lib.rs index 3947edecb5a..93b70ef8e4a 100644 --- a/src/librustc_const_math/lib.rs +++ b/src/librustc_const_math/lib.rs @@ -14,9 +14,6 @@ //! //! This API is completely unstable and subject to change. -#![crate_name = "rustc_const_math"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] diff --git a/src/librustc_data_structures/lib.rs b/src/librustc_data_structures/lib.rs index 54eed6dc92a..da00ebc4b9e 100644 --- a/src/librustc_data_structures/lib.rs +++ b/src/librustc_data_structures/lib.rs @@ -16,9 +16,6 @@ //! //! This API is completely unstable and subject to change. -#![crate_name = "rustc_data_structures"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://www.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index d7b5d4a6fe3..e56c989b843 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -14,9 +14,6 @@ //! //! This API is completely unstable and subject to change. -#![crate_name = "rustc_driver"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 12b5ccf4837..0ce999c9b62 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![crate_name = "rustc_errors"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] diff --git a/src/librustc_incremental/lib.rs b/src/librustc_incremental/lib.rs index c68153140d9..8870033095c 100644 --- a/src/librustc_incremental/lib.rs +++ b/src/librustc_incremental/lib.rs @@ -10,9 +10,6 @@ //! Support for serializing the dep-graph and reloading it. -#![crate_name = "rustc_incremental"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 755370b6465..5ef277f02ac 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -19,9 +19,6 @@ //! //! This API is completely unstable and subject to change. -#![crate_name = "rustc_lint"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index 5f12f561faf..3c3e627ee4b 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -13,9 +13,6 @@ #![allow(non_snake_case)] #![allow(dead_code)] -#![crate_name = "rustc_llvm"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs index 8fd87ae88a8..7d796dbd00f 100644 --- a/src/librustc_metadata/lib.rs +++ b/src/librustc_metadata/lib.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![crate_name = "rustc_metadata"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs index 7aa46799924..dba625e98fd 100644 --- a/src/librustc_mir/lib.rs +++ b/src/librustc_mir/lib.rs @@ -14,9 +14,6 @@ Rust MIR: a lowered representation of Rust. Also: an experiment! */ -#![crate_name = "rustc_mir"] -#![crate_type = "rlib"] -#![crate_type = "dylib"] #![deny(warnings)] #![feature(box_patterns)] diff --git a/src/librustc_passes/lib.rs b/src/librustc_passes/lib.rs index 6c41aad98d5..28b99e1185b 100644 --- a/src/librustc_passes/lib.rs +++ b/src/librustc_passes/lib.rs @@ -14,9 +14,6 @@ //! //! This API is completely unstable and subject to change. -#![crate_name = "rustc_passes"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] diff --git a/src/librustc_platform_intrinsics/lib.rs b/src/librustc_platform_intrinsics/lib.rs index ef1d9093df2..4cc65ee28e8 100644 --- a/src/librustc_platform_intrinsics/lib.rs +++ b/src/librustc_platform_intrinsics/lib.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![crate_name = "rustc_platform_intrinsics"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![deny(warnings)] #![allow(bad_style)] diff --git a/src/librustc_plugin/lib.rs b/src/librustc_plugin/lib.rs index 602b71dca05..a2a6d183e9c 100644 --- a/src/librustc_plugin/lib.rs +++ b/src/librustc_plugin/lib.rs @@ -60,9 +60,6 @@ //! See the [`plugin` feature](../../unstable-book/language-features/plugin.html) of //! the Unstable Book for more examples. -#![crate_name = "rustc_plugin"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index eb82dddaf56..772b16bbecf 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![crate_name = "rustc_privacy"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index bfc76ee2f74..ee349e31128 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![crate_name = "rustc_resolve"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index bc9d760d148..9b74df865d7 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![crate_name = "rustc_save_analysis"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index 6da42caf75b..1758e331129 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -14,9 +14,6 @@ //! //! This API is completely unstable and subject to change. -#![crate_name = "rustc_trans"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] diff --git a/src/librustc_trans_utils/lib.rs b/src/librustc_trans_utils/lib.rs index 81e83076f8c..90e17906328 100644 --- a/src/librustc_trans_utils/lib.rs +++ b/src/librustc_trans_utils/lib.rs @@ -12,9 +12,6 @@ //! //! This API is completely unstable and subject to change. -#![crate_name = "rustc_trans_utils"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 294429b5b36..86feea13b17 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -63,9 +63,6 @@ This API is completely unstable and subject to change. */ -#![crate_name = "rustc_typeck"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 1c3f296bed9..61a8165d26a 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![crate_name = "rustdoc"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/", diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs index c3107d1f190..2e354252c15 100644 --- a/src/libserialize/lib.rs +++ b/src/libserialize/lib.rs @@ -14,9 +14,6 @@ Core encoding and decoding interfaces. */ -#![crate_name = "serialize"] -#![crate_type = "rlib"] -#![crate_type = "dylib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/", diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 30495f29745..cf1eb5cd52e 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -209,10 +209,7 @@ //! [other]: #what-is-in-the-standard-library-documentation //! [primitive types]: ../book/first-edition/primitive-types.html -#![crate_name = "std"] #![stable(feature = "rust1", since = "1.0.0")] -#![crate_type = "rlib"] -#![crate_type = "dylib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/", diff --git a/src/libstd_unicode/lib.rs b/src/libstd_unicode/lib.rs index d568baa2cd7..e5a114caed0 100644 --- a/src/libstd_unicode/lib.rs +++ b/src/libstd_unicode/lib.rs @@ -20,9 +20,7 @@ //! provide for basic string-related manipulations. This crate does not //! (yet) aim to provide a full set of Unicode tables. -#![crate_name = "std_unicode"] #![unstable(feature = "unicode", issue = "27783")] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/", diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 43345b02bf6..e3c9f0a9345 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -14,9 +14,6 @@ //! //! This API is completely unstable and subject to change. -#![crate_name = "syntax"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/", diff --git a/src/libsyntax_ext/lib.rs b/src/libsyntax_ext/lib.rs index 439538a8b5e..fa39095d329 100644 --- a/src/libsyntax_ext/lib.rs +++ b/src/libsyntax_ext/lib.rs @@ -10,9 +10,6 @@ //! Syntax extensions in the Rust compiler. -#![crate_name = "syntax_ext"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index 2385e3509ad..d34dcfa3ed3 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -14,9 +14,6 @@ //! //! This API is completely unstable and subject to change. -#![crate_name = "syntax_pos"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index 4864e4581fa..ad0e582b1c3 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -40,9 +40,6 @@ //! [win]: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682010%28v=vs.85%29.aspx //! [ti]: https://en.wikipedia.org/wiki/Terminfo -#![crate_name = "term"] -#![crate_type = "rlib"] -#![crate_type = "dylib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/", diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 5e34688f8cb..652bfa82b5c 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -23,10 +23,11 @@ // running tests while providing a base that other test frameworks may // build off of. +// NB: this is also specified in this crate's Cargo.toml, but libsyntax contains logic specific to +// this crate, which relies on this attribute (rather than the value of `--crate-name` passed by +// cargo) to detect this crate. #![crate_name = "test"] #![unstable(feature = "test", issue = "27812")] -#![crate_type = "rlib"] -#![crate_type = "dylib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/", diff --git a/src/libunwind/lib.rs b/src/libunwind/lib.rs index 2f425d8e986..461b49aa363 100644 --- a/src/libunwind/lib.rs +++ b/src/libunwind/lib.rs @@ -9,8 +9,6 @@ // except according to those terms. #![no_std] -#![crate_name = "unwind"] -#![crate_type = "rlib"] #![unstable(feature = "panic_unwind", issue = "32837")] #![deny(warnings)] diff --git a/src/test/run-make/alloc-extern-crates/Makefile b/src/test/run-make/alloc-extern-crates/Makefile index b8c52378554..7197f4e17e3 100644 --- a/src/test/run-make/alloc-extern-crates/Makefile +++ b/src/test/run-make/alloc-extern-crates/Makefile @@ -2,4 +2,4 @@ all: $(RUSTC) fakealloc.rs - $(RUSTC) ../../../liballoc/lib.rs --cfg feature=\"external_crate\" --extern external=$(TMPDIR)/$(shell $(RUSTC) --print file-names fakealloc.rs) + $(RUSTC) --crate-type=rlib ../../../liballoc/lib.rs --cfg feature=\"external_crate\" --extern external=$(TMPDIR)/$(shell $(RUSTC) --print file-names fakealloc.rs) From 0a6c724ddedf10e60b6fff76a9347cabf1807c04 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 25 Aug 2017 23:09:00 +0200 Subject: [PATCH 29/50] Add missing link in string doc --- src/liballoc/string.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index 96bd6273c94..b1919c7c968 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -82,7 +82,7 @@ use boxed::Box; /// /// # Examples /// -/// You can create a `String` from a literal string with `String::from`: +/// You can create a `String` from a literal string with [`String::from`]: /// /// ``` /// let hello = String::from("Hello, world!"); @@ -98,6 +98,7 @@ use boxed::Box; /// hello.push_str("orld!"); /// ``` /// +/// [`String::from`]: #method.from /// [`char`]: ../../std/primitive.char.html /// [`push`]: #method.push /// [`push_str`]: #method.push_str From 6ca124bc9e6756d0f7ea2c7790251aaf531f75e4 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 25 Aug 2017 17:12:20 -0500 Subject: [PATCH 30/50] haiku/librustc_back: Remove incorrect no_integrated_as * Makes rust bootstrap incorrectly search for xxx.s vs xxx.0.s * Not needed or incorrect fix for another issue. --- src/librustc_back/target/haiku_base.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/librustc_back/target/haiku_base.rs b/src/librustc_back/target/haiku_base.rs index 21410dcd412..112f424f7a8 100644 --- a/src/librustc_back/target/haiku_base.rs +++ b/src/librustc_back/target/haiku_base.rs @@ -20,7 +20,6 @@ pub fn opts() -> TargetOptions { target_family: Some("unix".to_string()), relro_level: RelroLevel::Full, linker_is_gnu: true, - no_integrated_as: true, .. Default::default() } } From 64b0b2bfebf857f25f826ca9ebb07630287bc4d0 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 23 Aug 2017 12:52:22 -0700 Subject: [PATCH 31/50] rustc_errors: Add the ability to delay as bugs This adds a function to `DiagnosticBuilder` to delay the entire diagnostic as a bug to be emitted at a later time. This'll end up getting used in the compiler in the subsequent commits... --- src/librustc_errors/diagnostic_builder.rs | 22 ++++++++++++++++++++-- src/librustc_errors/lib.rs | 16 ++++++---------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs index 0a811989350..2c8d8b4691f 100644 --- a/src/librustc_errors/diagnostic_builder.rs +++ b/src/librustc_errors/diagnostic_builder.rs @@ -110,6 +110,22 @@ impl<'a> DiagnosticBuilder<'a> { // } } + /// Delay emission of this diagnostic as a bug. + /// + /// This can be useful in contexts where an error indicates a bug but + /// typically this only happens when other compilation errors have already + /// happened. In those cases this can be used to defer emission of this + /// diagnostic as a bug in the compiler only if no other errors have been + /// emitted. + /// + /// In the meantime, though, callsites are required to deal with the "bug" + /// locally in whichever way makes the most sense. + pub fn delay_as_bug(&mut self) { + self.level = Level::Bug; + *self.handler.delayed_span_bug.borrow_mut() = Some(self.diagnostic.clone()); + self.cancel(); + } + /// Add a span/label to be included in the resulting snippet. /// This is pushed onto the `MultiSpan` that was created when the /// diagnostic was first built. If you don't call this function at @@ -182,8 +198,10 @@ impl<'a> DiagnosticBuilder<'a> { DiagnosticBuilder::new_diagnostic(handler, diagnostic) } - /// Creates a new `DiagnosticBuilder` with an already constructed diagnostic. - pub fn new_diagnostic(handler: &'a Handler, diagnostic: Diagnostic) -> DiagnosticBuilder<'a> { + /// Creates a new `DiagnosticBuilder` with an already constructed + /// diagnostic. + pub fn new_diagnostic(handler: &'a Handler, diagnostic: Diagnostic) + -> DiagnosticBuilder<'a> { DiagnosticBuilder { handler, diagnostic } } } diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index a51e6022350..60f9276c0ca 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -275,7 +275,7 @@ pub struct Handler { pub can_emit_warnings: bool, treat_err_as_bug: bool, continue_after_error: Cell, - delayed_span_bug: RefCell>, + delayed_span_bug: RefCell>, tracked_diagnostics: RefCell>>, } @@ -442,8 +442,9 @@ impl Handler { if self.treat_err_as_bug { self.span_bug(sp, msg); } - let mut delayed = self.delayed_span_bug.borrow_mut(); - *delayed = Some((sp.into(), msg.to_string())); + let mut diagnostic = Diagnostic::new(Level::Bug, msg); + diagnostic.set_span(sp.into()); + *self.delayed_span_bug.borrow_mut() = Some(diagnostic); } pub fn span_bug_no_panic>(&self, sp: S, msg: &str) { self.emit(&sp.into(), msg, Bug); @@ -510,14 +511,9 @@ impl Handler { let s; match self.err_count.get() { 0 => { - let delayed_bug = self.delayed_span_bug.borrow(); - match *delayed_bug { - Some((ref span, ref errmsg)) => { - self.span_bug(span.clone(), errmsg); - } - _ => {} + if let Some(bug) = self.delayed_span_bug.borrow_mut().take() { + DiagnosticBuilder::new_diagnostic(self, bug).emit(); } - return; } 1 => s = "aborting due to previous error".to_string(), From 97f2c37435b76c59ff60164b30a02f09641f798f Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 23 Aug 2017 12:53:29 -0700 Subject: [PATCH 32/50] rustc: Change the return of a query's `try_get` This alters the return value of the `try_get` function so the error contains a diagnostic rather than a `CycleError`. This way consumers are forced to take *some* action (else they get a bug to an un-emitted diagnostic). This action could be to emit the error itself, or in some cases delay the diagnostic as a bug and continue. --- src/librustc/ty/maps.rs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/librustc/ty/maps.rs b/src/librustc/ty/maps.rs index f1c624a94e3..18202c96cf5 100644 --- a/src/librustc/ty/maps.rs +++ b/src/librustc/ty/maps.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use errors::DiagnosticBuilder; use dep_graph::{DepConstructor, DepNode, DepNodeIndex}; use errors::{Diagnostic, DiagnosticBuilder}; use hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; @@ -218,7 +219,9 @@ pub struct CycleError<'a, 'tcx: 'a> { } impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { - pub fn report_cycle(self, CycleError { span, cycle }: CycleError) { + pub fn report_cycle(self, CycleError { span, cycle }: CycleError) + -> DiagnosticBuilder<'a> + { // Subtle: release the refcell lock before invoking `describe()` // below by dropping `cycle`. let stack = cycle.to_vec(); @@ -247,8 +250,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { err.note(&format!("...which then again requires {}, completing the cycle.", stack[0].1.describe(self))); - err.emit(); - }); + return err + }) } fn cycle_check(self, span: Span, query: Query<'gcx>, compute: F) @@ -704,8 +707,11 @@ macro_rules! define_maps { } pub fn try_get(tcx: TyCtxt<'a, $tcx, 'lcx>, span: Span, key: $K) - -> Result<$V, CycleError<'a, $tcx>> { - Self::try_get_with(tcx, span, key, Clone::clone) + -> Result<$V, DiagnosticBuilder<'a>> { + match Self::try_get_with(tcx, span, key, Clone::clone) { + Ok(e) => Ok(e), + Err(e) => Err(tcx.report_cycle(e)), + } } pub fn force(tcx: TyCtxt<'a, $tcx, 'lcx>, span: Span, key: $K) { @@ -714,7 +720,7 @@ macro_rules! define_maps { match Self::try_get_with(tcx, span, key, |_| ()) { Ok(()) => {} - Err(e) => tcx.report_cycle(e) + Err(e) => tcx.report_cycle(e).emit(), } } })* @@ -751,8 +757,8 @@ macro_rules! define_maps { impl<'a, $tcx, 'lcx> TyCtxtAt<'a, $tcx, 'lcx> { $($(#[$attr])* pub fn $name(self, key: $K) -> $V { - queries::$name::try_get(self.tcx, self.span, key).unwrap_or_else(|e| { - self.report_cycle(e); + queries::$name::try_get(self.tcx, self.span, key).unwrap_or_else(|mut e| { + e.emit(); Value::from_cycle_error(self.global_tcx()) }) })* From ecb29c11bbcfac40218b6b35e9ccf26b4a7db151 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 23 Aug 2017 12:54:36 -0700 Subject: [PATCH 33/50] rustc: Fix two instances of `try_get` The `sized_constraint` and `needs_drop_raw` queries both use `try_get` to detect cycles, but in both of these cases the cycle indicates an error has happened elsewhere in compilation. In these cases we can just delay the diagnostic to get emitted as a bug later if we ended up forgetting to emit the error diagnostic. --- src/librustc/ty/mod.rs | 7 +++++-- src/librustc/ty/util.rs | 10 +++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index f9bbcc1bbe0..852bd48a5ee 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -1684,12 +1684,15 @@ impl<'a, 'gcx, 'tcx> AdtDef { pub fn sized_constraint(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> &'tcx [Ty<'tcx>] { match queries::adt_sized_constraint::try_get(tcx, DUMMY_SP, self.did) { Ok(tys) => tys, - Err(_) => { + Err(mut bug) => { debug!("adt_sized_constraint: {:?} is recursive", self); // This should be reported as an error by `check_representable`. // // Consider the type as Sized in the meanwhile to avoid - // further errors. + // further errors. Delay our `bug` diagnostic here to get + // emitted later as well in case we accidentally otherwise don't + // emit an error. + bug.delay_as_bug(); tcx.intern_type_list(&[tcx.types.err]) } } diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index 9cd6aa21118..bbbb8611f98 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -1069,11 +1069,15 @@ fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let needs_drop = |ty: Ty<'tcx>| -> bool { match ty::queries::needs_drop_raw::try_get(tcx, DUMMY_SP, param_env.and(ty)) { Ok(v) => v, - Err(_) => { + Err(mut bug) => { // Cycles should be reported as an error by `check_representable`. // - // Consider the type as not needing drop in the meanwhile to avoid - // further errors. + // Consider the type as not needing drop in the meanwhile to + // avoid further errors. + // + // In case we forgot to emit a bug elsewhere, delay our + // diagnostic to get emitted as a compiler bug. + bug.delay_as_bug(); false } } From 82bad957c0314bb841757d8260f0f7f8f5050c57 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 24 Aug 2017 07:00:44 -0700 Subject: [PATCH 34/50] rustc: Add a FIXME for `try_get` in MIR inlining It sounds like this is being handled elsewhere, so for now just preserve the existing behavior of ignoring th error. --- src/librustc_mir/transform/inline.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index 28aedc8d674..53b46dd2683 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -115,8 +115,13 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { Ok(ref callee_mir) if self.should_inline(callsite, callee_mir) => { callee_mir.subst(self.tcx, callsite.substs) } + Ok(_) => continue, - _ => continue, + Err(mut bug) => { + // FIXME(#43542) shouldn't have to cancel an error + bug.cancel(); + continue + } }; let start = caller_mir.basic_blocks().len(); From c77213d0cc4c536af70d2ca232ec481394fac808 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 24 Aug 2017 07:37:09 -0700 Subject: [PATCH 35/50] rustc: Skip cyclic checks in `item_path` This seems like it may be likely to cause bugs with `RUST_LOG` and other "interesting" scenarios, but it removes the usage of `try_get` for now! --- src/librustc/ty/item_path.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/librustc/ty/item_path.rs b/src/librustc/ty/item_path.rs index 76a20ed8f30..5caf5139812 100644 --- a/src/librustc/ty/item_path.rs +++ b/src/librustc/ty/item_path.rs @@ -13,7 +13,6 @@ use hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use ty::{self, Ty, TyCtxt}; use syntax::ast; use syntax::symbol::Symbol; -use syntax_pos::DUMMY_SP; use std::cell::Cell; @@ -222,11 +221,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { let use_types = !self.is_default_impl(impl_def_id) && (!impl_def_id.is_local() || { // Otherwise, use filename/line-number if forced. let force_no_types = FORCE_IMPL_FILENAME_LINE.with(|f| f.get()); - !force_no_types && { - // Otherwise, use types if we can query them without inducing a cycle. - ty::queries::impl_trait_ref::try_get(self, DUMMY_SP, impl_def_id).is_ok() && - ty::queries::type_of::try_get(self, DUMMY_SP, impl_def_id).is_ok() - } + !force_no_types }); if !use_types { From c766aa4e3b90c17ed6ded91e964c3537ba5eb14b Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 24 Aug 2017 15:13:55 -0700 Subject: [PATCH 36/50] rustc: Make `report_cycle` and `CycleError` private --- src/librustc/ty/maps.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/librustc/ty/maps.rs b/src/librustc/ty/maps.rs index 18202c96cf5..042ec49b0bd 100644 --- a/src/librustc/ty/maps.rs +++ b/src/librustc/ty/maps.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use errors::DiagnosticBuilder; use dep_graph::{DepConstructor, DepNode, DepNodeIndex}; use errors::{Diagnostic, DiagnosticBuilder}; use hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; @@ -213,13 +212,13 @@ impl QueryMap { } } -pub struct CycleError<'a, 'tcx: 'a> { +struct CycleError<'a, 'tcx: 'a> { span: Span, cycle: RefMut<'a, [(Span, Query<'tcx>)]>, } impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { - pub fn report_cycle(self, CycleError { span, cycle }: CycleError) + fn report_cycle(self, CycleError { span, cycle }: CycleError) -> DiagnosticBuilder<'a> { // Subtle: release the refcell lock before invoking `describe()` From 7cb3f45063a42d4a457801ecc0800b19b1cfa178 Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Thu, 24 Aug 2017 17:52:28 +1200 Subject: [PATCH 37/50] Update RLS and Cargo --- src/Cargo.lock | 230 ++++++++++++++++++++++++++++-------------------- src/Cargo.toml | 5 ++ src/tools/cargo | 2 +- src/tools/rls | 2 +- 4 files changed, 142 insertions(+), 97 deletions(-) diff --git a/src/Cargo.lock b/src/Cargo.lock index b5db5ce3613..e9b648e3428 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -94,7 +94,7 @@ dependencies = [ "dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -142,10 +142,10 @@ dependencies = [ "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -161,9 +161,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "build-manifest" version = "0.1.0" dependencies = [ - "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -176,7 +176,7 @@ dependencies = [ [[package]] name = "cargo" version = "0.22.0" -source = "git+https://github.com/rust-lang/cargo#88aa6423a164774d09abc78a24e74e8e665f651b" +source = "git+https://github.com/rust-lang/cargo#bcf3997b1fa177afc5b6c632a6fbbf6cc75df427" replace = "cargo 0.22.0" [[package]] @@ -187,6 +187,7 @@ dependencies = [ "atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "bufstream 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "cargotest 0.1.0", + "core-foundation 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "crates-io 0.11.0", "crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "curl 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -210,19 +211,20 @@ dependencies = [ "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.9.17 (registry+https://github.com/rust-lang/crates.io-index)", "psapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "same-file 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_ignored 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "shell-escape 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "tar 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -241,7 +243,7 @@ dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "tar 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -260,7 +262,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "clap" -version = "2.25.1" +version = "2.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -268,8 +270,8 @@ dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "term_size 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-segmentation 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-segmentation 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -323,14 +325,31 @@ dependencies = [ "rand 0.0.0", ] +[[package]] +name = "core-foundation" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation-sys 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation-sys" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "crates-io" version = "0.11.0" dependencies = [ "curl 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.11.0-rc.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -348,8 +367,8 @@ dependencies = [ "curl-sys 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-probe 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", - "socket2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.17 (registry+https://github.com/rust-lang/crates.io-index)", + "socket2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -361,7 +380,7 @@ dependencies = [ "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.17 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -397,8 +416,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -472,6 +491,10 @@ version = "0.1.0" name = "find_all_refs_no_cfg_test" version = "0.1.0" +[[package]] +name = "find_impls" +version = "0.1.0" + [[package]] name = "flate2" version = "0.2.19" @@ -529,7 +552,7 @@ dependencies = [ "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "libgit2-sys 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-probe 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.17 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -588,7 +611,7 @@ dependencies = [ "pest 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "quick-error 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -642,11 +665,23 @@ dependencies = [ "walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "infer_bin" +version = "0.1.0" + +[[package]] +name = "infer_custom_bin" +version = "0.1.0" + +[[package]] +name = "infer_lib" +version = "0.1.0" + [[package]] name = "installer" version = "0.0.0" dependencies = [ - "clap 2.25.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.26.0 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -673,13 +708,13 @@ dependencies = [ [[package]] name = "jsonrpc-core" -version = "7.0.1" +version = "7.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -698,8 +733,8 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "url_serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -733,7 +768,7 @@ dependencies = [ "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "libssh2-sys 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.17 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -745,7 +780,7 @@ dependencies = [ "cmake 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.17 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -771,7 +806,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lzma-sys" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -789,16 +824,16 @@ name = "mdbook" version = "0.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "clap 2.25.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.26.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "handlebars 0.26.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "open 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "pulldown-cmark 0.0.14 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -832,7 +867,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "net2 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -843,7 +878,7 @@ version = "0.1.0" [[package]] name = "net2" -version = "0.2.30" +version = "0.2.31" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -859,7 +894,7 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-bigint 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "num-complex 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", + "num-complex 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", "num-rational 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", @@ -879,7 +914,7 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.1.39" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", @@ -927,6 +962,10 @@ dependencies = [ "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "omit_init_build" +version = "0.1.0" + [[package]] name = "open" version = "1.2.0" @@ -934,14 +973,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "openssl" -version = "0.9.15" +version = "0.9.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.17 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -951,12 +990,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "openssl-sys" -version = "0.9.15" +version = "0.9.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1051,14 +1091,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "racer" -version = "2.0.9" +version = "2.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "clap 2.25.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.26.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "syntex_errors 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)", "syntex_syntax 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1140,20 +1178,20 @@ version = "0.1.0" dependencies = [ "cargo 0.22.0 (git+https://github.com/rust-lang/cargo)", "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 7.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core 7.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "languageserver-types 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "racer 2.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "racer 2.0.10 (registry+https://github.com/rust-lang/crates.io-index)", "rls-analysis 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rls-data 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rls-vfs 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustfmt-nightly 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rustfmt-nightly 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "url_serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1177,8 +1215,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1187,8 +1225,8 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1196,7 +1234,7 @@ name = "rls-vfs" version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "racer 2.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "racer 2.0.10 (registry+https://github.com/rust-lang/crates.io-index)", "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1204,7 +1242,7 @@ dependencies = [ name = "rustbook" version = "0.1.0" dependencies = [ - "clap 2.25.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.26.0 (registry+https://github.com/rust-lang/crates.io-index)", "mdbook 0.0.22 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1231,7 +1269,7 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1544,7 +1582,7 @@ dependencies = [ "num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", - "rustc-demangle 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_allocator 0.0.0", "rustc_back 0.0.0", "rustc_bitflags 0.0.0", @@ -1616,7 +1654,7 @@ dependencies = [ [[package]] name = "rustfmt-nightly" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "diff 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1626,13 +1664,13 @@ dependencies = [ "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "strings 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-segmentation 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-segmentation 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1661,7 +1699,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1671,12 +1709,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde_derive" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1698,7 +1736,7 @@ name = "serde_ignored" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1709,7 +1747,7 @@ dependencies = [ "dtoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1723,7 +1761,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "socket2" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1937,7 +1975,7 @@ dependencies = [ [[package]] name = "textwrap" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "term_size 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1984,10 +2022,10 @@ dependencies = [ [[package]] name = "toml" -version = "0.4.2" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2010,7 +2048,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "unicode-segmentation" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2058,7 +2096,7 @@ name = "url_serde" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2147,7 +2185,7 @@ name = "xz2" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lzma-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "lzma-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2170,8 +2208,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum bufstream 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f2f382711e76b9de6c744cc00d0497baba02fb00a787f088c879f01d09468e32" "checksum cargo 0.22.0 (git+https://github.com/rust-lang/cargo)" = "" "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" -"checksum clap 2.25.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7f1aabf260a8f3fefa8871f16b531038c98dd9eab1cfa2c575e78c459abfa3a0" +"checksum clap 2.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2267a8fdd4dce6956ba6649e130f62fb279026e5e84b92aa939ac8f85ce3f9f0" "checksum cmake 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "b8ebbb35d3dc9cd09497168f33de1acb79b265d350ab0ac34133b98f8509af1f" +"checksum core-foundation 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5909502e547762013619f4c4e01cc7393c20fe2d52d7fa471c1210adb2320dc7" +"checksum core-foundation-sys 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bc9fb3d6cb663e6fd7cf1c63f9b144ee2b1e4a78595a0451dd34bff85b9a3387" "checksum crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0c5ea215664ca264da8a9d9c3be80d2eaf30923c259d03e870388eb927508f97" "checksum curl 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7034c534a1d7d22f7971d6088aa9d281d219ef724026c3428092500f41ae9c2c" "checksum curl-sys 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d5481162dc4f424d088581db2f979fa7d4c238fe9794595de61d8d7522e277de" @@ -2205,7 +2245,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum ignore 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b3fcaf2365eb14b28ec7603c98c06cc531f19de9eb283d89a3dff8417c8c99f5" "checksum itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eb2f404fbc66fd9aac13e998248505e7ecb2ad8e44ab6388684c5fb11c6c251c" "checksum jobserver 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "443ae8bc0af6c106e6e8b77e04684faecc1a5ce94e058f4c2b0a037b0ea1b133" -"checksum jsonrpc-core 7.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "da622868a84d3f4fd897f6408ba6714aabf663302802358564b384157c1a5bfa" +"checksum jsonrpc-core 7.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "903e5eee845f3d83c1436d12848d97b1247cf850ff06a8e1db2f1ce3543af2cf" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum languageserver-types 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d52e477b23bf52cd3ca0f9fc6c5d14be954eec97e3b9cdfbd962d911bd533caf" "checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf" @@ -2214,26 +2254,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum libssh2-sys 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0db4ec23611747ef772db1c4d650f8bd762f07b461727ec998f953c614024b75" "checksum libz-sys 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)" = "3fdd64ef8ee652185674455c1d450b83cbc8ad895625d543b5324d923f82e4d8" "checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b" -"checksum lzma-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "013fa6506eb7d26040c46dab9ecb7ccb4e2896b5bf24a9d65932501ea9f67af8" +"checksum lzma-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "66b2e318eb97ab84f05725471f90c52a09c964053a5899a13fd0165acc26d00b" "checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376" "checksum mdbook 0.0.22 (registry+https://github.com/rust-lang/crates.io-index)" = "22911d86cde6f80fa9f0fb2a68bbbde85d97af4fe0ce267141c83a4187d28700" "checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20" "checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4" "checksum miniz-sys 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "28eaee17666671fa872e567547e8428e83308ebe5808cdf6a0e28397dbe2c726" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" -"checksum net2 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)" = "94101fd932816f97eb9a5116f6c1a11511a1fed7db21c5ccd823b2dc11abf566" +"checksum net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)" = "3a80f842784ef6c9a958b68b7516bc7e35883c614004dd94959a4dca1b716c09" "checksum num 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "a311b77ebdc5dd4cf6449d81e4135d9f0e3b153839ac90e648a8ef538f923525" "checksum num-bigint 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "8fd0f8dbb4c0960998958a796281d88c16fbe68d87b1baa6f31e2979e81fd0bd" -"checksum num-complex 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "eb24db7f1904e67a5dfe5f7f62b82f5c963e0f777b23f98cde9c5094fc4fa179" +"checksum num-complex 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "503e668405c5492d67cf662a81e05be40efe2e6bcf10f7794a07bd9865e704e6" "checksum num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "d1452e8b06e448a07f0e6ebb0bb1d92b8890eea63288c0b627331d53514d0fba" "checksum num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)" = "7485fcc84f85b4ecd0ea527b14189281cf27d60e583ae65ebc9c088b13dffe01" "checksum num-rational 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "288629c76fac4b33556f4b7ab57ba21ae202da65ba8b77466e6d598e31990790" "checksum num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "99843c856d68d8b4313b03a17e33c4bb42ae8f6610ea81b28abe076ac721b9b0" "checksum num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aec53c34f2d0247c5ca5d32cca1478762f301740468ee9ee6dcb7a0dd7a0c584" "checksum open 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3478ed1686bd1300c8a981a940abc92b06fac9cbef747f4c668d4e032ff7b842" -"checksum openssl 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f776f1d8af832fd2c637ee182c801e8f7ea8895718a2be9914cca001f6e2c40a" +"checksum openssl 0.9.17 (registry+https://github.com/rust-lang/crates.io-index)" = "085aaedcc89a2fac1eb2bc19cd66f29d4ea99fec60f82a5f3a88a6be7dbd90b5" "checksum openssl-probe 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d98df0270d404ccd3c050a41d579c52d1db15375168bb3471e04ec0f5f378daf" -"checksum openssl-sys 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)" = "ad95f8160d1c150c4f44d4c4959732e048ac046c37f597fe362f8bf57561ffb4" +"checksum openssl-sys 0.9.17 (registry+https://github.com/rust-lang/crates.io-index)" = "7e3a9845a4c9fdb321931868aae5549e96bb7b979bf9af7de03603d74691b5f3" "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" "checksum percent-encoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de154f638187706bde41d9b4738748933d64e6b37bdbffc0b47a97d16a6ae356" "checksum pest 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0a6dda33d67c26f0aac90d324ab2eb7239c819fc7b2552fe9faa4fe88441edc8" @@ -2243,7 +2283,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum quick-error 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c36987d4978eb1be2e422b1e0423a557923a5c3e7e6f31d5699e9aafaefa469" "checksum quote 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4c5cf478fe1006dbcc72567121d23dbdae5f1632386068c5c86ff4f645628504" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" -"checksum racer 2.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9079a128fdb6f0c8850010e1478b215d4c00134654bf995bfda41824951ce9bd" +"checksum racer 2.0.10 (registry+https://github.com/rust-lang/crates.io-index)" = "f120c7510ef7aff254aeb06067fb6fac573ec96a1660e194787cf9dced412bf0" "checksum rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "022e0636ec2519ddae48154b028864bdce4eaf7d35226ab8e65c611be97b189d" "checksum regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f" "checksum regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1731164734096285ec2a5ec7fea5248ae2f5485b3feeb0115af4fda2183b2d1b" @@ -2253,21 +2293,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rls-data 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "11d339f1888e33e74d8032de0f83c40b2bdaaaf04a8cfc03b32186c3481fb534" "checksum rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d7c7046dc6a92f2ae02ed302746db4382e75131b9ce20ce967259f6b5867a6a" "checksum rls-vfs 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ffd34691a510938bb67fe0444fb363103c73ffb31c121d1e16bc92d8945ea8ff" -"checksum rustc-demangle 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3058a43ada2c2d0b92b3ae38007a2d0fa5e9db971be260e0171408a4ff471c95" +"checksum rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "aee45432acc62f7b9a108cc054142dac51f979e69e71ddce7d6fc7adf29e817e" "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" -"checksum rustfmt-nightly 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa1ffc66e1e1786355f22e8a958a57bd67fbf9564f522f87f31de9586715f8f6" +"checksum rustfmt-nightly 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6eea0d0590ae793fc4d281df56e01dc7531575c8ed9a72fadf5fdc7305a0d32f" "checksum same-file 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d931a44fdaa43b8637009e7632a02adc4f2b2e0733c08caa4cf00e8da4a117a7" "checksum scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f417c22df063e9450888a7561788e9bd46d3bb3c1466435b4eccb903807f147d" "checksum scopeguard 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "59a076157c1e2dc561d8de585151ee6965d910dd4dcb5dabb7ae3e83981a6c57" "checksum semver 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3fdd61b85a0fa777f7fb7c454b9189b2941b110d1385ce84d7f76efdf1606a85" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)" = "433d7d9f8530d5a939ad5e0e72a6243d2e42a24804f70bf592c679363dcacb2f" -"checksum serde_derive 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)" = "7b707cf0d4cab852084f573058def08879bb467fda89d99052485e7d00edd624" +"checksum serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "f7726f29ddf9731b17ff113c461e362c381d9d69433f79de4f3dd572488823e9" +"checksum serde_derive 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cf823e706be268e73e7747b147aa31c8f633ab4ba31f115efb57e5047c3a76dd" "checksum serde_derive_internals 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)" = "37aee4e0da52d801acfbc0cc219eb1eda7142112339726e427926a6f6ee65d3a" "checksum serde_ignored 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c10e798e4405d7dcec3658989e35ee6706f730a9ed7c1184d5ebd84317e82f46" "checksum serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "48b04779552e92037212c3615370f6bd57a40ebba7f20e554ff9f55e41a69a7b" "checksum shell-escape 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "dd5cc96481d54583947bfe88bf30c23d53f883c6cd0145368b69989d97b84ef8" -"checksum socket2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "12cdbddbaa27bf94cc194b8e37f5811db6fe83cea96cf99cf1f8e92b65a41371" +"checksum socket2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4daf80fcf54186fac4fe049e0b39d36a5cfde69a11a06413e61e77f553cccf9a" "checksum stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "15132e0e364248108c5e2c02e3ab539be8d6f5d52a01ca9bbf27ed657316f02b" "checksum strings 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "da75d8bf2c4d210d63dd09581a041b036001f9f6e03d9b151dbff810fb7ba26a" "checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694" @@ -2282,16 +2322,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" "checksum term_size 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2b6b55df3198cc93372e85dd2ed817f0e38ce8cc0f22eb32391bfad9c4bf209" "checksum termcolor 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9a5193a56b8d82014662c4b933dea6bec851daf018a2b01722e007daaf5f9dca" -"checksum textwrap 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f86300c3e7416ee233abd7cda890c492007a3980f941f79185c753a701257167" +"checksum textwrap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f728584ea33b0ad19318e20557cb0a39097751dbb07171419673502f848c7af6" "checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03" "checksum thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5" "checksum thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14" "checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4" -"checksum toml 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b0601da6c97135c8d330c7a13a013ca6cd4143221b01de2f8d4edc50a9e551c7" +"checksum toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a7540f4ffc193e0d3c94121edb19b055670d369f77d5804db11ae053a45b6e7e" "checksum typed-arena 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5934776c3ac1bea4a9d56620d6bf2d483b20d394e49581db40f187e1118ff667" "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" "checksum unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "51ccda9ef9efa3f7ef5d91e8f9b83bbe6955f9bf86aec89d5cce2c874625920f" -"checksum unicode-segmentation 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18127285758f0e2c6cf325bb3f3d138a12fee27de4f23e146cd6a179f26c2cf3" +"checksum unicode-segmentation 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8083c594e02b8ae1654ae26f0ade5158b119bd88ad0e8227a5d8fcd72407946" "checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f" "checksum unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "36dff09cafb4ec7c8cf0023eb0b686cb6ce65499116a12201c9e11840ca01beb" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" diff --git a/src/Cargo.toml b/src/Cargo.toml index 4b84272df98..ffec3eb0755 100644 --- a/src/Cargo.toml +++ b/src/Cargo.toml @@ -32,6 +32,11 @@ members = [ "tools/rls/test_data/multiple_bins", "tools/rls/test_data/bin_lib", "tools/rls/test_data/reformat_with_range", + "tools/rls/test_data/find_impls", + "tools/rls/test_data/infer_bin", + "tools/rls/test_data/infer_custom_bin", + "tools/rls/test_data/infer_lib", + "tools/rls/test_data/omit_init_build", ] # Curiously, compiletest will segfault if compiled with opt-level=3 on 64-bit diff --git a/src/tools/cargo b/src/tools/cargo index 7704f7b1fd5..bcf3997b1fa 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit 7704f7b1fd52607104cc7fdc435d636c9de1fe90 +Subproject commit bcf3997b1fa177afc5b6c632a6fbbf6cc75df427 diff --git a/src/tools/rls b/src/tools/rls index 5d4bbd9052f..25ffb3a3d78 160000 --- a/src/tools/rls +++ b/src/tools/rls @@ -1 +1 @@ -Subproject commit 5d4bbd9052fe2af849a7d017b85df98ad002c20f +Subproject commit 25ffb3a3d7809b4fa112f3e04e926eb539dd5e90 From 911a15d5a82cd3a48d7bc6ca3eb906d46e45eb35 Mon Sep 17 00:00:00 2001 From: "Evgeniy A. Dushistov" Date: Sat, 26 Aug 2017 08:24:26 +0300 Subject: [PATCH 38/50] Add test for wrong code generation for HashSet creation on arm cpu This is test for #42918. To reproduce bug you need machine with arm cpu and compile with optimization. I tried with rustc 1.19.0-nightly (3d5b8c626 2017-06-09), if compile test with -C opt-level=3 for target=arm-linux-androideabi and run on "Qualcomm MSM 8974 arm cpu" then assert fails, if compile and run with -C opt-level=2 it gives segmentation fault. So I add `compile-flags: -O`. With rustc 1.19.0 (0ade33941 2017-07-17) all works fine. Closes #42918 --- .../run-pass/wrong-hashset-issue-42918.rs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/test/run-pass/wrong-hashset-issue-42918.rs diff --git a/src/test/run-pass/wrong-hashset-issue-42918.rs b/src/test/run-pass/wrong-hashset-issue-42918.rs new file mode 100644 index 00000000000..5a23adeceb5 --- /dev/null +++ b/src/test/run-pass/wrong-hashset-issue-42918.rs @@ -0,0 +1,38 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// +// compile-flags: -O + +use std::collections::HashSet; + +#[derive(PartialEq, Debug, Hash, Eq, Clone, PartialOrd, Ord)] +enum MyEnum { + E0, + + E1, + + E2, + E3, + E4, + + E5, + E6, + E7, +} + + +fn main() { + use MyEnum::*; + let s: HashSet<_> = [E4, E1].iter().cloned().collect(); + let mut v: Vec<_> = s.into_iter().collect(); + v.sort(); + + assert_eq!([E1, E4], &v[..]); +} From a947c6a595ea243754235913f7ae0f2bf454d903 Mon Sep 17 00:00:00 2001 From: Mark Simulacrum Date: Sat, 26 Aug 2017 12:26:19 -0600 Subject: [PATCH 39/50] Update cargo --- src/Cargo.lock | 6 ------ src/tools/cargo | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/Cargo.lock b/src/Cargo.lock index e9b648e3428..ad96ff40cd6 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -233,22 +233,16 @@ dependencies = [ name = "cargotest" version = "0.1.0" dependencies = [ - "bufstream 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "cargo 0.22.0", "filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", "git2 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "hamcrest 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "tar 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", - "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] diff --git a/src/tools/cargo b/src/tools/cargo index bcf3997b1fa..7847f75bb6f 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit bcf3997b1fa177afc5b6c632a6fbbf6cc75df427 +Subproject commit 7847f75bb6fc4fee6f511ca740bbe6872c08502b From ffe64a26abb194a7ddcc5f410512043a65b3eb91 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 26 Aug 2017 18:34:13 -0700 Subject: [PATCH 40/50] ci: Remove the need for `dumb-init` Newer versions of Docker have a `--init` argument which spawns an init process in the container, which we should be able to use everywhere now. --- src/ci/docker/arm-android/Dockerfile | 5 +---- src/ci/docker/armhf-gnu/Dockerfile | 5 ----- src/ci/docker/asmjs/Dockerfile | 5 ----- src/ci/docker/cross/Dockerfile | 5 ----- src/ci/docker/disabled/aarch64-gnu/Dockerfile | 5 ----- .../disabled/dist-aarch64-android/Dockerfile | 5 ----- .../docker/disabled/dist-armv7-android/Dockerfile | 5 ----- .../docker/disabled/dist-i686-android/Dockerfile | 5 ----- .../disabled/dist-x86_64-android/Dockerfile | 5 ----- .../docker/disabled/dist-x86_64-redox/Dockerfile | 5 ----- src/ci/docker/disabled/wasm32-exp/Dockerfile | 7 ------- src/ci/docker/disabled/wasm32/Dockerfile | 5 ----- src/ci/docker/dist-aarch64-linux/Dockerfile | 5 ----- src/ci/docker/dist-android/Dockerfile | 5 ----- src/ci/docker/dist-arm-linux/Dockerfile | 5 ----- src/ci/docker/dist-armhf-linux/Dockerfile | 5 ----- src/ci/docker/dist-armv7-linux/Dockerfile | 5 ----- src/ci/docker/dist-fuchsia/Dockerfile | 5 ----- src/ci/docker/dist-i586-gnu-i686-musl/Dockerfile | 5 ----- src/ci/docker/dist-i686-freebsd/Dockerfile | 5 ----- src/ci/docker/dist-i686-linux/Dockerfile | 5 ----- src/ci/docker/dist-mips-linux/Dockerfile | 5 ----- src/ci/docker/dist-mips64-linux/Dockerfile | 5 ----- src/ci/docker/dist-mips64el-linux/Dockerfile | 5 ----- src/ci/docker/dist-mipsel-linux/Dockerfile | 5 ----- src/ci/docker/dist-powerpc-linux/Dockerfile | 5 ----- src/ci/docker/dist-powerpc64-linux/Dockerfile | 4 ---- src/ci/docker/dist-powerpc64le-linux/Dockerfile | 5 ----- src/ci/docker/dist-s390x-linux/Dockerfile | 5 ----- src/ci/docker/dist-x86_64-freebsd/Dockerfile | 5 ----- src/ci/docker/dist-x86_64-linux/Dockerfile | 5 ----- src/ci/docker/dist-x86_64-musl/Dockerfile | 5 ----- src/ci/docker/dist-x86_64-netbsd/Dockerfile | 5 ----- src/ci/docker/i686-gnu-nopt/Dockerfile | 5 ----- src/ci/docker/i686-gnu/Dockerfile | 5 ----- src/ci/docker/run.sh | 1 + src/ci/docker/scripts/dumb-init.sh | 15 --------------- src/ci/docker/x86_64-gnu-aux/Dockerfile | 5 ----- src/ci/docker/x86_64-gnu-debug/Dockerfile | 5 ----- src/ci/docker/x86_64-gnu-distcheck/Dockerfile | 5 ----- .../docker/x86_64-gnu-full-bootstrap/Dockerfile | 5 ----- src/ci/docker/x86_64-gnu-incremental/Dockerfile | 5 ----- src/ci/docker/x86_64-gnu-llvm-3.7/Dockerfile | 5 ----- src/ci/docker/x86_64-gnu-nopt/Dockerfile | 5 ----- src/ci/docker/x86_64-gnu/Dockerfile | 5 ----- 45 files changed, 2 insertions(+), 230 deletions(-) delete mode 100644 src/ci/docker/scripts/dumb-init.sh diff --git a/src/ci/docker/arm-android/Dockerfile b/src/ci/docker/arm-android/Dockerfile index 6cdaf6acfef..49d07d28d3c 100644 --- a/src/ci/docker/arm-android/Dockerfile +++ b/src/ci/docker/arm-android/Dockerfile @@ -3,9 +3,6 @@ FROM ubuntu:16.04 COPY scripts/android-base-apt-get.sh /scripts/ RUN sh /scripts/android-base-apt-get.sh -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - COPY scripts/android-ndk.sh /scripts/ RUN . /scripts/android-ndk.sh && \ download_and_make_toolchain android-ndk-r13b-linux-x86_64.zip arm 9 @@ -38,4 +35,4 @@ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh COPY scripts/android-start-emulator.sh /scripts/ -ENTRYPOINT ["/usr/bin/dumb-init", "--", "/scripts/android-start-emulator.sh"] +ENTRYPOINT ["/scripts/android-start-emulator.sh"] diff --git a/src/ci/docker/armhf-gnu/Dockerfile b/src/ci/docker/armhf-gnu/Dockerfile index 14785b706fb..191f8e3a289 100644 --- a/src/ci/docker/armhf-gnu/Dockerfile +++ b/src/ci/docker/armhf-gnu/Dockerfile @@ -73,14 +73,9 @@ RUN arm-linux-gnueabihf-gcc addentropy.c -o rootfs/addentropy -static # TODO: What is this?! RUN curl -O http://ftp.nl.debian.org/debian/dists/jessie/main/installer-armhf/current/images/device-tree/vexpress-v2p-ca15-tc1.dtb -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - ENV RUST_CONFIGURE_ARGS \ --target=arm-unknown-linux-gnueabihf \ --qemu-armhf-rootfs=/tmp/rootfs diff --git a/src/ci/docker/asmjs/Dockerfile b/src/ci/docker/asmjs/Dockerfile index 1c39e8523da..28caf1fb57a 100644 --- a/src/ci/docker/asmjs/Dockerfile +++ b/src/ci/docker/asmjs/Dockerfile @@ -13,9 +13,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ gdb \ xz-utils -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - COPY scripts/emscripten.sh /scripts/ RUN bash /scripts/emscripten.sh @@ -35,5 +32,3 @@ ENV SCRIPT python2.7 ../x.py test --target $TARGETS COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] diff --git a/src/ci/docker/cross/Dockerfile b/src/ci/docker/cross/Dockerfile index 0579d2397c8..a83bbe9c60e 100644 --- a/src/ci/docker/cross/Dockerfile +++ b/src/ci/docker/cross/Dockerfile @@ -21,9 +21,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libssl-dev \ pkg-config -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - WORKDIR /tmp COPY cross/build-rumprun.sh /tmp/ @@ -71,5 +68,3 @@ ENV SCRIPT python2.7 ../x.py dist --target $TARGETS # sccache COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] diff --git a/src/ci/docker/disabled/aarch64-gnu/Dockerfile b/src/ci/docker/disabled/aarch64-gnu/Dockerfile index e468b1abdfb..9a0e4531223 100644 --- a/src/ci/docker/disabled/aarch64-gnu/Dockerfile +++ b/src/ci/docker/disabled/aarch64-gnu/Dockerfile @@ -70,14 +70,9 @@ RUN chmod +x rootfs/etc/init.d/rcS COPY scripts/qemu-bare-bones-addentropy.c /tmp/addentropy.c RUN aarch64-linux-gnu-gcc addentropy.c -o rootfs/addentropy -static -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - ENV RUST_CONFIGURE_ARGS \ --target=aarch64-unknown-linux-gnu \ --qemu-aarch64-rootfs=/tmp/rootfs diff --git a/src/ci/docker/disabled/dist-aarch64-android/Dockerfile b/src/ci/docker/disabled/dist-aarch64-android/Dockerfile index 1c9e036f093..20d823a3d73 100644 --- a/src/ci/docker/disabled/dist-aarch64-android/Dockerfile +++ b/src/ci/docker/disabled/dist-aarch64-android/Dockerfile @@ -3,9 +3,6 @@ FROM ubuntu:16.04 COPY scripts/android-base-apt-get.sh /scripts/ RUN sh /scripts/android-base-apt-get.sh -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - COPY scripts/android-ndk.sh /scripts/ RUN . /scripts/android-ndk.sh && \ download_and_make_toolchain android-ndk-r13b-linux-x86_64.zip arm64 21 @@ -28,5 +25,3 @@ ENV SCRIPT python2.7 ../x.py dist --target $HOSTS --host $HOSTS COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] diff --git a/src/ci/docker/disabled/dist-armv7-android/Dockerfile b/src/ci/docker/disabled/dist-armv7-android/Dockerfile index 326e00548b1..3435d641a13 100644 --- a/src/ci/docker/disabled/dist-armv7-android/Dockerfile +++ b/src/ci/docker/disabled/dist-armv7-android/Dockerfile @@ -3,9 +3,6 @@ FROM ubuntu:16.04 COPY scripts/android-base-apt-get.sh /scripts/ RUN sh /scripts/android-base-apt-get.sh -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - COPY scripts/android-ndk.sh /scripts/ RUN . /scripts/android-ndk.sh && \ download_ndk android-ndk-r13b-linux-x86_64.zip && \ @@ -46,5 +43,3 @@ ENV SCRIPT \ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] diff --git a/src/ci/docker/disabled/dist-i686-android/Dockerfile b/src/ci/docker/disabled/dist-i686-android/Dockerfile index d01648e2b9d..4bb7053760f 100644 --- a/src/ci/docker/disabled/dist-i686-android/Dockerfile +++ b/src/ci/docker/disabled/dist-i686-android/Dockerfile @@ -3,9 +3,6 @@ FROM ubuntu:16.04 COPY scripts/android-base-apt-get.sh /scripts/ RUN sh /scripts/android-base-apt-get.sh -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - COPY scripts/android-ndk.sh /scripts/ RUN . /scripts/android-ndk.sh && \ download_ndk android-ndk-r13b-linux-x86_64.zip && \ @@ -46,5 +43,3 @@ ENV SCRIPT \ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] diff --git a/src/ci/docker/disabled/dist-x86_64-android/Dockerfile b/src/ci/docker/disabled/dist-x86_64-android/Dockerfile index 2622b4b3fac..525b218417b 100644 --- a/src/ci/docker/disabled/dist-x86_64-android/Dockerfile +++ b/src/ci/docker/disabled/dist-x86_64-android/Dockerfile @@ -3,9 +3,6 @@ FROM ubuntu:16.04 COPY scripts/android-base-apt-get.sh /scripts/ RUN sh /scripts/android-base-apt-get.sh -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - COPY scripts/android-ndk.sh /scripts/ RUN . /scripts/android-ndk.sh && \ download_and_make_toolchain android-ndk-r13b-linux-x86_64.zip x86_64 21 @@ -28,5 +25,3 @@ ENV SCRIPT python2.7 ../x.py dist --target $HOSTS --host $HOSTS COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] diff --git a/src/ci/docker/disabled/dist-x86_64-redox/Dockerfile b/src/ci/docker/disabled/dist-x86_64-redox/Dockerfile index 852ae058373..ed19939545f 100644 --- a/src/ci/docker/disabled/dist-x86_64-redox/Dockerfile +++ b/src/ci/docker/disabled/dist-x86_64-redox/Dockerfile @@ -3,11 +3,6 @@ FROM ubuntu:16.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - COPY scripts/crosstool-ng.sh /scripts/ RUN sh /scripts/crosstool-ng.sh diff --git a/src/ci/docker/disabled/wasm32-exp/Dockerfile b/src/ci/docker/disabled/wasm32-exp/Dockerfile index 4e337883165..6323369421b 100644 --- a/src/ci/docker/disabled/wasm32-exp/Dockerfile +++ b/src/ci/docker/disabled/wasm32-exp/Dockerfile @@ -15,10 +15,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ jq \ bzip2 -# dumb-init -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - # emscripten COPY scripts/emscripten-wasm.sh /scripts/ COPY disabled/wasm32-exp/node.sh /usr/local/bin/node @@ -37,6 +33,3 @@ ENV TARGETS=wasm32-experimental-emscripten ENV RUST_CONFIGURE_ARGS --target=$TARGETS --experimental-targets=WebAssembly ENV SCRIPT python2.7 ../x.py test --target $TARGETS - -# init -ENTRYPOINT ["/usr/bin/dumb-init", "--"] diff --git a/src/ci/docker/disabled/wasm32/Dockerfile b/src/ci/docker/disabled/wasm32/Dockerfile index bf9bf77e649..7f6f8ae0882 100644 --- a/src/ci/docker/disabled/wasm32/Dockerfile +++ b/src/ci/docker/disabled/wasm32/Dockerfile @@ -13,9 +13,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ gdb \ xz-utils -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - # emscripten COPY scripts/emscripten.sh /scripts/ RUN bash /scripts/emscripten.sh @@ -36,5 +33,3 @@ ENV TARGETS=wasm32-unknown-emscripten ENV RUST_CONFIGURE_ARGS --target=$TARGETS ENV SCRIPT python2.7 ../x.py test --target $TARGETS - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] diff --git a/src/ci/docker/dist-aarch64-linux/Dockerfile b/src/ci/docker/dist-aarch64-linux/Dockerfile index cc3b6b8c692..841d3012125 100644 --- a/src/ci/docker/dist-aarch64-linux/Dockerfile +++ b/src/ci/docker/dist-aarch64-linux/Dockerfile @@ -3,11 +3,6 @@ FROM ubuntu:16.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - # Ubuntu 16.04 (this container) ships with make 4, but something in the # toolchains we build below chokes on that, so go back to make 3 COPY scripts/make3.sh /scripts/ diff --git a/src/ci/docker/dist-android/Dockerfile b/src/ci/docker/dist-android/Dockerfile index f3beddfae0a..a36f7fc1ac5 100644 --- a/src/ci/docker/dist-android/Dockerfile +++ b/src/ci/docker/dist-android/Dockerfile @@ -3,9 +3,6 @@ FROM ubuntu:16.04 COPY scripts/android-base-apt-get.sh /scripts/ RUN sh /scripts/android-base-apt-get.sh -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - # ndk COPY scripts/android-ndk.sh /scripts/ RUN . /scripts/android-ndk.sh && \ @@ -36,5 +33,3 @@ ENV SCRIPT python2.7 ../x.py dist --target $TARGETS COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] diff --git a/src/ci/docker/dist-arm-linux/Dockerfile b/src/ci/docker/dist-arm-linux/Dockerfile index 590d6eb98b3..ecd5090ea05 100644 --- a/src/ci/docker/dist-arm-linux/Dockerfile +++ b/src/ci/docker/dist-arm-linux/Dockerfile @@ -3,11 +3,6 @@ FROM ubuntu:16.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - # Ubuntu 16.04 (this container) ships with make 4, but something in the # toolchains we build below chokes on that, so go back to make 3 COPY scripts/make3.sh /scripts/ diff --git a/src/ci/docker/dist-armhf-linux/Dockerfile b/src/ci/docker/dist-armhf-linux/Dockerfile index b3dedc4b7f0..5bbd17bd414 100644 --- a/src/ci/docker/dist-armhf-linux/Dockerfile +++ b/src/ci/docker/dist-armhf-linux/Dockerfile @@ -3,11 +3,6 @@ FROM ubuntu:16.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - # Ubuntu 16.04 (this container) ships with make 4, but something in the # toolchains we build below chokes on that, so go back to make 3 COPY scripts/make3.sh /scripts/ diff --git a/src/ci/docker/dist-armv7-linux/Dockerfile b/src/ci/docker/dist-armv7-linux/Dockerfile index 82536b68bbe..ea9034d7178 100644 --- a/src/ci/docker/dist-armv7-linux/Dockerfile +++ b/src/ci/docker/dist-armv7-linux/Dockerfile @@ -3,11 +3,6 @@ FROM ubuntu:16.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - # Ubuntu 16.04 (this container) ships with make 4, but something in the # toolchains we build below chokes on that, so go back to make 3 COPY scripts/make3.sh /scripts/ diff --git a/src/ci/docker/dist-fuchsia/Dockerfile b/src/ci/docker/dist-fuchsia/Dockerfile index 24ad12a4900..e18cb453baf 100644 --- a/src/ci/docker/dist-fuchsia/Dockerfile +++ b/src/ci/docker/dist-fuchsia/Dockerfile @@ -24,11 +24,6 @@ WORKDIR /tmp COPY dist-fuchsia/shared.sh dist-fuchsia/build-toolchain.sh dist-fuchsia/compiler-rt-dso-handle.patch /tmp/ RUN /tmp/build-toolchain.sh -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/dist-i586-gnu-i686-musl/Dockerfile b/src/ci/docker/dist-i586-gnu-i686-musl/Dockerfile index 036dce2a735..efde3ff5296 100644 --- a/src/ci/docker/dist-i586-gnu-i686-musl/Dockerfile +++ b/src/ci/docker/dist-i586-gnu-i686-musl/Dockerfile @@ -20,11 +20,6 @@ WORKDIR /build/ COPY dist-i586-gnu-i686-musl/musl-libunwind-patch.patch dist-i586-gnu-i686-musl/build-musl.sh /build/ RUN sh /build/build-musl.sh && rm -rf /build -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/dist-i686-freebsd/Dockerfile b/src/ci/docker/dist-i686-freebsd/Dockerfile index c40881332a1..b82d227b3ef 100644 --- a/src/ci/docker/dist-i686-freebsd/Dockerfile +++ b/src/ci/docker/dist-i686-freebsd/Dockerfile @@ -19,11 +19,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ COPY dist-i686-freebsd/build-toolchain.sh /tmp/ RUN /tmp/build-toolchain.sh i686 -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/dist-i686-linux/Dockerfile b/src/ci/docker/dist-i686-linux/Dockerfile index beb53783bac..a5d776af19d 100644 --- a/src/ci/docker/dist-i686-linux/Dockerfile +++ b/src/ci/docker/dist-i686-linux/Dockerfile @@ -76,11 +76,6 @@ RUN ./build-cmake.sh COPY dist-i686-linux/build-headers.sh /tmp/ RUN ./build-headers.sh -RUN curl -Lo /rustroot/dumb-init \ - https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 && \ - chmod +x /rustroot/dumb-init -ENTRYPOINT ["/rustroot/dumb-init", "--"] - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/dist-mips-linux/Dockerfile b/src/ci/docker/dist-mips-linux/Dockerfile index 81997e0508a..94a3cf8a382 100644 --- a/src/ci/docker/dist-mips-linux/Dockerfile +++ b/src/ci/docker/dist-mips-linux/Dockerfile @@ -17,14 +17,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ pkg-config -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - ENV HOSTS=mips-unknown-linux-gnu ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended diff --git a/src/ci/docker/dist-mips64-linux/Dockerfile b/src/ci/docker/dist-mips64-linux/Dockerfile index 646cb4d256a..0b0dfff1fe3 100644 --- a/src/ci/docker/dist-mips64-linux/Dockerfile +++ b/src/ci/docker/dist-mips64-linux/Dockerfile @@ -16,14 +16,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libssl-dev \ pkg-config -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - ENV HOSTS=mips64-unknown-linux-gnuabi64 ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended diff --git a/src/ci/docker/dist-mips64el-linux/Dockerfile b/src/ci/docker/dist-mips64el-linux/Dockerfile index 1abb04fd8b2..1810b1cdc5a 100644 --- a/src/ci/docker/dist-mips64el-linux/Dockerfile +++ b/src/ci/docker/dist-mips64el-linux/Dockerfile @@ -17,14 +17,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ pkg-config -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - ENV HOSTS=mips64el-unknown-linux-gnuabi64 ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended diff --git a/src/ci/docker/dist-mipsel-linux/Dockerfile b/src/ci/docker/dist-mipsel-linux/Dockerfile index a78e39e7d71..f5be0748475 100644 --- a/src/ci/docker/dist-mipsel-linux/Dockerfile +++ b/src/ci/docker/dist-mipsel-linux/Dockerfile @@ -16,14 +16,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libssl-dev \ pkg-config -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - ENV HOSTS=mipsel-unknown-linux-gnu ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended diff --git a/src/ci/docker/dist-powerpc-linux/Dockerfile b/src/ci/docker/dist-powerpc-linux/Dockerfile index ed9f883cc83..14ce3654fce 100644 --- a/src/ci/docker/dist-powerpc-linux/Dockerfile +++ b/src/ci/docker/dist-powerpc-linux/Dockerfile @@ -3,11 +3,6 @@ FROM ubuntu:16.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - # Ubuntu 16.04 (this container) ships with make 4, but something in the # toolchains we build below chokes on that, so go back to make 3 COPY scripts/make3.sh /scripts/ diff --git a/src/ci/docker/dist-powerpc64-linux/Dockerfile b/src/ci/docker/dist-powerpc64-linux/Dockerfile index 523211498fb..1f6e83e2f49 100644 --- a/src/ci/docker/dist-powerpc64-linux/Dockerfile +++ b/src/ci/docker/dist-powerpc64-linux/Dockerfile @@ -3,10 +3,6 @@ FROM ubuntu:16.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] # Ubuntu 16.04 (this container) ships with make 4, but something in the # toolchains we build below chokes on that, so go back to make 3 diff --git a/src/ci/docker/dist-powerpc64le-linux/Dockerfile b/src/ci/docker/dist-powerpc64le-linux/Dockerfile index 06b262c515a..d4677e18060 100644 --- a/src/ci/docker/dist-powerpc64le-linux/Dockerfile +++ b/src/ci/docker/dist-powerpc64le-linux/Dockerfile @@ -3,11 +3,6 @@ FROM ubuntu:16.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - # Ubuntu 16.04 (this container) ships with make 4, but something in the # toolchains we build below chokes on that, so go back to make 3 COPY scripts/make3.sh /scripts/ diff --git a/src/ci/docker/dist-s390x-linux/Dockerfile b/src/ci/docker/dist-s390x-linux/Dockerfile index 84769af12b5..39478e92f7c 100644 --- a/src/ci/docker/dist-s390x-linux/Dockerfile +++ b/src/ci/docker/dist-s390x-linux/Dockerfile @@ -3,11 +3,6 @@ FROM ubuntu:16.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - # Ubuntu 16.04 (this container) ships with make 4, but something in the # toolchains we build below chokes on that, so go back to make 3 COPY scripts/make3.sh /scripts/ diff --git a/src/ci/docker/dist-x86_64-freebsd/Dockerfile b/src/ci/docker/dist-x86_64-freebsd/Dockerfile index b62b46701a7..b7c00df4db2 100644 --- a/src/ci/docker/dist-x86_64-freebsd/Dockerfile +++ b/src/ci/docker/dist-x86_64-freebsd/Dockerfile @@ -19,11 +19,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ COPY dist-x86_64-freebsd/build-toolchain.sh /tmp/ RUN /tmp/build-toolchain.sh x86_64 -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/dist-x86_64-linux/Dockerfile b/src/ci/docker/dist-x86_64-linux/Dockerfile index d0ab47ad3dc..a954fd86a24 100644 --- a/src/ci/docker/dist-x86_64-linux/Dockerfile +++ b/src/ci/docker/dist-x86_64-linux/Dockerfile @@ -76,11 +76,6 @@ RUN ./build-cmake.sh COPY dist-x86_64-linux/build-headers.sh /tmp/ RUN ./build-headers.sh -RUN curl -Lo /rustroot/dumb-init \ - https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 && \ - chmod +x /rustroot/dumb-init -ENTRYPOINT ["/rustroot/dumb-init", "--"] - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/dist-x86_64-musl/Dockerfile b/src/ci/docker/dist-x86_64-musl/Dockerfile index eebc283e966..91ed6bfe1f6 100644 --- a/src/ci/docker/dist-x86_64-musl/Dockerfile +++ b/src/ci/docker/dist-x86_64-musl/Dockerfile @@ -20,11 +20,6 @@ WORKDIR /build/ COPY dist-x86_64-musl/build-musl.sh /build/ RUN sh /build/build-musl.sh && rm -rf /build -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/dist-x86_64-netbsd/Dockerfile b/src/ci/docker/dist-x86_64-netbsd/Dockerfile index 0c140500266..4fd2503c31b 100644 --- a/src/ci/docker/dist-x86_64-netbsd/Dockerfile +++ b/src/ci/docker/dist-x86_64-netbsd/Dockerfile @@ -3,11 +3,6 @@ FROM ubuntu:16.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - # Ubuntu 16.04 (this container) ships with make 4, but something in the # toolchains we build below chokes on that, so go back to make 3 COPY scripts/make3.sh /scripts/ diff --git a/src/ci/docker/i686-gnu-nopt/Dockerfile b/src/ci/docker/i686-gnu-nopt/Dockerfile index 56ff9922ae3..5a83bd318c4 100644 --- a/src/ci/docker/i686-gnu-nopt/Dockerfile +++ b/src/ci/docker/i686-gnu-nopt/Dockerfile @@ -14,13 +14,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ xz-utils -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - ENV RUST_CONFIGURE_ARGS --build=i686-unknown-linux-gnu --disable-optimize-tests ENV RUST_CHECK_TARGET check diff --git a/src/ci/docker/i686-gnu/Dockerfile b/src/ci/docker/i686-gnu/Dockerfile index 1c1333cd7c8..daa24e0e818 100644 --- a/src/ci/docker/i686-gnu/Dockerfile +++ b/src/ci/docker/i686-gnu/Dockerfile @@ -14,13 +14,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ xz-utils -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - ENV RUST_CONFIGURE_ARGS --build=i686-unknown-linux-gnu ENV SCRIPT python2.7 ../x.py test diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh index d3f339bc15f..5eba81ff60a 100755 --- a/src/ci/docker/run.sh +++ b/src/ci/docker/run.sh @@ -89,6 +89,7 @@ exec docker \ --env TRAVIS_BRANCH \ --volume "$HOME/.cargo:/cargo" \ --volume "$HOME/rustsrc:$HOME/rustsrc" \ + --init \ --rm \ rust-ci \ /checkout/src/ci/run.sh diff --git a/src/ci/docker/scripts/dumb-init.sh b/src/ci/docker/scripts/dumb-init.sh deleted file mode 100644 index 42ecec6ba08..00000000000 --- a/src/ci/docker/scripts/dumb-init.sh +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -set -ex - -curl -fOL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb -dpkg -i dumb-init_*.deb -rm dumb-init_*.deb diff --git a/src/ci/docker/x86_64-gnu-aux/Dockerfile b/src/ci/docker/x86_64-gnu-aux/Dockerfile index a449526efcc..35a387221c6 100644 --- a/src/ci/docker/x86_64-gnu-aux/Dockerfile +++ b/src/ci/docker/x86_64-gnu-aux/Dockerfile @@ -14,13 +14,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ xz-utils \ pkg-config -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu ENV RUST_CHECK_TARGET check-aux diff --git a/src/ci/docker/x86_64-gnu-debug/Dockerfile b/src/ci/docker/x86_64-gnu-debug/Dockerfile index 8111118ad3d..95d41028595 100644 --- a/src/ci/docker/x86_64-gnu-debug/Dockerfile +++ b/src/ci/docker/x86_64-gnu-debug/Dockerfile @@ -13,14 +13,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ gdb \ xz-utils -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - ENV RUST_CONFIGURE_ARGS \ --build=x86_64-unknown-linux-gnu \ --enable-debug \ diff --git a/src/ci/docker/x86_64-gnu-distcheck/Dockerfile b/src/ci/docker/x86_64-gnu-distcheck/Dockerfile index c3fe8ea51cb..786f59eb9f7 100644 --- a/src/ci/docker/x86_64-gnu-distcheck/Dockerfile +++ b/src/ci/docker/x86_64-gnu-distcheck/Dockerfile @@ -15,14 +15,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libssl-dev \ pkg-config -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu ENV SCRIPT python2.7 ../x.py test distcheck ENV DIST_SRC 1 diff --git a/src/ci/docker/x86_64-gnu-full-bootstrap/Dockerfile b/src/ci/docker/x86_64-gnu-full-bootstrap/Dockerfile index 377e0869557..70390c2ac1d 100644 --- a/src/ci/docker/x86_64-gnu-full-bootstrap/Dockerfile +++ b/src/ci/docker/x86_64-gnu-full-bootstrap/Dockerfile @@ -13,14 +13,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ gdb \ xz-utils -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - ENV RUST_CONFIGURE_ARGS \ --build=x86_64-unknown-linux-gnu \ --enable-full-bootstrap diff --git a/src/ci/docker/x86_64-gnu-incremental/Dockerfile b/src/ci/docker/x86_64-gnu-incremental/Dockerfile index a21a99e965e..d323677698c 100644 --- a/src/ci/docker/x86_64-gnu-incremental/Dockerfile +++ b/src/ci/docker/x86_64-gnu-incremental/Dockerfile @@ -13,14 +13,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ gdb \ xz-utils -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu ENV RUSTFLAGS -Zincremental=/tmp/rust-incr-cache ENV RUST_CHECK_TARGET check diff --git a/src/ci/docker/x86_64-gnu-llvm-3.7/Dockerfile b/src/ci/docker/x86_64-gnu-llvm-3.7/Dockerfile index 1a9f1d2d737..e832a2445ba 100644 --- a/src/ci/docker/x86_64-gnu-llvm-3.7/Dockerfile +++ b/src/ci/docker/x86_64-gnu-llvm-3.7/Dockerfile @@ -16,14 +16,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ zlib1g-dev \ xz-utils -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - ENV RUST_CONFIGURE_ARGS \ --build=x86_64-unknown-linux-gnu \ --llvm-root=/usr/lib/llvm-3.7 diff --git a/src/ci/docker/x86_64-gnu-nopt/Dockerfile b/src/ci/docker/x86_64-gnu-nopt/Dockerfile index e008b21f66f..d2b0dd13dc2 100644 --- a/src/ci/docker/x86_64-gnu-nopt/Dockerfile +++ b/src/ci/docker/x86_64-gnu-nopt/Dockerfile @@ -13,13 +13,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ gdb \ xz-utils -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu --disable-optimize-tests ENV RUST_CHECK_TARGET check diff --git a/src/ci/docker/x86_64-gnu/Dockerfile b/src/ci/docker/x86_64-gnu/Dockerfile index 3a6760b4762..7570bca5906 100644 --- a/src/ci/docker/x86_64-gnu/Dockerfile +++ b/src/ci/docker/x86_64-gnu/Dockerfile @@ -13,13 +13,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ gdb \ xz-utils -COPY scripts/dumb-init.sh /scripts/ -RUN sh /scripts/dumb-init.sh - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu --enable-sanitizers --enable-profiler ENV SCRIPT python2.7 ../x.py test From dc7c7ba0c9f401f5597a245e05ee9e8d760715d3 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 26 Aug 2017 19:36:46 -0700 Subject: [PATCH 41/50] std: Handle OS errors when joining threads Also add to the documentation that the `join` method can panic. cc #34971 cc #43539 --- src/libstd/sys/unix/thread.rs | 3 ++- src/libstd/sys/windows/c.rs | 1 + src/libstd/sys/windows/thread.rs | 6 +++++- src/libstd/thread/mod.rs | 5 +++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index 15747746611..40f1d6a6db1 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -168,7 +168,8 @@ impl Thread { unsafe { let ret = libc::pthread_join(self.id, ptr::null_mut()); mem::forget(self); - debug_assert_eq!(ret, 0); + assert!(ret == 0, + "failed to join thread: {}", io::Error::from_raw_os_error(ret)); } } diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs index ba54ca6ea18..7dfcc996e18 100644 --- a/src/libstd/sys/windows/c.rs +++ b/src/libstd/sys/windows/c.rs @@ -273,6 +273,7 @@ pub const FILE_END: DWORD = 2; pub const WAIT_OBJECT_0: DWORD = 0x00000000; pub const WAIT_TIMEOUT: DWORD = 258; +pub const WAIT_FAILED: DWORD = 0xFFFFFFFF; #[cfg(target_env = "msvc")] pub const MAX_SYM_NAME: usize = 2000; diff --git a/src/libstd/sys/windows/thread.rs b/src/libstd/sys/windows/thread.rs index 5a376a867ee..2cdd86e88b0 100644 --- a/src/libstd/sys/windows/thread.rs +++ b/src/libstd/sys/windows/thread.rs @@ -61,7 +61,11 @@ impl Thread { } pub fn join(self) { - unsafe { c::WaitForSingleObject(self.handle.raw(), c::INFINITE); } + let rc = unsafe { c::WaitForSingleObject(self.handle.raw(), c::INFINITE) }; + if rc == c::WAIT_FAILED { + panic!("failed to join on thread: {}", + io::Error::last_os_error()); + } } pub fn yield_now() { diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index ee103c803f5..195a02ae537 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -1230,6 +1230,11 @@ impl JoinHandle { /// [`Err`]: ../../std/result/enum.Result.html#variant.Err /// [`panic`]: ../../std/macro.panic.html /// + /// # Panics + /// + /// This function may panic on some platforms if a thread attempts to join + /// itself or otherwise may create a deadlock with joining threads. + /// /// # Examples /// /// ``` From bc5bd51c4563cd76fd3d73eb3eeff7cf6e9905b1 Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Sun, 11 Jun 2017 11:44:22 +0900 Subject: [PATCH 42/50] Make unused-extern-crate warn-by-default --- src/librustc/lint/builtin.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index cbe642a9a76..811bf977610 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -30,7 +30,7 @@ declare_lint! { declare_lint! { pub UNUSED_EXTERN_CRATES, - Allow, + Warn, "extern crates that are never used" } From 611b1111394a065783091b17b025c34427af3d68 Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Sat, 24 Jun 2017 17:48:27 +0900 Subject: [PATCH 43/50] Move unused-extern-crate to late pass --- src/Cargo.lock | 4 +--- src/liballoc/tests/lib.rs | 5 ----- src/libcore/tests/lib.rs | 4 ---- src/librustc/dep_graph/dep_node.rs | 2 ++ src/librustc/lib.rs | 4 ++-- src/librustc/ty/context.rs | 3 +++ src/librustc/ty/maps.rs | 14 ++++++++++++++ src/librustc/ty/mod.rs | 1 + src/librustc_borrowck/Cargo.toml | 1 - src/librustc_borrowck/lib.rs | 2 -- src/librustc_driver/driver.rs | 1 + src/librustc_metadata/Cargo.toml | 1 - src/librustc_metadata/cstore_impl.rs | 2 ++ src/librustc_metadata/lib.rs | 1 - src/librustc_resolve/build_reduced_graph.rs | 2 +- src/librustc_resolve/check_unused.rs | 6 ++---- src/librustc_resolve/lib.rs | 6 ++++-- src/librustc_resolve/resolve_imports.rs | 8 +++++--- src/librustc_tsan/Cargo.toml | 1 + src/librustc_tsan/lib.rs | 9 ++++++++- src/librustc_typeck/check_unused.rs | 10 ++++++++++ src/libstd/lib.rs | 3 ++- src/libstd/prelude/mod.rs | 1 + src/libstd/sys/unix/ext/fs.rs | 2 -- src/libsyntax_ext/Cargo.toml | 1 - src/libsyntax_ext/lib.rs | 1 - .../plugin-as-extern-crate.rs | 1 + src/test/compile-fail/E0254.rs | 1 + src/test/compile-fail/E0259.rs | 1 + src/test/compile-fail/E0260.rs | 1 + .../compile-fail/enable-unstable-lib-feature.rs | 1 + src/test/compile-fail/issue-36881.rs | 1 + src/test/compile-fail/lint-stability-deprecated.rs | 2 +- .../compile-fail/macro-reexport-malformed-1.rs | 1 + .../compile-fail/macro-reexport-malformed-2.rs | 1 + .../compile-fail/macro-reexport-malformed-3.rs | 1 + src/test/compile-fail/macro-use-bad-args-1.rs | 1 + src/test/compile-fail/macro-use-bad-args-2.rs | 1 + src/test/compile-fail/no-std-inject.rs | 1 + src/test/compile-fail/placement-expr-unstable.rs | 2 -- ...esolve-conflict-extern-crate-vs-extern-crate.rs | 1 + src/test/compile-fail/resolve_self_super_hint.rs | 1 + src/test/compile-fail/unused-attr.rs | 2 +- 43 files changed, 76 insertions(+), 39 deletions(-) diff --git a/src/Cargo.lock b/src/Cargo.lock index ad96ff40cd6..123c884585c 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -1327,7 +1327,6 @@ dependencies = [ "graphviz 0.0.0", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", - "rustc_data_structures 0.0.0", "rustc_errors 0.0.0", "rustc_mir 0.0.0", "syntax 0.0.0", @@ -1464,7 +1463,6 @@ dependencies = [ "proc_macro 0.0.0", "rustc 0.0.0", "rustc_back 0.0.0", - "rustc_const_math 0.0.0", "rustc_data_structures 0.0.0", "rustc_errors 0.0.0", "serialize 0.0.0", @@ -1605,6 +1603,7 @@ dependencies = [ name = "rustc_tsan" version = "0.0.0" dependencies = [ + "alloc 0.0.0", "alloc_system 0.0.0", "build_helper 0.1.0", "cmake 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1859,7 +1858,6 @@ name = "syntax_ext" version = "0.0.0" dependencies = [ "fmt_macros 0.0.0", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "proc_macro 0.0.0", "rustc_errors 0.0.0", "syntax 0.0.0", diff --git a/src/liballoc/tests/lib.rs b/src/liballoc/tests/lib.rs index 86309dd87de..8f3e71ef794 100644 --- a/src/liballoc/tests/lib.rs +++ b/src/liballoc/tests/lib.rs @@ -10,7 +10,6 @@ #![deny(warnings)] -#![feature(alloc)] #![feature(attr_literals)] #![feature(box_syntax)] #![feature(inclusive_range_syntax)] @@ -27,14 +26,10 @@ #![feature(splice)] #![feature(str_escape)] #![feature(string_retain)] -#![feature(test)] #![feature(unboxed_closures)] #![feature(unicode)] -extern crate alloc; -extern crate test; extern crate std_unicode; -extern crate core; use std::hash::{Hash, Hasher}; use std::collections::hash_map::DefaultHasher; diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index 84a3be99c27..ab2022b1824 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -26,7 +26,6 @@ #![feature(inclusive_range)] #![feature(inclusive_range_syntax)] #![feature(iter_rfind)] -#![feature(libc)] #![feature(nonzero)] #![feature(ord_max_min)] #![feature(rand)] @@ -41,13 +40,10 @@ #![feature(test)] #![feature(trusted_len)] #![feature(try_from)] -#![feature(unicode)] #![feature(unique)] extern crate core; extern crate test; -extern crate libc; -extern crate std_unicode; extern crate rand; mod any; diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index 9e5d4081231..01fff605283 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -522,6 +522,8 @@ define_dep_nodes!( <'tcx> [] DylibDepFormats(DefId), [] IsAllocator(DefId), [] IsPanicRuntime(DefId), + [] IsCompilerBuiltins(DefId), + [] HasGlobalAllocator(DefId), [] ExternCrate(DefId), [] LintLevels, ); diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 03dc2f3c1ac..900f4031d2f 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -26,7 +26,6 @@ #![feature(core_intrinsics)] #![feature(discriminant_value)] #![feature(i128_type)] -#![feature(libc)] #![feature(never_type)] #![feature(nonzero)] #![feature(quote)] @@ -45,7 +44,6 @@ extern crate core; extern crate fmt_macros; extern crate getopts; extern crate graphviz; -extern crate libc; extern crate owning_ref; extern crate rustc_back; extern crate rustc_data_structures; @@ -62,7 +60,9 @@ extern crate serialize as rustc_serialize; // used by deriving // Note that librustc doesn't actually depend on these crates, see the note in // `Cargo.toml` for this crate about why these are here. +#[allow(unused_extern_crates)] extern crate flate2; +#[allow(unused_extern_crates)] extern crate test; #[macro_use] diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index da1039c5de1..0f815584378 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -797,6 +797,8 @@ pub struct GlobalCtxt<'tcx> { pub maybe_unused_trait_imports: NodeSet, + pub maybe_unused_extern_crates: Vec<(NodeId, Span, CrateNum)>, + // Internal cache for metadata decoding. No need to track deps on this. pub rcache: RefCell>>, @@ -1038,6 +1040,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { mir_passes, freevars: RefCell::new(resolutions.freevars), maybe_unused_trait_imports: resolutions.maybe_unused_trait_imports, + maybe_unused_extern_crates: resolutions.maybe_unused_extern_crates, rcache: RefCell::new(FxHashMap()), normalized_cache: RefCell::new(FxHashMap()), inhabitedness_cache: RefCell::new(FxHashMap()), diff --git a/src/librustc/ty/maps.rs b/src/librustc/ty/maps.rs index 042ec49b0bd..a73202ced61 100644 --- a/src/librustc/ty/maps.rs +++ b/src/librustc/ty/maps.rs @@ -516,6 +516,18 @@ impl<'tcx> QueryDescription for queries::is_panic_runtime<'tcx> { } } +impl<'tcx> QueryDescription for queries::is_compiler_builtins<'tcx> { + fn describe(_: TyCtxt, _: DefId) -> String { + "checking if the crate is_compiler_builtins".to_string() + } +} + +impl<'tcx> QueryDescription for queries::has_global_allocator<'tcx> { + fn describe(_: TyCtxt, _: DefId) -> String { + "checking if the crate has_global_allocator".to_string() + } +} + impl<'tcx> QueryDescription for queries::extern_crate<'tcx> { fn describe(_: TyCtxt, _: DefId) -> String { "getting crate's ExternCrateData".to_string() @@ -1079,6 +1091,8 @@ define_maps! { <'tcx> [] is_allocator: IsAllocator(DefId) -> bool, [] is_panic_runtime: IsPanicRuntime(DefId) -> bool, + [] is_compiler_builtins: IsCompilerBuiltins(DefId) -> bool, + [] has_global_allocator: HasGlobalAllocator(DefId) -> bool, [] extern_crate: ExternCrate(DefId) -> Rc>, diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 852bd48a5ee..efd735b3f28 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -131,6 +131,7 @@ pub struct Resolutions { pub freevars: FreevarMap, pub trait_map: TraitMap, pub maybe_unused_trait_imports: NodeSet, + pub maybe_unused_extern_crates: Vec<(NodeId, Span, CrateNum)>, pub export_map: ExportMap, } diff --git a/src/librustc_borrowck/Cargo.toml b/src/librustc_borrowck/Cargo.toml index af99c0e9387..25f02537490 100644 --- a/src/librustc_borrowck/Cargo.toml +++ b/src/librustc_borrowck/Cargo.toml @@ -15,6 +15,5 @@ syntax = { path = "../libsyntax" } syntax_pos = { path = "../libsyntax_pos" } graphviz = { path = "../libgraphviz" } rustc = { path = "../librustc" } -rustc_data_structures = { path = "../librustc_data_structures" } rustc_mir = { path = "../librustc_mir" } rustc_errors = { path = "../librustc_errors" } diff --git a/src/librustc_borrowck/lib.rs b/src/librustc_borrowck/lib.rs index e7f4f9caee3..9bedbfed5db 100644 --- a/src/librustc_borrowck/lib.rs +++ b/src/librustc_borrowck/lib.rs @@ -28,9 +28,7 @@ extern crate rustc_errors as errors; extern crate graphviz as dot; #[macro_use] extern crate rustc; -extern crate rustc_data_structures; extern crate rustc_mir; -extern crate core; // for NonZero pub use borrowck::check_crate; pub use borrowck::build_borrowck_dataflow_data_for_fn; diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 163c698e3ff..96688c6ac9c 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -877,6 +877,7 @@ pub fn phase_2_configure_and_expand(sess: &Session, export_map: resolver.export_map, trait_map: resolver.trait_map, maybe_unused_trait_imports: resolver.maybe_unused_trait_imports, + maybe_unused_extern_crates: resolver.maybe_unused_extern_crates, }, hir_forest, }) diff --git a/src/librustc_metadata/Cargo.toml b/src/librustc_metadata/Cargo.toml index 67b459ea18f..40b75be36fe 100644 --- a/src/librustc_metadata/Cargo.toml +++ b/src/librustc_metadata/Cargo.toml @@ -15,7 +15,6 @@ owning_ref = "0.3.3" proc_macro = { path = "../libproc_macro" } rustc = { path = "../librustc" } rustc_back = { path = "../librustc_back" } -rustc_const_math = { path = "../librustc_const_math" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_errors = { path = "../librustc_errors" } serialize = { path = "../libserialize" } diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs index cfba11b5151..ad320a7ff3d 100644 --- a/src/librustc_metadata/cstore_impl.rs +++ b/src/librustc_metadata/cstore_impl.rs @@ -137,6 +137,8 @@ provide! { <'tcx> tcx, def_id, cdata, dylib_dependency_formats => { Rc::new(cdata.get_dylib_dependency_formats(&tcx.dep_graph)) } is_panic_runtime => { cdata.is_panic_runtime(&tcx.dep_graph) } + is_compiler_builtins => { cdata.is_compiler_builtins(&tcx.dep_graph) } + has_global_allocator => { cdata.has_global_allocator(&tcx.dep_graph) } extern_crate => { Rc::new(cdata.extern_crate.get()) } } diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs index 7d796dbd00f..f79abecf9da 100644 --- a/src/librustc_metadata/lib.rs +++ b/src/librustc_metadata/lib.rs @@ -39,7 +39,6 @@ extern crate proc_macro; #[macro_use] extern crate rustc; extern crate rustc_back; -extern crate rustc_const_math; extern crate rustc_data_structures; mod diagnostics; diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 47fa5357abf..a07de6e6914 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -264,7 +264,7 @@ impl<'a> Resolver<'a> { id: item.id, parent, imported_module: Cell::new(Some(module)), - subclass: ImportDirectiveSubclass::ExternCrate, + subclass: ImportDirectiveSubclass::ExternCrate { cnum: crate_id }, span: item.span, module_path: Vec::new(), vis: Cell::new(vis), diff --git a/src/librustc_resolve/check_unused.rs b/src/librustc_resolve/check_unused.rs index 05c227340d8..6e7f212bd4d 100644 --- a/src/librustc_resolve/check_unused.rs +++ b/src/librustc_resolve/check_unused.rs @@ -120,10 +120,8 @@ pub fn check_crate(resolver: &mut Resolver, krate: &ast::Crate) { _ if directive.used.get() || directive.vis.get() == ty::Visibility::Public || directive.span.source_equal(&DUMMY_SP) => {} - ImportDirectiveSubclass::ExternCrate => { - let lint = lint::builtin::UNUSED_EXTERN_CRATES; - let msg = "unused extern crate"; - ; resolver.session.buffer_lint(lint, directive.id, directive.span, msg) + ImportDirectiveSubclass::ExternCrate { cnum } => { + resolver.maybe_unused_extern_crates.push((directive.id, directive.span, cnum)); } ImportDirectiveSubclass::MacroUse => { let lint = lint::builtin::UNUSED_IMPORTS; diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index ee349e31128..324d6081635 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -35,7 +35,7 @@ use rustc::middle::cstore::CrateLoader; use rustc::session::Session; use rustc::lint; use rustc::hir::def::*; -use rustc::hir::def_id::{CRATE_DEF_INDEX, LOCAL_CRATE, DefId}; +use rustc::hir::def_id::{CRATE_DEF_INDEX, LOCAL_CRATE, CrateNum, DefId}; use rustc::ty; use rustc::hir::{Freevar, FreevarMap, TraitCandidate, TraitMap, GlobMap}; use rustc::util::nodemap::{NodeMap, NodeSet, FxHashMap, FxHashSet, DefIdMap}; @@ -1102,7 +1102,7 @@ impl<'a> NameBinding<'a> { match self.kind { NameBindingKind::Import { directive: &ImportDirective { - subclass: ImportDirectiveSubclass::ExternCrate, .. + subclass: ImportDirectiveSubclass::ExternCrate { .. }, .. }, .. } => true, _ => false, @@ -1250,6 +1250,7 @@ pub struct Resolver<'a> { used_imports: FxHashSet<(NodeId, Namespace)>, pub maybe_unused_trait_imports: NodeSet, + pub maybe_unused_extern_crates: Vec<(NodeId, Span, CrateNum)>, /// privacy errors are delayed until the end in order to deduplicate them privacy_errors: Vec>, @@ -1457,6 +1458,7 @@ impl<'a> Resolver<'a> { used_imports: FxHashSet(), maybe_unused_trait_imports: NodeSet(), + maybe_unused_extern_crates: Vec::new(), privacy_errors: Vec::new(), ambiguity_errors: Vec::new(), diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index 5616971e9d1..d4846fb1bd5 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -19,7 +19,7 @@ use {resolve_error, ResolutionError}; use rustc::ty; use rustc::lint::builtin::PUB_USE_OF_PRIVATE_EXTERN_CRATE; -use rustc::hir::def_id::DefId; +use rustc::hir::def_id::{CrateNum, DefId}; use rustc::hir::def::*; use rustc::util::nodemap::{FxHashMap, FxHashSet}; @@ -48,7 +48,9 @@ pub enum ImportDirectiveSubclass<'a> { max_vis: Cell, // The visibility of the greatest reexport. // n.b. `max_vis` is only used in `finalize_import` to check for reexport errors. }, - ExternCrate, + ExternCrate { + cnum: CrateNum, + }, MacroUse, } @@ -924,7 +926,7 @@ fn import_directive_subclass_to_string(subclass: &ImportDirectiveSubclass) -> St match *subclass { SingleImport { source, .. } => source.to_string(), GlobImport { .. } => "*".to_string(), - ExternCrate => "".to_string(), + ExternCrate { .. } => "".to_string(), MacroUse => "#[macro_use]".to_string(), } } diff --git a/src/librustc_tsan/Cargo.toml b/src/librustc_tsan/Cargo.toml index 97c1181e3a2..7b83985ba67 100644 --- a/src/librustc_tsan/Cargo.toml +++ b/src/librustc_tsan/Cargo.toml @@ -14,5 +14,6 @@ build_helper = { path = "../build_helper" } cmake = "0.1.18" [dependencies] +alloc = { path = "../liballoc" } alloc_system = { path = "../liballoc_system" } core = { path = "../libcore" } diff --git a/src/librustc_tsan/lib.rs b/src/librustc_tsan/lib.rs index 54941362e84..3429e3bda0f 100644 --- a/src/librustc_tsan/lib.rs +++ b/src/librustc_tsan/lib.rs @@ -9,8 +9,10 @@ // except according to those terms. #![sanitizer_runtime] -#![feature(sanitizer_runtime)] #![feature(alloc_system)] +#![feature(allocator_api)] +#![feature(global_allocator)] +#![feature(sanitizer_runtime)] #![feature(staged_api)] #![no_std] #![unstable(feature = "sanitizer_runtime_lib", @@ -18,3 +20,8 @@ issue = "0")] extern crate alloc_system; + +use alloc_system::System; + +#[global_allocator] +static ALLOC: System = System; diff --git a/src/librustc_typeck/check_unused.rs b/src/librustc_typeck/check_unused.rs index e95d49f00bf..bfa9371d138 100644 --- a/src/librustc_typeck/check_unused.rs +++ b/src/librustc_typeck/check_unused.rs @@ -72,4 +72,14 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { let mut visitor = CheckVisitor { tcx, used_trait_imports }; tcx.hir.krate().visit_all_item_likes(&mut visitor); + + for &(id, span, cnum) in &tcx.maybe_unused_extern_crates { + if !tcx.is_compiler_builtins(cnum.as_def_id()) + && !tcx.is_panic_runtime(cnum.as_def_id()) + && !tcx.has_global_allocator(cnum.as_def_id()) { + let lint = lint::builtin::UNUSED_EXTERN_CRATES; + let msg = "unused extern crate"; + tcx.lint_node(lint, id, span, msg); + } + } } diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index cf1eb5cd52e..9b80a5c462f 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -283,7 +283,7 @@ #![feature(on_unimplemented)] #![feature(oom)] #![feature(optin_builtin_traits)] -#![feature(panic_unwind)] +#![cfg_attr(any(unix, target_os = "redox"), feature(panic_unwind))] #![feature(peek)] #![feature(placement_in_syntax)] #![feature(placement_new_protocol)] @@ -358,6 +358,7 @@ extern crate std_unicode; extern crate libc; // We always need an unwinder currently for backtraces +#[cfg(any(unix, target_os = "redox"))] extern crate unwind; // compiler-rt intrinsics diff --git a/src/libstd/prelude/mod.rs b/src/libstd/prelude/mod.rs index 49cdba21a1d..538753d8692 100644 --- a/src/libstd/prelude/mod.rs +++ b/src/libstd/prelude/mod.rs @@ -23,6 +23,7 @@ //! On a technical level, Rust inserts //! //! ``` +//! # #[allow(unused_extern_crates)] //! extern crate std; //! ``` //! diff --git a/src/libstd/sys/unix/ext/fs.rs b/src/libstd/sys/unix/ext/fs.rs index a94585723a1..f44b9aa9615 100644 --- a/src/libstd/sys/unix/ext/fs.rs +++ b/src/libstd/sys/unix/ext/fs.rs @@ -154,8 +154,6 @@ pub trait OpenOptionsExt { /// # Examples /// /// ```no_run - /// # #![feature(libc)] - /// extern crate libc; /// use std::fs::OpenOptions; /// use std::os::unix::fs::OpenOptionsExt; /// diff --git a/src/libsyntax_ext/Cargo.toml b/src/libsyntax_ext/Cargo.toml index bdcec26cb83..1c470240288 100644 --- a/src/libsyntax_ext/Cargo.toml +++ b/src/libsyntax_ext/Cargo.toml @@ -10,7 +10,6 @@ crate-type = ["dylib"] [dependencies] fmt_macros = { path = "../libfmt_macros" } -log = "0.3" proc_macro = { path = "../libproc_macro" } rustc_errors = { path = "../librustc_errors" } syntax = { path = "../libsyntax" } diff --git a/src/libsyntax_ext/lib.rs b/src/libsyntax_ext/lib.rs index fa39095d329..42bbb4ae0cb 100644 --- a/src/libsyntax_ext/lib.rs +++ b/src/libsyntax_ext/lib.rs @@ -18,7 +18,6 @@ #![feature(proc_macro_internals)] extern crate fmt_macros; -extern crate log; #[macro_use] extern crate syntax; extern crate syntax_pos; diff --git a/src/test/compile-fail-fulldeps/plugin-as-extern-crate.rs b/src/test/compile-fail-fulldeps/plugin-as-extern-crate.rs index edbb77fe390..bb292e2e52a 100644 --- a/src/test/compile-fail-fulldeps/plugin-as-extern-crate.rs +++ b/src/test/compile-fail-fulldeps/plugin-as-extern-crate.rs @@ -15,6 +15,7 @@ // libsyntax is not compiled for it. #![deny(plugin_as_library)] +#![allow(unused_extern_crates)] extern crate macro_crate_test; //~ ERROR compiler plugin used as an ordinary library diff --git a/src/test/compile-fail/E0254.rs b/src/test/compile-fail/E0254.rs index 89227f6b010..996a6b97cd9 100644 --- a/src/test/compile-fail/E0254.rs +++ b/src/test/compile-fail/E0254.rs @@ -9,6 +9,7 @@ // except according to those terms. #![feature(alloc)] +#![allow(unused_extern_crates)] extern crate alloc; //~^ NOTE previous import of the extern crate `alloc` here diff --git a/src/test/compile-fail/E0259.rs b/src/test/compile-fail/E0259.rs index 60bcd2ae076..c285c4d9e00 100644 --- a/src/test/compile-fail/E0259.rs +++ b/src/test/compile-fail/E0259.rs @@ -9,6 +9,7 @@ // except according to those terms. #![feature(alloc, libc)] +#![allow(unused_extern_crates)] extern crate alloc; //~^ NOTE previous import of the extern crate `alloc` here diff --git a/src/test/compile-fail/E0260.rs b/src/test/compile-fail/E0260.rs index 5e802bbbe3d..ad8888e58f7 100644 --- a/src/test/compile-fail/E0260.rs +++ b/src/test/compile-fail/E0260.rs @@ -9,6 +9,7 @@ // except according to those terms. #![feature(alloc)] +#![allow(unused_extern_crates)] extern crate alloc; //~^ NOTE previous import of the extern crate `alloc` here diff --git a/src/test/compile-fail/enable-unstable-lib-feature.rs b/src/test/compile-fail/enable-unstable-lib-feature.rs index c65b2366bf1..bc9e2345f0e 100644 --- a/src/test/compile-fail/enable-unstable-lib-feature.rs +++ b/src/test/compile-fail/enable-unstable-lib-feature.rs @@ -16,6 +16,7 @@ #![deny(non_snake_case)] // To trigger a hard error // Shouldn't generate a warning about unstable features +#[allow(unused_extern_crates)] extern crate stability_cfg2; pub fn BOGUS() { } //~ ERROR diff --git a/src/test/compile-fail/issue-36881.rs b/src/test/compile-fail/issue-36881.rs index e05dc066199..0f5aa24926b 100644 --- a/src/test/compile-fail/issue-36881.rs +++ b/src/test/compile-fail/issue-36881.rs @@ -11,6 +11,7 @@ // aux-build:issue-36881-aux.rs fn main() { + #[allow(unused_extern_crates)] extern crate issue_36881_aux; use issue_36881_aux::Foo; //~ ERROR unresolved import } diff --git a/src/test/compile-fail/lint-stability-deprecated.rs b/src/test/compile-fail/lint-stability-deprecated.rs index 8443518b3f5..9bc2c021904 100644 --- a/src/test/compile-fail/lint-stability-deprecated.rs +++ b/src/test/compile-fail/lint-stability-deprecated.rs @@ -14,7 +14,7 @@ // aux-build:stability_cfg2.rs #![warn(deprecated)] -#![allow(dead_code)] +#![allow(dead_code, unused_extern_crates)] #![feature(staged_api, test_feature, rustc_attrs)] #![stable(feature = "rust1", since = "1.0.0")] diff --git a/src/test/compile-fail/macro-reexport-malformed-1.rs b/src/test/compile-fail/macro-reexport-malformed-1.rs index ea2dfca0714..a2778a83130 100644 --- a/src/test/compile-fail/macro-reexport-malformed-1.rs +++ b/src/test/compile-fail/macro-reexport-malformed-1.rs @@ -11,5 +11,6 @@ #![no_std] #![feature(macro_reexport)] +#[allow(unused_extern_crates)] #[macro_reexport] //~ ERROR bad macro reexport extern crate std; diff --git a/src/test/compile-fail/macro-reexport-malformed-2.rs b/src/test/compile-fail/macro-reexport-malformed-2.rs index 844955fb7e6..c5af9e3799d 100644 --- a/src/test/compile-fail/macro-reexport-malformed-2.rs +++ b/src/test/compile-fail/macro-reexport-malformed-2.rs @@ -11,5 +11,6 @@ #![no_std] #![feature(macro_reexport)] +#[allow(unused_extern_crates)] #[macro_reexport="foo"] //~ ERROR bad macro reexport extern crate std; diff --git a/src/test/compile-fail/macro-reexport-malformed-3.rs b/src/test/compile-fail/macro-reexport-malformed-3.rs index 381c22854e6..d72d1ee004e 100644 --- a/src/test/compile-fail/macro-reexport-malformed-3.rs +++ b/src/test/compile-fail/macro-reexport-malformed-3.rs @@ -11,5 +11,6 @@ #![no_std] #![feature(macro_reexport)] +#[allow(unused_extern_crates)] #[macro_reexport(foo="bar")] //~ ERROR bad macro reexport extern crate std; diff --git a/src/test/compile-fail/macro-use-bad-args-1.rs b/src/test/compile-fail/macro-use-bad-args-1.rs index 39c09c69779..a07cc834411 100644 --- a/src/test/compile-fail/macro-use-bad-args-1.rs +++ b/src/test/compile-fail/macro-use-bad-args-1.rs @@ -10,5 +10,6 @@ #![no_std] +#[allow(unused_extern_crates)] #[macro_use(foo(bar))] //~ ERROR bad macro import extern crate std; diff --git a/src/test/compile-fail/macro-use-bad-args-2.rs b/src/test/compile-fail/macro-use-bad-args-2.rs index 11a0108b99b..89004f16897 100644 --- a/src/test/compile-fail/macro-use-bad-args-2.rs +++ b/src/test/compile-fail/macro-use-bad-args-2.rs @@ -10,5 +10,6 @@ #![no_std] +#[allow(unused_extern_crates)] #[macro_use(foo="bar")] //~ ERROR bad macro import extern crate std; diff --git a/src/test/compile-fail/no-std-inject.rs b/src/test/compile-fail/no-std-inject.rs index f384eafa34b..49064853d21 100644 --- a/src/test/compile-fail/no-std-inject.rs +++ b/src/test/compile-fail/no-std-inject.rs @@ -9,6 +9,7 @@ // except according to those terms. #![no_std] +#![allow(unused_extern_crates)] extern crate core; //~ ERROR: the name `core` is defined multiple times extern crate std; diff --git a/src/test/compile-fail/placement-expr-unstable.rs b/src/test/compile-fail/placement-expr-unstable.rs index cc73cbe15fe..35695efe1a9 100644 --- a/src/test/compile-fail/placement-expr-unstable.rs +++ b/src/test/compile-fail/placement-expr-unstable.rs @@ -12,8 +12,6 @@ #![feature(placement_in_syntax)] -extern crate core; - fn main() { use std::boxed::HEAP; //~ ERROR use of unstable library feature diff --git a/src/test/compile-fail/resolve-conflict-extern-crate-vs-extern-crate.rs b/src/test/compile-fail/resolve-conflict-extern-crate-vs-extern-crate.rs index 87a17c0f19a..6a04a2c3704 100644 --- a/src/test/compile-fail/resolve-conflict-extern-crate-vs-extern-crate.rs +++ b/src/test/compile-fail/resolve-conflict-extern-crate-vs-extern-crate.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[allow(unused_extern_crates)] extern crate std; //~^ ERROR the name `std` is defined multiple times diff --git a/src/test/compile-fail/resolve_self_super_hint.rs b/src/test/compile-fail/resolve_self_super_hint.rs index 09951348448..a89fd802baf 100644 --- a/src/test/compile-fail/resolve_self_super_hint.rs +++ b/src/test/compile-fail/resolve_self_super_hint.rs @@ -9,6 +9,7 @@ // except according to those terms. #![feature(alloc)] +#![allow(unused_extern_crates)] mod a { extern crate alloc; diff --git a/src/test/compile-fail/unused-attr.rs b/src/test/compile-fail/unused-attr.rs index 6416e1cacdc..e20d03478ec 100644 --- a/src/test/compile-fail/unused-attr.rs +++ b/src/test/compile-fail/unused-attr.rs @@ -9,7 +9,7 @@ // except according to those terms. #![deny(unused_attributes)] -#![allow(dead_code, unused_imports)] +#![allow(dead_code, unused_imports, unused_extern_crates)] #![feature(custom_attribute)] #![foo] //~ ERROR unused attribute From 8309a4c43b7f034418627abfb42ad25453c55320 Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Sun, 13 Aug 2017 11:58:17 +0900 Subject: [PATCH 44/50] Address review comments, second turn --- src/librustc/ty/context.rs | 2 +- src/librustc/ty/mod.rs | 2 +- src/librustc_resolve/build_reduced_graph.rs | 2 +- src/librustc_resolve/check_unused.rs | 4 ++-- src/librustc_resolve/lib.rs | 6 +++--- src/librustc_resolve/resolve_imports.rs | 8 +++----- src/librustc_typeck/check_unused.rs | 9 +++++---- .../compile-fail/auxiliary/lint_unused_extern_crate5.rs | 9 +++++++++ src/test/compile-fail/lint-unused-extern-crate.rs | 5 ++++- 9 files changed, 29 insertions(+), 18 deletions(-) create mode 100644 src/test/compile-fail/auxiliary/lint_unused_extern_crate5.rs diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 0f815584378..6ce2232eb3e 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -797,7 +797,7 @@ pub struct GlobalCtxt<'tcx> { pub maybe_unused_trait_imports: NodeSet, - pub maybe_unused_extern_crates: Vec<(NodeId, Span, CrateNum)>, + pub maybe_unused_extern_crates: Vec<(NodeId, Span)>, // Internal cache for metadata decoding. No need to track deps on this. pub rcache: RefCell>>, diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index efd735b3f28..6597dccf258 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -131,7 +131,7 @@ pub struct Resolutions { pub freevars: FreevarMap, pub trait_map: TraitMap, pub maybe_unused_trait_imports: NodeSet, - pub maybe_unused_extern_crates: Vec<(NodeId, Span, CrateNum)>, + pub maybe_unused_extern_crates: Vec<(NodeId, Span)>, pub export_map: ExportMap, } diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index a07de6e6914..47fa5357abf 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -264,7 +264,7 @@ impl<'a> Resolver<'a> { id: item.id, parent, imported_module: Cell::new(Some(module)), - subclass: ImportDirectiveSubclass::ExternCrate { cnum: crate_id }, + subclass: ImportDirectiveSubclass::ExternCrate, span: item.span, module_path: Vec::new(), vis: Cell::new(vis), diff --git a/src/librustc_resolve/check_unused.rs b/src/librustc_resolve/check_unused.rs index 6e7f212bd4d..a66d1ce0859 100644 --- a/src/librustc_resolve/check_unused.rs +++ b/src/librustc_resolve/check_unused.rs @@ -120,8 +120,8 @@ pub fn check_crate(resolver: &mut Resolver, krate: &ast::Crate) { _ if directive.used.get() || directive.vis.get() == ty::Visibility::Public || directive.span.source_equal(&DUMMY_SP) => {} - ImportDirectiveSubclass::ExternCrate { cnum } => { - resolver.maybe_unused_extern_crates.push((directive.id, directive.span, cnum)); + ImportDirectiveSubclass::ExternCrate => { + resolver.maybe_unused_extern_crates.push((directive.id, directive.span)); } ImportDirectiveSubclass::MacroUse => { let lint = lint::builtin::UNUSED_IMPORTS; diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 324d6081635..a83ac9bb633 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -35,7 +35,7 @@ use rustc::middle::cstore::CrateLoader; use rustc::session::Session; use rustc::lint; use rustc::hir::def::*; -use rustc::hir::def_id::{CRATE_DEF_INDEX, LOCAL_CRATE, CrateNum, DefId}; +use rustc::hir::def_id::{CRATE_DEF_INDEX, LOCAL_CRATE, DefId}; use rustc::ty; use rustc::hir::{Freevar, FreevarMap, TraitCandidate, TraitMap, GlobMap}; use rustc::util::nodemap::{NodeMap, NodeSet, FxHashMap, FxHashSet, DefIdMap}; @@ -1102,7 +1102,7 @@ impl<'a> NameBinding<'a> { match self.kind { NameBindingKind::Import { directive: &ImportDirective { - subclass: ImportDirectiveSubclass::ExternCrate { .. }, .. + subclass: ImportDirectiveSubclass::ExternCrate, .. }, .. } => true, _ => false, @@ -1250,7 +1250,7 @@ pub struct Resolver<'a> { used_imports: FxHashSet<(NodeId, Namespace)>, pub maybe_unused_trait_imports: NodeSet, - pub maybe_unused_extern_crates: Vec<(NodeId, Span, CrateNum)>, + pub maybe_unused_extern_crates: Vec<(NodeId, Span)>, /// privacy errors are delayed until the end in order to deduplicate them privacy_errors: Vec>, diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index d4846fb1bd5..5616971e9d1 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -19,7 +19,7 @@ use {resolve_error, ResolutionError}; use rustc::ty; use rustc::lint::builtin::PUB_USE_OF_PRIVATE_EXTERN_CRATE; -use rustc::hir::def_id::{CrateNum, DefId}; +use rustc::hir::def_id::DefId; use rustc::hir::def::*; use rustc::util::nodemap::{FxHashMap, FxHashSet}; @@ -48,9 +48,7 @@ pub enum ImportDirectiveSubclass<'a> { max_vis: Cell, // The visibility of the greatest reexport. // n.b. `max_vis` is only used in `finalize_import` to check for reexport errors. }, - ExternCrate { - cnum: CrateNum, - }, + ExternCrate, MacroUse, } @@ -926,7 +924,7 @@ fn import_directive_subclass_to_string(subclass: &ImportDirectiveSubclass) -> St match *subclass { SingleImport { source, .. } => source.to_string(), GlobImport { .. } => "*".to_string(), - ExternCrate { .. } => "".to_string(), + ExternCrate => "".to_string(), MacroUse => "#[macro_use]".to_string(), } } diff --git a/src/librustc_typeck/check_unused.rs b/src/librustc_typeck/check_unused.rs index bfa9371d138..3da154e0689 100644 --- a/src/librustc_typeck/check_unused.rs +++ b/src/librustc_typeck/check_unused.rs @@ -73,10 +73,11 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { let mut visitor = CheckVisitor { tcx, used_trait_imports }; tcx.hir.krate().visit_all_item_likes(&mut visitor); - for &(id, span, cnum) in &tcx.maybe_unused_extern_crates { - if !tcx.is_compiler_builtins(cnum.as_def_id()) - && !tcx.is_panic_runtime(cnum.as_def_id()) - && !tcx.has_global_allocator(cnum.as_def_id()) { + for &(id, span) in &tcx.maybe_unused_extern_crates { + let cnum = tcx.sess.cstore.extern_mod_stmt_cnum(id).unwrap().as_def_id(); + if !tcx.is_compiler_builtins(cnum) + && !tcx.is_panic_runtime(cnum) + && !tcx.has_global_allocator(cnum) { let lint = lint::builtin::UNUSED_EXTERN_CRATES; let msg = "unused extern crate"; tcx.lint_node(lint, id, span, msg); diff --git a/src/test/compile-fail/auxiliary/lint_unused_extern_crate5.rs b/src/test/compile-fail/auxiliary/lint_unused_extern_crate5.rs new file mode 100644 index 00000000000..fc4bca865c9 --- /dev/null +++ b/src/test/compile-fail/auxiliary/lint_unused_extern_crate5.rs @@ -0,0 +1,9 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. diff --git a/src/test/compile-fail/lint-unused-extern-crate.rs b/src/test/compile-fail/lint-unused-extern-crate.rs index b12ef6277bb..a3cfa134983 100644 --- a/src/test/compile-fail/lint-unused-extern-crate.rs +++ b/src/test/compile-fail/lint-unused-extern-crate.rs @@ -12,12 +12,15 @@ // aux-build:lint_unused_extern_crate2.rs // aux-build:lint_unused_extern_crate3.rs // aux-build:lint_unused_extern_crate4.rs +// aux-build:lint_unused_extern_crate5.rs #![deny(unused_extern_crates)] #![allow(unused_variables)] #![allow(deprecated)] -extern crate lint_unused_extern_crate4; //~ ERROR: unused extern crate +extern crate lint_unused_extern_crate5; //~ ERROR: unused extern crate + +pub extern crate lint_unused_extern_crate4; // no error, it is reexported extern crate lint_unused_extern_crate3; // no error, it is used From 6e18fe4d22e810524c9158705dd5e62f3bc13106 Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Mon, 14 Aug 2017 09:26:14 +0900 Subject: [PATCH 45/50] Add missing dependency for Windows --- src/libpanic_unwind/lib.rs | 5 ++++- src/librustc/lib.rs | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libpanic_unwind/lib.rs b/src/libpanic_unwind/lib.rs index 5a340f1323d..558286f4ec0 100644 --- a/src/libpanic_unwind/lib.rs +++ b/src/libpanic_unwind/lib.rs @@ -34,7 +34,9 @@ #![feature(core_intrinsics)] #![feature(lang_items)] #![feature(libc)] -#![feature(panic_unwind)] +#![cfg_attr(not(any(target_env = "msvc", + all(windows, target_arch = "x86_64", target_env = "gnu"))), + feature(panic_unwind))] #![feature(raw)] #![feature(staged_api)] #![feature(unwind_attributes)] @@ -45,6 +47,7 @@ extern crate alloc; extern crate libc; +#[cfg(not(any(target_env = "msvc", all(windows, target_arch = "x86_64", target_env = "gnu"))))] extern crate unwind; use core::intrinsics; diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 900f4031d2f..152b2e2aa5e 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -26,6 +26,7 @@ #![feature(core_intrinsics)] #![feature(discriminant_value)] #![feature(i128_type)] +#![cfg_attr(windows, feature(libc))] #![feature(never_type)] #![feature(nonzero)] #![feature(quote)] @@ -44,6 +45,8 @@ extern crate core; extern crate fmt_macros; extern crate getopts; extern crate graphviz; +#[cfg(windows)] +extern crate libc; extern crate owning_ref; extern crate rustc_back; extern crate rustc_data_structures; From bf9bdefe8ad97357694107ad6d7743b91ec9bad6 Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Tue, 22 Aug 2017 10:30:51 +0900 Subject: [PATCH 46/50] Whitelist unwind import in std This is a part of libbacktrace linkage and thus the compiler cannot detect if it's used or not. --- src/libstd/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 9b80a5c462f..b57067e35e9 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -283,7 +283,7 @@ #![feature(on_unimplemented)] #![feature(oom)] #![feature(optin_builtin_traits)] -#![cfg_attr(any(unix, target_os = "redox"), feature(panic_unwind))] +#![feature(panic_unwind)] #![feature(peek)] #![feature(placement_in_syntax)] #![feature(placement_new_protocol)] @@ -358,7 +358,7 @@ extern crate std_unicode; extern crate libc; // We always need an unwinder currently for backtraces -#[cfg(any(unix, target_os = "redox"))] +#[allow(unused_extern_crates)] extern crate unwind; // compiler-rt intrinsics From 7f054990b6bb19e15750a4442a24941cc157acb6 Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Tue, 22 Aug 2017 13:33:43 +0900 Subject: [PATCH 47/50] Platform gate libc in libtest --- src/libtest/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 652bfa82b5c..642eb285564 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -35,13 +35,14 @@ #![deny(warnings)] #![feature(asm)] -#![feature(libc)] +#![cfg_attr(unix, feature(libc))] #![feature(set_stdio)] #![feature(panic_unwind)] #![feature(staged_api)] extern crate getopts; extern crate term; +#[cfg(unix)] extern crate libc; extern crate panic_unwind; From 7a8d38e522b77cb21d38919e6d9ce1b8480cfca0 Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Wed, 23 Aug 2017 09:57:05 +0900 Subject: [PATCH 48/50] Additional libc cleanup --- src/librustc_driver/lib.rs | 3 ++- src/librustc_errors/lib.rs | 3 ++- src/tools/compiletest/src/main.rs | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index e56c989b843..1915a1c8648 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -20,7 +20,7 @@ #![deny(warnings)] #![feature(box_syntax)] -#![feature(libc)] +#![cfg_attr(unix, feature(libc))] #![feature(quote)] #![feature(rustc_diagnostic_macros)] #![feature(set_stdio)] @@ -29,6 +29,7 @@ extern crate arena; extern crate getopts; extern crate graphviz; extern crate env_logger; +#[cfg(unix)] extern crate libc; extern crate rustc; extern crate rustc_allocator; diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 2f5aac65b92..870bb01bb9f 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -16,10 +16,11 @@ #![feature(custom_attribute)] #![allow(unused_attributes)] #![feature(range_contains)] -#![feature(libc)] +#![cfg_attr(unix, feature(libc))] #![feature(conservative_impl_trait)] extern crate term; +#[cfg(unix)] extern crate libc; extern crate serialize as rustc_serialize; extern crate syntax_pos; diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 20239e97478..15216f52d91 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -14,6 +14,7 @@ #![deny(warnings)] +#[cfg(any(target_os = "macos", target_os = "ios"))] extern crate libc; extern crate test; extern crate getopts; From 2140a1e5c695bb651ad5fc5c1395689c12d642e3 Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Thu, 24 Aug 2017 09:27:12 +0900 Subject: [PATCH 49/50] Whitelist for dummy_jemalloc --- src/liballoc_jemalloc/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/liballoc_jemalloc/lib.rs b/src/liballoc_jemalloc/lib.rs index 513b299fcf3..efefabc974c 100644 --- a/src/liballoc_jemalloc/lib.rs +++ b/src/liballoc_jemalloc/lib.rs @@ -19,7 +19,7 @@ #![feature(libc)] #![feature(linkage)] #![feature(staged_api)] -#![cfg_attr(dummy_jemalloc, allow(dead_code))] +#![cfg_attr(dummy_jemalloc, allow(dead_code, unused_extern_crates))] #![cfg_attr(not(dummy_jemalloc), feature(allocator_api))] extern crate alloc; From a91bdf4ad558b3cf7b2a0230df15d83a6a686397 Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Fri, 25 Aug 2017 15:54:15 +0900 Subject: [PATCH 50/50] Update Cargo submodule --- src/tools/cargo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/cargo b/src/tools/cargo index 7847f75bb6f..3d3f2c05d74 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit 7847f75bb6fc4fee6f511ca740bbe6872c08502b +Subproject commit 3d3f2c05d742e5f907e951aa8849b03f0bc1a895