1
Fork 0

recurse into refs when comparing tys for diagnostics

This commit is contained in:
jyn 2023-12-07 22:54:41 -05:00
parent d6fa38a9b2
commit eb53721a34
58 changed files with 226 additions and 216 deletions

View file

@ -1181,37 +1181,54 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
debug!("cmp(t1={}, t1.kind={:?}, t2={}, t2.kind={:?})", t1, t1.kind(), t2, t2.kind()); debug!("cmp(t1={}, t1.kind={:?}, t2={}, t2.kind={:?})", t1, t1.kind(), t2, t2.kind());
// helper functions // helper functions
fn equals<'tcx>(a: Ty<'tcx>, b: Ty<'tcx>) -> bool { let recurse = |t1, t2, values: &mut (DiagnosticStyledString, DiagnosticStyledString)| {
match (a.kind(), b.kind()) { let (x1, x2) = self.cmp(t1, t2);
(a, b) if *a == *b => true, (values.0).0.extend(x1.0);
(&ty::Int(_), &ty::Infer(ty::InferTy::IntVar(_))) (values.1).0.extend(x2.0);
| ( };
&ty::Infer(ty::InferTy::IntVar(_)),
&ty::Int(_) | &ty::Infer(ty::InferTy::IntVar(_)),
)
| (&ty::Float(_), &ty::Infer(ty::InferTy::FloatVar(_)))
| (
&ty::Infer(ty::InferTy::FloatVar(_)),
&ty::Float(_) | &ty::Infer(ty::InferTy::FloatVar(_)),
) => true,
_ => false,
}
}
fn push_ty_ref<'tcx>( fn fmt_region<'tcx>(region: ty::Region<'tcx>) -> String {
region: ty::Region<'tcx>,
ty: Ty<'tcx>,
mutbl: hir::Mutability,
s: &mut DiagnosticStyledString,
) {
let mut r = region.to_string(); let mut r = region.to_string();
if r == "'_" { if r == "'_" {
r.clear(); r.clear();
} else { } else {
r.push(' '); r.push(' ');
} }
s.push_highlighted(format!("&{}{}", r, mutbl.prefix_str())); format!("&{r}")
s.push_normal(ty.to_string()); }
fn push_ref<'tcx>(
region: ty::Region<'tcx>,
mutbl: hir::Mutability,
s: &mut DiagnosticStyledString,
) {
s.push_highlighted(fmt_region(region));
s.push_highlighted(mutbl.prefix_str());
}
fn cmp_ty_refs<'tcx>(
r1: ty::Region<'tcx>,
mut1: hir::Mutability,
r2: ty::Region<'tcx>,
mut2: hir::Mutability,
ss: &mut (DiagnosticStyledString, DiagnosticStyledString),
) {
let (r1, r2) = (fmt_region(r1), fmt_region(r2));
if r1 != r2 {
ss.0.push_highlighted(r1);
ss.1.push_highlighted(r2);
} else {
ss.0.push_normal(r1);
ss.1.push_normal(r2);
}
if mut1 != mut2 {
ss.0.push_highlighted(mut1.prefix_str());
ss.1.push_highlighted(mut2.prefix_str());
} else {
ss.0.push_normal(mut1.prefix_str());
ss.1.push_normal(mut2.prefix_str());
}
} }
// process starts here // process starts here
@ -1310,9 +1327,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
values.0.push_normal("_"); values.0.push_normal("_");
values.1.push_normal("_"); values.1.push_normal("_");
} else { } else {
let (x1, x2) = self.cmp(ta1, ta2); recurse(ta1, ta2, &mut values);
(values.0).0.extend(x1.0);
(values.1).0.extend(x2.0);
} }
self.push_comma(&mut values.0, &mut values.1, len, i); self.push_comma(&mut values.0, &mut values.1, len, i);
} }
@ -1418,27 +1433,24 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
} }
} }
// When finding T != &T, highlight only the borrow // When finding `&T != &T`, compare the references, then recurse into pointee type
(&ty::Ref(r1, ref_ty1, mutbl1), _) if equals(ref_ty1, t2) => { (&ty::Ref(r1, ref_ty1, mutbl1), &ty::Ref(r2, ref_ty2, mutbl2)) => {
let mut values = (DiagnosticStyledString::new(), DiagnosticStyledString::new()); let mut values = (DiagnosticStyledString::new(), DiagnosticStyledString::new());
push_ty_ref(r1, ref_ty1, mutbl1, &mut values.0); cmp_ty_refs(r1, mutbl1, r2, mutbl2, &mut values);
values.1.push_normal(t2.to_string()); recurse(ref_ty1, ref_ty2, &mut values);
values values
} }
(_, &ty::Ref(r2, ref_ty2, mutbl2)) if equals(t1, ref_ty2) => { // When finding T != &T, highlight the borrow
(&ty::Ref(r1, ref_ty1, mutbl1), _) => {
let mut values = (DiagnosticStyledString::new(), DiagnosticStyledString::new()); let mut values = (DiagnosticStyledString::new(), DiagnosticStyledString::new());
values.0.push_normal(t1.to_string()); push_ref(r1, mutbl1, &mut values.0);
push_ty_ref(r2, ref_ty2, mutbl2, &mut values.1); recurse(ref_ty1, t2, &mut values);
values values
} }
(_, &ty::Ref(r2, ref_ty2, mutbl2)) => {
// When encountering &T != &mut T, highlight only the borrow
(&ty::Ref(r1, ref_ty1, mutbl1), &ty::Ref(r2, ref_ty2, mutbl2))
if equals(ref_ty1, ref_ty2) =>
{
let mut values = (DiagnosticStyledString::new(), DiagnosticStyledString::new()); let mut values = (DiagnosticStyledString::new(), DiagnosticStyledString::new());
push_ty_ref(r1, ref_ty1, mutbl1, &mut values.0); push_ref(r2, mutbl2, &mut values.1);
push_ty_ref(r2, ref_ty2, mutbl2, &mut values.1); recurse(t1, ref_ty2, &mut values);
values values
} }
@ -1448,9 +1460,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
(DiagnosticStyledString::normal("("), DiagnosticStyledString::normal("(")); (DiagnosticStyledString::normal("("), DiagnosticStyledString::normal("("));
let len = args1.len(); let len = args1.len();
for (i, (left, right)) in args1.iter().zip(args2).enumerate() { for (i, (left, right)) in args1.iter().zip(args2).enumerate() {
let (x1, x2) = self.cmp(left, right); recurse(left, right, &mut values);
(values.0).0.extend(x1.0);
(values.1).0.extend(x2.0);
self.push_comma(&mut values.0, &mut values.1, len, i); self.push_comma(&mut values.0, &mut values.1, len, i);
} }
if len == 1 { if len == 1 {

View file

@ -4,8 +4,8 @@ error[E0308]: const not compatible with trait
LL | const NAME: &'a str = "unit"; LL | const NAME: &'a str = "unit";
| ^^^^^^^^^^^^^^^^^^^ lifetime mismatch | ^^^^^^^^^^^^^^^^^^^ lifetime mismatch
| |
= note: expected reference `&'static str` = note: expected reference `&'static _`
found reference `&'a str` found reference `&'a _`
note: the lifetime `'a` as defined here... note: the lifetime `'a` as defined here...
--> $DIR/associated-const-impl-wrong-lifetime.rs:6:6 --> $DIR/associated-const-impl-wrong-lifetime.rs:6:6
| |

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | debug_assert_eq!(iter.next(), Some(value)); LL | debug_assert_eq!(iter.next(), Some(value));
| ^^^^^^^^^^^ expected `Option<<I as Iterator>::Item>`, found `Option<&<I as Iterator>::Item>` | ^^^^^^^^^^^ expected `Option<<I as Iterator>::Item>`, found `Option<&<I as Iterator>::Item>`
| |
= note: expected enum `Option<<I as Iterator>::Item>` = note: expected enum `Option<_>`
found enum `Option<&<I as Iterator>::Item>` found enum `Option<&_>`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -9,8 +9,8 @@ note: type in trait
| |
LL | fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>>; LL | fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: expected signature `fn(&i32) -> Pin<Box<dyn Future<Output = i32>>>` = note: expected signature `fn(&_) -> Pin<Box<dyn Future<Output = i32>>>`
found signature `fn(&i32) -> impl Future<Output = i32>` found signature `fn(&_) -> impl Future<Output = i32>`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -22,8 +22,8 @@ error[E0308]: method not compatible with trait
LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
| |
= note: expected signature `fn(&'a isize, Inv<'c>, Inv<'c>, Inv<'_>)` = note: expected signature `fn(&'a _, Inv<'c>, Inv<'c>, Inv<'_>)`
found signature `fn(&'a isize, Inv<'_>, Inv<'c>, Inv<'_>)` found signature `fn(&'a _, Inv<'_>, Inv<'c>, Inv<'_>)`
note: the lifetime `'c` as defined here... note: the lifetime `'c` as defined here...
--> $DIR/regions-bound-missing-bound-in-impl.rs:27:24 --> $DIR/regions-bound-missing-bound-in-impl.rs:27:24
| |
@ -41,8 +41,8 @@ error[E0308]: method not compatible with trait
LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
| |
= note: expected signature `fn(&'a isize, Inv<'c>, Inv<'c>, Inv<'_>)` = note: expected signature `fn(&'a _, Inv<'c>, Inv<'c>, Inv<'_>)`
found signature `fn(&'a isize, Inv<'_>, Inv<'c>, Inv<'_>)` found signature `fn(&'a _, Inv<'_>, Inv<'c>, Inv<'_>)`
note: the lifetime `'c` as defined here... note: the lifetime `'c` as defined here...
--> $DIR/regions-bound-missing-bound-in-impl.rs:27:24 --> $DIR/regions-bound-missing-bound-in-impl.rs:27:24
| |

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | val LL | val
| ^^^ expected `Box<dyn MyTrait>`, found `&Box<dyn MyTrait>` | ^^^ expected `Box<dyn MyTrait>`, found `&Box<dyn MyTrait>`
| |
= note: expected struct `Box<(dyn MyTrait + 'static)>` = note: expected struct `Box<_>`
found reference `&Box<(dyn MyTrait + 'static)>` found reference `&Box<_>`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -25,8 +25,8 @@ error[E0308]: mismatched types
LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {}); LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {});
| ^ one type is more general than the other | ^ one type is more general than the other
| |
= note: expected fn pointer `fn(&u32)` = note: expected fn pointer `fn(&_)`
found fn pointer `for<'a> fn(&'a u32)` found fn pointer `for<'a> fn(&'a _)`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/expect-fn-supply-fn.rs:39:50 --> $DIR/expect-fn-supply-fn.rs:39:50
@ -34,8 +34,8 @@ error[E0308]: mismatched types
LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {}); LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {});
| ^ one type is more general than the other | ^ one type is more general than the other
| |
= note: expected fn pointer `for<'a> fn(&'a u32)` = note: expected fn pointer `for<'a> fn(&'a _)`
found fn pointer `fn(&u32)` found fn pointer `fn(&_)`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/expect-fn-supply-fn.rs:48:50 --> $DIR/expect-fn-supply-fn.rs:48:50
@ -43,8 +43,8 @@ error[E0308]: mismatched types
LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| { LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| {
| ^ one type is more general than the other | ^ one type is more general than the other
| |
= note: expected fn pointer `for<'a> fn(&'a u32)` = note: expected fn pointer `for<'a> fn(&'a _)`
found fn pointer `fn(&u32)` found fn pointer `fn(&_)`
error: aborting due to 5 previous errors error: aborting due to 5 previous errors

View file

@ -6,8 +6,8 @@ LL | foo(move |x| v);
| | | |
| expected due to this | expected due to this
| |
= note: expected closure signature `fn(char) -> _` = note: expected closure signature `fn(_) -> _`
found closure signature `for<'a> fn(&'a char) -> _` found closure signature `for<'a> fn(&'a _) -> _`
note: closure inferred to have a different signature due to this bound note: closure inferred to have a different signature due to this bound
--> $DIR/multiple-fn-bounds.rs:1:11 --> $DIR/multiple-fn-bounds.rs:1:11
| |

View file

@ -35,20 +35,20 @@ fn main() {
// suggest removing reference // suggest removing reference
let c: fn(u32) -> u32 = &foo; let c: fn(u32) -> u32 = &foo;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected fn pointer `fn(u32) -> u32` //~| expected fn pointer `fn(_) -> _`
//~| found reference `&fn(u32) -> u32 {foo}` //~| found reference `&fn(_) -> _ {foo}`
// suggest using reference // suggest using reference
let d: &fn(u32) -> u32 = foo; let d: &fn(u32) -> u32 = foo;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected reference `&fn(u32) -> u32` //~| expected reference `&fn(_) -> _`
//~| found fn item `fn(u32) -> u32 {foo}` //~| found fn item `fn(_) -> _ {foo}`
// suggest casting with reference // suggest casting with reference
let e: &fn(u32) -> u32 = &foo; let e: &fn(u32) -> u32 = &foo;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected reference `&fn(u32) -> u32` //~| expected reference `&fn(_) -> _`
//~| found reference `&fn(u32) -> u32 {foo}` //~| found reference `&fn(_) -> _ {foo}`
// OK // OK
let mut z: fn(u32) -> u32 = foo as fn(u32) -> u32; let mut z: fn(u32) -> u32 = foo as fn(u32) -> u32;

View file

@ -6,8 +6,8 @@ LL | let g = if n % 2 == 0 { &foo } else { &bar };
| | | |
| expected because of this | expected because of this
| |
= note: expected reference `&fn(u32) -> u32 {foo}` = note: expected reference `&fn(_) -> _ {foo}`
found reference `&fn(u32) -> u32 {bar}` found reference `&fn(_) -> _ {bar}`
= note: different fn items have unique types, even if their signatures are the same = note: different fn items have unique types, even if their signatures are the same
= help: consider casting both fn items to fn pointers using `as fn(u32) -> u32` = help: consider casting both fn items to fn pointers using `as fn(u32) -> u32`
@ -47,8 +47,8 @@ LL | let c: fn(u32) -> u32 = &foo;
| | | |
| expected due to this | expected due to this
| |
= note: expected fn pointer `fn(u32) -> u32` = note: expected fn pointer `fn(_) -> _`
found reference `&fn(u32) -> u32 {foo}` found reference `&fn(_) -> _ {foo}`
help: consider removing the reference help: consider removing the reference
| |
LL | let c: fn(u32) -> u32 = foo; LL | let c: fn(u32) -> u32 = foo;
@ -62,8 +62,8 @@ LL | let d: &fn(u32) -> u32 = foo;
| | | |
| expected due to this | expected due to this
| |
= note: expected reference `&fn(u32) -> u32` = note: expected reference `&fn(_) -> _`
found fn item `fn(u32) -> u32 {foo}` found fn item `fn(_) -> _ {foo}`
help: consider using a reference help: consider using a reference
| |
LL | let d: &fn(u32) -> u32 = &foo; LL | let d: &fn(u32) -> u32 = &foo;
@ -77,8 +77,8 @@ LL | let e: &fn(u32) -> u32 = &foo;
| | | |
| expected due to this | expected due to this
| |
= note: expected reference `&fn(u32) -> u32` = note: expected reference `&fn(_) -> _`
found reference `&fn(u32) -> u32 {foo}` found reference `&fn(_) -> _ {foo}`
= note: fn items are distinct from fn pointers = note: fn items are distinct from fn pointers
help: consider casting to a fn pointer help: consider casting to a fn pointer
| |

View file

@ -9,8 +9,8 @@ LL | fn copy(&self) -> Self::Gat<'_> where T: Copy {
LL | *self.test() LL | *self.test()
| ^^^^^^^^^^^^ expected `&T`, found type parameter `T` | ^^^^^^^^^^^^ expected `&T`, found type parameter `T`
| |
= note: expected reference `&T` = note: expected reference `&_`
found type parameter `T` found type parameter `_`
help: consider removing deref here help: consider removing deref here
| |
LL - *self.test() LL - *self.test()

View file

@ -8,8 +8,8 @@ LL | / check! { bound_a_b_ret_a_vs_bound_a_ret_a: (for<'a,'b> fn(&'a u32, &'b u3
LL | | for<'a> fn(&'a u32, &'a u32) -> &'a u32) } LL | | for<'a> fn(&'a u32, &'a u32) -> &'a u32) }
| |_____________________________________________- in this macro invocation | |_____________________________________________- in this macro invocation
| |
= note: expected enum `Option<for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32>` = note: expected enum `Option<for<'a, 'b> fn(&'a _, &'b _) -> &'a _>`
found enum `Option<for<'a> fn(&'a u32, &'a u32) -> &'a u32>` found enum `Option<for<'a> fn(&'a _, &'a _) -> &'a _>`
= note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -8,8 +8,8 @@ LL | / check! { bound_a_vs_free_x: (for<'a> fn(&'a u32),
LL | | fn(&'x u32)) } LL | | fn(&'x u32)) }
| |______________- in this macro invocation | |______________- in this macro invocation
| |
= note: expected enum `Option<for<'a> fn(&'a u32)>` = note: expected enum `Option<for<'a> fn(&'a _)>`
found enum `Option<fn(&u32)>` found enum `Option<fn(&_)>`
= note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -6,8 +6,8 @@ LL | let _: for<'b> fn(&'b u32) = foo();
| | | |
| expected due to this | expected due to this
| |
= note: expected fn pointer `for<'b> fn(&'b u32)` = note: expected fn pointer `for<'b> fn(&'b _)`
found fn pointer `fn(&u32)` found fn pointer `fn(&_)`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -15,8 +15,8 @@ note: type in trait
| |
LL | fn bar(&self) -> impl Sized; LL | fn bar(&self) -> impl Sized;
| ^^^^^^^^^^ | ^^^^^^^^^^
= note: expected signature `fn(&U) -> impl Sized` = note: expected signature `fn(&_) -> impl Sized`
found signature `fn(&U) -> U` found signature `fn(&_) -> U`
error: method with return-position `impl Trait` in trait cannot be specialized error: method with return-position `impl Trait` in trait cannot be specialized
--> $DIR/specialization-broken.rs:15:5 --> $DIR/specialization-broken.rs:15:5

