Skip to content

Commit

Permalink
Fix rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed May 28, 2020
1 parent c52dbbc commit cb6408a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
}
let mut visitor = AssocTypeFinder(FxIndexSet::default());
trait_fn_sig.output().visit_with(&mut visitor);
if let Some(id) = tcx.hir().as_local_hir_id(trait_def_id) {
if let Some(id) = trait_def_id.as_local().map(|id| tcx.hir().as_local_hir_id(id)) {
let parent_id = tcx.hir().get_parent_item(id);
let trait_item = tcx.hir().expect_item(parent_id);
if let ItemKind::Trait(_, _, generics, _, _) = &trait_item.kind {
Expand All @@ -103,9 +103,10 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
let assoc_item = self.tcx().associated_item(trait_def_id);
let mut visitor = TypeParamSpanVisitor { tcx: self.tcx(), types: vec![] };
match assoc_item.kind {
ty::AssocKind::Method => {
ty::AssocKind::Fn => {
let hir = self.tcx().hir();
if let Some(hir_id) = hir.as_local_hir_id(assoc_item.def_id) {
if let Some(hir_id) = assoc_item.def_id.as_local().map(|id| hir.as_local_hir_id(id))
{
if let Some(decl) = hir.fn_decl_by_hir_id(hir_id) {
visitor.visit_fn_decl(decl);
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/error-codes/E0490.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ note: ...so that the expression is assignable
|
LL | let x: &'a _ = &y;
| ^^
= note: expected `&'a &()`
found `&'a &'b ()`
= note: expected `&'a &()`
found `&'a &'b ()`
note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 1:6...
--> $DIR/E0490.rs:1:6
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ error: `impl` item signature doesn't match `trait` item signature
--> $DIR/mismatched_trait_impl.rs:9:5
|
LL | fn foo(&self, x: &'a u32, y: &u32) -> &'a u32;
| ---------------------------------------------- expected fn(&i32, &'a u32, &u32) -> &'a u32
| ---------------------------------------------- expected `fn(&i32, &'a u32, &u32) -> &'a u32`
...
LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found fn(&i32, &u32, &u32) -> &u32
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&i32, &u32, &u32) -> &u32`
|
= note: expected `fn(&i32, &'a u32, &u32) -> &'a u32`
found `fn(&i32, &u32, &u32) -> &u32`
Expand Down
4 changes: 0 additions & 4 deletions src/test/ui/issues/issue-20225.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ LL | extern "rust-call" fn call(&self, (_,): (T,)) {}
|
= note: expected fn pointer `extern "rust-call" fn(&Foo, (&'a T,))`
found fn pointer `extern "rust-call" fn(&Foo, (T,))`
= help: type parameters must be constrained to match other types
= note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters

error[E0053]: method `call_mut` has an incompatible type for trait
--> $DIR/issue-20225.rs:11:3
Expand All @@ -21,8 +19,6 @@ LL | extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {}
|
= note: expected fn pointer `extern "rust-call" fn(&mut Foo, (&'a T,))`
found fn pointer `extern "rust-call" fn(&mut Foo, (T,))`
= help: type parameters must be constrained to match other types
= note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters

error[E0053]: method `call_once` has an incompatible type for trait
--> $DIR/issue-20225.rs:18:3
Expand Down

0 comments on commit cb6408a

Please sign in to comment.