Skip to content

Commit cb6408a

Browse files
committed
Fix rebase
1 parent c52dbbc commit cb6408a

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

src/librustc_infer/infer/error_reporting/nice_region_error/trait_impl_difference.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
8383
}
8484
let mut visitor = AssocTypeFinder(FxIndexSet::default());
8585
trait_fn_sig.output().visit_with(&mut visitor);
86-
if let Some(id) = tcx.hir().as_local_hir_id(trait_def_id) {
86+
if let Some(id) = trait_def_id.as_local().map(|id| tcx.hir().as_local_hir_id(id)) {
8787
let parent_id = tcx.hir().get_parent_item(id);
8888
let trait_item = tcx.hir().expect_item(parent_id);
8989
if let ItemKind::Trait(_, _, generics, _, _) = &trait_item.kind {
@@ -103,9 +103,10 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
103103
let assoc_item = self.tcx().associated_item(trait_def_id);
104104
let mut visitor = TypeParamSpanVisitor { tcx: self.tcx(), types: vec![] };
105105
match assoc_item.kind {
106-
ty::AssocKind::Method => {
106+
ty::AssocKind::Fn => {
107107
let hir = self.tcx().hir();
108-
if let Some(hir_id) = hir.as_local_hir_id(assoc_item.def_id) {
108+
if let Some(hir_id) = assoc_item.def_id.as_local().map(|id| hir.as_local_hir_id(id))
109+
{
109110
if let Some(decl) = hir.fn_decl_by_hir_id(hir_id) {
110111
visitor.visit_fn_decl(decl);
111112
}

src/test/ui/error-codes/E0490.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ note: ...so that the expression is assignable
5858
|
5959
LL | let x: &'a _ = &y;
6060
| ^^
61-
= note: expected `&'a &()`
62-
found `&'a &'b ()`
61+
= note: expected `&'a &()`
62+
found `&'a &'b ()`
6363
note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 1:6...
6464
--> $DIR/E0490.rs:1:6
6565
|

src/test/ui/in-band-lifetimes/mismatched_trait_impl.nll.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ error: `impl` item signature doesn't match `trait` item signature
22
--> $DIR/mismatched_trait_impl.rs:9:5
33
|
44
LL | fn foo(&self, x: &'a u32, y: &u32) -> &'a u32;
5-
| ---------------------------------------------- expected fn(&i32, &'a u32, &u32) -> &'a u32
5+
| ---------------------------------------------- expected `fn(&i32, &'a u32, &u32) -> &'a u32`
66
...
77
LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
8-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found fn(&i32, &u32, &u32) -> &u32
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&i32, &u32, &u32) -> &u32`
99
|
1010
= note: expected `fn(&i32, &'a u32, &u32) -> &'a u32`
1111
found `fn(&i32, &u32, &u32) -> &u32`

src/test/ui/issues/issue-20225.stderr

-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ LL | extern "rust-call" fn call(&self, (_,): (T,)) {}
88
|
99
= note: expected fn pointer `extern "rust-call" fn(&Foo, (&'a T,))`
1010
found fn pointer `extern "rust-call" fn(&Foo, (T,))`
11-
= help: type parameters must be constrained to match other types
12-
= note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
1311

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

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

0 commit comments

Comments
 (0)