1
Fork 0

Specific labels when referring to "expected" and "found" types

This commit is contained in:
Esteban Küber 2019-11-13 14:16:56 -08:00
parent a0d40f8bdf
commit 83ffda5216
406 changed files with 1598 additions and 1518 deletions

View file

@ -1197,18 +1197,25 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
}; };
if let Some((expected, found)) = expected_found { if let Some((expected, found)) = expected_found {
let expected_label = exp_found.map(|ef| ef.expected.prefix_string())
.unwrap_or("type".into());
let found_label = exp_found.map(|ef| ef.found.prefix_string())
.unwrap_or("type".into());
match (terr, is_simple_error, expected == found) { match (terr, is_simple_error, expected == found) {
(&TypeError::Sorts(ref values), false, true) => { (&TypeError::Sorts(ref values), false, extra) => {
let sort_string = | a_type: Ty<'tcx> | let sort_string = |ty: Ty<'tcx>| match (extra, &ty.kind) {
if let ty::Opaque(def_id, _) = a_type.kind { (true, ty::Opaque(def_id, _)) => format!(
format!(" (opaque type at {})", self.tcx.sess.source_map() " (opaque type at {})",
.mk_substr_filename(self.tcx.def_span(def_id))) self.tcx.sess.source_map()
} else { .mk_substr_filename(self.tcx.def_span(*def_id)),
format!(" ({})", a_type.sort_string(self.tcx)) ),
(true, _) => format!(" ({})", ty.sort_string(self.tcx)),
(false, _) => "".to_string(),
}; };
diag.note_expected_found_extra( diag.note_expected_found_extra(
&"type", &expected_label,
expected, expected,
&found_label,
found, found,
&sort_string(values.expected), &sort_string(values.expected),
&sort_string(values.found), &sort_string(values.found),
@ -1222,15 +1229,14 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
"note_type_err: exp_found={:?}, expected={:?} found={:?}", "note_type_err: exp_found={:?}, expected={:?} found={:?}",
exp_found, expected, found exp_found, expected, found
); );
if let Some(exp_found) = exp_found { diag.note_expected_found(&expected_label, expected, &found_label, found);
self.suggest_as_ref_where_appropriate(span, &exp_found, diag);
}
diag.note_expected_found(&"type", expected, found);
} }
_ => (), _ => (),
} }
} }
if let Some(exp_found) = exp_found {
self.suggest_as_ref_where_appropriate(span, &exp_found, diag);
}
// In some (most?) cases cause.body_id points to actual body, but in some cases // In some (most?) cases cause.body_id points to actual body, but in some cases
// it's a actual definition. According to the comments (e.g. in // it's a actual definition. According to the comments (e.g. in

View file

@ -246,6 +246,37 @@ impl<'tcx> ty::TyS<'tcx> {
ty::Error => "type error".into(), ty::Error => "type error".into(),
} }
} }
pub fn prefix_string(&self) -> Cow<'static, str> {
debug!("prefix_string {:?} {} {:?}", self, self, self.kind);
match self.kind {
ty::Infer(_) | ty::Error | ty::Bool | ty::Char | ty::Int(_) |
ty::Uint(_) | ty::Float(_) | ty::Str | ty::Never => "type".into(),
ty::Tuple(ref tys) if tys.is_empty() => "type".into(),
ty::Adt(def, _) => def.descr().into(),
ty::Foreign(_) => "extern type".into(),
ty::Array(..) => "array".into(),
ty::Slice(_) => "slice".into(),
ty::RawPtr(_) => "raw pointer".into(),
ty::Ref(.., mutbl) => match mutbl {
hir::Mutability::Mutable => "mutable reference",
_ => "reference"
}.into(),
ty::FnDef(..) => "fn item".into(),
ty::FnPtr(_) => "fn pointer".into(),
ty::Dynamic(..) => "trait".into(),
ty::Closure(..) => "closure".into(),
ty::Generator(..) => "generator".into(),
ty::GeneratorWitness(..) => "generator witness".into(),
ty::Tuple(..) => "tuple".into(),
ty::Placeholder(..) => "placeholder type".into(),
ty::Bound(..) => "bound type".into(),
ty::Projection(_) => "associated type".into(),
ty::UnnormalizedProjection(_) => "associated type".into(),
ty::Param(_) => "type parameter".into(),
ty::Opaque(..) => "opaque type".into(),
}
}
} }
impl<'tcx> TyCtxt<'tcx> { impl<'tcx> TyCtxt<'tcx> {

View file

@ -143,20 +143,21 @@ impl Diagnostic {
self self
} }
pub fn note_expected_found(&mut self, pub fn note_expected_found(
label: &dyn fmt::Display, &mut self,
expected_label: &dyn fmt::Display,
expected: DiagnosticStyledString, expected: DiagnosticStyledString,
found: DiagnosticStyledString) found_label: &dyn fmt::Display,
-> &mut Self found: DiagnosticStyledString,
{ ) -> &mut Self {
self.note_expected_found_extra(label, expected, found, &"", &"") self.note_expected_found_extra(expected_label, expected, found_label, found, &"", &"")
} }
pub fn note_unsuccessfull_coercion(&mut self, pub fn note_unsuccessfull_coercion(
&mut self,
expected: DiagnosticStyledString, expected: DiagnosticStyledString,
found: DiagnosticStyledString) found: DiagnosticStyledString,
-> &mut Self ) -> &mut Self {
{
let mut msg: Vec<_> = let mut msg: Vec<_> =
vec![(format!("required when trying to coerce from type `"), vec![(format!("required when trying to coerce from type `"),
Style::NoStyle)]; Style::NoStyle)];
@ -178,22 +179,33 @@ impl Diagnostic {
self self
} }
pub fn note_expected_found_extra(&mut self, pub fn note_expected_found_extra(
label: &dyn fmt::Display, &mut self,
expected_label: &dyn fmt::Display,
expected: DiagnosticStyledString, expected: DiagnosticStyledString,
found_label: &dyn fmt::Display,
found: DiagnosticStyledString, found: DiagnosticStyledString,
expected_extra: &dyn fmt::Display, expected_extra: &dyn fmt::Display,
found_extra: &dyn fmt::Display) found_extra: &dyn fmt::Display,
-> &mut Self ) -> &mut Self {
{ let expected_label = format!("expected {}", expected_label);
let mut msg: Vec<_> = vec![(format!("expected {} `", label), Style::NoStyle)]; let found_label = format!("found {}", found_label);
let (found_padding, expected_padding) = if expected_label.len() > found_label.len() {
(expected_label.len() - found_label.len(), 0)
} else {
(0, found_label.len() - expected_label.len())
};
let mut msg: Vec<_> = vec![(
format!("{}{} `", " ".repeat(expected_padding), expected_label),
Style::NoStyle,
)];
msg.extend(expected.0.iter() msg.extend(expected.0.iter()
.map(|x| match *x { .map(|x| match *x {
StringPart::Normal(ref s) => (s.to_owned(), Style::NoStyle), StringPart::Normal(ref s) => (s.to_owned(), Style::NoStyle),
StringPart::Highlighted(ref s) => (s.to_owned(), Style::Highlight), StringPart::Highlighted(ref s) => (s.to_owned(), Style::Highlight),
})); }));
msg.push((format!("`{}\n", expected_extra), Style::NoStyle)); msg.push((format!("`{}\n", expected_extra), Style::NoStyle));
msg.push((format!(" found {} `", label), Style::NoStyle)); msg.push((format!("{}{} `", " ".repeat(found_padding), found_label), Style::NoStyle));
msg.extend(found.0.iter() msg.extend(found.0.iter()
.map(|x| match *x { .map(|x| match *x {
StringPart::Normal(ref s) => (s.to_owned(), Style::NoStyle), StringPart::Normal(ref s) => (s.to_owned(), Style::NoStyle),

View file

@ -195,34 +195,41 @@ impl<'a> DiagnosticBuilder<'a> {
self self
} }
forward!(pub fn note_expected_found(&mut self, forward!(pub fn note_expected_found(
label: &dyn fmt::Display, &mut self,
expected_label: &dyn fmt::Display,
expected: DiagnosticStyledString, expected: DiagnosticStyledString,
found_label: &dyn fmt::Display,
found: DiagnosticStyledString, found: DiagnosticStyledString,
) -> &mut Self); ) -> &mut Self);
forward!(pub fn note_expected_found_extra(&mut self, forward!(pub fn note_expected_found_extra(
label: &dyn fmt::Display, &mut self,
expected_label: &dyn fmt::Display,
expected: DiagnosticStyledString, expected: DiagnosticStyledString,
found_label: &dyn fmt::Display,
found: DiagnosticStyledString, found: DiagnosticStyledString,
expected_extra: &dyn fmt::Display, expected_extra: &dyn fmt::Display,
found_extra: &dyn fmt::Display, found_extra: &dyn fmt::Display,
) -> &mut Self); ) -> &mut Self);
forward!(pub fn note_unsuccessfull_coercion(&mut self, forward!(pub fn note_unsuccessfull_coercion(
&mut self,
expected: DiagnosticStyledString, expected: DiagnosticStyledString,
found: DiagnosticStyledString, found: DiagnosticStyledString,
) -> &mut Self); ) -> &mut Self);
forward!(pub fn note(&mut self, msg: &str) -> &mut Self); forward!(pub fn note(&mut self, msg: &str) -> &mut Self);
forward!(pub fn span_note<S: Into<MultiSpan>>(&mut self, forward!(pub fn span_note<S: Into<MultiSpan>>(
&mut self,
sp: S, sp: S,
msg: &str, msg: &str,
) -> &mut Self); ) -> &mut Self);
forward!(pub fn warn(&mut self, msg: &str) -> &mut Self); forward!(pub fn warn(&mut self, msg: &str) -> &mut Self);
forward!(pub fn span_warn<S: Into<MultiSpan>>(&mut self, sp: S, msg: &str) -> &mut Self); forward!(pub fn span_warn<S: Into<MultiSpan>>(&mut self, sp: S, msg: &str) -> &mut Self);
forward!(pub fn help(&mut self, msg: &str) -> &mut Self); forward!(pub fn help(&mut self, msg: &str) -> &mut Self);
forward!(pub fn span_help<S: Into<MultiSpan>>(&mut self, forward!(pub fn span_help<S: Into<MultiSpan>>(
&mut self,
sp: S, sp: S,
msg: &str, msg: &str,
) -> &mut Self); ) -> &mut Self);

View file

@ -17,7 +17,7 @@ LL | |_: [_; break]| {}
| ^^^^^^^^^^^^^^^^^^ expected (), found closure | ^^^^^^^^^^^^^^^^^^ expected (), found closure
| |
= note: expected type `()` = note: expected type `()`
found type `[closure@$DIR/array-break-length.rs:3:9: 3:27]` found closure `[closure@$DIR/array-break-length.rs:3:9: 3:27]`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/array-break-length.rs:8:9 --> $DIR/array-break-length.rs:8:9
@ -26,7 +26,7 @@ LL | |_: [_; continue]| {}
| ^^^^^^^^^^^^^^^^^^^^^ expected (), found closure | ^^^^^^^^^^^^^^^^^^^^^ expected (), found closure
| |
= note: expected type `()` = note: expected type `()`
found type `[closure@$DIR/array-break-length.rs:8:9: 8:30]` found closure `[closure@$DIR/array-break-length.rs:8:9: 8:30]`
error: aborting due to 4 previous errors error: aborting due to 4 previous errors

View file

@ -2,13 +2,13 @@ fn main() {
let _x: i32 = [1, 2, 3]; let _x: i32 = [1, 2, 3];
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `i32` //~| expected type `i32`
//~| found type `[{integer}; 3]` //~| found array `[{integer}; 3]`
//~| expected i32, found array of 3 elements //~| expected i32, found array of 3 elements
let x: &[i32] = &[1, 2, 3]; let x: &[i32] = &[1, 2, 3];
let _y: &i32 = x; let _y: &i32 = x;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `&i32` //~| expected reference `&i32`
//~| found type `&[i32]` //~| found reference `&[i32]`
//~| expected i32, found slice //~| expected i32, found slice
} }

View file

@ -5,7 +5,7 @@ LL | let _x: i32 = [1, 2, 3];
| ^^^^^^^^^ expected i32, found array of 3 elements | ^^^^^^^^^ expected i32, found array of 3 elements
| |
= note: expected type `i32` = note: expected type `i32`
found type `[{integer}; 3]` found array `[{integer}; 3]`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/array-not-vector.rs:9:20 --> $DIR/array-not-vector.rs:9:20
@ -13,8 +13,8 @@ error[E0308]: mismatched types
LL | let _y: &i32 = x; LL | let _y: &i32 = x;
| ^ expected i32, found slice | ^ expected i32, found slice
| |
= note: expected type `&i32` = note: expected reference `&i32`
found type `&[i32]` found reference `&[i32]`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -7,8 +7,8 @@ LL | const FROM: Self::Out;
LL | const FROM: &'static str = "foo"; LL | const FROM: &'static str = "foo";
| ^^^^^^^^^^^^ expected associated type, found reference | ^^^^^^^^^^^^ expected associated type, found reference
| |
= note: expected type `<T as Foo>::Out` = note: expected associated type `<T as Foo>::Out`
found type `&'static str` found reference `&'static str`
= note: consider constraining the associated type `<T as Foo>::Out` to `&'static str` or calling a method that returns `<T as Foo>::Out` = note: consider constraining the associated type `<T as Foo>::Out` to `&'static str` or calling a method that returns `<T as Foo>::Out`
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | const NAME: &'a str = "unit"; LL | const NAME: &'a str = "unit";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
| |
= note: expected type `&'static str` = note: expected reference `&'static str`
found type `&'a str` found reference `&'a str`
note: the lifetime `'a` as defined on the impl at 6:6... note: the lifetime `'a` as defined on the impl at 6:6...
--> $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 | fn b() { dent(ModelT, Blue); } LL | fn b() { dent(ModelT, Blue); }
| ^^^^ expected struct `Black`, found struct `Blue` | ^^^^ expected struct `Black`, found struct `Blue`
| |
= note: expected type `Black` = note: expected struct `Black`
found type `Blue` found struct `Blue`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/associated-type-projection-from-supertrait.rs:28:23 --> $DIR/associated-type-projection-from-supertrait.rs:28:23
@ -13,8 +13,8 @@ error[E0308]: mismatched types
LL | fn c() { dent(ModelU, Black); } LL | fn c() { dent(ModelU, Black); }
| ^^^^^ expected struct `Blue`, found struct `Black` | ^^^^^ expected struct `Blue`, found struct `Black`
| |
= note: expected type `Blue` = note: expected struct `Blue`
found type `Black` found struct `Black`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/associated-type-projection-from-supertrait.rs:32:28 --> $DIR/associated-type-projection-from-supertrait.rs:32:28
@ -22,8 +22,8 @@ error[E0308]: mismatched types
LL | fn f() { ModelT.chip_paint(Blue); } LL | fn f() { ModelT.chip_paint(Blue); }
| ^^^^ expected struct `Black`, found struct `Blue` | ^^^^ expected struct `Black`, found struct `Blue`
| |
= note: expected type `Black` = note: expected struct `Black`
found type `Blue` found struct `Blue`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/associated-type-projection-from-supertrait.rs:33:28 --> $DIR/associated-type-projection-from-supertrait.rs:33:28
@ -31,8 +31,8 @@ error[E0308]: mismatched types
LL | fn g() { ModelU.chip_paint(Black); } LL | fn g() { ModelU.chip_paint(Black); }
| ^^^^^ expected struct `Blue`, found struct `Black` | ^^^^^ expected struct `Blue`, found struct `Black`
| |
= note: expected type `Blue` = note: expected struct `Blue`
found type `Black` found struct `Black`
error: aborting due to 4 previous errors error: aborting due to 4 previous errors

View file

@ -7,8 +7,8 @@ LL | fn blue_car<C:Car<Color=Blue>>(c: C) {
LL | fn b() { blue_car(ModelT); } LL | fn b() { blue_car(ModelT); }
| ^^^^^^^^ expected struct `Blue`, found struct `Black` | ^^^^^^^^ expected struct `Blue`, found struct `Black`
| |
= note: expected type `Blue` = note: expected struct `Blue`
found type `Black` found struct `Black`
error[E0271]: type mismatch resolving `<ModelU as Vehicle>::Color == Black` error[E0271]: type mismatch resolving `<ModelU as Vehicle>::Color == Black`
--> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:32:10 --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:32:10
@ -19,8 +19,8 @@ LL | fn black_car<C:Car<Color=Black>>(c: C) {
LL | fn c() { black_car(ModelU); } LL | fn c() { black_car(ModelU); }
| ^^^^^^^^^ expected struct `Black`, found struct `Blue` | ^^^^^^^^^ expected struct `Black`, found struct `Blue`
| |
= note: expected type `Black` = note: expected struct `Black`
found type `Blue` found struct `Blue`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -22,9 +22,9 @@ fn foo1<I: Foo<A=Bar>>(x: I) {
fn foo2<I: Foo>(x: I) { fn foo2<I: Foo>(x: I) {
let _: Bar = x.boo(); let _: Bar = x.boo();
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `Bar` //~| found associated type `<I as Foo>::A`
//~| found type `<I as Foo>::A`
//~| expected struct `Bar`, found associated type //~| expected struct `Bar`, found associated type
//~| expected struct `Bar`
} }

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | let _: Bar = x.boo(); LL | let _: Bar = x.boo();
| ^^^^^^^ expected struct `Bar`, found associated type | ^^^^^^^ expected struct `Bar`, found associated type
| |
= note: expected type `Bar` = note: expected struct `Bar`
found type `<I as Foo>::A` found associated type `<I as Foo>::A`
= note: consider constraining the associated type `<I as Foo>::A` to `Bar` = note: consider constraining the associated type `<I as Foo>::A` to `Bar`
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
@ -18,7 +18,7 @@ LL | fn foo1<I: Foo<A=Bar>>(x: I) {
LL | foo1(a); LL | foo1(a);
| ^^^^ expected struct `Bar`, found usize | ^^^^ expected struct `Bar`, found usize
| |
= note: expected type `Bar` = note: expected struct `Bar`
found type `usize` found type `usize`
error[E0271]: type mismatch resolving `<isize as Foo>::A == Bar` error[E0271]: type mismatch resolving `<isize as Foo>::A == Bar`
@ -27,7 +27,7 @@ error[E0271]: type mismatch resolving `<isize as Foo>::A == Bar`
LL | baz(&a); LL | baz(&a);
| ^^ expected struct `Bar`, found usize | ^^ expected struct `Bar`, found usize
| |
= note: expected type `Bar` = note: expected struct `Bar`
found type `usize` found type `usize`
= note: required for the cast to the object type `dyn Foo<A = Bar>` = note: required for the cast to the object type `dyn Foo<A = Bar>`

View file

@ -9,8 +9,8 @@ LL | where T : for<'x> TheTrait<&'x isize, A = &'x isize>
LL | foo::<UintStruct>(); LL | foo::<UintStruct>();
| ^^^^^^^^^^^^^^^^^ expected isize, found usize | ^^^^^^^^^^^^^^^^^ expected isize, found usize
| |
= note: expected type `&isize` = note: expected reference `&isize`
found type `&usize` found reference `&usize`
error[E0271]: type mismatch resolving `for<'x> <IntStruct as TheTrait<&'x isize>>::A == &'x usize` error[E0271]: type mismatch resolving `for<'x> <IntStruct as TheTrait<&'x isize>>::A == &'x usize`
--> $DIR/associated-types-eq-hr.rs:86:5 --> $DIR/associated-types-eq-hr.rs:86:5
@ -23,8 +23,8 @@ LL | where T : for<'x> TheTrait<&'x isize, A = &'x usize>
LL | bar::<IntStruct>(); LL | bar::<IntStruct>();
| ^^^^^^^^^^^^^^^^ expected usize, found isize | ^^^^^^^^^^^^^^^^ expected usize, found isize
| |
= note: expected type `&usize` = note: expected reference `&usize`
found type `&isize` found reference `&isize`
error[E0277]: the trait bound `for<'x, 'y> Tuple: TheTrait<(&'x isize, &'y isize)>` is not satisfied error[E0277]: the trait bound `for<'x, 'y> Tuple: TheTrait<(&'x isize, &'y isize)>` is not satisfied
--> $DIR/associated-types-eq-hr.rs:91:17 --> $DIR/associated-types-eq-hr.rs:91:17

View file

@ -10,7 +10,7 @@ LL | fn test_adapter<T, I: Iterator<Item=Option<T>>>(it: I) {
LL | is_iterator_of::<Option<T>, _>(&adapter); LL | is_iterator_of::<Option<T>, _>(&adapter);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `std::option::Option`, found type parameter `T` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `std::option::Option`, found type parameter `T`
| |
= note: expected type `std::option::Option<T>` = note: expected enum `std::option::Option<T>`
found type `T` found type `T`
= help: type parameters must be constrained to match other types = 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 = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters

View file

@ -8,7 +8,7 @@ LL | fn want_y<T:Foo<Y=i32>>(t: &T) { }
| ------ ----- required by this bound in `want_y` | ------ ----- required by this bound in `want_y`
| |
= note: expected type `i32` = note: expected type `i32`
found type `<T as Foo>::Y` found associated type `<T as Foo>::Y`
= note: consider constraining the associated type `<T as Foo>::Y` to `i32` = note: consider constraining the associated type `<T as Foo>::Y` to `i32`
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
@ -22,7 +22,7 @@ LL | fn want_x<T:Foo<X=u32>>(t: &T) { }
| ------ ----- required by this bound in `want_x` | ------ ----- required by this bound in `want_x`
| |
= note: expected type `u32` = note: expected type `u32`
found type `<T as Foo>::X` found associated type `<T as Foo>::X`
= note: consider constraining the associated type `<T as Foo>::X` to `u32` = note: consider constraining the associated type `<T as Foo>::X` to `u32`
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html

View file

@ -8,7 +8,7 @@ LL | <() as Visit>::visit();
| ^^^^^^^^^^^^^^^^^^^^ expected (), found &() | ^^^^^^^^^^^^^^^^^^^^ expected (), found &()
| |
= note: expected type `()` = note: expected type `()`
found type `&()` found reference `&()`
= note: required because of the requirements on the impl of `Visit` for `()` = note: required because of the requirements on the impl of `Visit` for `()`
error: aborting due to previous error error: aborting due to previous error

View file

@ -73,7 +73,7 @@ LL | fn rethrow_targets_async_block_not_fn() -> Result<u8, MyErr> {
| | | |
| implicitly returns `()` as its body has no tail or `return` expression | implicitly returns `()` as its body has no tail or `return` expression
| |
= note: expected type `std::result::Result<u8, MyErr>` = note: expected enum `std::result::Result<u8, MyErr>`
found type `()` found type `()`
error[E0308]: mismatched types error[E0308]: mismatched types
@ -84,7 +84,7 @@ LL | fn rethrow_targets_async_block_not_async_fn() -> Result<u8, MyErr> {
| | | |
| implicitly returns `()` as its body has no tail or `return` expression | implicitly returns `()` as its body has no tail or `return` expression
| |
= note: expected type `std::result::Result<u8, MyErr>` = note: expected enum `std::result::Result<u8, MyErr>`
found type `()` found type `()`
error: aborting due to 8 previous errors error: aborting due to 8 previous errors

View file

@ -5,7 +5,7 @@ LL | take_u32(x)
| ^ expected u32, found opaque type | ^ expected u32, found opaque type
| |
= note: expected type `u32` = note: expected type `u32`
found type `impl std::future::Future` found opaque type `impl std::future::Future`
error: aborting due to previous error error: aborting due to previous error

View file

@ -8,7 +8,7 @@ LL | take_u32(x)
| help: consider using `.await` here: `x.await` | help: consider using `.await` here: `x.await`
| |
= note: expected type `u32` = note: expected type `u32`
found type `impl std::future::Future` found opaque type `impl std::future::Future`
error: aborting due to previous error error: aborting due to previous error

View file

@ -8,7 +8,7 @@ LL | take_u32(x)
| help: consider using `.await` here: `x.await` | help: consider using `.await` here: `x.await`
| |
= note: expected type `u32` = note: expected type `u32`
found type `impl std::future::Future` found opaque type `impl std::future::Future`
error: aborting due to previous error error: aborting due to previous error

View file

@ -1,6 +1,6 @@
static i: String = 10; static i: String = 10;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `std::string::String`
//~| found type `{integer}`
//~| expected struct `std::string::String`, found integer //~| expected struct `std::string::String`, found integer
//~| expected struct `std::string::String`
//~| found type `{integer}`
fn main() { println!("{}", i); } fn main() { println!("{}", i); }

View file

@ -7,7 +7,7 @@ LL | static i: String = 10;
| expected struct `std::string::String`, found integer | expected struct `std::string::String`, found integer
| help: try using a conversion method: `10.to_string()` | help: try using a conversion method: `10.to_string()`
| |
= note: expected type `std::string::String` = note: expected struct `std::string::String`
found type `{integer}` found type `{integer}`
error: aborting due to previous error error: aborting due to previous error

View file

@ -22,8 +22,8 @@ error[E0580]: main function has wrong type
LL | fn main(arguments: Vec<String>) { LL | fn main(arguments: Vec<String>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
| |
= note: expected type `fn()` = note: expected fn pointer `fn()`
found type `fn(std::vec::Vec<std::string::String>)` found fn pointer `fn(std::vec::Vec<std::string::String>)`
error: aborting due to 4 previous errors error: aborting due to 4 previous errors

View file

@ -22,8 +22,8 @@ error[E0580]: main function has wrong type
LL | fn main(arguments: Vec<String>) { LL | fn main(arguments: Vec<String>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
| |
= note: expected type `fn()` = note: expected fn pointer `fn()`
found type `fn(std::vec::Vec<std::string::String>)` found fn pointer `fn(std::vec::Vec<std::string::String>)`
error: aborting due to 4 previous errors error: aborting due to 4 previous errors

View file

@ -4,8 +4,8 @@ error[E0580]: main function has wrong type
LL | fn main(x: isize) { } LL | fn main(x: isize) { }
| ^^^^^^^^^^^^^^^^^ incorrect number of function parameters | ^^^^^^^^^^^^^^^^^ incorrect number of function parameters
| |
= note: expected type `fn()` = note: expected fn pointer `fn()`
found type `fn(isize)` found fn pointer `fn(isize)`
error: aborting due to previous error error: aborting due to previous error

View file

@ -5,7 +5,7 @@ LL | let bar = 5;
| ^^^ expected integer, found struct `foo::bar` | ^^^ expected integer, found struct `foo::bar`
| |
= note: expected type `{integer}` = note: expected type `{integer}`
found type `foo::bar` found struct `foo::bar`
error: aborting due to previous error error: aborting due to previous error

View file

@ -9,7 +9,7 @@ LL | 0u8;
LL | "bla".to_string(); LL | "bla".to_string();
| - help: consider removing this semicolon | - help: consider removing this semicolon
| |
= note: expected type `std::string::String` = note: expected struct `std::string::String`
found type `()` found type `()`
error[E0308]: mismatched types error[E0308]: mismatched types
@ -23,7 +23,7 @@ LL | "this won't work".to_string();
LL | "removeme".to_string(); LL | "removeme".to_string();
| - help: consider removing this semicolon | - help: consider removing this semicolon
| |
= note: expected type `std::string::String` = note: expected struct `std::string::String`
found type `()` found type `()`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -9,7 +9,7 @@ LL | fn foo() -> String {
LL | ; LL | ;
| - help: consider removing this semicolon | - help: consider removing this semicolon
| |
= note: expected type `std::string::String` = note: expected struct `std::string::String`
found type `()` found type `()`
error[E0308]: mismatched types error[E0308]: mismatched types
@ -23,7 +23,7 @@ LL | "foobar".to_string()
LL | ; LL | ;
| - help: consider removing this semicolon | - help: consider removing this semicolon
| |
= note: expected type `std::string::String` = note: expected struct `std::string::String`
found type `()` found type `()`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -6,9 +6,9 @@ mod a {
pub fn get_enum_struct_variant() -> () { pub fn get_enum_struct_variant() -> () {
Enum::EnumStructVariant { x: 1, y: 2, z: 3 } Enum::EnumStructVariant { x: 1, y: 2, z: 3 }
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `()`
//~| found type `a::Enum`
//~| expected (), found enum `a::Enum` //~| expected (), found enum `a::Enum`
//~| expected type `()`
//~| found enum `a::Enum`
} }
} }
@ -21,9 +21,9 @@ mod b {
match enum_struct_variant { match enum_struct_variant {
a::Enum::EnumStructVariant { x, y, z } => { a::Enum::EnumStructVariant { x, y, z } => {
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `()`
//~| found type `a::Enum`
//~| expected (), found enum `a::Enum` //~| expected (), found enum `a::Enum`
//~| expected type `()`
//~| found enum `a::Enum`
} }
} }
} }

View file

@ -7,7 +7,7 @@ LL | Enum::EnumStructVariant { x: 1, y: 2, z: 3 }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found enum `a::Enum` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found enum `a::Enum`
| |
= note: expected type `()` = note: expected type `()`
found type `a::Enum` found enum `a::Enum`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/issue-13624.rs:22:9 --> $DIR/issue-13624.rs:22:9
@ -18,7 +18,7 @@ LL | a::Enum::EnumStructVariant { x, y, z } => {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found enum `a::Enum` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found enum `a::Enum`
| |
= note: expected type `()` = note: expected type `()`
found type `a::Enum` found enum `a::Enum`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -7,7 +7,7 @@ LL | |y| x + y
| ^^^^^^^^^ expected (), found closure | ^^^^^^^^^ expected (), found closure
| |
= note: expected type `()` = note: expected type `()`
found type `[closure@$DIR/issue-20862.rs:2:5: 2:14 x:_]` found closure `[closure@$DIR/issue-20862.rs:2:5: 2:14 x:_]`
error[E0618]: expected function, found `()` error[E0618]: expected function, found `()`
--> $DIR/issue-20862.rs:7:13 --> $DIR/issue-20862.rs:7:13

View file

@ -18,7 +18,7 @@ LL | b + 3
| ^^^^^ expected (), found struct `Bob` | ^^^^^ expected (), found struct `Bob`
| |
= note: expected type `()` = note: expected type `()`
found type `Bob` found struct `Bob`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -2,6 +2,6 @@ fn main() {
&panic!() &panic!()
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `()` //~| expected type `()`
//~| found type `&_` //~| found reference `&_`
//~| expected (), found reference //~| expected (), found reference
} }

View file

@ -10,7 +10,7 @@ LL | &panic!()
| help: consider removing the borrow: `panic!()` | help: consider removing the borrow: `panic!()`
| |
= note: expected type `()` = note: expected type `()`
found type `&_` found reference `&_`
error: aborting due to previous error error: aborting due to 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 type `fn(&'a isize, Inv<'c>, Inv<'c>, Inv<'d>)` = note: expected fn pointer `fn(&'a isize, Inv<'c>, Inv<'c>, Inv<'d>)`
found type `fn(&'a isize, Inv<'_>, Inv<'c>, Inv<'d>)` found fn pointer `fn(&'a isize, Inv<'_>, Inv<'c>, Inv<'d>)`
note: the lifetime `'c` as defined on the method body at 27:24... note: the lifetime `'c` as defined on the method body at 27:24...
--> $DIR/regions-bound-missing-bound-in-impl.rs:27:24 --> $DIR/regions-bound-missing-bound-in-impl.rs:27:24
| |

View file

@ -28,8 +28,8 @@ error[E0308]: mismatched types
LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo; LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo;
| ^^^ expected non-variadic fn, found variadic function | ^^^ expected non-variadic fn, found variadic function
| |
= note: expected type `unsafe extern "C" fn(isize, u8)` = note: expected fn pointer `unsafe extern "C" fn(isize, u8)`
found type `unsafe extern "C" fn(isize, u8, ...) {foo}` found fn item `unsafe extern "C" fn(isize, u8, ...) {foo}`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/variadic-ffi-1.rs:20:54 --> $DIR/variadic-ffi-1.rs:20:54
@ -37,8 +37,8 @@ error[E0308]: mismatched types
LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar; LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar;
| ^^^ expected variadic fn, found non-variadic function | ^^^ expected variadic fn, found non-variadic function
| |
= note: expected type `extern "C" fn(isize, u8, ...)` = note: expected fn pointer `extern "C" fn(isize, u8, ...)`
found type `extern "C" fn(isize, u8) {bar}` found fn item `extern "C" fn(isize, u8) {bar}`
error[E0617]: can't pass `f32` to variadic function error[E0617]: can't pass `f32` to variadic function
--> $DIR/variadic-ffi-1.rs:22:19 --> $DIR/variadic-ffi-1.rs:22:19

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | ap LL | ap
| ^^ lifetime mismatch | ^^ lifetime mismatch
| |
= note: expected type `core::ffi::VaListImpl<'f>` = note: expected struct `core::ffi::VaListImpl<'f>`
found type `core::ffi::VaListImpl<'_>` found struct `core::ffi::VaListImpl<'_>`
note: the scope of call-site for function at 7:78... note: the scope of call-site for function at 7:78...
--> $DIR/variadic-ffi-4.rs:7:78 --> $DIR/variadic-ffi-4.rs:7:78
| |
@ -26,8 +26,8 @@ error[E0308]: mismatched types
LL | ap LL | ap
| ^^ lifetime mismatch | ^^ lifetime mismatch
| |
= note: expected type `core::ffi::VaListImpl<'static>` = note: expected struct `core::ffi::VaListImpl<'static>`
found type `core::ffi::VaListImpl<'_>` found struct `core::ffi::VaListImpl<'_>`
note: the scope of call-site for function at 11:79... note: the scope of call-site for function at 11:79...
--> $DIR/variadic-ffi-4.rs:11:79 --> $DIR/variadic-ffi-4.rs:11:79
| |
@ -69,8 +69,8 @@ error[E0308]: mismatched types
LL | *ap0 = ap1; LL | *ap0 = ap1;
| ^^^ lifetime mismatch | ^^^ lifetime mismatch
| |
= note: expected type `core::ffi::VaListImpl<'_>` = note: expected struct `core::ffi::VaListImpl<'_>`
found type `core::ffi::VaListImpl<'_>` found struct `core::ffi::VaListImpl<'_>`
note: the scope of call-site for function at 19:87... note: the scope of call-site for function at 19:87...
--> $DIR/variadic-ffi-4.rs:19:87 --> $DIR/variadic-ffi-4.rs:19:87
| |
@ -121,8 +121,8 @@ error[E0308]: mismatched types
LL | ap0 = &mut ap1; LL | ap0 = &mut ap1;
| ^^^^^^^^ lifetime mismatch | ^^^^^^^^ lifetime mismatch
| |
= note: expected type `&mut core::ffi::VaListImpl<'_>` = note: expected mutable reference `&mut core::ffi::VaListImpl<'_>`
found type `&mut core::ffi::VaListImpl<'_>` found mutable reference `&mut core::ffi::VaListImpl<'_>`
note: the scope of call-site for function at 23:83... note: the scope of call-site for function at 23:83...
--> $DIR/variadic-ffi-4.rs:23:83 --> $DIR/variadic-ffi-4.rs:23:83
| |
@ -189,8 +189,8 @@ error[E0308]: mismatched types
LL | *ap0 = ap1.clone(); LL | *ap0 = ap1.clone();
| ^^^^^^^^^^^ lifetime mismatch | ^^^^^^^^^^^ lifetime mismatch
| |
= note: expected type `core::ffi::VaListImpl<'_>` = note: expected struct `core::ffi::VaListImpl<'_>`
found type `core::ffi::VaListImpl<'_>` found struct `core::ffi::VaListImpl<'_>`
note: the scope of call-site for function at 30:87... note: the scope of call-site for function at 30:87...
--> $DIR/variadic-ffi-4.rs:30:87 --> $DIR/variadic-ffi-4.rs:30:87
| |

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {}); LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
| ^^^^^^^^^^^ lifetime mismatch | ^^^^^^^^^^^ lifetime mismatch
| |
= note: expected type `fn(&u32)` = note: expected fn pointer `fn(&u32)`
found type `fn(&'x u32)` found fn pointer `fn(&'x u32)`
note: the anonymous lifetime #2 defined on the body at 14:48... note: the anonymous lifetime #2 defined on the body at 14:48...
--> $DIR/expect-fn-supply-fn.rs:14:48 --> $DIR/expect-fn-supply-fn.rs:14:48
| |
@ -23,8 +23,8 @@ error[E0308]: mismatched types
LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {}); LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
| ^^^^^^^^^^^ lifetime mismatch | ^^^^^^^^^^^ lifetime mismatch
| |
= note: expected type `fn(&u32)` = note: expected fn pointer `fn(&u32)`
found type `fn(&'x u32)` found fn pointer `fn(&'x u32)`
note: the lifetime `'x` as defined on the function body at 11:36... note: the lifetime `'x` as defined on the function body at 11:36...
--> $DIR/expect-fn-supply-fn.rs:11:36 --> $DIR/expect-fn-supply-fn.rs:11:36
| |

View file

@ -23,7 +23,7 @@ LL | while |_: [_; continue]| {} {}
| ^^^^^^^^^^^^^^^^^^^^^ expected bool, found closure | ^^^^^^^^^^^^^^^^^^^^^ expected bool, found closure
| |
= note: expected type `bool` = note: expected type `bool`
found type `[closure@$DIR/closure-array-break-length.rs:4:11: 4:32]` found closure `[closure@$DIR/closure-array-break-length.rs:4:11: 4:32]`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/closure-array-break-length.rs:7:11 --> $DIR/closure-array-break-length.rs:7:11
@ -32,7 +32,7 @@ LL | while |_: [_; break]| {} {}
| ^^^^^^^^^^^^^^^^^^ expected bool, found closure | ^^^^^^^^^^^^^^^^^^ expected bool, found closure
| |
= note: expected type `bool` = note: expected type `bool`
found type `[closure@$DIR/closure-array-break-length.rs:7:11: 7:29]` found closure `[closure@$DIR/closure-array-break-length.rs:7:11: 7:29]`
error: aborting due to 5 previous errors error: aborting due to 5 previous errors

View file

@ -24,8 +24,8 @@ error[E0308]: mismatched types
LL | closure_expecting_bound(|x: &'x u32| { LL | closure_expecting_bound(|x: &'x u32| {
| ^^^^^^^ lifetime mismatch | ^^^^^^^ lifetime mismatch
| |
= note: expected type `&u32` = note: expected reference `&u32`
found type `&'x u32` found reference `&'x u32`
note: the anonymous lifetime #2 defined on the body at 37:29... note: the anonymous lifetime #2 defined on the body at 37:29...
--> $DIR/expect-region-supply-region.rs:37:29 --> $DIR/expect-region-supply-region.rs:37:29
| |
@ -50,8 +50,8 @@ error[E0308]: mismatched types
LL | closure_expecting_bound(|x: &'x u32| { LL | closure_expecting_bound(|x: &'x u32| {
| ^^^^^^^ lifetime mismatch | ^^^^^^^ lifetime mismatch
| |
= note: expected type `&u32` = note: expected reference `&u32`
found type `&'x u32` found reference `&'x u32`
note: the lifetime `'x` as defined on the function body at 32:30... note: the lifetime `'x` as defined on the function body at 32:30...
--> $DIR/expect-region-supply-region.rs:32:30 --> $DIR/expect-region-supply-region.rs:32:30
| |

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | let foo: fn(u8) -> u8 = |v: u8| { a += v; a }; LL | let foo: fn(u8) -> u8 = |v: u8| { a += v; a };
| ^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found closure | ^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found closure
| |
= note: expected type `fn(u8) -> u8` = note: expected fn pointer `fn(u8) -> u8`
found type `[closure@$DIR/closure-no-fn-1.rs:6:29: 6:50 a:_]` found closure `[closure@$DIR/closure-no-fn-1.rs:6:29: 6:50 a:_]`
error: aborting due to previous error error: aborting due to previous error

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | let bar: fn() -> u8 = || { b }; LL | let bar: fn() -> u8 = || { b };
| ^^^^^^^^ expected fn pointer, found closure | ^^^^^^^^ expected fn pointer, found closure
| |
= note: expected type `fn() -> u8` = note: expected fn pointer `fn() -> u8`
found type `[closure@$DIR/closure-no-fn-2.rs:6:27: 6:35 b:_]` found closure `[closure@$DIR/closure-no-fn-2.rs:6:27: 6:35 b:_]`
error: aborting due to previous error error: aborting due to previous error

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | call_bare(f) LL | call_bare(f)
| ^ expected fn pointer, found closure | ^ expected fn pointer, found closure
| |
= note: expected type `for<'r> fn(&'r str)` = note: expected fn pointer `for<'r> fn(&'r str)`
found type `[closure@$DIR/closure-reform-bad.rs:10:13: 10:50 string:_]` found closure `[closure@$DIR/closure-reform-bad.rs:10:13: 10:50 string:_]`
error: aborting due to previous error error: aborting due to previous error

View file

@ -13,7 +13,7 @@ LL | "bar boo"
| ^^^^^^^^^^^^^^^^^^^^ expected (), found reference | ^^^^^^^^^^^^^^^^^^^^ expected (), found reference
| |
= note: expected type `()` = note: expected type `()`
found type `&'static str` found reference `&'static str`
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 _ = box { [1, 2, 3] }: Box<[i32]>; LL | let _ = box { [1, 2, 3] }: Box<[i32]>;
| ^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements | ^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
| |
= note: expected type `std::boxed::Box<[i32]>` = note: expected struct `std::boxed::Box<[i32]>`
found type `std::boxed::Box<[i32; 3]>` found struct `std::boxed::Box<[i32; 3]>`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:10:13 --> $DIR/coerce-expect-unsized-ascribed.rs:10:13
@ -13,8 +13,8 @@ error[E0308]: mismatched types
LL | let _ = box if true { [1, 2, 3] } else { [1, 3, 4] }: Box<[i32]>; LL | let _ = box if true { [1, 2, 3] } else { [1, 3, 4] }: Box<[i32]>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
| |
= note: expected type `std::boxed::Box<[i32]>` = note: expected struct `std::boxed::Box<[i32]>`
found type `std::boxed::Box<[i32; 3]>` found struct `std::boxed::Box<[i32; 3]>`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:11:13 --> $DIR/coerce-expect-unsized-ascribed.rs:11:13
@ -22,8 +22,8 @@ error[E0308]: mismatched types
LL | let _ = box match true { true => [1, 2, 3], false => [1, 3, 4] }: Box<[i32]>; LL | let _ = box match true { true => [1, 2, 3], false => [1, 3, 4] }: Box<[i32]>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
| |
= note: expected type `std::boxed::Box<[i32]>` = note: expected struct `std::boxed::Box<[i32]>`
found type `std::boxed::Box<[i32; 3]>` found struct `std::boxed::Box<[i32; 3]>`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:13:13 --> $DIR/coerce-expect-unsized-ascribed.rs:13:13
@ -31,8 +31,8 @@ error[E0308]: mismatched types
LL | let _ = box { |x| (x as u8) }: Box<dyn Fn(i32) -> _>; LL | let _ = box { |x| (x as u8) }: Box<dyn Fn(i32) -> _>;
| ^^^^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure | ^^^^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure
| |
= note: expected type `std::boxed::Box<dyn std::ops::Fn(i32) -> u8>` = note: expected struct `std::boxed::Box<dyn std::ops::Fn(i32) -> u8>`
found type `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:13:19: 13:32]>` found struct `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:13:19: 13:32]>`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:14:13 --> $DIR/coerce-expect-unsized-ascribed.rs:14:13
@ -40,8 +40,8 @@ error[E0308]: mismatched types
LL | let _ = box if true { false } else { true }: Box<dyn Debug>; LL | let _ = box if true { false } else { true }: Box<dyn Debug>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found bool | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found bool
| |
= note: expected type `std::boxed::Box<dyn std::fmt::Debug>` = note: expected struct `std::boxed::Box<dyn std::fmt::Debug>`
found type `std::boxed::Box<bool>` found struct `std::boxed::Box<bool>`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:15:13 --> $DIR/coerce-expect-unsized-ascribed.rs:15:13
@ -49,8 +49,8 @@ error[E0308]: mismatched types
LL | let _ = box match true { true => 'a', false => 'b' }: Box<dyn Debug>; LL | let _ = box match true { true => 'a', false => 'b' }: Box<dyn Debug>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found char | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found char
| |
= note: expected type `std::boxed::Box<dyn std::fmt::Debug>` = note: expected struct `std::boxed::Box<dyn std::fmt::Debug>`
found type `std::boxed::Box<char>` found struct `std::boxed::Box<char>`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:17:13 --> $DIR/coerce-expect-unsized-ascribed.rs:17:13
@ -58,8 +58,8 @@ error[E0308]: mismatched types
LL | let _ = &{ [1, 2, 3] }: &[i32]; LL | let _ = &{ [1, 2, 3] }: &[i32];
| ^^^^^^^^^^^^^^ expected slice, found array of 3 elements | ^^^^^^^^^^^^^^ expected slice, found array of 3 elements
| |
= note: expected type `&[i32]` = note: expected reference `&[i32]`
found type `&[i32; 3]` found reference `&[i32; 3]`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:18:13 --> $DIR/coerce-expect-unsized-ascribed.rs:18:13
@ -67,8 +67,8 @@ error[E0308]: mismatched types
LL | let _ = &if true { [1, 2, 3] } else { [1, 3, 4] }: &[i32]; LL | let _ = &if true { [1, 2, 3] } else { [1, 3, 4] }: &[i32];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
| |
= note: expected type `&[i32]` = note: expected reference `&[i32]`
found type `&[i32; 3]` found reference `&[i32; 3]`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:19:13 --> $DIR/coerce-expect-unsized-ascribed.rs:19:13
@ -76,8 +76,8 @@ error[E0308]: mismatched types
LL | let _ = &match true { true => [1, 2, 3], false => [1, 3, 4] }: &[i32]; LL | let _ = &match true { true => [1, 2, 3], false => [1, 3, 4] }: &[i32];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
| |
= note: expected type `&[i32]` = note: expected reference `&[i32]`
found type `&[i32; 3]` found reference `&[i32; 3]`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:21:13 --> $DIR/coerce-expect-unsized-ascribed.rs:21:13
@ -85,8 +85,8 @@ error[E0308]: mismatched types
LL | let _ = &{ |x| (x as u8) }: &dyn Fn(i32) -> _; LL | let _ = &{ |x| (x as u8) }: &dyn Fn(i32) -> _;
| ^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure | ^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure
| |
= note: expected type `&dyn std::ops::Fn(i32) -> u8` = note: expected reference `&dyn std::ops::Fn(i32) -> u8`
found type `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:21:16: 21:29]` found reference `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:21:16: 21:29]`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:22:13 --> $DIR/coerce-expect-unsized-ascribed.rs:22:13
@ -94,8 +94,8 @@ error[E0308]: mismatched types
LL | let _ = &if true { false } else { true }: &dyn Debug; LL | let _ = &if true { false } else { true }: &dyn Debug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found bool | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found bool
| |
= note: expected type `&dyn std::fmt::Debug` = note: expected reference `&dyn std::fmt::Debug`
found type `&bool` found reference `&bool`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:23:13 --> $DIR/coerce-expect-unsized-ascribed.rs:23:13
@ -103,8 +103,8 @@ error[E0308]: mismatched types
LL | let _ = &match true { true => 'a', false => 'b' }: &dyn Debug; LL | let _ = &match true { true => 'a', false => 'b' }: &dyn Debug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found char | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found char
| |
= note: expected type `&dyn std::fmt::Debug` = note: expected reference `&dyn std::fmt::Debug`
found type `&char` found reference `&char`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:25:13 --> $DIR/coerce-expect-unsized-ascribed.rs:25:13
@ -112,8 +112,8 @@ error[E0308]: mismatched types
LL | let _ = Box::new([1, 2, 3]): Box<[i32]>; LL | let _ = Box::new([1, 2, 3]): Box<[i32]>;
| ^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements | ^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
| |
= note: expected type `std::boxed::Box<[i32]>` = note: expected struct `std::boxed::Box<[i32]>`
found type `std::boxed::Box<[i32; 3]>` found struct `std::boxed::Box<[i32; 3]>`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:26:13 --> $DIR/coerce-expect-unsized-ascribed.rs:26:13
@ -121,8 +121,8 @@ error[E0308]: mismatched types
LL | let _ = Box::new(|x| (x as u8)): Box<dyn Fn(i32) -> _>; LL | let _ = Box::new(|x| (x as u8)): Box<dyn Fn(i32) -> _>;
| ^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure | ^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure
| |
= note: expected type `std::boxed::Box<dyn std::ops::Fn(i32) -> _>` = note: expected struct `std::boxed::Box<dyn std::ops::Fn(i32) -> _>`
found type `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:26:22: 26:35]>` found struct `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:26:22: 26:35]>`
error: aborting due to 14 previous errors error: aborting due to 14 previous errors

View file

@ -4,7 +4,7 @@ fn main() {
let x = 0; let x = 0;
f(&x); f(&x);
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `&mut i32` //~| expected mutable reference `&mut i32`
//~| found type `&{integer}` //~| found reference `&{integer}`
//~| types differ in mutability //~| types differ in mutability
} }

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | f(&x); LL | f(&x);
| ^^ types differ in mutability | ^^ types differ in mutability
| |
= note: expected type `&mut i32` = note: expected mutable reference `&mut i32`
found type `&{integer}` found reference `&{integer}`
error: aborting due to previous error error: aborting due to previous error

View file

@ -49,8 +49,8 @@ error[E0308]: mismatched types
LL | let x: [!; 2] = [return, 22]; LL | let x: [!; 2] = [return, 22];
| ^^^^^^^^^^^^ expected !, found integer | ^^^^^^^^^^^^ expected !, found integer
| |
= note: expected type `[!; 2]` = note: expected array `[!; 2]`
found type `[{integer}; 2]` found array `[{integer}; 2]`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/coerce-to-bang.rs:55:22 --> $DIR/coerce-to-bang.rs:55:22

View file

@ -21,7 +21,7 @@ LL | fn foo() -> Result<u8, u64> {
LL | Ok(1); LL | Ok(1);
| - help: consider removing this semicolon | - help: consider removing this semicolon
| |
= note: expected type `std::result::Result<u8, u64>` = note: expected enum `std::result::Result<u8, u64>`
found type `()` found type `()`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -3,6 +3,6 @@
fn main() { fn main() {
let _: &[i32] = [0]; let _: &[i32] = [0];
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `&[i32]` //~| expected reference `&[i32]`
//~| expected &[i32], found array of 1 element //~| expected &[i32], found array of 1 element
} }

View file

@ -7,8 +7,8 @@ LL | let _: &[i32] = [0];
| expected &[i32], found array of 1 element | expected &[i32], found array of 1 element
| help: consider borrowing here: `&[0]` | help: consider borrowing here: `&[0]`
| |
= note: expected type `&[i32]` = note: expected reference `&[i32]`
found type `[{integer}; 1]` found array `[{integer}; 1]`
error: aborting due to previous error error: aborting due to previous error

View file

@ -10,8 +10,8 @@ LL | fn b<F:Clone,G>(&self, _x: G) -> G { panic!() }
| | found type parameter | | found type parameter
| expected type parameter | expected type parameter
| |
= note: expected type `fn(&E, F) -> F` = note: expected fn pointer `fn(&E, F) -> F`
found type `fn(&E, G) -> G` found fn pointer `fn(&E, G) -> G`
= note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound
= note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | let _ = const_generic_lib::function(const_generic_lib::Struct([0u8, 1u8])); LL | let _ = const_generic_lib::function(const_generic_lib::Struct([0u8, 1u8]));
| ^^^^^^^^^^ expected an array with a fixed size of 3 elements, found one with 2 elements | ^^^^^^^^^^ expected an array with a fixed size of 3 elements, found one with 2 elements
| |
= note: expected type `[u8; 3]` = note: expected array `[u8; 3]`
found type `[u8; 2]` found array `[u8; 2]`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-argument-cross-crate-mismatch.rs:8:65 --> $DIR/const-argument-cross-crate-mismatch.rs:8:65
@ -13,8 +13,8 @@ error[E0308]: mismatched types
LL | let _: const_generic_lib::Alias = const_generic_lib::Struct([0u8, 1u8, 2u8]); LL | let _: const_generic_lib::Alias = const_generic_lib::Struct([0u8, 1u8, 2u8]);
| ^^^^^^^^^^^^^^^ expected an array with a fixed size of 2 elements, found one with 3 elements | ^^^^^^^^^^^^^^^ expected an array with a fixed size of 2 elements, found one with 3 elements
| |
= note: expected type `[u8; 2]` = note: expected array `[u8; 2]`
found type `[u8; 3]` found array `[u8; 3]`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -12,8 +12,8 @@ error[E0308]: mismatched types
LL | let _: Checked<{not_one}> = Checked::<{not_two}>; LL | let _: Checked<{not_one}> = Checked::<{not_two}>;
| ^^^^^^^^^^^^^^^^^^^^ expected `not_one`, found `not_two` | ^^^^^^^^^^^^^^^^^^^^ expected `not_one`, found `not_two`
| |
= note: expected type `Checked<not_one>` = note: expected struct `Checked<not_one>`
found type `Checked<not_two>` found struct `Checked<not_two>`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/fn-const-param-infer.rs:20:24 --> $DIR/fn-const-param-infer.rs:20:24
@ -21,8 +21,8 @@ error[E0308]: mismatched types
LL | let _ = Checked::<{generic_arg::<u32>}>; LL | let _ = Checked::<{generic_arg::<u32>}>;
| ^^^^^^^^^^^^^^^^^^ expected usize, found u32 | ^^^^^^^^^^^^^^^^^^ expected usize, found u32
| |
= note: expected type `fn(usize) -> bool` = note: expected fn pointer `fn(usize) -> bool`
found type `fn(u32) -> bool {generic_arg::<u32>}` found fn item `fn(u32) -> bool {generic_arg::<u32>}`
error[E0282]: type annotations needed error[E0282]: type annotations needed
--> $DIR/fn-const-param-infer.rs:22:24 --> $DIR/fn-const-param-infer.rs:22:24
@ -36,8 +36,8 @@ error[E0308]: mismatched types
LL | let _: Checked<{generic::<u32>}> = Checked::<{generic::<u16>}>; LL | let _: Checked<{generic::<u32>}> = Checked::<{generic::<u16>}>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `generic::<u32>`, found `generic::<u16>` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `generic::<u32>`, found `generic::<u16>`
| |
= note: expected type `Checked<generic::<u32>>` = note: expected struct `Checked<generic::<u32>>`
found type `Checked<generic::<u16>>` found struct `Checked<generic::<u16>>`
error: aborting due to 4 previous errors error: aborting due to 4 previous errors

View file

@ -12,8 +12,8 @@ error[E0308]: mismatched types
LL | let _: Const<{15 as *const _}> = Const::<{10 as *const _}>; LL | let _: Const<{15 as *const _}> = Const::<{10 as *const _}>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{pointer}`, found `{pointer}` | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{pointer}`, found `{pointer}`
| |
= note: expected type `Const<{pointer}>` = note: expected struct `Const<{pointer}>`
found type `Const<{pointer}>` found struct `Const<{pointer}>`
error: aborting due to previous error error: aborting due to previous error

View file

@ -12,8 +12,8 @@ error[E0308]: mismatched types
LL | let _: ConstString<"Hello"> = ConstString::<"World">; LL | let _: ConstString<"Hello"> = ConstString::<"World">;
| ^^^^^^^^^^^^^^^^^^^^^^ expected `"Hello"`, found `"World"` | ^^^^^^^^^^^^^^^^^^^^^^ expected `"Hello"`, found `"World"`
| |
= note: expected type `ConstString<"Hello">` = note: expected struct `ConstString<"Hello">`
found type `ConstString<"World">` found struct `ConstString<"World">`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/slice-const-param-mismatch.rs:11:33 --> $DIR/slice-const-param-mismatch.rs:11:33
@ -21,8 +21,8 @@ error[E0308]: mismatched types
LL | let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↥">; LL | let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↥">;
| ^^^^^^^^^^^^^^^^^^^^^ expected `"ℇ㇈↦"`, found `"ℇ㇈↥"` | ^^^^^^^^^^^^^^^^^^^^^ expected `"ℇ㇈↦"`, found `"ℇ㇈↥"`
| |
= note: expected type `ConstString<"ℇ㇈↦">` = note: expected struct `ConstString<"ℇ㇈↦">`
found type `ConstString<"ℇ㇈↥">` found struct `ConstString<"ℇ㇈↥">`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/slice-const-param-mismatch.rs:13:33 --> $DIR/slice-const-param-mismatch.rs:13:33
@ -30,8 +30,8 @@ error[E0308]: mismatched types
LL | let _: ConstBytes<b"AAA"> = ConstBytes::<b"BBB">; LL | let _: ConstBytes<b"AAA"> = ConstBytes::<b"BBB">;
| ^^^^^^^^^^^^^^^^^^^^ expected `b"AAA"`, found `b"BBB"` | ^^^^^^^^^^^^^^^^^^^^ expected `b"AAA"`, found `b"BBB"`
| |
= note: expected type `ConstBytes<b"AAA">` = note: expected struct `ConstBytes<b"AAA">`
found type `ConstBytes<b"BBB">` found struct `ConstBytes<b"BBB">`
error: aborting due to 3 previous errors error: aborting due to 3 previous errors

View file

@ -12,8 +12,8 @@ error[E0308]: mismatched types
LL | let _: A<'a, u32, {2u32}, {3u32}> = A::<'a, u32, {4u32}, {3u32}> { data: PhantomData }; LL | let _: A<'a, u32, {2u32}, {3u32}> = A::<'a, u32, {4u32}, {3u32}> { data: PhantomData };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `2u32`, found `4u32` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `2u32`, found `4u32`
| |
= note: expected type `A<'_, _, 2u32, _>` = note: expected struct `A<'_, _, 2u32, _>`
found type `A<'_, _, 4u32, _>` found struct `A<'_, _, 4u32, _>`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/types-mismatch-const-args.rs:15:41 --> $DIR/types-mismatch-const-args.rs:15:41
@ -21,8 +21,8 @@ error[E0308]: mismatched types
LL | let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData }; LL | let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u16, found u32 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u16, found u32
| |
= note: expected type `A<'a, u16, _, _>` = note: expected struct `A<'a, u16, _, _>`
found type `A<'b, u32, _, _>` found struct `A<'b, u32, _, _>`
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 | const BLUB: [i32; (ARR[0] - 40) as usize] = [5]; LL | const BLUB: [i32; (ARR[0] - 40) as usize] = [5];
| ^^^ expected an array with a fixed size of 2 elements, found one with 1 element | ^^^ expected an array with a fixed size of 2 elements, found one with 1 element
| |
= note: expected type `[i32; 2]` = note: expected array `[i32; 2]`
found type `[i32; 1]` found array `[i32; 1]`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-array-oob-arith.rs:10:44 --> $DIR/const-array-oob-arith.rs:10:44
@ -13,8 +13,8 @@ error[E0308]: mismatched types
LL | const BOO: [i32; (ARR[0] - 41) as usize] = [5, 99]; LL | const BOO: [i32; (ARR[0] - 41) as usize] = [5, 99];
| ^^^^^^^ expected an array with a fixed size of 1 element, found one with 2 elements | ^^^^^^^ expected an array with a fixed size of 1 element, found one with 2 elements
| |
= note: expected type `[i32; 1]` = note: expected array `[i32; 1]`
found type `[i32; 2]` found array `[i32; 2]`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -9,7 +9,7 @@ enum E {
V = CONSTANT, V = CONSTANT,
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected isize, found struct `S` //~| expected isize, found struct `S`
//~| found type `S` //~| found struct `S`
} }
fn main() {} fn main() {}

View file

@ -5,7 +5,7 @@ LL | V = CONSTANT,
| ^^^^^^^^ expected isize, found struct `S` | ^^^^^^^^ expected isize, found struct `S`
| |
= note: expected type `isize` = note: expected type `isize`
found type `S` found struct `S`
error: aborting due to previous error error: aborting due to previous error

View file

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | const TUP: (usize,) = 5usize << 64; LL | const TUP: (usize,) = 5usize << 64;
| ^^^^^^^^^^^^ expected tuple, found usize | ^^^^^^^^^^^^ expected tuple, found usize
| |
= note: expected type `(usize,)` = note: expected tuple `(usize,)`
found type `usize` found type `usize`
error[E0080]: evaluation of constant value failed error[E0080]: evaluation of constant value failed

View file

@ -7,8 +7,8 @@ LL | let _tis_an_instants_play: String = "'Tis a fond Ambush—";
| expected struct `std::string::String`, found reference | expected struct `std::string::String`, found reference
| help: try using a conversion method: `"'Tis a fond Ambush—".to_string()` | help: try using a conversion method: `"'Tis a fond Ambush—".to_string()`
| |
= note: expected type `std::string::String` = note: expected struct `std::string::String`
found type `&'static str` found reference `&'static str`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/conversion-methods.rs:6:40 --> $DIR/conversion-methods.rs:6:40
@ -19,8 +19,8 @@ LL | let _just_to_make_bliss: PathBuf = Path::new("/ern/her/own/surprise");
| expected struct `std::path::PathBuf`, found reference | expected struct `std::path::PathBuf`, found reference
| help: try using a conversion method: `Path::new("/ern/her/own/surprise").to_path_buf()` | help: try using a conversion method: `Path::new("/ern/her/own/surprise").to_path_buf()`
| |
= note: expected type `std::path::PathBuf` = note: expected struct `std::path::PathBuf`
found type `&std::path::Path` found reference `&std::path::Path`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/conversion-methods.rs:9:40 --> $DIR/conversion-methods.rs:9:40
@ -31,7 +31,7 @@ LL | let _but_should_the_play: String = 2; // Perhaps surprisingly, we sugge
| expected struct `std::string::String`, found integer | expected struct `std::string::String`, found integer
| help: try using a conversion method: `2.to_string()` | help: try using a conversion method: `2.to_string()`
| |
= note: expected type `std::string::String` = note: expected struct `std::string::String`
found type `{integer}` found type `{integer}`
error[E0308]: mismatched types error[E0308]: mismatched types
@ -43,8 +43,8 @@ LL | let _prove_piercing_earnest: Vec<usize> = &[1, 2, 3];
| expected struct `std::vec::Vec`, found reference | expected struct `std::vec::Vec`, found reference
| help: try using a conversion method: `(&[1, 2, 3]).to_vec()` | help: try using a conversion method: `(&[1, 2, 3]).to_vec()`
| |
= note: expected type `std::vec::Vec<usize>` = note: expected struct `std::vec::Vec<usize>`
found type `&[{integer}; 3]` found reference `&[{integer}; 3]`
error: aborting due to 4 previous errors error: aborting due to 4 previous errors

View file

@ -8,6 +8,6 @@ impl Trait for Foo {}
pub fn main() { pub fn main() {
let x: Box<dyn Trait> = Box::new(Foo); let x: Box<dyn Trait> = Box::new(Foo);
let _y: &dyn Trait = x; //~ ERROR E0308 let _y: &dyn Trait = x; //~ ERROR E0308
//~| expected type `&dyn Trait` //~| expected reference `&dyn Trait`
//~| found type `std::boxed::Box<dyn Trait>` //~| found struct `std::boxed::Box<dyn Trait>`
} }

View file

@ -7,8 +7,8 @@ LL | let _y: &dyn Trait = x;
| expected &dyn Trait, found struct `std::boxed::Box` | expected &dyn Trait, found struct `std::boxed::Box`
| help: consider borrowing here: `&x` | help: consider borrowing here: `&x`
| |
= note: expected type `&dyn Trait` = note: expected reference `&dyn Trait`
found type `std::boxed::Box<dyn Trait>` found struct `std::boxed::Box<dyn Trait>`
error: aborting due to previous error error: aborting due to previous error

View file

@ -7,8 +7,8 @@ LL | foo(s);
| expected struct `std::string::String`, found reference | expected struct `std::string::String`, found reference
| help: try using a conversion method: `s.to_string()` | help: try using a conversion method: `s.to_string()`
| |
= note: expected type `std::string::String` = note: expected struct `std::string::String`
found type `&std::string::String` found reference `&std::string::String`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/deref-suggestion.rs:14:10 --> $DIR/deref-suggestion.rs:14:10
@ -20,7 +20,7 @@ LL | foo3(u);
| help: consider dereferencing the borrow: `*u` | help: consider dereferencing the borrow: `*u`
| |
= note: expected type `u32` = note: expected type `u32`
found type `&u32` found reference `&u32`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/deref-suggestion.rs:30:9 --> $DIR/deref-suggestion.rs:30:9
@ -31,8 +31,8 @@ LL | foo(&"aaa".to_owned());
| expected struct `std::string::String`, found reference | expected struct `std::string::String`, found reference
| help: consider removing the borrow: `"aaa".to_owned()` | help: consider removing the borrow: `"aaa".to_owned()`
| |
= note: expected type `std::string::String` = note: expected struct `std::string::String`
found type `&std::string::String` found reference `&std::string::String`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/deref-suggestion.rs:32:9 --> $DIR/deref-suggestion.rs:32:9
@ -43,8 +43,8 @@ LL | foo(&mut "aaa".to_owned());
| expected struct `std::string::String`, found mutable reference | expected struct `std::string::String`, found mutable reference
| help: consider removing the borrow: `"aaa".to_owned()` | help: consider removing the borrow: `"aaa".to_owned()`
| |
= note: expected type `std::string::String` = note: expected struct `std::string::String`
found type `&mut std::string::String` found mutable reference `&mut std::string::String`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/deref-suggestion.rs:2:20 --> $DIR/deref-suggestion.rs:2:20
@ -56,7 +56,7 @@ LL | foo3(borrow!(0));
| ---------- in this macro invocation | ---------- in this macro invocation
| |
= note: expected type `u32` = note: expected type `u32`
found type `&{integer}` found reference `&{integer}`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/deref-suggestion.rs:36:5 --> $DIR/deref-suggestion.rs:36:5
@ -65,7 +65,7 @@ LL | assert_eq!(3i32, &3i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found &i32 | ^^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found &i32
| |
= note: expected type `i32` = note: expected type `i32`
found type `&i32` found reference `&i32`
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error[E0308]: mismatched types error[E0308]: mismatched types
@ -77,7 +77,7 @@ LL | let s = S { u };
| expected &u32, found integer | expected &u32, found integer
| help: consider borrowing here: `u: &u` | help: consider borrowing here: `u: &u`
| |
= note: expected type `&u32` = note: expected reference `&u32`
found type `{integer}` found type `{integer}`
error[E0308]: mismatched types error[E0308]: mismatched types
@ -89,7 +89,7 @@ LL | let s = S { u: u };
| expected &u32, found integer | expected &u32, found integer
| help: consider borrowing here: `&u` | help: consider borrowing here: `&u`
| |
= note: expected type `&u32` = note: expected reference `&u32`
found type `{integer}` found type `{integer}`
error[E0308]: mismatched types error[E0308]: mismatched types
@ -102,7 +102,7 @@ LL | let r = R { i };
| help: consider dereferencing the borrow: `i: *i` | help: consider dereferencing the borrow: `i: *i`
| |
= note: expected type `u32` = note: expected type `u32`
found type `&{integer}` found reference `&{integer}`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/deref-suggestion.rs:46:20 --> $DIR/deref-suggestion.rs:46:20
@ -114,7 +114,7 @@ LL | let r = R { i: i };
| help: consider dereferencing the borrow: `*i` | help: consider dereferencing the borrow: `*i`
| |
= note: expected type `u32` = note: expected type `u32`
found type `&{integer}` found reference `&{integer}`
error: aborting due to 10 previous errors error: aborting due to 10 previous errors

View file

@ -31,16 +31,16 @@ fn main() {
// n > m // n > m
let &&x = &1isize as &dyn T; let &&x = &1isize as &dyn T;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `dyn T` //~| expected trait `dyn T`
//~| found type `&_` //~| found reference `&_`
//~| expected trait T, found reference //~| expected trait T, found reference
let &&&x = &(&1isize as &dyn T); let &&&x = &(&1isize as &dyn T);
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `dyn T` //~| expected trait `dyn T`
//~| found type `&_` //~| found reference `&_`
//~| expected trait T, found reference //~| expected trait T, found reference
let box box x = box 1isize as Box<dyn T>; let box box x = box 1isize as Box<dyn T>;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `dyn T` //~| expected trait `dyn T`
//~| found type `std::boxed::Box<_>` //~| found struct `std::boxed::Box<_>`
} }

View file

@ -25,8 +25,8 @@ LL | let &&x = &1isize as &dyn T;
| expected trait T, found reference | expected trait T, found reference
| help: you can probably remove the explicit borrow: `x` | help: you can probably remove the explicit borrow: `x`
| |
= note: expected type `dyn T` = note: expected trait `dyn T`
found type `&_` found reference `&_`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/destructure-trait-ref.rs:37:11 --> $DIR/destructure-trait-ref.rs:37:11
@ -37,8 +37,8 @@ LL | let &&&x = &(&1isize as &dyn T);
| expected trait T, found reference | expected trait T, found reference
| help: you can probably remove the explicit borrow: `x` | help: you can probably remove the explicit borrow: `x`
| |
= note: expected type `dyn T` = note: expected trait `dyn T`
found type `&_` found reference `&_`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/destructure-trait-ref.rs:42:13 --> $DIR/destructure-trait-ref.rs:42:13
@ -46,8 +46,8 @@ error[E0308]: mismatched types
LL | let box box x = box 1isize as Box<dyn T>; LL | let box box x = box 1isize as Box<dyn T>;
| ^^^^^ expected trait T, found struct `std::boxed::Box` | ^^^^^ expected trait T, found struct `std::boxed::Box`
| |
= note: expected type `dyn T` = note: expected trait `dyn T`
found type `std::boxed::Box<_>` found struct `std::boxed::Box<_>`
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View file

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | this_function_expects_a_double_option(n); LL | this_function_expects_a_double_option(n);
| ^ expected enum `DoubleOption`, found usize | ^ expected enum `DoubleOption`, found usize
| |
= note: expected type `DoubleOption<_>` = note: expected enum `DoubleOption<_>`
found type `usize` found type `usize`
help: try using a variant of the expected enum help: try using a variant of the expected enum
| |
@ -19,8 +19,8 @@ error[E0308]: mismatched types
LL | let _c = Context { wrapper: Payload{} }; LL | let _c = Context { wrapper: Payload{} };
| ^^^^^^^^^ expected struct `Wrapper`, found struct `Payload` | ^^^^^^^^^ expected struct `Wrapper`, found struct `Payload`
| |
= note: expected type `Wrapper` = note: expected struct `Wrapper`
found type `Payload` found struct `Payload`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -12,8 +12,8 @@ error[E0308]: mismatched types
LL | let x: &Bottom = &t; LL | let x: &Bottom = &t;
| ^^ expected struct `Bottom`, found struct `Top` | ^^ expected struct `Bottom`, found struct `Top`
| |
= note: expected type `&Bottom` = note: expected reference `&Bottom`
found type `&Top` found reference `&Top`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -8,7 +8,7 @@ LL | ::std::mem::transmute::<f64, [u8; 8]>(panic!())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected !, found array of 8 elements | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected !, found array of 8 elements
| |
= note: expected type `!` = note: expected type `!`
found type `[u8; 8]` found array `[u8; 8]`
error: aborting due to previous error error: aborting due to previous error

View file

@ -5,7 +5,7 @@ LL | &panic!()
| ^^^^^^^^^ expected (), found reference | ^^^^^^^^^ expected (), found reference
| |
= note: expected type `()` = note: expected type `()`
found type `&_` found reference `&_`
help: try adding a return type help: try adding a return type
| |
LL | fn g() -> &_ { LL | fn g() -> &_ {
@ -24,7 +24,7 @@ LL | (return 1, return 2)
| ^^^^^^^^^^^^^^^^^^^^ expected isize, found tuple | ^^^^^^^^^^^^^^^^^^^^ expected isize, found tuple
| |
= note: expected type `isize` = note: expected type `isize`
found type `(!, !)` found tuple `(!, !)`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -32,8 +32,8 @@ pub fn main() {
let z: Box<dyn ToBar> = Box::new(Bar1 {f: 36}); let z: Box<dyn ToBar> = Box::new(Bar1 {f: 36});
f5.2 = Bar1 {f: 36}; f5.2 = Bar1 {f: 36};
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `dyn ToBar`
//~| found type `Bar1`
//~| expected trait ToBar, found struct `Bar1` //~| expected trait ToBar, found struct `Bar1`
//~| expected trait `dyn ToBar`
//~| found struct `Bar1`
//~| ERROR the size for values of type //~| ERROR the size for values of type
} }

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | f5.2 = Bar1 {f: 36}; LL | f5.2 = Bar1 {f: 36};
| ^^^^^^^^^^^^ expected trait ToBar, found struct `Bar1` | ^^^^^^^^^^^^ expected trait ToBar, found struct `Bar1`
| |
= note: expected type `dyn ToBar` = note: expected trait `dyn ToBar`
found type `Bar1` found struct `Bar1`
error[E0277]: the size for values of type `dyn ToBar` cannot be known at compilation time error[E0277]: the size for values of type `dyn ToBar` cannot be known at compilation time
--> $DIR/dst-bad-assign-3.rs:33:5 --> $DIR/dst-bad-assign-3.rs:33:5

View file

@ -34,8 +34,8 @@ pub fn main() {
let z: Box<dyn ToBar> = Box::new(Bar1 {f: 36}); let z: Box<dyn ToBar> = Box::new(Bar1 {f: 36});
f5.ptr = Bar1 {f: 36}; f5.ptr = Bar1 {f: 36};
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `dyn ToBar`
//~| found type `Bar1`
//~| expected trait ToBar, found struct `Bar1` //~| expected trait ToBar, found struct `Bar1`
//~| expected trait `dyn ToBar`
//~| found struct `Bar1`
//~| ERROR the size for values of type //~| ERROR the size for values of type
} }

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | f5.ptr = Bar1 {f: 36}; LL | f5.ptr = Bar1 {f: 36};
| ^^^^^^^^^^^^ expected trait ToBar, found struct `Bar1` | ^^^^^^^^^^^^ expected trait ToBar, found struct `Bar1`
| |
= note: expected type `dyn ToBar` = note: expected trait `dyn ToBar`
found type `Bar1` found struct `Bar1`
error[E0277]: the size for values of type `dyn ToBar` cannot be known at compilation time error[E0277]: the size for values of type `dyn ToBar` cannot be known at compilation time
--> $DIR/dst-bad-assign.rs:35:5 --> $DIR/dst-bad-assign.rs:35:5

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | let f3: &Fat<[usize]> = f2; LL | let f3: &Fat<[usize]> = f2;
| ^^ expected slice, found array of 3 elements | ^^ expected slice, found array of 3 elements
| |
= note: expected type `&Fat<[usize]>` = note: expected reference `&Fat<[usize]>`
found type `&Fat<[isize; 3]>` found reference `&Fat<[isize; 3]>`
error[E0277]: the trait bound `Foo: Bar` is not satisfied error[E0277]: the trait bound `Foo: Bar` is not satisfied
--> $DIR/dst-bad-coerce1.rs:22:29 --> $DIR/dst-bad-coerce1.rs:22:29
@ -21,8 +21,8 @@ error[E0308]: mismatched types
LL | let f3: &([usize],) = f2; LL | let f3: &([usize],) = f2;
| ^^ expected slice, found array of 3 elements | ^^ expected slice, found array of 3 elements
| |
= note: expected type `&([usize],)` = note: expected reference `&([usize],)`
found type `&([isize; 3],)` found reference `&([isize; 3],)`
error[E0277]: the trait bound `Foo: Bar` is not satisfied error[E0277]: the trait bound `Foo: Bar` is not satisfied
--> $DIR/dst-bad-coerce1.rs:34:27 --> $DIR/dst-bad-coerce1.rs:34:27

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | let f3: &mut Fat<[isize]> = f2; LL | let f3: &mut Fat<[isize]> = f2;
| ^^ types differ in mutability | ^^ types differ in mutability
| |
= note: expected type `&mut Fat<[isize]>` = note: expected mutable reference `&mut Fat<[isize]>`
found type `&Fat<[isize; 3]>` found reference `&Fat<[isize; 3]>`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/dst-bad-coerce2.rs:20:33 --> $DIR/dst-bad-coerce2.rs:20:33
@ -13,8 +13,8 @@ error[E0308]: mismatched types
LL | let f3: &mut Fat<dyn Bar> = f2; LL | let f3: &mut Fat<dyn Bar> = f2;
| ^^ types differ in mutability | ^^ types differ in mutability
| |
= note: expected type `&mut Fat<dyn Bar>` = note: expected mutable reference `&mut Fat<dyn Bar>`
found type `&Fat<Foo>` found reference `&Fat<Foo>`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/dst-bad-coerce2.rs:25:31 --> $DIR/dst-bad-coerce2.rs:25:31
@ -22,8 +22,8 @@ error[E0308]: mismatched types
LL | let f3: &mut ([isize],) = f2; LL | let f3: &mut ([isize],) = f2;
| ^^ types differ in mutability | ^^ types differ in mutability
| |
= note: expected type `&mut ([isize],)` = note: expected mutable reference `&mut ([isize],)`
found type `&([isize; 3],)` found reference `&([isize; 3],)`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/dst-bad-coerce2.rs:30:31 --> $DIR/dst-bad-coerce2.rs:30:31
@ -31,8 +31,8 @@ error[E0308]: mismatched types
LL | let f3: &mut (dyn Bar,) = f2; LL | let f3: &mut (dyn Bar,) = f2;
| ^^ types differ in mutability | ^^ types differ in mutability
| |
= note: expected type `&mut (dyn Bar,)` = note: expected mutable reference `&mut (dyn Bar,)`
found type `&(Foo,)` found reference `&(Foo,)`
error: aborting due to 4 previous errors error: aborting due to 4 previous errors

View file

@ -11,15 +11,15 @@ pub fn main() {
let f1: &Fat<[isize]> = &Fat { ptr: [1, 2, 3] }; let f1: &Fat<[isize]> = &Fat { ptr: [1, 2, 3] };
let f2: &Fat<[isize; 3]> = f1; let f2: &Fat<[isize; 3]> = f1;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `&Fat<[isize; 3]>` //~| expected reference `&Fat<[isize; 3]>`
//~| found type `&Fat<[isize]>` //~| found reference `&Fat<[isize]>`
//~| expected array of 3 elements, found slice //~| expected array of 3 elements, found slice
// Tuple with a vec of isizes. // Tuple with a vec of isizes.
let f1: &([isize],) = &([1, 2, 3],); let f1: &([isize],) = &([1, 2, 3],);
let f2: &([isize; 3],) = f1; let f2: &([isize; 3],) = f1;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `&([isize; 3],)` //~| expected reference `&([isize; 3],)`
//~| found type `&([isize],)` //~| found reference `&([isize],)`
//~| expected array of 3 elements, found slice //~| expected array of 3 elements, found slice
} }

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | let f2: &Fat<[isize; 3]> = f1; LL | let f2: &Fat<[isize; 3]> = f1;
| ^^ expected array of 3 elements, found slice | ^^ expected array of 3 elements, found slice
| |
= note: expected type `&Fat<[isize; 3]>` = note: expected reference `&Fat<[isize; 3]>`
found type `&Fat<[isize]>` found reference `&Fat<[isize]>`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/dst-bad-coerce4.rs:20:30 --> $DIR/dst-bad-coerce4.rs:20:30
@ -13,8 +13,8 @@ error[E0308]: mismatched types
LL | let f2: &([isize; 3],) = f1; LL | let f2: &([isize; 3],) = f1;
| ^^ expected array of 3 elements, found slice | ^^ expected array of 3 elements, found slice
| |
= note: expected type `&([isize; 3],)` = note: expected reference `&([isize; 3],)`
found type `&([isize],)` found reference `&([isize],)`
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 y: &S = x; LL | let y: &S = x;
| ^ expected &S, found *-ptr | ^ expected &S, found *-ptr
| |
= note: expected type `&S` = note: expected reference `&S`
found type `*const S` found raw pointer `*const S`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/dst-bad-coercions.rs:15:21 --> $DIR/dst-bad-coercions.rs:15:21
@ -16,8 +16,8 @@ LL | let y: &dyn T = x;
| expected &dyn T, found *-ptr | expected &dyn T, found *-ptr
| help: consider borrowing here: `&x` | help: consider borrowing here: `&x`
| |
= note: expected type `&dyn T` = note: expected reference `&dyn T`
found type `*const S` found raw pointer `*const S`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/dst-bad-coercions.rs:19:17 --> $DIR/dst-bad-coercions.rs:19:17
@ -25,8 +25,8 @@ error[E0308]: mismatched types
LL | let y: &S = x; LL | let y: &S = x;
| ^ expected &S, found *-ptr | ^ expected &S, found *-ptr
| |
= note: expected type `&S` = note: expected reference `&S`
found type `*mut S` found raw pointer `*mut S`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/dst-bad-coercions.rs:20:21 --> $DIR/dst-bad-coercions.rs:20:21
@ -37,8 +37,8 @@ LL | let y: &dyn T = x;
| expected &dyn T, found *-ptr | expected &dyn T, found *-ptr
| help: consider borrowing here: `&x` | help: consider borrowing here: `&x`
| |
= note: expected type `&dyn T` = note: expected reference `&dyn T`
found type `*mut S` found raw pointer `*mut S`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/dst-bad-coercions.rs:23:25 --> $DIR/dst-bad-coercions.rs:23:25
@ -46,8 +46,8 @@ error[E0308]: mismatched types
LL | let x: &mut dyn T = &S; LL | let x: &mut dyn T = &S;
| ^^ types differ in mutability | ^^ types differ in mutability
| |
= note: expected type `&mut dyn T` = note: expected mutable reference `&mut dyn T`
found type `&S` found reference `&S`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/dst-bad-coercions.rs:24:25 --> $DIR/dst-bad-coercions.rs:24:25
@ -55,8 +55,8 @@ error[E0308]: mismatched types
LL | let x: *mut dyn T = &S; LL | let x: *mut dyn T = &S;
| ^^ types differ in mutability | ^^ types differ in mutability
| |
= note: expected type `*mut dyn T` = note: expected raw pointer `*mut dyn T`
found type `&S` found reference `&S`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/dst-bad-coercions.rs:25:21 --> $DIR/dst-bad-coercions.rs:25:21
@ -64,8 +64,8 @@ error[E0308]: mismatched types
LL | let x: *mut S = &S; LL | let x: *mut S = &S;
| ^^ types differ in mutability | ^^ types differ in mutability
| |
= note: expected type `*mut S` = note: expected raw pointer `*mut S`
found type `&S` found reference `&S`
error: aborting due to 7 previous errors error: aborting due to 7 previous errors

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | let (a, b, c) = (A::new(), A::new()); // This tuple is 2 elements, should be three LL | let (a, b, c) = (A::new(), A::new()); // This tuple is 2 elements, should be three
| ^^^^^^^^^ expected a tuple with 2 elements, found one with 3 elements | ^^^^^^^^^ expected a tuple with 2 elements, found one with 3 elements
| |
= note: expected type `(A, A)` = note: expected tuple `(A, A)`
found type `(_, _, _)` found tuple `(_, _, _)`
error: aborting due to previous error error: aborting due to previous error

View file

@ -8,7 +8,7 @@ LL | foo(3_i8);
| ^^^ expected u32, found reference | ^^^ expected u32, found reference
| |
= note: expected type `u32` = note: expected type `u32`
found type `&'static str` found reference `&'static str`
error: aborting due to previous error error: aborting due to previous error

View file

@ -4,8 +4,8 @@ error[E0308]: intrinsic has wrong type
LL | fn size_of<T>(); LL | fn size_of<T>();
| ^^^^^^^^^^^^^^^^ expected (), found usize | ^^^^^^^^^^^^^^^^ expected (), found usize
| |
= note: expected type `extern "rust-intrinsic" fn()` = note: expected fn pointer `extern "rust-intrinsic" fn()`
found type `extern "rust-intrinsic" fn() -> usize` found fn pointer `extern "rust-intrinsic" fn() -> usize`
error: aborting due to previous error error: aborting due to previous error

View file

@ -7,8 +7,8 @@ LL | wants_uniq(x);
| expected struct `std::string::String`, found &str | expected struct `std::string::String`, found &str
| help: try using a conversion method: `x.to_string()` | help: try using a conversion method: `x.to_string()`
| |
= note: expected type `std::string::String` = note: expected struct `std::string::String`
found type `&str` found reference `&str`
error: aborting due to previous error error: aborting due to previous error

View file

@ -12,7 +12,7 @@ LL | match [5..4, 99..105, 43..44] {
LL | [_, 99.., _] => {}, LL | [_, 99.., _] => {},
| ^^^^ expected struct `std::ops::Range`, found integer | ^^^^ expected struct `std::ops::Range`, found integer
| |
= note: expected type `std::ops::Range<{integer}>` = note: expected struct `std::ops::Range<{integer}>`
found type `{integer}` found type `{integer}`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -18,7 +18,7 @@ LL | match [5..4, 99..105, 43..44] {
LL | [_, 99..] => {}, LL | [_, 99..] => {},
| ^^^^ expected struct `std::ops::Range`, found integer | ^^^^ expected struct `std::ops::Range`, found integer
| |
= note: expected type `std::ops::Range<{integer}>` = note: expected struct `std::ops::Range<{integer}>`
found type `{integer}` found type `{integer}`
error: aborting due to 3 previous errors error: aborting due to 3 previous errors

View file

@ -12,7 +12,7 @@ LL | match [5..4, 99..105, 43..44] {
LL | [..9, 99..100, _] => {}, LL | [..9, 99..100, _] => {},
| ^^^ expected struct `std::ops::Range`, found integer | ^^^ expected struct `std::ops::Range`, found integer
| |
= note: expected type `std::ops::Range<{integer}>` = note: expected struct `std::ops::Range<{integer}>`
found type `{integer}` found type `{integer}`
error[E0308]: mismatched types error[E0308]: mismatched types
@ -23,7 +23,7 @@ LL | match [5..4, 99..105, 43..44] {
LL | [..9, 99..100, _] => {}, LL | [..9, 99..100, _] => {},
| ^^^^^^^ expected struct `std::ops::Range`, found integer | ^^^^^^^ expected struct `std::ops::Range`, found integer
| |
= note: expected type `std::ops::Range<{integer}>` = note: expected struct `std::ops::Range<{integer}>`
found type `{integer}` found type `{integer}`
error: aborting due to 3 previous errors error: aborting due to 3 previous errors

View file

@ -7,12 +7,12 @@ impl<'a,'b> Foo<'a,'b> {
fn bar(self: fn bar(self:
Foo<'b,'a> Foo<'b,'a>
//~^ ERROR mismatched `self` parameter type //~^ ERROR mismatched `self` parameter type
//~| expected type `Foo<'a, 'b>` //~| expected struct `Foo<'a, 'b>`
//~| found type `Foo<'b, 'a>` //~| found struct `Foo<'b, 'a>`
//~| lifetime mismatch //~| lifetime mismatch
//~| ERROR mismatched `self` parameter type //~| ERROR mismatched `self` parameter type
//~| expected type `Foo<'a, 'b>` //~| expected struct `Foo<'a, 'b>`
//~| found type `Foo<'b, 'a>` //~| found struct `Foo<'b, 'a>`
//~| lifetime mismatch //~| lifetime mismatch
) {} ) {}
} }

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched `self` parameter type
LL | Foo<'b,'a> LL | Foo<'b,'a>
| ^^^^^^^^^^ lifetime mismatch | ^^^^^^^^^^ lifetime mismatch
| |
= note: expected type `Foo<'a, 'b>` = note: expected struct `Foo<'a, 'b>`
found type `Foo<'b, 'a>` found struct `Foo<'b, 'a>`
note: the lifetime `'b` as defined on the impl at 6:9... note: the lifetime `'b` as defined on the impl at 6:9...
--> $DIR/explicit-self-lifetime-mismatch.rs:6:9 --> $DIR/explicit-self-lifetime-mismatch.rs:6:9
| |
@ -23,8 +23,8 @@ error[E0308]: mismatched `self` parameter type
LL | Foo<'b,'a> LL | Foo<'b,'a>
| ^^^^^^^^^^ lifetime mismatch | ^^^^^^^^^^ lifetime mismatch
| |
= note: expected type `Foo<'a, 'b>` = note: expected struct `Foo<'a, 'b>`
found type `Foo<'b, 'a>` found struct `Foo<'b, 'a>`
note: the lifetime `'a` as defined on the impl at 6:6... note: the lifetime `'a` as defined on the impl at 6:6...
--> $DIR/explicit-self-lifetime-mismatch.rs:6:6 --> $DIR/explicit-self-lifetime-mismatch.rs:6:6
| |

View file

@ -4,8 +4,8 @@ error[E0580]: main function has wrong type
LL | extern fn main() {} LL | extern fn main() {}
| ^^^^^^^^^^^^^^^^ expected "Rust" fn, found "C" fn | ^^^^^^^^^^^^^^^^ expected "Rust" fn, found "C" fn
| |
= note: expected type `fn()` = note: expected fn pointer `fn()`
found type `extern "C" fn()` found fn pointer `extern "C" fn()`
error: aborting due to previous error error: aborting due to previous error

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | r LL | r
| ^ expected extern type `B`, found extern type `A` | ^ expected extern type `B`, found extern type `A`
| |
= note: expected type `&B` = note: expected reference `&B`
found type `&A` found reference `&A`
error: aborting due to previous error error: aborting due to previous error

View file

@ -21,8 +21,8 @@ error[E0308]: mismatched types
LL | let x = f == g; LL | let x = f == g;
| ^ expected fn item, found a different fn item | ^ expected fn item, found a different fn item
| |
= note: expected type `fn() {main::f}` = note: expected fn item `fn() {main::f}`
found type `fn() {main::g}` found fn item `fn() {main::g}`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -12,8 +12,8 @@ impl<T> Foo for T { /* `foo` is still default here */ }
fn main() { fn main() {
eq(foo::<u8>, bar::<u8>); eq(foo::<u8>, bar::<u8>);
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `fn(isize) -> isize {foo::<u8>}` //~| expected fn item `fn(isize) -> isize {foo::<u8>}`
//~| found type `fn(isize) -> isize {bar::<u8>}` //~| found fn item `fn(isize) -> isize {bar::<u8>}`
//~| expected fn item, found a different fn item //~| expected fn item, found a different fn item
eq(foo::<u8>, foo::<i8>); eq(foo::<u8>, foo::<i8>);
@ -22,8 +22,8 @@ fn main() {
eq(bar::<String>, bar::<Vec<u8>>); eq(bar::<String>, bar::<Vec<u8>>);
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `fn(isize) -> isize {bar::<std::string::String>}` //~| expected fn item `fn(isize) -> isize {bar::<std::string::String>}`
//~| found type `fn(isize) -> isize {bar::<std::vec::Vec<u8>>}` //~| found fn item `fn(isize) -> isize {bar::<std::vec::Vec<u8>>}`
//~| expected struct `std::string::String`, found struct `std::vec::Vec` //~| expected struct `std::string::String`, found struct `std::vec::Vec`
// Make sure we distinguish between trait methods correctly. // Make sure we distinguish between trait methods correctly.

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | eq(foo::<u8>, bar::<u8>); LL | eq(foo::<u8>, bar::<u8>);
| ^^^^^^^^^ expected fn item, found a different fn item | ^^^^^^^^^ expected fn item, found a different fn item
| |
= note: expected type `fn(isize) -> isize {foo::<u8>}` = note: expected fn item `fn(isize) -> isize {foo::<u8>}`
found type `fn(isize) -> isize {bar::<u8>}` found fn item `fn(isize) -> isize {bar::<u8>}`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/fn-item-type.rs:19:19 --> $DIR/fn-item-type.rs:19:19
@ -13,8 +13,8 @@ error[E0308]: mismatched types
LL | eq(foo::<u8>, foo::<i8>); LL | eq(foo::<u8>, foo::<i8>);
| ^^^^^^^^^ expected u8, found i8 | ^^^^^^^^^ expected u8, found i8
| |
= note: expected type `fn(isize) -> isize {foo::<u8>}` = note: expected fn item `fn(isize) -> isize {foo::<u8>}`
found type `fn(isize) -> isize {foo::<i8>}` found fn item `fn(isize) -> isize {foo::<i8>}`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/fn-item-type.rs:23:23 --> $DIR/fn-item-type.rs:23:23
@ -22,8 +22,8 @@ error[E0308]: mismatched types
LL | eq(bar::<String>, bar::<Vec<u8>>); LL | eq(bar::<String>, bar::<Vec<u8>>);
| ^^^^^^^^^^^^^^ expected struct `std::string::String`, found struct `std::vec::Vec` | ^^^^^^^^^^^^^^ expected struct `std::string::String`, found struct `std::vec::Vec`
| |
= note: expected type `fn(isize) -> isize {bar::<std::string::String>}` = note: expected fn item `fn(isize) -> isize {bar::<std::string::String>}`
found type `fn(isize) -> isize {bar::<std::vec::Vec<u8>>}` found fn item `fn(isize) -> isize {bar::<std::vec::Vec<u8>>}`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/fn-item-type.rs:30:26 --> $DIR/fn-item-type.rs:30:26
@ -31,8 +31,8 @@ error[E0308]: mismatched types
LL | eq(<u8 as Foo>::foo, <u16 as Foo>::foo); LL | eq(<u8 as Foo>::foo, <u16 as Foo>::foo);
| ^^^^^^^^^^^^^^^^^ expected u8, found u16 | ^^^^^^^^^^^^^^^^^ expected u8, found u16
| |
= note: expected type `fn() {<u8 as Foo>::foo}` = note: expected fn item `fn() {<u8 as Foo>::foo}`
found type `fn() {<u16 as Foo>::foo}` found fn item `fn() {<u16 as Foo>::foo}`
error: aborting due to 4 previous errors error: aborting due to 4 previous errors

View file

@ -6,15 +6,15 @@ fn main() {
let _: () = (box |_: isize| {}) as Box<dyn FnOnce(isize)>; let _: () = (box |_: isize| {}) as Box<dyn FnOnce(isize)>;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `()` //~| expected type `()`
//~| found type `std::boxed::Box<dyn std::ops::FnOnce(isize)>` //~| found struct `std::boxed::Box<dyn std::ops::FnOnce(isize)>`
let _: () = (box |_: isize, isize| {}) as Box<dyn Fn(isize, isize)>; let _: () = (box |_: isize, isize| {}) as Box<dyn Fn(isize, isize)>;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `()` //~| expected type `()`
//~| found type `std::boxed::Box<dyn std::ops::Fn(isize, isize)>` //~| found struct `std::boxed::Box<dyn std::ops::Fn(isize, isize)>`
let _: () = (box || -> isize { unimplemented!() }) as Box<dyn FnMut() -> isize>; let _: () = (box || -> isize { unimplemented!() }) as Box<dyn FnMut() -> isize>;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `()` //~| expected type `()`
//~| found type `std::boxed::Box<dyn std::ops::FnMut() -> isize>` //~| found struct `std::boxed::Box<dyn std::ops::FnMut() -> isize>`
needs_fn(1); needs_fn(1);
//~^ ERROR expected a `std::ops::Fn<(isize,)>` closure, found `{integer}` //~^ ERROR expected a `std::ops::Fn<(isize,)>` closure, found `{integer}`

View file

@ -5,7 +5,7 @@ LL | let _: () = (box |_: isize| {}) as Box<dyn FnOnce(isize)>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box`
| |
= note: expected type `()` = note: expected type `()`
found type `std::boxed::Box<dyn std::ops::FnOnce(isize)>` found struct `std::boxed::Box<dyn std::ops::FnOnce(isize)>`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/fn-trait-formatting.rs:10:17 --> $DIR/fn-trait-formatting.rs:10:17
@ -14,7 +14,7 @@ LL | let _: () = (box |_: isize, isize| {}) as Box<dyn Fn(isize, isize)>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box`
| |
= note: expected type `()` = note: expected type `()`
found type `std::boxed::Box<dyn std::ops::Fn(isize, isize)>` found struct `std::boxed::Box<dyn std::ops::Fn(isize, isize)>`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/fn-trait-formatting.rs:14:17 --> $DIR/fn-trait-formatting.rs:14:17
@ -23,7 +23,7 @@ LL | let _: () = (box || -> isize { unimplemented!() }) as Box<dyn FnMut() -
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box`
| |
= note: expected type `()` = note: expected type `()`
found type `std::boxed::Box<dyn std::ops::FnMut() -> isize>` found struct `std::boxed::Box<dyn std::ops::FnMut() -> isize>`
error[E0277]: expected a `std::ops::Fn<(isize,)>` closure, found `{integer}` error[E0277]: expected a `std::ops::Fn<(isize,)>` closure, found `{integer}`
--> $DIR/fn-trait-formatting.rs:19:14 --> $DIR/fn-trait-formatting.rs:19:14

View file

@ -4,7 +4,7 @@ fn main() {
let x: Option<usize>; let x: Option<usize>;
x = 5; x = 5;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `std::option::Option<usize>` //~| expected enum `std::option::Option<usize>`
//~| found type `{integer}` //~| found type `{integer}`
//~| expected enum `std::option::Option`, found integer //~| expected enum `std::option::Option`, found integer
} }

View file

@ -7,7 +7,7 @@ LL | x = 5;
| expected enum `std::option::Option`, found integer | expected enum `std::option::Option`, found integer
| help: try using a variant of the expected enum: `Some(5)` | help: try using a variant of the expected enum: `Some(5)`
| |
= note: expected type `std::option::Option<usize>` = note: expected enum `std::option::Option<usize>`
found type `{integer}` found type `{integer}`
error: aborting due to previous error error: aborting due to previous error

View file

@ -11,9 +11,9 @@ mod y {
fn bar(x: x::Foo) -> y::Foo { fn bar(x: x::Foo) -> y::Foo {
return x; return x;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `y::Foo`
//~| found type `x::Foo`
//~| expected enum `y::Foo`, found enum `x::Foo` //~| expected enum `y::Foo`, found enum `x::Foo`
//~| expected enum `y::Foo`
//~| found enum `x::Foo`
} }
fn main() { fn main() {

Some files were not shown because too many files have changed in this diff Show more