Skip to content

Instantly share code, notes, and snippets.

@nikomatsakis
Last active September 7, 2017 16:55
Show Gist options
  • Save nikomatsakis/6cc6364d0ff255863f7559327c4b71bc to your computer and use it in GitHub Desktop.
Save nikomatsakis/6cc6364d0ff255863f7559327c4b71bc to your computer and use it in GitHub Desktop.
diff --git a/src/librustc/infer/error_reporting/different_lifetimes.rs b/src/librustc/infer/error_reporting/different_lifetimes.rs
index 90c207ca2e..46b2ec1b3a 100644
--- a/src/librustc/infer/error_reporting/different_lifetimes.rs
+++ b/src/librustc/infer/error_reporting/different_lifetimes.rs
@@ -139,32 +139,29 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
if let Some(anon_reg) = self.is_suitable_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);
- if let ty::TyFnDef(_, _) = ret_ty.sty {
- 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,
+ 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();
- }
+ return inputs
+ .iter()
+ .filter_map(|arg| {
+ self.find_component_for_bound_region(&**arg, br)
+ })
+ .next();
}
}
None
diff --git a/src/test/compile-fail/associated-types-subtyping-1.rs b/src/test/compile-fail/associated-types-subtyping-1.rs
index f9106ba396..64dcdd39e7 100644
--- a/src/test/compile-fail/associated-types-subtyping-1.rs
+++ b/src/test/compile-fail/associated-types-subtyping-1.rs
@@ -31,7 +31,7 @@ fn method2<'a,'b,T>(x: &'a T, y: &'b T)
// Note that &'static T <: &'a T.
let a: <T as Trait<'a>>::Type = loop { };
let b: <T as Trait<'b>>::Type = loop { };
- let _: <T as Trait<'b>>::Type = a; //~ ERROR mismatched types
+ let _: <T as Trait<'b>>::Type = a; //~ ERROR E0623
}
fn method3<'a,'b,T>(x: &'a T, y: &'b T)
@@ -40,7 +40,7 @@ fn method3<'a,'b,T>(x: &'a T, y: &'b T)
// Note that &'static T <: &'a T.
let a: <T as Trait<'a>>::Type = loop { };
let b: <T as Trait<'b>>::Type = loop { };
- let _: <T as Trait<'a>>::Type = b; //~ ERROR mismatched types
+ let _: <T as Trait<'a>>::Type = b; //~ ERROR E0623
}
fn method4<'a,'b,T>(x: &'a T, y: &'b T)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment