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 @@ pub fn note_type_err(
};
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) {
(&TypeError::Sorts(ref values), false, true) => {
let sort_string = | a_type: Ty<'tcx> |
if let ty::Opaque(def_id, _) = a_type.kind {
format!(" (opaque type at {})", self.tcx.sess.source_map()
.mk_substr_filename(self.tcx.def_span(def_id)))
} else {
format!(" ({})", a_type.sort_string(self.tcx))
};
(&TypeError::Sorts(ref values), false, extra) => {
let sort_string = |ty: Ty<'tcx>| match (extra, &ty.kind) {
(true, ty::Opaque(def_id, _)) => format!(
" (opaque type at {})",
self.tcx.sess.source_map()
.mk_substr_filename(self.tcx.def_span(*def_id)),
),
(true, _) => format!(" ({})", ty.sort_string(self.tcx)),
(false, _) => "".to_string(),
};
diag.note_expected_found_extra(
&"type",
&expected_label,
expected,
&found_label,
found,
&sort_string(values.expected),
&sort_string(values.found),
@ -1222,15 +1229,14 @@ pub fn note_type_err(
"note_type_err: exp_found={:?}, expected={:?} found={:?}",
exp_found, expected, found
);
if let Some(exp_found) = exp_found {
self.suggest_as_ref_where_appropriate(span, &exp_found, diag);
}
diag.note_expected_found(&"type", expected, found);
diag.note_expected_found(&expected_label, expected, &found_label, 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
// it's a actual definition. According to the comments (e.g. in

View file

@ -246,6 +246,37 @@ pub fn sort_string(&self, tcx: TyCtxt<'_>) -> Cow<'static, str> {
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> {

View file

@ -143,20 +143,21 @@ pub fn replace_span_with(&mut self, after: Span) -> &mut Self {
self
}
pub fn note_expected_found(&mut self,
label: &dyn fmt::Display,
expected: DiagnosticStyledString,
found: DiagnosticStyledString)
-> &mut Self
{
self.note_expected_found_extra(label, expected, found, &"", &"")
pub fn note_expected_found(
&mut self,
expected_label: &dyn fmt::Display,
expected: DiagnosticStyledString,
found_label: &dyn fmt::Display,
found: DiagnosticStyledString,
) -> &mut Self {
self.note_expected_found_extra(expected_label, expected, found_label, found, &"", &"")
}
pub fn note_unsuccessfull_coercion(&mut self,
expected: DiagnosticStyledString,
found: DiagnosticStyledString)
-> &mut Self
{
pub fn note_unsuccessfull_coercion(
&mut self,
expected: DiagnosticStyledString,
found: DiagnosticStyledString,
) -> &mut Self {
let mut msg: Vec<_> =
vec![(format!("required when trying to coerce from type `"),
Style::NoStyle)];
@ -178,27 +179,38 @@ pub fn note_unsuccessfull_coercion(&mut self,
self
}
pub fn note_expected_found_extra(&mut self,
label: &dyn fmt::Display,
expected: DiagnosticStyledString,
found: DiagnosticStyledString,
expected_extra: &dyn fmt::Display,
found_extra: &dyn fmt::Display)
-> &mut Self
{
let mut msg: Vec<_> = vec![(format!("expected {} `", label), Style::NoStyle)];
pub fn note_expected_found_extra(
&mut self,
expected_label: &dyn fmt::Display,
expected: DiagnosticStyledString,
found_label: &dyn fmt::Display,
found: DiagnosticStyledString,
expected_extra: &dyn fmt::Display,
found_extra: &dyn fmt::Display,
) -> &mut Self {
let expected_label = format!("expected {}", expected_label);
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()
.map(|x| match *x {
StringPart::Normal(ref s) => (s.to_owned(), Style::NoStyle),
StringPart::Highlighted(ref s) => (s.to_owned(), Style::Highlight),
}));
.map(|x| match *x {
StringPart::Normal(ref s) => (s.to_owned(), Style::NoStyle),
StringPart::Highlighted(ref s) => (s.to_owned(), Style::Highlight),
}));
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()
.map(|x| match *x {
StringPart::Normal(ref s) => (s.to_owned(), Style::NoStyle),
StringPart::Highlighted(ref s) => (s.to_owned(), Style::Highlight),
}));
.map(|x| match *x {
StringPart::Normal(ref s) => (s.to_owned(), Style::NoStyle),
StringPart::Highlighted(ref s) => (s.to_owned(), Style::Highlight),
}));
msg.push((format!("`{}", found_extra), Style::NoStyle));
// For now, just attach these as notes

View file

@ -195,37 +195,44 @@ pub fn span_label<T: Into<String>>(&mut self, span: Span, label: T) -> &mut Self
self
}
forward!(pub fn note_expected_found(&mut self,
label: &dyn fmt::Display,
expected: DiagnosticStyledString,
found: DiagnosticStyledString,
) -> &mut Self);
forward!(pub fn note_expected_found(
&mut self,
expected_label: &dyn fmt::Display,
expected: DiagnosticStyledString,
found_label: &dyn fmt::Display,
found: DiagnosticStyledString,
) -> &mut Self);
forward!(pub fn note_expected_found_extra(&mut self,
label: &dyn fmt::Display,
expected: DiagnosticStyledString,
found: DiagnosticStyledString,
expected_extra: &dyn fmt::Display,
found_extra: &dyn fmt::Display,
) -> &mut Self);
forward!(pub fn note_expected_found_extra(
&mut self,
expected_label: &dyn fmt::Display,
expected: DiagnosticStyledString,
found_label: &dyn fmt::Display,
found: DiagnosticStyledString,
expected_extra: &dyn fmt::Display,
found_extra: &dyn fmt::Display,
) -> &mut Self);
forward!(pub fn note_unsuccessfull_coercion(&mut self,
expected: DiagnosticStyledString,
found: DiagnosticStyledString,
) -> &mut Self);
forward!(pub fn note_unsuccessfull_coercion(
&mut self,
expected: DiagnosticStyledString,
found: DiagnosticStyledString,
) -> &mut Self);
forward!(pub fn note(&mut self, msg: &str) -> &mut Self);
forward!(pub fn span_note<S: Into<MultiSpan>>(&mut self,
sp: S,
msg: &str,
) -> &mut Self);
forward!(pub fn span_note<S: Into<MultiSpan>>(
&mut self,
sp: S,
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 help(&mut self, msg: &str) -> &mut Self);
forward!(pub fn span_help<S: Into<MultiSpan>>(&mut self,
sp: S,
msg: &str,
) -> &mut Self);
forward!(pub fn span_help<S: Into<MultiSpan>>(
&mut self,
sp: S,
msg: &str,
) -> &mut Self);
pub fn multipart_suggestion(
&mut self,

View file

@ -17,7 +17,7 @@ LL | |_: [_; break]| {}
| ^^^^^^^^^^^^^^^^^^ expected (), found closure
|
= 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
--> $DIR/array-break-length.rs:8:9
@ -26,7 +26,7 @@ LL | |_: [_; continue]| {}
| ^^^^^^^^^^^^^^^^^^^^^ expected (), found closure
|
= 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

View file

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

View file

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

View file

@ -7,8 +7,8 @@ LL | const FROM: Self::Out;
LL | const FROM: &'static str = "foo";
| ^^^^^^^^^^^^ expected associated type, found reference
|
= note: expected type `<T as Foo>::Out`
found type `&'static str`
= note: expected associated type `<T as Foo>::Out`
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: 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";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= note: expected type `&'static str`
found type `&'a str`
= note: expected reference `&'static str`
found reference `&'a str`
note: the lifetime `'a` as defined on the impl at 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); }
| ^^^^ expected struct `Black`, found struct `Blue`
|
= note: expected type `Black`
found type `Blue`
= note: expected struct `Black`
found struct `Blue`
error[E0308]: mismatched types
--> $DIR/associated-type-projection-from-supertrait.rs:28:23
@ -13,8 +13,8 @@ error[E0308]: mismatched types
LL | fn c() { dent(ModelU, Black); }
| ^^^^^ expected struct `Blue`, found struct `Black`
|
= note: expected type `Blue`
found type `Black`
= note: expected struct `Blue`
found struct `Black`
error[E0308]: mismatched types
--> $DIR/associated-type-projection-from-supertrait.rs:32:28
@ -22,8 +22,8 @@ error[E0308]: mismatched types
LL | fn f() { ModelT.chip_paint(Blue); }
| ^^^^ expected struct `Black`, found struct `Blue`
|
= note: expected type `Black`
found type `Blue`
= note: expected struct `Black`
found struct `Blue`
error[E0308]: mismatched types
--> $DIR/associated-type-projection-from-supertrait.rs:33:28
@ -31,8 +31,8 @@ error[E0308]: mismatched types
LL | fn g() { ModelU.chip_paint(Black); }
| ^^^^^ expected struct `Blue`, found struct `Black`
|
= note: expected type `Blue`
found type `Black`
= note: expected struct `Blue`
found struct `Black`
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); }
| ^^^^^^^^ expected struct `Blue`, found struct `Black`
|
= note: expected type `Blue`
found type `Black`
= note: expected struct `Blue`
found struct `Black`
error[E0271]: type mismatch resolving `<ModelU as Vehicle>::Color == Black`
--> $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); }
| ^^^^^^^^^ expected struct `Black`, found struct `Blue`
|
= note: expected type `Black`
found type `Blue`
= note: expected struct `Black`
found struct `Blue`
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) {
let _: Bar = x.boo();
//~^ ERROR mismatched types
//~| expected type `Bar`
//~| found type `<I as Foo>::A`
//~| found associated type `<I as Foo>::A`
//~| expected struct `Bar`, found associated type
//~| expected struct `Bar`
}

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | let _: Bar = x.boo();
| ^^^^^^^ expected struct `Bar`, found associated type
|
= note: expected type `Bar`
found type `<I as Foo>::A`
= note: expected struct `Bar`
found associated type `<I as Foo>::A`
= 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
@ -18,8 +18,8 @@ LL | fn foo1<I: Foo<A=Bar>>(x: I) {
LL | foo1(a);
| ^^^^ expected struct `Bar`, found usize
|
= note: expected type `Bar`
found type `usize`
= note: expected struct `Bar`
found type `usize`
error[E0271]: type mismatch resolving `<isize as Foo>::A == Bar`
--> $DIR/associated-types-eq-3.rs:41:9
@ -27,8 +27,8 @@ error[E0271]: type mismatch resolving `<isize as Foo>::A == Bar`
LL | baz(&a);
| ^^ expected struct `Bar`, found usize
|
= note: expected type `Bar`
found type `usize`
= note: expected struct `Bar`
found type `usize`
= note: required for the cast to the object type `dyn Foo<A = Bar>`
error: aborting due to 3 previous errors

View file

@ -9,8 +9,8 @@ LL | where T : for<'x> TheTrait<&'x isize, A = &'x isize>
LL | foo::<UintStruct>();
| ^^^^^^^^^^^^^^^^^ expected isize, found usize
|
= note: expected type `&isize`
found type `&usize`
= note: expected reference `&isize`
found reference `&usize`
error[E0271]: type mismatch resolving `for<'x> <IntStruct as TheTrait<&'x isize>>::A == &'x usize`
--> $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>();
| ^^^^^^^^^^^^^^^^ expected usize, found isize
|
= note: expected type `&usize`
found type `&isize`
= note: expected reference `&usize`
found reference `&isize`
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

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);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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`
= 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

View file

@ -7,8 +7,8 @@ LL | want_y(t);
LL | fn want_y<T:Foo<Y=i32>>(t: &T) { }
| ------ ----- required by this bound in `want_y`
|
= note: expected type `i32`
found type `<T as Foo>::Y`
= note: expected type `i32`
found associated type `<T as Foo>::Y`
= 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
@ -21,8 +21,8 @@ LL | want_x(t);
LL | fn want_x<T:Foo<X=u32>>(t: &T) { }
| ------ ----- required by this bound in `want_x`
|
= note: expected type `u32`
found type `<T as Foo>::X`
= note: expected type `u32`
found associated type `<T as Foo>::X`
= 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

View file

@ -7,8 +7,8 @@ LL | fn visit() {}
LL | <() as Visit>::visit();
| ^^^^^^^^^^^^^^^^^^^^ expected (), found &()
|
= note: expected type `()`
found type `&()`
= note: expected type `()`
found reference `&()`
= note: required because of the requirements on the impl of `Visit` for `()`
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
|
= note: expected type `std::result::Result<u8, MyErr>`
= note: expected enum `std::result::Result<u8, MyErr>`
found type `()`
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
|
= note: expected type `std::result::Result<u8, MyErr>`
= note: expected enum `std::result::Result<u8, MyErr>`
found type `()`
error: aborting due to 8 previous errors

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | take_u32(x)
| ^ expected u32, found opaque type
|
= note: expected type `u32`
found type `impl std::future::Future`
= note: expected type `u32`
found opaque type `impl std::future::Future`
error: aborting due to previous error

View file

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

View file

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

View file

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

View file

@ -7,8 +7,8 @@ LL | static i: String = 10;
| expected struct `std::string::String`, found integer
| help: try using a conversion method: `10.to_string()`
|
= note: expected type `std::string::String`
found type `{integer}`
= note: expected struct `std::string::String`
found type `{integer}`
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>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
= note: expected type `fn()`
found type `fn(std::vec::Vec<std::string::String>)`
= note: expected fn pointer `fn()`
found fn pointer `fn(std::vec::Vec<std::string::String>)`
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>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
= note: expected type `fn()`
found type `fn(std::vec::Vec<std::string::String>)`
= note: expected fn pointer `fn()`
found fn pointer `fn(std::vec::Vec<std::string::String>)`
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) { }
| ^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
= note: expected type `fn()`
found type `fn(isize)`
= note: expected fn pointer `fn()`
found fn pointer `fn(isize)`
error: aborting due to previous error

View file

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

View file

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

View file

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

View file

@ -6,9 +6,9 @@ pub enum Enum {
pub fn get_enum_struct_variant() -> () {
Enum::EnumStructVariant { x: 1, y: 2, z: 3 }
//~^ ERROR mismatched types
//~| expected type `()`
//~| found type `a::Enum`
//~| expected (), found enum `a::Enum`
//~| expected type `()`
//~| found enum `a::Enum`
}
}
@ -21,9 +21,9 @@ fn test_enum_struct_variant() {
match enum_struct_variant {
a::Enum::EnumStructVariant { x, y, z } => {
//~^ ERROR mismatched types
//~| expected type `()`
//~| found type `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`
|
= note: expected type `()`
found type `a::Enum`
found enum `a::Enum`
error[E0308]: mismatched types
--> $DIR/issue-13624.rs:22:9
@ -18,7 +18,7 @@ LL | a::Enum::EnumStructVariant { x, y, z } => {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found enum `a::Enum`
|
= note: expected type `()`
found type `a::Enum`
found enum `a::Enum`
error: aborting due to 2 previous errors

View file

@ -7,7 +7,7 @@ LL | |y| x + y
| ^^^^^^^^^ expected (), found closure
|
= 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 `()`
--> $DIR/issue-20862.rs:7:13

View file

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

View file

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

View file

@ -9,8 +9,8 @@ LL | &panic!()
| expected (), found reference
| help: consider removing the borrow: `panic!()`
|
= note: expected type `()`
found type `&_`
= note: expected type `()`
found reference `&_`
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>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= note: expected type `fn(&'a isize, Inv<'c>, Inv<'c>, Inv<'d>)`
found type `fn(&'a isize, Inv<'_>, Inv<'c>, Inv<'d>)`
= note: expected fn pointer `fn(&'a isize, Inv<'c>, 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...
--> $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;
| ^^^ expected non-variadic fn, found variadic function
|
= note: expected type `unsafe extern "C" fn(isize, u8)`
found type `unsafe extern "C" fn(isize, u8, ...) {foo}`
= note: expected fn pointer `unsafe extern "C" fn(isize, u8)`
found fn item `unsafe extern "C" fn(isize, u8, ...) {foo}`
error[E0308]: mismatched types
--> $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;
| ^^^ expected variadic fn, found non-variadic function
|
= note: expected type `extern "C" fn(isize, u8, ...)`
found type `extern "C" fn(isize, u8) {bar}`
= note: expected fn pointer `extern "C" fn(isize, u8, ...)`
found fn item `extern "C" fn(isize, u8) {bar}`
error[E0617]: can't pass `f32` to variadic function
--> $DIR/variadic-ffi-1.rs:22:19

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | ap
| ^^ lifetime mismatch
|
= note: expected type `core::ffi::VaListImpl<'f>`
found type `core::ffi::VaListImpl<'_>`
= note: expected struct `core::ffi::VaListImpl<'f>`
found struct `core::ffi::VaListImpl<'_>`
note: the scope of call-site for function at 7:78...
--> $DIR/variadic-ffi-4.rs:7:78
|
@ -26,8 +26,8 @@ error[E0308]: mismatched types
LL | ap
| ^^ lifetime mismatch
|
= note: expected type `core::ffi::VaListImpl<'static>`
found type `core::ffi::VaListImpl<'_>`
= note: expected struct `core::ffi::VaListImpl<'static>`
found struct `core::ffi::VaListImpl<'_>`
note: the scope of call-site for function at 11:79...
--> $DIR/variadic-ffi-4.rs:11:79
|
@ -69,8 +69,8 @@ error[E0308]: mismatched types
LL | *ap0 = ap1;
| ^^^ lifetime mismatch
|
= note: expected type `core::ffi::VaListImpl<'_>`
found type `core::ffi::VaListImpl<'_>`
= note: expected struct `core::ffi::VaListImpl<'_>`
found struct `core::ffi::VaListImpl<'_>`
note: the scope of call-site for function at 19:87...
--> $DIR/variadic-ffi-4.rs:19:87
|
@ -121,8 +121,8 @@ error[E0308]: mismatched types
LL | ap0 = &mut ap1;
| ^^^^^^^^ lifetime mismatch
|
= note: expected type `&mut core::ffi::VaListImpl<'_>`
found type `&mut core::ffi::VaListImpl<'_>`
= note: expected mutable reference `&mut core::ffi::VaListImpl<'_>`
found mutable reference `&mut core::ffi::VaListImpl<'_>`
note: the scope of call-site for function at 23:83...
--> $DIR/variadic-ffi-4.rs:23:83
|
@ -189,8 +189,8 @@ error[E0308]: mismatched types
LL | *ap0 = ap1.clone();
| ^^^^^^^^^^^ lifetime mismatch
|
= note: expected type `core::ffi::VaListImpl<'_>`
found type `core::ffi::VaListImpl<'_>`
= note: expected struct `core::ffi::VaListImpl<'_>`
found struct `core::ffi::VaListImpl<'_>`
note: the scope of call-site for function at 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| {});
| ^^^^^^^^^^^ lifetime mismatch
|
= note: expected type `fn(&u32)`
found type `fn(&'x u32)`
= note: expected fn pointer `fn(&u32)`
found fn pointer `fn(&'x u32)`
note: the anonymous lifetime #2 defined on the body at 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| {});
| ^^^^^^^^^^^ lifetime mismatch
|
= note: expected type `fn(&u32)`
found type `fn(&'x u32)`
= note: expected fn pointer `fn(&u32)`
found fn pointer `fn(&'x u32)`
note: the lifetime `'x` as defined on the function body at 11:36...
--> $DIR/expect-fn-supply-fn.rs:11:36
|

View file

@ -23,7 +23,7 @@ LL | while |_: [_; continue]| {} {}
| ^^^^^^^^^^^^^^^^^^^^^ expected bool, found closure
|
= 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
--> $DIR/closure-array-break-length.rs:7:11
@ -32,7 +32,7 @@ LL | while |_: [_; break]| {} {}
| ^^^^^^^^^^^^^^^^^^ expected bool, found closure
|
= 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

View file

@ -24,8 +24,8 @@ error[E0308]: mismatched types
LL | closure_expecting_bound(|x: &'x u32| {
| ^^^^^^^ lifetime mismatch
|
= note: expected type `&u32`
found type `&'x u32`
= note: expected reference `&u32`
found reference `&'x u32`
note: the anonymous lifetime #2 defined on the body at 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| {
| ^^^^^^^ lifetime mismatch
|
= note: expected type `&u32`
found type `&'x u32`
= note: expected reference `&u32`
found reference `&'x u32`
note: the lifetime `'x` as defined on the function body at 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 };
| ^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found closure
|
= note: expected type `fn(u8) -> u8`
found type `[closure@$DIR/closure-no-fn-1.rs:6:29: 6:50 a:_]`
= note: expected fn pointer `fn(u8) -> u8`
found closure `[closure@$DIR/closure-no-fn-1.rs:6:29: 6:50 a:_]`
error: aborting due to previous error

View file

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

View file

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

View file

@ -12,8 +12,8 @@ LL | fn foo() {
LL | "bar boo"
| ^^^^^^^^^^^^^^^^^^^^ expected (), found reference
|
= note: expected type `()`
found type `&'static str`
= note: expected type `()`
found reference `&'static str`
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]>;
| ^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
|
= note: expected type `std::boxed::Box<[i32]>`
found type `std::boxed::Box<[i32; 3]>`
= note: expected struct `std::boxed::Box<[i32]>`
found struct `std::boxed::Box<[i32; 3]>`
error[E0308]: mismatched types
--> $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]>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
|
= note: expected type `std::boxed::Box<[i32]>`
found type `std::boxed::Box<[i32; 3]>`
= note: expected struct `std::boxed::Box<[i32]>`
found struct `std::boxed::Box<[i32; 3]>`
error[E0308]: mismatched types
--> $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]>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
|
= note: expected type `std::boxed::Box<[i32]>`
found type `std::boxed::Box<[i32; 3]>`
= note: expected struct `std::boxed::Box<[i32]>`
found struct `std::boxed::Box<[i32; 3]>`
error[E0308]: mismatched types
--> $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) -> _>;
| ^^^^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure
|
= note: expected type `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]>`
= note: expected struct `std::boxed::Box<dyn std::ops::Fn(i32) -> u8>`
found struct `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:13:19: 13:32]>`
error[E0308]: mismatched types
--> $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>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found bool
|
= note: expected type `std::boxed::Box<dyn std::fmt::Debug>`
found type `std::boxed::Box<bool>`
= note: expected struct `std::boxed::Box<dyn std::fmt::Debug>`
found struct `std::boxed::Box<bool>`
error[E0308]: mismatched types
--> $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>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found char
|
= note: expected type `std::boxed::Box<dyn std::fmt::Debug>`
found type `std::boxed::Box<char>`
= note: expected struct `std::boxed::Box<dyn std::fmt::Debug>`
found struct `std::boxed::Box<char>`
error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:17:13
@ -58,8 +58,8 @@ error[E0308]: mismatched types
LL | let _ = &{ [1, 2, 3] }: &[i32];
| ^^^^^^^^^^^^^^ expected slice, found array of 3 elements
|
= note: expected type `&[i32]`
found type `&[i32; 3]`
= note: expected reference `&[i32]`
found reference `&[i32; 3]`
error[E0308]: mismatched types
--> $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];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
|
= note: expected type `&[i32]`
found type `&[i32; 3]`
= note: expected reference `&[i32]`
found reference `&[i32; 3]`
error[E0308]: mismatched types
--> $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];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
|
= note: expected type `&[i32]`
found type `&[i32; 3]`
= note: expected reference `&[i32]`
found reference `&[i32; 3]`
error[E0308]: mismatched types
--> $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) -> _;
| ^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure
|
= note: expected type `&dyn std::ops::Fn(i32) -> u8`
found type `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:21:16: 21:29]`
= note: expected reference `&dyn std::ops::Fn(i32) -> u8`
found reference `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:21:16: 21:29]`
error[E0308]: mismatched types
--> $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;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found bool
|
= note: expected type `&dyn std::fmt::Debug`
found type `&bool`
= note: expected reference `&dyn std::fmt::Debug`
found reference `&bool`
error[E0308]: mismatched types
--> $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;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found char
|
= note: expected type `&dyn std::fmt::Debug`
found type `&char`
= note: expected reference `&dyn std::fmt::Debug`
found reference `&char`
error[E0308]: mismatched types
--> $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]>;
| ^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
|
= note: expected type `std::boxed::Box<[i32]>`
found type `std::boxed::Box<[i32; 3]>`
= note: expected struct `std::boxed::Box<[i32]>`
found struct `std::boxed::Box<[i32; 3]>`
error[E0308]: mismatched types
--> $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) -> _>;
| ^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure
|
= note: expected type `std::boxed::Box<dyn std::ops::Fn(i32) -> _>`
found type `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:26:22: 26:35]>`
= note: expected struct `std::boxed::Box<dyn std::ops::Fn(i32) -> _>`
found struct `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:26:22: 26:35]>`
error: aborting due to 14 previous errors

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -7,8 +7,8 @@ LL | let _: &[i32] = [0];
| expected &[i32], found array of 1 element
| help: consider borrowing here: `&[0]`
|
= note: expected type `&[i32]`
found type `[{integer}; 1]`
= note: expected reference `&[i32]`
found array `[{integer}; 1]`
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
| expected type parameter
|
= note: expected type `fn(&E, F) -> F`
found type `fn(&E, G) -> G`
= note: expected fn pointer `fn(&E, F) -> F`
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: 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]));
| ^^^^^^^^^^ expected an array with a fixed size of 3 elements, found one with 2 elements
|
= note: expected type `[u8; 3]`
found type `[u8; 2]`
= note: expected array `[u8; 3]`
found array `[u8; 2]`
error[E0308]: mismatched types
--> $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]);
| ^^^^^^^^^^^^^^^ expected an array with a fixed size of 2 elements, found one with 3 elements
|
= note: expected type `[u8; 2]`
found type `[u8; 3]`
= note: expected array `[u8; 2]`
found array `[u8; 3]`
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}>;
| ^^^^^^^^^^^^^^^^^^^^ expected `not_one`, found `not_two`
|
= note: expected type `Checked<not_one>`
found type `Checked<not_two>`
= note: expected struct `Checked<not_one>`
found struct `Checked<not_two>`
error[E0308]: mismatched types
--> $DIR/fn-const-param-infer.rs:20:24
@ -21,8 +21,8 @@ error[E0308]: mismatched types
LL | let _ = Checked::<{generic_arg::<u32>}>;
| ^^^^^^^^^^^^^^^^^^ expected usize, found u32
|
= note: expected type `fn(usize) -> bool`
found type `fn(u32) -> bool {generic_arg::<u32>}`
= note: expected fn pointer `fn(usize) -> bool`
found fn item `fn(u32) -> bool {generic_arg::<u32>}`
error[E0282]: type annotations needed
--> $DIR/fn-const-param-infer.rs:22:24
@ -36,8 +36,8 @@ error[E0308]: mismatched types
LL | let _: Checked<{generic::<u32>}> = Checked::<{generic::<u16>}>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `generic::<u32>`, found `generic::<u16>`
|
= note: expected type `Checked<generic::<u32>>`
found type `Checked<generic::<u16>>`
= note: expected struct `Checked<generic::<u32>>`
found struct `Checked<generic::<u16>>`
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 _}>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{pointer}`, found `{pointer}`
|
= note: expected type `Const<{pointer}>`
found type `Const<{pointer}>`
= note: expected struct `Const<{pointer}>`
found struct `Const<{pointer}>`
error: aborting due to previous error

View file

@ -12,8 +12,8 @@ error[E0308]: mismatched types
LL | let _: ConstString<"Hello"> = ConstString::<"World">;
| ^^^^^^^^^^^^^^^^^^^^^^ expected `"Hello"`, found `"World"`
|
= note: expected type `ConstString<"Hello">`
found type `ConstString<"World">`
= note: expected struct `ConstString<"Hello">`
found struct `ConstString<"World">`
error[E0308]: mismatched types
--> $DIR/slice-const-param-mismatch.rs:11:33
@ -21,8 +21,8 @@ error[E0308]: mismatched types
LL | let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↥">;
| ^^^^^^^^^^^^^^^^^^^^^ expected `"ℇ㇈↦"`, found `"ℇ㇈↥"`
|
= note: expected type `ConstString<"ℇ㇈↦">`
found type `ConstString<"ℇ㇈↥">`
= note: expected struct `ConstString<"ℇ㇈↦">`
found struct `ConstString<"ℇ㇈↥">`
error[E0308]: mismatched types
--> $DIR/slice-const-param-mismatch.rs:13:33
@ -30,8 +30,8 @@ error[E0308]: mismatched types
LL | let _: ConstBytes<b"AAA"> = ConstBytes::<b"BBB">;
| ^^^^^^^^^^^^^^^^^^^^ expected `b"AAA"`, found `b"BBB"`
|
= note: expected type `ConstBytes<b"AAA">`
found type `ConstBytes<b"BBB">`
= note: expected struct `ConstBytes<b"AAA">`
found struct `ConstBytes<b"BBB">`
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 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `2u32`, found `4u32`
|
= note: expected type `A<'_, _, 2u32, _>`
found type `A<'_, _, 4u32, _>`
= note: expected struct `A<'_, _, 2u32, _>`
found struct `A<'_, _, 4u32, _>`
error[E0308]: mismatched types
--> $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 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u16, found u32
|
= note: expected type `A<'a, u16, _, _>`
found type `A<'b, u32, _, _>`
= note: expected struct `A<'a, u16, _, _>`
found struct `A<'b, u32, _, _>`
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];
| ^^^ expected an array with a fixed size of 2 elements, found one with 1 element
|
= note: expected type `[i32; 2]`
found type `[i32; 1]`
= note: expected array `[i32; 2]`
found array `[i32; 1]`
error[E0308]: mismatched types
--> $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];
| ^^^^^^^ expected an array with a fixed size of 1 element, found one with 2 elements
|
= note: expected type `[i32; 1]`
found type `[i32; 2]`
= note: expected array `[i32; 1]`
found array `[i32; 2]`
error: aborting due to 2 previous errors

View file

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

View file

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

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | const TUP: (usize,) = 5usize << 64;
| ^^^^^^^^^^^^ expected tuple, found usize
|
= note: expected type `(usize,)`
found type `usize`
= note: expected tuple `(usize,)`
found type `usize`
error[E0080]: evaluation of constant value failed
--> $DIR/const-tup-index-span.rs:6:18

View file

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

View file

@ -8,6 +8,6 @@ impl Trait for Foo {}
pub fn main() {
let x: Box<dyn Trait> = Box::new(Foo);
let _y: &dyn Trait = x; //~ ERROR E0308
//~| expected type `&dyn Trait`
//~| found type `std::boxed::Box<dyn Trait>`
//~| expected reference `&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`
| help: consider borrowing here: `&x`
|
= note: expected type `&dyn Trait`
found type `std::boxed::Box<dyn Trait>`
= note: expected reference `&dyn Trait`
found struct `std::boxed::Box<dyn Trait>`
error: aborting due to previous error

View file

@ -7,8 +7,8 @@ LL | foo(s);
| expected struct `std::string::String`, found reference
| help: try using a conversion method: `s.to_string()`
|
= note: expected type `std::string::String`
found type `&std::string::String`
= note: expected struct `std::string::String`
found reference `&std::string::String`
error[E0308]: mismatched types
--> $DIR/deref-suggestion.rs:14:10
@ -19,8 +19,8 @@ LL | foo3(u);
| expected u32, found &u32
| help: consider dereferencing the borrow: `*u`
|
= note: expected type `u32`
found type `&u32`
= note: expected type `u32`
found reference `&u32`
error[E0308]: mismatched types
--> $DIR/deref-suggestion.rs:30:9
@ -31,8 +31,8 @@ LL | foo(&"aaa".to_owned());
| expected struct `std::string::String`, found reference
| help: consider removing the borrow: `"aaa".to_owned()`
|
= note: expected type `std::string::String`
found type `&std::string::String`
= note: expected struct `std::string::String`
found reference `&std::string::String`
error[E0308]: mismatched types
--> $DIR/deref-suggestion.rs:32:9
@ -43,8 +43,8 @@ LL | foo(&mut "aaa".to_owned());
| expected struct `std::string::String`, found mutable reference
| help: consider removing the borrow: `"aaa".to_owned()`
|
= note: expected type `std::string::String`
found type `&mut std::string::String`
= note: expected struct `std::string::String`
found mutable reference `&mut std::string::String`
error[E0308]: mismatched types
--> $DIR/deref-suggestion.rs:2:20
@ -55,8 +55,8 @@ LL | ($x:expr) => { &$x }
LL | foo3(borrow!(0));
| ---------- in this macro invocation
|
= note: expected type `u32`
found type `&{integer}`
= note: expected type `u32`
found reference `&{integer}`
error[E0308]: mismatched types
--> $DIR/deref-suggestion.rs:36:5
@ -64,8 +64,8 @@ error[E0308]: mismatched types
LL | assert_eq!(3i32, &3i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found &i32
|
= note: expected type `i32`
found type `&i32`
= note: expected 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)
error[E0308]: mismatched types
@ -77,8 +77,8 @@ LL | let s = S { u };
| expected &u32, found integer
| help: consider borrowing here: `u: &u`
|
= note: expected type `&u32`
found type `{integer}`
= note: expected reference `&u32`
found type `{integer}`
error[E0308]: mismatched types
--> $DIR/deref-suggestion.rs:41:20
@ -89,8 +89,8 @@ LL | let s = S { u: u };
| expected &u32, found integer
| help: consider borrowing here: `&u`
|
= note: expected type `&u32`
found type `{integer}`
= note: expected reference `&u32`
found type `{integer}`
error[E0308]: mismatched types
--> $DIR/deref-suggestion.rs:44:17
@ -101,8 +101,8 @@ LL | let r = R { i };
| expected u32, found &{integer}
| help: consider dereferencing the borrow: `i: *i`
|
= note: expected type `u32`
found type `&{integer}`
= note: expected type `u32`
found reference `&{integer}`
error[E0308]: mismatched types
--> $DIR/deref-suggestion.rs:46:20
@ -113,8 +113,8 @@ LL | let r = R { i: i };
| expected u32, found &{integer}
| help: consider dereferencing the borrow: `*i`
|
= note: expected type `u32`
found type `&{integer}`
= note: expected type `u32`
found reference `&{integer}`
error: aborting due to 10 previous errors

View file

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

View file

@ -25,8 +25,8 @@ LL | let &&x = &1isize as &dyn T;
| expected trait T, found reference
| help: you can probably remove the explicit borrow: `x`
|
= note: expected type `dyn T`
found type `&_`
= note: expected trait `dyn T`
found reference `&_`
error[E0308]: mismatched types
--> $DIR/destructure-trait-ref.rs:37:11
@ -37,8 +37,8 @@ LL | let &&&x = &(&1isize as &dyn T);
| expected trait T, found reference
| help: you can probably remove the explicit borrow: `x`
|
= note: expected type `dyn T`
found type `&_`
= note: expected trait `dyn T`
found reference `&_`
error[E0308]: mismatched types
--> $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>;
| ^^^^^ expected trait T, found struct `std::boxed::Box`
|
= note: expected type `dyn T`
found type `std::boxed::Box<_>`
= note: expected trait `dyn T`
found struct `std::boxed::Box<_>`
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);
| ^ expected enum `DoubleOption`, found usize
|
= note: expected type `DoubleOption<_>`
= note: expected enum `DoubleOption<_>`
found type `usize`
help: try using a variant of the expected enum
|
@ -19,8 +19,8 @@ error[E0308]: mismatched types
LL | let _c = Context { wrapper: Payload{} };
| ^^^^^^^^^ expected struct `Wrapper`, found struct `Payload`
|
= note: expected type `Wrapper`
found type `Payload`
= note: expected struct `Wrapper`
found struct `Payload`
error: aborting due to 2 previous errors

View file

@ -12,8 +12,8 @@ error[E0308]: mismatched types
LL | let x: &Bottom = &t;
| ^^ expected struct `Bottom`, found struct `Top`
|
= note: expected type `&Bottom`
found type `&Top`
= note: expected reference `&Bottom`
found reference `&Top`
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
|
= note: expected type `!`
found type `[u8; 8]`
found array `[u8; 8]`
error: aborting due to previous error

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | &panic!()
| ^^^^^^^^^ expected (), found reference
|
= note: expected type `()`
found type `&_`
= note: expected type `()`
found reference `&_`
help: try adding a return type
|
LL | fn g() -> &_ {
@ -24,7 +24,7 @@ LL | (return 1, return 2)
| ^^^^^^^^^^^^^^^^^^^^ expected isize, found tuple
|
= note: expected type `isize`
found type `(!, !)`
found tuple `(!, !)`
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});
f5.2 = Bar1 {f: 36};
//~^ ERROR mismatched types
//~| expected type `dyn ToBar`
//~| found type `Bar1`
//~| expected trait ToBar, found struct `Bar1`
//~| expected trait `dyn ToBar`
//~| found struct `Bar1`
//~| ERROR the size for values of type
}

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | f5.2 = Bar1 {f: 36};
| ^^^^^^^^^^^^ expected trait ToBar, found struct `Bar1`
|
= note: expected type `dyn ToBar`
found type `Bar1`
= note: expected trait `dyn ToBar`
found struct `Bar1`
error[E0277]: the size for values of type `dyn ToBar` cannot be known at compilation time
--> $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});
f5.ptr = Bar1 {f: 36};
//~^ ERROR mismatched types
//~| expected type `dyn ToBar`
//~| found type `Bar1`
//~| expected trait ToBar, found struct `Bar1`
//~| expected trait `dyn ToBar`
//~| found struct `Bar1`
//~| ERROR the size for values of type
}

View file

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

View file

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

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | let f3: &mut Fat<[isize]> = f2;
| ^^ types differ in mutability
|
= note: expected type `&mut Fat<[isize]>`
found type `&Fat<[isize; 3]>`
= note: expected mutable reference `&mut Fat<[isize]>`
found reference `&Fat<[isize; 3]>`
error[E0308]: mismatched types
--> $DIR/dst-bad-coerce2.rs:20:33
@ -13,8 +13,8 @@ error[E0308]: mismatched types
LL | let f3: &mut Fat<dyn Bar> = f2;
| ^^ types differ in mutability
|
= note: expected type `&mut Fat<dyn Bar>`
found type `&Fat<Foo>`
= note: expected mutable reference `&mut Fat<dyn Bar>`
found reference `&Fat<Foo>`
error[E0308]: mismatched types
--> $DIR/dst-bad-coerce2.rs:25:31
@ -22,8 +22,8 @@ error[E0308]: mismatched types
LL | let f3: &mut ([isize],) = f2;
| ^^ types differ in mutability
|
= note: expected type `&mut ([isize],)`
found type `&([isize; 3],)`
= note: expected mutable reference `&mut ([isize],)`
found reference `&([isize; 3],)`
error[E0308]: mismatched types
--> $DIR/dst-bad-coerce2.rs:30:31
@ -31,8 +31,8 @@ error[E0308]: mismatched types
LL | let f3: &mut (dyn Bar,) = f2;
| ^^ types differ in mutability
|
= note: expected type `&mut (dyn Bar,)`
found type `&(Foo,)`
= note: expected mutable reference `&mut (dyn Bar,)`
found reference `&(Foo,)`
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 f2: &Fat<[isize; 3]> = f1;
//~^ ERROR mismatched types
//~| expected type `&Fat<[isize; 3]>`
//~| found type `&Fat<[isize]>`
//~| expected reference `&Fat<[isize; 3]>`
//~| found reference `&Fat<[isize]>`
//~| expected array of 3 elements, found slice
// Tuple with a vec of isizes.
let f1: &([isize],) = &([1, 2, 3],);
let f2: &([isize; 3],) = f1;
//~^ ERROR mismatched types
//~| expected type `&([isize; 3],)`
//~| found type `&([isize],)`
//~| expected reference `&([isize; 3],)`
//~| found reference `&([isize],)`
//~| expected array of 3 elements, found slice
}

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | let f2: &Fat<[isize; 3]> = f1;
| ^^ expected array of 3 elements, found slice
|
= note: expected type `&Fat<[isize; 3]>`
found type `&Fat<[isize]>`
= note: expected reference `&Fat<[isize; 3]>`
found reference `&Fat<[isize]>`
error[E0308]: mismatched types
--> $DIR/dst-bad-coerce4.rs:20:30
@ -13,8 +13,8 @@ error[E0308]: mismatched types
LL | let f2: &([isize; 3],) = f1;
| ^^ expected array of 3 elements, found slice
|
= note: expected type `&([isize; 3],)`
found type `&([isize],)`
= note: expected reference `&([isize; 3],)`
found reference `&([isize],)`
error: aborting due to 2 previous errors

View file

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

View file

@ -7,8 +7,8 @@ LL | fn foo<T>(t: T) where T: Trait<AssociatedType=u32> {
LL | foo(3_i8);
| ^^^ expected u32, found reference
|
= note: expected type `u32`
found type `&'static str`
= note: expected type `u32`
found reference `&'static str`
error: aborting due to previous error

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched `self` parameter type
LL | Foo<'b,'a>
| ^^^^^^^^^^ lifetime mismatch
|
= note: expected type `Foo<'a, 'b>`
found type `Foo<'b, 'a>`
= note: expected struct `Foo<'a, 'b>`
found struct `Foo<'b, 'a>`
note: the lifetime `'b` as defined on the impl at 6:9...
--> $DIR/explicit-self-lifetime-mismatch.rs:6:9
|
@ -23,8 +23,8 @@ error[E0308]: mismatched `self` parameter type
LL | Foo<'b,'a>
| ^^^^^^^^^^ lifetime mismatch
|
= note: expected type `Foo<'a, 'b>`
found type `Foo<'b, 'a>`
= note: expected struct `Foo<'a, 'b>`
found struct `Foo<'b, 'a>`
note: the lifetime `'a` as defined on the impl at 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() {}
| ^^^^^^^^^^^^^^^^ expected "Rust" fn, found "C" fn
|
= note: expected type `fn()`
found type `extern "C" fn()`
= note: expected fn pointer `fn()`
found fn pointer `extern "C" fn()`
error: aborting due to previous error

View file

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

View file

@ -21,8 +21,8 @@ error[E0308]: mismatched types
LL | let x = f == g;
| ^ expected fn item, found a different fn item
|
= note: expected type `fn() {main::f}`
found type `fn() {main::g}`
= note: expected fn item `fn() {main::f}`
found fn item `fn() {main::g}`
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() {
eq(foo::<u8>, bar::<u8>);
//~^ ERROR mismatched types
//~| expected type `fn(isize) -> isize {foo::<u8>}`
//~| found type `fn(isize) -> isize {bar::<u8>}`
//~| expected fn item `fn(isize) -> isize {foo::<u8>}`
//~| found fn item `fn(isize) -> isize {bar::<u8>}`
//~| expected fn item, found a different fn item
eq(foo::<u8>, foo::<i8>);
@ -22,8 +22,8 @@ fn main() {
eq(bar::<String>, bar::<Vec<u8>>);
//~^ ERROR mismatched types
//~| expected type `fn(isize) -> isize {bar::<std::string::String>}`
//~| found type `fn(isize) -> isize {bar::<std::vec::Vec<u8>>}`
//~| expected fn item `fn(isize) -> isize {bar::<std::string::String>}`
//~| found fn item `fn(isize) -> isize {bar::<std::vec::Vec<u8>>}`
//~| expected struct `std::string::String`, found struct `std::vec::Vec`
// Make sure we distinguish between trait methods correctly.

View file

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

View file

@ -6,15 +6,15 @@ fn main() {
let _: () = (box |_: isize| {}) as Box<dyn FnOnce(isize)>;
//~^ ERROR mismatched types
//~| 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)>;
//~^ ERROR mismatched types
//~| 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>;
//~^ ERROR mismatched types
//~| 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);
//~^ 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`
|
= 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
--> $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`
|
= 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
--> $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`
|
= 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}`
--> $DIR/fn-trait-formatting.rs:19:14

View file

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

View file

@ -7,7 +7,7 @@ LL | x = 5;
| expected enum `std::option::Option`, found integer
| 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}`
error: aborting due to previous error

View file

@ -11,9 +11,9 @@ pub enum Foo { }
fn bar(x: x::Foo) -> y::Foo {
return x;
//~^ 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`
}
fn main() {

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