View file

@ -18,8 +18,8 @@ LL | fn eq(&self, _other: &(Foo, i32)) -> bool {
| expected `a::Bar`, found opaque type | expected `a::Bar`, found opaque type
| help: change the parameter type to match the trait: `&(a::Bar, i32)` | help: change the parameter type to match the trait: `&(a::Bar, i32)`
| |
= note: expected signature `fn(&a::Bar, &(a::Bar, i32)) -> _` = note: expected signature `fn(&a::Bar, &(a::Bar, _)) -> _`
found signature `fn(&a::Bar, &(a::Foo, i32)) -> _` found signature `fn(&a::Bar, &(a::Foo, _)) -> _`
error: unconstrained opaque type error: unconstrained opaque type
--> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:18:16 --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:18:16
@ -41,8 +41,8 @@ LL | fn eq(&self, _other: &(Bar, i32)) -> bool {
| expected opaque type, found `b::Bar` | expected opaque type, found `b::Bar`
| help: change the parameter type to match the trait: `&(b::Foo, i32)` | help: change the parameter type to match the trait: `&(b::Foo, i32)`
| |
= note: expected signature `fn(&b::Bar, &(b::Foo, i32)) -> _` = note: expected signature `fn(&b::Bar, &(b::Foo, _)) -> _`
found signature `fn(&b::Bar, &(b::Bar, i32)) -> _` found signature `fn(&b::Bar, &(b::Bar, _)) -> _`
note: this item must have the opaque type in its signature in order to be able to register hidden types note: this item must have the opaque type in its signature in order to be able to register hidden types
--> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:24:12 --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:24:12
| |

View file

@ -6,8 +6,8 @@ LL | real_dispatch(f)
| | | |
| required by a bound introduced by this call | required by a bound introduced by this call
| |
= note: expected a closure with arguments `(&mut UIView<'a, T>,)` = note: expected a closure with arguments `(&mut UIView<'a, _>,)`
found a closure with arguments `(&mut UIView<'_, T>,)` found a closure with arguments `(&mut UIView<'_, _>,)`
note: required by a bound in `real_dispatch` note: required by a bound in `real_dispatch`
--> $DIR/issue-100690.rs:9:8 --> $DIR/issue-100690.rs:9:8
| |

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched `self` parameter type
LL | fn say(self: &Pair<&str, isize>) { LL | fn say(self: &Pair<&str, isize>) {
| ^^^^^^^^^^^^^^^^^^ lifetime mismatch | ^^^^^^^^^^^^^^^^^^ lifetime mismatch
| |
= note: expected struct `Pair<&str, _>` = note: expected struct `Pair<&_, _>`
found struct `Pair<&str, _>` found struct `Pair<&_, _>`
note: the anonymous lifetime defined here... note: the anonymous lifetime defined here...
--> $DIR/issue-17905-2.rs:8:24 --> $DIR/issue-17905-2.rs:8:24
| |
@ -23,8 +23,8 @@ error[E0308]: mismatched `self` parameter type
LL | fn say(self: &Pair<&str, isize>) { LL | fn say(self: &Pair<&str, isize>) {
| ^^^^^^^^^^^^^^^^^^ lifetime mismatch | ^^^^^^^^^^^^^^^^^^ lifetime mismatch
| |
= note: expected struct `Pair<&str, _>` = note: expected struct `Pair<&_, _>`
found struct `Pair<&str, _>` found struct `Pair<&_, _>`
note: the anonymous lifetime as defined here... note: the anonymous lifetime as defined here...
--> $DIR/issue-17905-2.rs:5:5 --> $DIR/issue-17905-2.rs:5:5
| |

View file

@ -9,8 +9,8 @@ LL | extern "rust-call" fn call(&self, (_,): (T,)) {}
| expected `&'a T`, found type parameter `T` | expected `&'a T`, found type parameter `T`
| help: change the parameter type to match the trait: `(&'a T,)` | help: change the parameter type to match the trait: `(&'a T,)`
| |
= note: expected signature `extern "rust-call" fn(&Foo, (&'a T,))` = note: expected signature `extern "rust-call" fn(&Foo, (&'a _,))`
found signature `extern "rust-call" fn(&Foo, (T,))` found signature `extern "rust-call" fn(&Foo, (_,))`
error[E0053]: method `call_mut` has an incompatible type for trait error[E0053]: method `call_mut` has an incompatible type for trait
--> $DIR/issue-20225.rs:11:51 --> $DIR/issue-20225.rs:11:51
@ -23,8 +23,8 @@ LL | extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {}
| expected `&'a T`, found type parameter `T` | expected `&'a T`, found type parameter `T`
| help: change the parameter type to match the trait: `(&'a T,)` | help: change the parameter type to match the trait: `(&'a T,)`
| |
= note: expected signature `extern "rust-call" fn(&mut Foo, (&'a T,))` = note: expected signature `extern "rust-call" fn(&mut Foo, (&'a _,))`
found signature `extern "rust-call" fn(&mut Foo, (T,))` found signature `extern "rust-call" fn(&mut Foo, (_,))`
error[E0053]: method `call_once` has an incompatible type for trait error[E0053]: method `call_once` has an incompatible type for trait
--> $DIR/issue-20225.rs:18:47 --> $DIR/issue-20225.rs:18:47
@ -38,8 +38,8 @@ LL | extern "rust-call" fn call_once(self, (_,): (T,)) {}
| expected `&'a T`, found type parameter `T` | expected `&'a T`, found type parameter `T`
| help: change the parameter type to match the trait: `(&'a T,)` | help: change the parameter type to match the trait: `(&'a T,)`
| |
= note: expected signature `extern "rust-call" fn(Foo, (&'a T,))` = note: expected signature `extern "rust-call" fn(Foo, (&'a _,))`
found signature `extern "rust-call" fn(Foo, (T,))` found signature `extern "rust-call" fn(Foo, (_,))`
error: aborting due to 3 previous errors error: aborting due to 3 previous errors

View file

@ -6,8 +6,8 @@ LL | let x: &fn(&B) -> u32 = &B::func;
| | | |
| expected due to this | expected due to this
| |
= note: expected reference `&for<'a> fn(&'a B) -> u32` = note: expected reference `&for<'a> fn(&'a B) -> _`
found reference `&for<'a> fn(&'a B) -> u32 {B::func}` found reference `&for<'a> fn(&'a B) -> _ {B::func}`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -4,8 +4,8 @@ error[E0308]: method not compatible with trait
LL | fn next(&'a mut self) -> Option<Self::Item> LL | fn next(&'a mut self) -> Option<Self::Item>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
| |
= note: expected signature `fn(&mut RepeatMut<'a, T>) -> Option<_>` = note: expected signature `fn(&mut RepeatMut<'_, _>) -> Option<_>`
found signature `fn(&'a mut RepeatMut<'a, T>) -> Option<_>` found signature `fn(&'a mut RepeatMut<'_, _>) -> Option<_>`
note: the anonymous lifetime as defined here... note: the anonymous lifetime as defined here...
--> $DIR/issue-37884.rs:6:5 --> $DIR/issue-37884.rs:6:5
| |

View file

@ -6,8 +6,8 @@ LL | let Some(n): &mut Option<i32> = &&Some(5i32) else { return };
| | | |
| expected due to this | expected due to this
| |
= note: expected mutable reference `&mut Option<i32>` = note: expected mutable reference `&mut Option<_>`
found reference `&&Option<i32>` found reference `&&Option<_>`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/let-else-binding-explicit-mut-annotated.rs:13:37 --> $DIR/let-else-binding-explicit-mut-annotated.rs:13:37
@ -17,8 +17,8 @@ LL | let Some(n): &mut Option<i32> = &&mut Some(5i32) else { return };
| | | |
| expected due to this | expected due to this
| |
= note: expected mutable reference `&mut Option<i32>` = note: expected mutable reference `&mut Option<_>`
found reference `&&mut Option<i32>` found reference `&&mut Option<_>`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -54,8 +54,8 @@ error[E0308]: mismatched types
LL | take_foo(|a: &i32| a); LL | take_foo(|a: &i32| a);
| ^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other | ^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
| |
= note: expected reference `&i32` = note: expected reference `&_`
found reference `&i32` found reference `&_`
note: the lifetime requirement is introduced here note: the lifetime requirement is introduced here
--> $DIR/issue-79187-2.rs:5:21 --> $DIR/issue-79187-2.rs:5:21
| |
@ -68,8 +68,8 @@ error[E0308]: mismatched types
LL | take_foo(|a: &i32| -> &i32 { a }); LL | take_foo(|a: &i32| -> &i32 { a });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
| |
= note: expected reference `&i32` = note: expected reference `&_`
found reference `&i32` found reference `&_`
note: the lifetime requirement is introduced here note: the lifetime requirement is introduced here
--> $DIR/issue-79187-2.rs:5:21 --> $DIR/issue-79187-2.rs:5:21
| |

View file

@ -12,8 +12,8 @@ LL | |
LL | | }; LL | | };
| |_____- `match` arms have incompatible types | |_____- `match` arms have incompatible types
| |
= note: expected fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8` = note: expected fn pointer `for<'a, 'b> fn(&'a _, &'b _) -> &'a _`
found fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8` found fn pointer `for<'a> fn(&'a _, &'a _) -> &'a _`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | _ => y, LL | _ => y,
| ^ one type is more general than the other | ^ one type is more general than the other
| |
= note: expected fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8` = note: expected fn pointer `for<'a, 'b> fn(&'a _, &'b _) -> &'a _`
found fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8` found fn pointer `for<'a> fn(&'a _, &'a _) -> &'a _`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -11,8 +11,8 @@ LL | |
LL | | }; LL | | };
| |_____- `match` arms have incompatible types | |_____- `match` arms have incompatible types
| |
= note: expected fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8` = note: expected fn pointer `for<'a> fn(&'a _, &'a _) -> &'a _`
found fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8` found fn pointer `for<'a, 'b> fn(&'a _, &'b _) -> &'a _`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | let Foo(ref mut y): Foo<fn(&'static str)> = x; LL | let Foo(ref mut y): Foo<fn(&'static str)> = x;
| ^^^^^^^^^ one type is more general than the other | ^^^^^^^^^ one type is more general than the other
| |
= note: expected fn pointer `for<'a> fn(&'a str)` = note: expected fn pointer `for<'a> fn(&'a _)`
found fn pointer `fn(&str)` found fn pointer `fn(&_)`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -6,8 +6,8 @@ LL | a.iter().map(|_: (u32, u32)| 45);
| | | |
| expected due to this | expected due to this
| |
= note: expected closure signature `fn(&(u32, u32)) -> _` = note: expected closure signature `fn(&(_, _)) -> _`
found closure signature `fn((u32, u32)) -> _` found closure signature `fn((_, _)) -> _`
note: required by a bound in `map` note: required by a bound in `map`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
help: consider adjusting the signature so it borrows its argument help: consider adjusting the signature so it borrows its argument

View file

@ -6,8 +6,8 @@ LL | once::<&str>("str").fuse().filter(|a: &str| true).count();
| | | |
| expected due to this | expected due to this
| |
= note: expected closure signature `for<'a> fn(&'a &str) -> _` = note: expected closure signature `for<'a> fn(&'a &_) -> _`
found closure signature `for<'a> fn(&'a str) -> _` found closure signature `for<'a> fn(&'a _) -> _`
note: required by a bound in `filter` note: required by a bound in `filter`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
help: consider adjusting the signature so it borrows its argument help: consider adjusting the signature so it borrows its argument

View file

@ -6,8 +6,8 @@ LL | needs_i32_ref_fn(foo::<()>);
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |
= note: expected fn pointer `fn(&'static i32, i32)` = note: expected fn pointer `fn(&'static _, _)`
found fn item `fn(i32, &'static i32) {foo::<()>}` found fn item `fn(_, &'static _) {foo::<()>}`
note: function defined here note: function defined here
--> $DIR/normalize-fn-sig.rs:11:4 --> $DIR/normalize-fn-sig.rs:11:4
| |

View file

@ -6,8 +6,8 @@ LL | let mut x: HashSet<Day> = v.clone();
| | | |
| expected due to this | expected due to this
| |
= note: expected struct `HashSet<Day>` = note: expected struct `HashSet<_>`
found reference `&HashSet<Day>` found reference `&HashSet<_>`
note: `HashSet<Day>` does not implement `Clone`, so `&HashSet<Day>` was cloned instead note: `HashSet<Day>` does not implement `Clone`, so `&HashSet<Day>` was cloned instead
--> $DIR/assignment-of-clone-call-on-ref-due-to-missing-bound.rs:18:39 --> $DIR/assignment-of-clone-call-on-ref-due-to-missing-bound.rs:18:39
| |

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | let a: for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32 = make_it(); LL | let a: for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32 = make_it();
| ^^^^^^^^^ one type is more general than the other | ^^^^^^^^^ one type is more general than the other
| |
= note: expected fn pointer `for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32` = note: expected fn pointer `for<'a, 'b> fn(&'a _, &'b _) -> &'a _`
found fn pointer `for<'a> fn(&'a u32, &'a u32) -> &'a u32` found fn pointer `for<'a> fn(&'a _, &'a _) -> &'a _`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/hr-fn-aaa-as-aba.rs:20:12 --> $DIR/hr-fn-aaa-as-aba.rs:20:12
@ -13,8 +13,8 @@ error[E0308]: mismatched types
LL | let _: for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32 = make_it(); LL | let _: for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32 = make_it();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
| |
= note: expected fn pointer `for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32` = note: expected fn pointer `for<'a, 'b> fn(&'a _, &'b _) -> &'a _`
found fn pointer `for<'a> fn(&'a u32, &'a u32) -> &'a u32` found fn pointer `for<'a> fn(&'a _, &'a _) -> &'a _`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | let b: fn(&u32) -> &u32 = a; LL | let b: fn(&u32) -> &u32 = a;
| ^ one type is more general than the other | ^ one type is more general than the other
| |
= note: expected fn pointer `for<'a> fn(&'a u32) -> &'a u32` = note: expected fn pointer `for<'a> fn(&'a _) -> &'a _`
found fn pointer `fn(&u32) -> &u32` found fn pointer `fn(&_) -> &_`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -4,8 +4,8 @@ error[E0308]: const not compatible with trait
LL | const AC: Option<&'c str> = None; LL | const AC: Option<&'c str> = None;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | ^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
| |
= note: expected enum `Option<&'b str>` = note: expected enum `Option<&'b _>`
found enum `Option<&'c str>` found enum `Option<&'c _>`
note: the lifetime `'c` as defined here... note: the lifetime `'c` as defined here...
--> $DIR/trait-associated-constant.rs:20:18 --> $DIR/trait-associated-constant.rs:20:18
| |

View file

@ -57,8 +57,8 @@ LL | let (Ok(ref a) | Err(ref mut a)): Result<&u8, &mut u8> = Ok(&0);
| | types differ in mutability | | types differ in mutability
| first introduced with type `&&u8` here | first introduced with type `&&u8` here
| |
= note: expected reference `&&u8` = note: expected reference `&&_`
found mutable reference `&mut &mut u8` found mutable reference `&mut &mut _`
= note: a binding must have the same type in all alternatives = note: a binding must have the same type in all alternatives
error[E0308]: mismatched types error[E0308]: mismatched types

View file

@ -6,8 +6,8 @@ LL | demo(tell(1)..tell(10));
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |
= note: expected reference `&std::ops::Range<usize>` = note: expected reference `&std::ops::Range<_>`
found struct `std::ops::Range<usize>` found struct `std::ops::Range<_>`
note: function defined here note: function defined here
--> $DIR/issue-73553-misinterp-range-literal.rs:3:4 --> $DIR/issue-73553-misinterp-range-literal.rs:3:4
| |

View file

@ -6,8 +6,8 @@ LL | fn f<'r>(f: fn(Cell<(&'r i32, &i32)>)) -> Ty {
LL | f LL | f
| ^ one type is more general than the other | ^ one type is more general than the other
| |
= note: expected fn pointer `for<'r> fn(Cell<(&'r i32, &'r i32)>)` = note: expected fn pointer `for<'r> fn(Cell<(&'r _, &'r _)>)`
found fn pointer `for<'a> fn(Cell<(&'r i32, &'a i32)>)` found fn pointer `for<'a> fn(Cell<(&'r _, &'a _)>)`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -6,8 +6,8 @@ LL | let _: fn(&mut &isize, &mut &isize) = a;
| | | |
| expected due to this | expected due to this
| |
= note: expected fn pointer `for<'a, 'b, 'c, 'd> fn(&'a mut &'b isize, &'c mut &'d isize)` = note: expected fn pointer `for<'a, 'b, 'c, 'd> fn(&'a mut &'b _, &'c mut &'d _)`
found fn item `for<'a, 'b> fn(&'a mut &isize, &'b mut &isize) {a::<'_, '_>}` found fn item `for<'a, 'b> fn(&'a mut &_, &'b mut &_) {a::<'_, '_>}`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -6,8 +6,8 @@ LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
| | | |
| expected due to this | expected due to this
| |
= note: expected fn pointer `for<'a, 'b, 'c, 'd, 'e, 'f> fn(&'a mut &'b isize, &'c mut &'d isize, &'e mut &'f isize)` = note: expected fn pointer `for<'a, 'b, 'c, 'd, 'e, 'f> fn(&'a mut &'b _, &'c mut &'d _, &'e mut &'f _)`
found fn item `for<'a, 'b, 'c> fn(&'a mut &isize, &'b mut &isize, &'c mut &isize) {a::<'_, '_, '_>}` found fn item `for<'a, 'b, 'c> fn(&'a mut &_, &'b mut &_, &'c mut &_) {a::<'_, '_, '_>}`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -6,8 +6,8 @@ LL | let _: fn(&mut &isize, &mut &isize) = a;
| | | |
| expected due to this | expected due to this
| |
= note: expected fn pointer `for<'a, 'b, 'c, 'd> fn(&'a mut &'b isize, &'c mut &'d isize)` = note: expected fn pointer `for<'a, 'b, 'c, 'd> fn(&'a mut &'b _, &'c mut &'d _)`
found fn item `for<'a, 'b> fn(&'a mut &isize, &'b mut &isize) {a::<'_, '_>}` found fn item `for<'a, 'b> fn(&'a mut &_, &'b mut &_) {a::<'_, '_>}`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -62,8 +62,8 @@ LL | Opts::A(ref mut i) | Opts::B(ref i) => {}
| | | |
| first introduced with type `&mut isize` here | first introduced with type `&mut isize` here
| |
= note: expected mutable reference `&mut isize` = note: expected mutable reference `&mut _`
found reference `&isize` found reference `&_`
= note: in the same arm, a binding must have the same type in all alternatives = note: in the same arm, a binding must have the same type in all alternatives
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View file

@ -6,8 +6,8 @@ LL | match &s {
LL | "abc" => true, LL | "abc" => true,
| ^^^^^ expected `&&str`, found `&str` | ^^^^^ expected `&&str`, found `&str`
| |
= note: expected reference `&&str` = note: expected reference `&&_`
found reference `&'static str` found reference `&'static _`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/lit.rs:16:9 --> $DIR/lit.rs:16:9

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | fn y(&self, y: f64) -> Self { P{y, .. self.clone() } } LL | fn y(&self, y: f64) -> Self { P{y, .. self.clone() } }
| ^^^^^^^^^^^^ expected `P<T>`, found `&P<T>` | ^^^^^^^^^^^^ expected `P<T>`, found `&P<T>`
| |
= note: expected struct `P<T>` = note: expected struct `P<_>`
found reference `&P<T>` found reference `&P<_>`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | func: &foo, LL | func: &foo,
| ^^^^ expected `&fn() -> Option<isize>`, found `&fn() -> Option<isize> {foo}` | ^^^^ expected `&fn() -> Option<isize>`, found `&fn() -> Option<isize> {foo}`
| |
= note: expected reference `&fn() -> Option<isize>` = note: expected reference `&fn() -> Option<_>`
found reference `&fn() -> Option<isize> {foo}` found reference `&fn() -> Option<_> {foo}`
= note: fn items are distinct from fn pointers = note: fn items are distinct from fn pointers
help: consider casting to a fn pointer help: consider casting to a fn pointer
| |

View file

@ -78,8 +78,8 @@ LL | let y: Option<&usize> = x;
| | | |
| expected due to this | expected due to this
| |
= note: expected enum `Option<&usize>` = note: expected enum `Option<&_>`
found reference `&Option<usize>` found reference `&Option<_>`
help: try using `.as_ref()` to convert `&Option<usize>` to `Option<&usize>` help: try using `.as_ref()` to convert `&Option<usize>` to `Option<&usize>`
| |
LL | let y: Option<&usize> = x.as_ref(); LL | let y: Option<&usize> = x.as_ref();
@ -93,8 +93,8 @@ LL | let y: Result<&usize, &usize> = x;
| | | |
| expected due to this | expected due to this
| |
= note: expected enum `Result<&usize, &usize>` = note: expected enum `Result<&_, &_>`
found reference `&Result<usize, usize>` found reference `&Result<_, _>`
help: try using `.as_ref()` to convert `&Result<usize, usize>` to `Result<&usize, &usize>` help: try using `.as_ref()` to convert `&Result<usize, usize>` to `Result<&usize, &usize>`
| |
LL | let y: Result<&usize, &usize> = x.as_ref(); LL | let y: Result<&usize, &usize> = x.as_ref();
@ -108,8 +108,8 @@ LL | let y: Result<&usize, usize> = x;
| | | |
| expected due to this | expected due to this
| |
= note: expected enum `Result<&usize, usize>` = note: expected enum `Result<&_, _>`
found reference `&Result<usize, usize>` found reference `&Result<_, _>`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/as-ref.rs:22:42 --> $DIR/as-ref.rs:22:42

View file

@ -8,8 +8,8 @@ LL | fn wat<T>(t: &T) -> T {
LL | t.clone() LL | t.clone()
| ^^^^^^^^^ expected type parameter `T`, found `&T` | ^^^^^^^^^ expected type parameter `T`, found `&T`
| |
= note: expected type parameter `T` = note: expected type parameter `_`
found reference `&T` found reference `&_`
note: `T` does not implement `Clone`, so `&T` was cloned instead note: `T` does not implement `Clone`, so `&T` was cloned instead
--> $DIR/clone-on-unconstrained-borrowed-type-param.rs:3:5 --> $DIR/clone-on-unconstrained-borrowed-type-param.rs:3:5
| |

View file

@ -18,8 +18,8 @@ LL | fn method(&self) -> Option<&Vec<u8>> {
LL | self.option..as_ref().map(|x| x) LL | self.option..as_ref().map(|x| x)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Option<&Vec<u8>>`, found `Range<Option<Vec<u8>>>` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Option<&Vec<u8>>`, found `Range<Option<Vec<u8>>>`
| |
= note: expected enum `Option<&Vec<u8>>` = note: expected enum `Option<&Vec<_>>`
found struct `std::ops::Range<Option<Vec<u8>>>` found struct `std::ops::Range<Option<Vec<_>>>`
help: you likely meant to write a method call instead of a range help: you likely meant to write a method call instead of a range
| |
LL - self.option..as_ref().map(|x| x) LL - self.option..as_ref().map(|x| x)

View file

@ -32,8 +32,8 @@ LL | fn suggestion2(opt: &mut Option<String>) {
LL | opt = Some(String::new()) LL | opt = Some(String::new())
| ^^^^^^^^^^^^^^^^^^^ expected `&mut Option<String>`, found `Option<String>` | ^^^^^^^^^^^^^^^^^^^ expected `&mut Option<String>`, found `Option<String>`
| |
= note: expected mutable reference `&mut Option<String>` = note: expected mutable reference `&mut Option<_>`
found enum `Option<String>` found enum `Option<_>`
help: consider dereferencing here to assign to the mutably borrowed value help: consider dereferencing here to assign to the mutably borrowed value
| |
LL | *opt = Some(String::new()) LL | *opt = Some(String::new())

View file

@ -9,8 +9,8 @@ note: type in trait
| |
LL | fn jumbo(&self, x: &usize) -> usize; LL | fn jumbo(&self, x: &usize) -> usize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: expected signature `fn(&usize, &usize) -> usize` = note: expected signature `fn(&_, &_) -> usize`
found signature `unsafe fn(&usize, &usize)` found signature `unsafe fn(&_, &_)`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -7,8 +7,8 @@ LL | fn mul(self, s: &f64) -> Vec1 {
| expected `f64`, found `&f64` | expected `f64`, found `&f64`
| help: change the parameter type to match the trait: `f64` | help: change the parameter type to match the trait: `f64`
| |
= note: expected signature `fn(Vec1, f64) -> Vec1` = note: expected signature `fn(Vec1, _) -> Vec1`
found signature `fn(Vec1, &f64) -> Vec1` found signature `fn(Vec1, &_) -> Vec1`
error[E0053]: method `mul` has an incompatible type for trait error[E0053]: method `mul` has an incompatible type for trait
--> $DIR/wrong-mul-method-signature.rs:33:21 --> $DIR/wrong-mul-method-signature.rs:33:21

View file

@ -25,8 +25,8 @@ LL | bar(v);
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |
= note: expected struct `Vec<i32>` = note: expected struct `Vec<_>`
found struct `Vec<&i32>` found struct `Vec<&_>`
note: function defined here note: function defined here
--> $DIR/point-at-inference-2.rs:1:4 --> $DIR/point-at-inference-2.rs:1:4
| |
@ -43,8 +43,8 @@ LL | bar(v);
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |
= note: expected struct `Vec<i32>` = note: expected struct `Vec<_>`
found struct `Vec<&i32>` found struct `Vec<&_>`
note: function defined here note: function defined here
--> $DIR/point-at-inference-2.rs:1:4 --> $DIR/point-at-inference-2.rs:1:4
| |

View file

@ -382,8 +382,8 @@ LL | want::<&Foo<foo>>(f);
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |
= note: expected reference `&Foo<foo>` = note: expected reference `&Foo<_>`
found struct `Foo<foo>` found struct `Foo<_>`
note: function defined here note: function defined here
--> $DIR/type-mismatch.rs:14:4 --> $DIR/type-mismatch.rs:14:4
| |
@ -402,8 +402,8 @@ LL | want::<&Foo<foo, B>>(f);
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |
= note: expected reference `&Foo<foo, B>` = note: expected reference `&Foo<_, B>`
found struct `Foo<foo>` found struct `Foo<_, A>`
note: function defined here note: function defined here
--> $DIR/type-mismatch.rs:14:4 --> $DIR/type-mismatch.rs:14:4
| |
@ -546,8 +546,8 @@ LL | want::<&Foo<foo>>(f);
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |
= note: expected reference `&Foo<foo>` = note: expected reference `&Foo<_, A>`
found struct `Foo<foo, B>` found struct `Foo<_, B>`
note: function defined here note: function defined here
--> $DIR/type-mismatch.rs:14:4 --> $DIR/type-mismatch.rs:14:4
| |
@ -562,8 +562,8 @@ LL | want::<&Foo<foo, B>>(f);
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |
= note: expected reference `&Foo<foo, B>` = note: expected reference `&Foo<_, _>`
found struct `Foo<foo, B>` found struct `Foo<_, _>`
note: function defined here note: function defined here
--> $DIR/type-mismatch.rs:14:4 --> $DIR/type-mismatch.rs:14:4
| |
@ -726,8 +726,8 @@ LL | want::<&Foo<foo>>(f);
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |
= note: expected reference `&Foo<foo>` = note: expected reference `&Foo<_, A, B>`
found struct `Foo<foo, B, A>` found struct `Foo<_, B, A>`
note: function defined here note: function defined here
--> $DIR/type-mismatch.rs:14:4 --> $DIR/type-mismatch.rs:14:4
| |
@ -742,8 +742,8 @@ LL | want::<&Foo<foo, B>>(f);
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |
= note: expected reference `&Foo<foo, B>` = note: expected reference `&Foo<_, _, B>`
found struct `Foo<foo, B, A>` found struct `Foo<_, _, A>`
note: function defined here note: function defined here
--> $DIR/type-mismatch.rs:14:4 --> $DIR/type-mismatch.rs:14:4
| |

View file

@ -44,8 +44,8 @@ LL | fn index<'a, K, V>(map: &'a HashMap<K, V>, k: K) -> &'a V {
LL | map[k] LL | map[k]
| ^ expected `&K`, found type parameter `K` | ^ expected `&K`, found type parameter `K`
| |
= note: expected reference `&K` = note: expected reference `&_`
found type parameter `K` found type parameter `_`
help: consider borrowing here help: consider borrowing here
| |
LL | map[&k] LL | map[&k]
@ -59,8 +59,8 @@ LL | fn index<'a, K, V>(map: &'a HashMap<K, V>, k: K) -> &'a V {
LL | map[k] LL | map[k]
| ^^^^^^ expected `&V`, found type parameter `V` | ^^^^^^ expected `&V`, found type parameter `V`
| |
= note: expected reference `&'a V` = note: expected reference `&'a _`
found type parameter `V` found type parameter `_`
help: consider borrowing here help: consider borrowing here
| |
LL | &map[k] LL | &map[k]

View file

@ -12,8 +12,8 @@ note: type in trait
| |
LL | fn values(&self) -> Self::Values; LL | fn values(&self) -> Self::Values;
| ^^^^^ | ^^^^^
= note: expected signature `fn(&Option<T>)` = note: expected signature `fn(&Option<_>)`
found signature `fn(Option<T>)` found signature `fn(Option<_>)`
error[E0631]: type mismatch in function arguments error[E0631]: type mismatch in function arguments
--> $DIR/mismatched-map-under-self.rs:12:18 --> $DIR/mismatched-map-under-self.rs:12:18

View file

@ -39,12 +39,12 @@ impl<'a, T> SomeTrait for &'a Bar<T> {
//~| ERROR has an incompatible type for trait //~| ERROR has an incompatible type for trait
fn dummy3(self: &&Bar<T>) {} fn dummy3(self: &&Bar<T>) {}
//~^ ERROR mismatched `self` parameter type //~^ ERROR mismatched `self` parameter type
//~| expected reference `&'a Bar<T>` //~| expected reference `&'a Bar<_>`
//~| found reference `&Bar<T>` //~| found reference `&Bar<_>`
//~| lifetime mismatch //~| lifetime mismatch
//~| ERROR mismatched `self` parameter type //~| ERROR mismatched `self` parameter type
//~| expected reference `&'a Bar<T>` //~| expected reference `&'a Bar<_>`
//~| found reference `&Bar<T>` //~| found reference `&Bar<_>`
//~| lifetime mismatch //~| lifetime mismatch
} }

View file

@ -31,8 +31,8 @@ error[E0308]: mismatched `self` parameter type
LL | fn dummy2(self: &Bar<T>) {} LL | fn dummy2(self: &Bar<T>) {}
| ^^^^^^^ lifetime mismatch | ^^^^^^^ lifetime mismatch
| |
= note: expected reference `&'a Bar<T>` = note: expected reference `&'a Bar<_>`
found reference `&Bar<T>` found reference `&Bar<_>`
note: the anonymous lifetime defined here... note: the anonymous lifetime defined here...
--> $DIR/ufcs-explicit-self-bad.rs:37:21 --> $DIR/ufcs-explicit-self-bad.rs:37:21
| |
@ -50,8 +50,8 @@ error[E0308]: mismatched `self` parameter type
LL | fn dummy2(self: &Bar<T>) {} LL | fn dummy2(self: &Bar<T>) {}
| ^^^^^^^ lifetime mismatch | ^^^^^^^ lifetime mismatch
| |
= note: expected reference `&'a Bar<T>` = note: expected reference `&'a Bar<_>`
found reference `&Bar<T>` found reference `&Bar<_>`
note: the lifetime `'a` as defined here... note: the lifetime `'a` as defined here...
--> $DIR/ufcs-explicit-self-bad.rs:35:6 --> $DIR/ufcs-explicit-self-bad.rs:35:6
| |
@ -69,8 +69,8 @@ error[E0308]: mismatched `self` parameter type
LL | fn dummy3(self: &&Bar<T>) {} LL | fn dummy3(self: &&Bar<T>) {}
| ^^^^^^^^ lifetime mismatch | ^^^^^^^^ lifetime mismatch
| |
= note: expected reference `&'a Bar<T>` = note: expected reference `&'a Bar<_>`
found reference `&Bar<T>` found reference `&Bar<_>`
note: the anonymous lifetime defined here... note: the anonymous lifetime defined here...
--> $DIR/ufcs-explicit-self-bad.rs:40:22 --> $DIR/ufcs-explicit-self-bad.rs:40:22
| |
@ -88,8 +88,8 @@ error[E0308]: mismatched `self` parameter type
LL | fn dummy3(self: &&Bar<T>) {} LL | fn dummy3(self: &&Bar<T>) {}
| ^^^^^^^^ lifetime mismatch | ^^^^^^^^ lifetime mismatch
| |
= note: expected reference `&'a Bar<T>` = note: expected reference `&'a Bar<_>`
found reference `&Bar<T>` found reference `&Bar<_>`
note: the lifetime `'a` as defined here... note: the lifetime `'a` as defined here...
--> $DIR/ufcs-explicit-self-bad.rs:35:6 --> $DIR/ufcs-explicit-self-bad.rs:35:6
| |
@ -115,8 +115,8 @@ note: type in trait
| |
LL | fn dummy2(&self); LL | fn dummy2(&self);
| ^^^^^ | ^^^^^
= note: expected signature `fn(&&'a Bar<T>)` = note: expected signature `fn(&&'a Bar<_>)`
found signature `fn(&Bar<T>)` found signature `fn(&Bar<_>)`
error: aborting due to 8 previous errors error: aborting due to 8 previous errors

View file

@ -7,8 +7,8 @@ trait Foo {
impl Foo for u32 { impl Foo for u32 {
fn len(&self) -> u32 { *self } fn len(&self) -> u32 { *self }
//~^ ERROR method `len` has an incompatible type for trait //~^ ERROR method `len` has an incompatible type for trait
//~| expected signature `unsafe fn(&u32) -> _` //~| expected signature `unsafe fn(&_) -> _`
//~| found signature `fn(&u32) -> _` //~| found signature `fn(&_) -> _`
} }
fn main() { } fn main() { }

View file

@ -9,8 +9,8 @@ note: type in trait
| |
LL | unsafe fn len(&self) -> u32; LL | unsafe fn len(&self) -> u32;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: expected signature `unsafe fn(&u32) -> _` = note: expected signature `unsafe fn(&_) -> _`
found signature `fn(&u32) -> _` found signature `fn(&_) -> _`
error: aborting due to 1 previous error error: aborting due to 1 previous error