mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
Rollup merge of #116908 - estebank:issue-78206, r=compiler-errors
Tweak wording of type errors involving type params Fix #78206.
This commit is contained in:
commit
64ed233fc1
@ -85,8 +85,13 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
{
|
||||
let p_def_id = tcx.generics_of(body_owner_def_id).type_param(p, tcx).def_id;
|
||||
let p_span = tcx.def_span(p_def_id);
|
||||
let expected = match (values.expected.kind(), values.found.kind()) {
|
||||
(ty::Param(_), _) => "expected ",
|
||||
(_, ty::Param(_)) => "found ",
|
||||
_ => "",
|
||||
};
|
||||
if !sp.contains(p_span) {
|
||||
diag.span_label(p_span, "this type parameter");
|
||||
diag.span_label(p_span, format!("{expected}this type parameter"));
|
||||
}
|
||||
let hir = tcx.hir();
|
||||
let mut note = true;
|
||||
@ -168,8 +173,13 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
| (ty::Dynamic(..) | ty::Alias(ty::Opaque, ..), ty::Param(p)) => {
|
||||
let generics = tcx.generics_of(body_owner_def_id);
|
||||
let p_span = tcx.def_span(generics.type_param(p, tcx).def_id);
|
||||
let expected = match (values.expected.kind(), values.found.kind()) {
|
||||
(ty::Param(_), _) => "expected ",
|
||||
(_, ty::Param(_)) => "found ",
|
||||
_ => "",
|
||||
};
|
||||
if !sp.contains(p_span) {
|
||||
diag.span_label(p_span, "this type parameter");
|
||||
diag.span_label(p_span, format!("{expected}this type parameter"));
|
||||
}
|
||||
diag.help("type parameters must be constrained to match other types");
|
||||
if tcx.sess.teach(&diag.get_code().unwrap()) {
|
||||
@ -209,7 +219,7 @@ impl<T> Trait<T> for X {
|
||||
let generics = tcx.generics_of(body_owner_def_id);
|
||||
let p_span = tcx.def_span(generics.type_param(p, tcx).def_id);
|
||||
if !sp.contains(p_span) {
|
||||
diag.span_label(p_span, "this type parameter");
|
||||
diag.span_label(p_span, "expected this type parameter");
|
||||
}
|
||||
diag.help(format!(
|
||||
"every closure has a distinct type and so could not always match the \
|
||||
@ -219,8 +229,13 @@ impl<T> Trait<T> for X {
|
||||
(ty::Param(p), _) | (_, ty::Param(p)) => {
|
||||
let generics = tcx.generics_of(body_owner_def_id);
|
||||
let p_span = tcx.def_span(generics.type_param(p, tcx).def_id);
|
||||
let expected = match (values.expected.kind(), values.found.kind()) {
|
||||
(ty::Param(_), _) => "expected ",
|
||||
(_, ty::Param(_)) => "found ",
|
||||
_ => "",
|
||||
};
|
||||
if !sp.contains(p_span) {
|
||||
diag.span_label(p_span, "this type parameter");
|
||||
diag.span_label(p_span, format!("{expected}this type parameter"));
|
||||
}
|
||||
}
|
||||
(ty::Alias(ty::Projection | ty::Inherent, proj_ty), _)
|
||||
|
@ -13,7 +13,7 @@ error[E0308]: mismatched types
|
||||
LL | fn foo<u32>(a: u32) -> u32 {
|
||||
| --- --- expected `u32` because of return type
|
||||
| |
|
||||
| this type parameter
|
||||
| expected this type parameter
|
||||
LL | 42
|
||||
| ^^ expected type parameter `u32`, found integer
|
||||
|
|
||||
|
@ -17,7 +17,7 @@ LL | fn f(x: &mut dyn Iterator<Item: Iterator<Item = &'_ ()>>) -> Option<&'_ ()>
|
||||
| ----------------------------- -------------- ^^^^^^^^ expected `Option<&()>`, found `Option<impl Iterator<Item = &'_ ()>>`
|
||||
| | |
|
||||
| | expected `Option<&()>` because of return type
|
||||
| this type parameter
|
||||
| found this type parameter
|
||||
|
|
||||
= note: expected enum `Option<&()>`
|
||||
found enum `Option<impl Iterator<Item = &'_ ()>>`
|
||||
|
@ -2,7 +2,7 @@ error[E0271]: type mismatch resolving `<Adapter<I> as Iterator>::Item == Option<
|
||||
--> $DIR/associated-types-issue-20346.rs:34:36
|
||||
|
|
||||
LL | fn test_adapter<T, I: Iterator<Item=Option<T>>>(it: I) {
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
...
|
||||
LL | is_iterator_of::<Option<T>, _>(&adapter);
|
||||
| ------------------------------ ^^^^^^^^ type mismatch resolving `<Adapter<I> as Iterator>::Item == Option<T>`
|
||||
|
@ -2,7 +2,9 @@ error[E0271]: type mismatch resolving `<T as Deref>::Target == T`
|
||||
--> $DIR/hr-associated-type-projection-1.rs:13:33
|
||||
|
|
||||
LL | impl<T: Copy + std::ops::Deref> UnsafeCopy<'_, T> for T {
|
||||
| - this type parameter ^^^^^^^^^^^^^^^^^ expected type parameter `T`, found associated type
|
||||
| - ^^^^^^^^^^^^^^^^^ expected type parameter `T`, found associated type
|
||||
| |
|
||||
| expected this type parameter
|
||||
|
|
||||
= note: expected type parameter `T`
|
||||
found associated type `<T as Deref>::Target`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-67945-1.rs:10:20
|
||||
|
|
||||
LL | struct Bug<S> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
...
|
||||
LL | let x: S = MaybeUninit::uninit();
|
||||
| - ^^^^^^^^^^^^^^^^^^^^^ expected type parameter `S`, found `MaybeUninit<_>`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-68648-2.rs:12:17
|
||||
|
|
||||
LL | fn bug<'a, T: Fun<F<'a> = T>>(t: T) -> T::F<'a> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
LL | T::identity(())
|
||||
| ----------- ^^ expected type parameter `T`, found `()`
|
||||
| |
|
||||
|
@ -2,7 +2,7 @@ error[E0271]: type mismatch resolving `<T as Deref>::Target == T`
|
||||
--> $DIR/issue-68656-unsized-values.rs:13:21
|
||||
|
|
||||
LL | impl<T: Copy + std::ops::Deref> UnsafeCopy<T> for T {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
LL | type Item<'a> = T;
|
||||
| ^ expected type parameter `T`, found associated type
|
||||
|
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-88360.rs:15:9
|
||||
|
|
||||
LL | trait SuperTrait<T>
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
...
|
||||
LL | fn copy(&self) -> Self::Gat<'_> where T: Copy {
|
||||
| ------------- expected `&T` because of return type
|
||||
|
@ -14,7 +14,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/missing-bounds.rs:11:11
|
||||
|
|
||||
LL | impl<B> Add for A<B> where B: Add {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
...
|
||||
LL | A(self.0 + rhs.0)
|
||||
| - ^^^^^^^^^^^^^^ expected type parameter `B`, found associated type
|
||||
@ -44,7 +44,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/missing-bounds.rs:21:14
|
||||
|
|
||||
LL | impl<B: Add> Add for C<B> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
...
|
||||
LL | Self(self.0 + rhs.0)
|
||||
| ---- ^^^^^^^^^^^^^^ expected type parameter `B`, found associated type
|
||||
@ -80,7 +80,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/missing-bounds.rs:42:14
|
||||
|
|
||||
LL | impl<B: Add> Add for E<B> where <B as Add>::Output = B {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
...
|
||||
LL | Self(self.0 + rhs.0)
|
||||
| ---- ^^^^^^^^^^^^^^ expected type parameter `B`, found associated type
|
||||
|
@ -7,7 +7,7 @@ LL | | &mut Header,
|
||||
LL | | &mut [EntryMetadata],
|
||||
LL | | &mut [Entry<C::EncodedKey, C::EncodedValue>]
|
||||
LL | | ) -> R,
|
||||
| |__________- this type parameter
|
||||
| |__________- expected this type parameter
|
||||
LL | ) {
|
||||
LL | let () = y;
|
||||
| ^^ - this expression has type `impl FnOnce(&mut Header, &mut [EntryMetadata], &mut [Entry<C::EncodedKey, C::EncodedValue>]) -> R`
|
||||
|
@ -6,7 +6,7 @@ LL | fn early<'late, T>(_: &'late ()) {}
|
||||
| | |
|
||||
| | expected type parameter `T`, found `()`
|
||||
| | help: change the parameter type to match the trait: `&T`
|
||||
| this type parameter
|
||||
| expected this type parameter
|
||||
|
|
||||
note: type in trait
|
||||
--> $DIR/method-signature-matches.rs:52:28
|
||||
|
@ -2,7 +2,7 @@ error[E0053]: method `bar` has an incompatible type for trait
|
||||
--> $DIR/specialization-broken.rs:15:22
|
||||
|
|
||||
LL | default impl<U> Foo for U
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
...
|
||||
LL | fn bar(&self) -> U {
|
||||
| ^
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | fn foo(x: impl Debug) -> String {
|
||||
| ---------- ------ expected `String` because of return type
|
||||
| |
|
||||
| this type parameter
|
||||
| found this type parameter
|
||||
LL | x
|
||||
| ^ expected `String`, found type parameter `impl Debug`
|
||||
|
|
||||
|
@ -70,7 +70,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-107090.rs:22:5
|
||||
|
|
||||
LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T {
|
||||
| - this type parameter ------- expected `&'out T` because of return type
|
||||
| - expected this type parameter ------- expected `&'out T` because of return type
|
||||
LL |
|
||||
LL | sadness.cast()
|
||||
| ^^^^^^^^^^^^^^ expected `&T`, found `&Foo<'_, '_, T>`
|
||||
|
@ -2,7 +2,7 @@ error[E0053]: method `call` has an incompatible type for trait
|
||||
--> $DIR/issue-20225.rs:6:43
|
||||
|
|
||||
LL | impl<'a, T> Fn<(&'a T,)> for Foo {
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
LL | extern "rust-call" fn call(&self, (_,): (T,)) {}
|
||||
| ^^^^
|
||||
| |
|
||||
@ -16,7 +16,7 @@ error[E0053]: method `call_mut` has an incompatible type for trait
|
||||
--> $DIR/issue-20225.rs:11:51
|
||||
|
|
||||
LL | impl<'a, T> FnMut<(&'a T,)> for Foo {
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
LL | extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {}
|
||||
| ^^^^
|
||||
| |
|
||||
@ -30,7 +30,7 @@ error[E0053]: method `call_once` has an incompatible type for trait
|
||||
--> $DIR/issue-20225.rs:18:47
|
||||
|
|
||||
LL | impl<'a, T> FnOnce<(&'a T,)> for Foo {
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
...
|
||||
LL | extern "rust-call" fn call_once(self, (_,): (T,)) {}
|
||||
| ^^^^
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-51154.rs:2:30
|
||||
|
|
||||
LL | fn foo<F: FnMut()>() {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
LL | let _: Box<F> = Box::new(|| ());
|
||||
| -------- ^^^^^ expected type parameter `F`, found closure
|
||||
| |
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-69306.rs:5:28
|
||||
|
|
||||
LL | impl<T> S0<T> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
LL | const C: S0<u8> = Self(0);
|
||||
| ---- ^ expected type parameter `T`, found integer
|
||||
| |
|
||||
@ -20,7 +20,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-69306.rs:5:23
|
||||
|
|
||||
LL | impl<T> S0<T> {
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
LL | const C: S0<u8> = Self(0);
|
||||
| ^^^^^^^ expected `S0<u8>`, found `S0<T>`
|
||||
|
|
||||
@ -31,7 +31,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-69306.rs:10:14
|
||||
|
|
||||
LL | impl<T> S0<T> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
...
|
||||
LL | Self(0);
|
||||
| ---- ^ expected type parameter `T`, found integer
|
||||
@ -50,7 +50,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-69306.rs:27:14
|
||||
|
|
||||
LL | impl<T> Foo<T> for <S0<T> as Fun>::Out {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
LL | fn foo() {
|
||||
LL | Self(0);
|
||||
| ---- ^ expected type parameter `T`, found integer
|
||||
@ -69,7 +69,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-69306.rs:33:32
|
||||
|
|
||||
LL | impl<T> S1<T, u8> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
LL | const C: S1<u8, u8> = Self(0, 1);
|
||||
| ---- ^ expected type parameter `T`, found integer
|
||||
| |
|
||||
@ -87,7 +87,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-69306.rs:33:27
|
||||
|
|
||||
LL | impl<T> S1<T, u8> {
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
LL | const C: S1<u8, u8> = Self(0, 1);
|
||||
| ^^^^^^^^^^ expected `S1<u8, u8>`, found `S1<T, u8>`
|
||||
|
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: lang item `start` function has wrong type
|
||||
LL | fn start<T>(_main: fn() -> u16, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
|
||||
| - ^^^^^^^^^^^ expected type parameter `T`, found `u16`
|
||||
| |
|
||||
| this type parameter
|
||||
| expected this type parameter
|
||||
|
|
||||
= note: expected signature `fn(fn() -> T, _, _, _) -> _`
|
||||
found signature `fn(fn() -> u16, _, _, _) -> _`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-35030.rs:9:14
|
||||
|
|
||||
LL | impl<bool> Parser<bool> for bool {
|
||||
| ---- this type parameter
|
||||
| ---- expected this type parameter
|
||||
LL | fn parse(text: &str) -> Option<bool> {
|
||||
LL | Some(true)
|
||||
| ---- ^^^^ expected type parameter `bool`, found `bool`
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | fn bad_echo<T>(_t: T) -> T {
|
||||
| - - expected `T` because of return type
|
||||
| |
|
||||
| this type parameter
|
||||
| expected this type parameter
|
||||
LL | "this should not suggest impl Trait"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found `&str`
|
||||
|
|
||||
@ -17,7 +17,7 @@ error[E0308]: mismatched types
|
||||
LL | fn bad_echo_2<T: Trait>(_t: T) -> T {
|
||||
| - - expected `T` because of return type
|
||||
| |
|
||||
| this type parameter
|
||||
| expected this type parameter
|
||||
LL | "this will not suggest it, because that would probably be wrong"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found `&str`
|
||||
|
|
||||
@ -30,7 +30,7 @@ error[E0308]: mismatched types
|
||||
LL | fn other_bounds_bad<T>() -> T
|
||||
| - - expected `T` because of return type
|
||||
| |
|
||||
| this type parameter
|
||||
| expected this type parameter
|
||||
...
|
||||
LL | "don't suggest this, because Option<T> places additional constraints"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found `&str`
|
||||
@ -46,7 +46,7 @@ LL | fn used_in_trait<T>() -> T
|
||||
| | |
|
||||
| | expected `T` because of return type
|
||||
| | help: consider using an impl return type: `impl Send`
|
||||
| this type parameter
|
||||
| expected this type parameter
|
||||
...
|
||||
LL | "don't suggest this, because the generic param is used in the bound."
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found `&str`
|
||||
|
@ -5,7 +5,7 @@ LL | fn bar<T: Trait + std::marker::Sync>() -> T
|
||||
| - -
|
||||
| | |
|
||||
| | expected `T` because of return type
|
||||
| this type parameter help: consider using an impl return type: `impl Trait + std::marker::Sync + Send`
|
||||
| expected this type parameter help: consider using an impl return type: `impl Trait + std::marker::Sync + Send`
|
||||
...
|
||||
LL | ()
|
||||
| ^^ expected type parameter `T`, found `()`
|
||||
@ -21,7 +21,7 @@ LL | fn other_bounds<T>() -> T
|
||||
| | |
|
||||
| | expected `T` because of return type
|
||||
| | help: consider using an impl return type: `impl Trait`
|
||||
| this type parameter
|
||||
| expected this type parameter
|
||||
...
|
||||
LL | ()
|
||||
| ^^ expected type parameter `T`, found `()`
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | fn wat<T>(t: &T) -> T {
|
||||
| - - expected `T` because of return type
|
||||
| |
|
||||
| this type parameter
|
||||
| expected this type parameter
|
||||
LL | t.clone()
|
||||
| ^^^^^^^^^ expected type parameter `T`, found `&T`
|
||||
|
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/expected-boxed-future-isnt-pinned.rs:11:5
|
||||
|
|
||||
LL | fn foo<F: Future<Output=i32> + Send + 'static>(x: F) -> BoxFuture<'static, i32> {
|
||||
| - this type parameter ----------------------- expected `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>` because of return type
|
||||
| - found this type parameter ----------------------- expected `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>` because of return type
|
||||
LL | // We could instead use an `async` block, but this way we have no std spans.
|
||||
LL | x
|
||||
| ^ expected `Pin<Box<...>>`, found type parameter `F`
|
||||
@ -30,7 +30,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/expected-boxed-future-isnt-pinned.rs:19:14
|
||||
|
|
||||
LL | fn baz<F: Future<Output=i32> + Send + 'static>(x: F) -> BoxFuture<'static, i32> {
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
LL | Pin::new(x)
|
||||
| -------- ^ expected `Box<dyn Future<Output = ...> + Send>`, found type parameter `F`
|
||||
| |
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/restrict-existing-type-bounds.rs:13:12
|
||||
|
|
||||
LL | impl<T: TryAdd> TryAdd for Option<T> {
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
...
|
||||
LL | Ok(self)
|
||||
| -- ^^^^ expected `Option<<T as TryAdd>::Output>`, found `Option<T>`
|
||||
@ -29,7 +29,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/restrict-existing-type-bounds.rs:26:12
|
||||
|
|
||||
LL | impl<T: TryAdd<Error = X>> TryAdd for Other<T> {
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
...
|
||||
LL | Ok(self)
|
||||
| -- ^^^^ expected `Other<<T as TryAdd>::Output>`, found `Other<T>`
|
||||
|
@ -124,7 +124,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/trait-with-missing-associated-type-restriction.rs:31:9
|
||||
|
|
||||
LL | fn baz<D: std::fmt::Debug, T: Trait<A = D>>(x: T) {
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
LL | qux(x.func())
|
||||
| --- ^^^^^^^^ expected `usize`, found type parameter `D`
|
||||
| |
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-52893.rs:53:22
|
||||
|
|
||||
LL | impl<F, Name, P> AddClass<Name, F> for Class<P>
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
...
|
||||
LL | builder.push(output);
|
||||
| ---- ^^^^^^ expected type parameter `F`, found `Class<P>`
|
||||
|
@ -42,7 +42,7 @@ error[E0308]: mismatched types
|
||||
LL | pub fn copy_any<T>(t: &T) -> T {
|
||||
| - - expected `T` because of return type
|
||||
| |
|
||||
| this type parameter
|
||||
| expected this type parameter
|
||||
LL | copy::<dyn Setup<From=T>>(t)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
||||
|
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/enum-variant-generic-args.rs:13:25
|
||||
|
|
||||
LL | impl<T> Enum<T> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
LL | fn ts_variant() {
|
||||
LL | Self::TSVariant(());
|
||||
| --------------- ^^ expected type parameter `T`, found `()`
|
||||
@ -50,7 +50,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/enum-variant-generic-args.rs:17:31
|
||||
|
|
||||
LL | impl<T> Enum<T> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
...
|
||||
LL | Self::<()>::TSVariant(());
|
||||
| --------------------- ^^ expected type parameter `T`, found `()`
|
||||
@ -98,7 +98,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/enum-variant-generic-args.rs:26:29
|
||||
|
|
||||
LL | impl<T> Enum<T> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
...
|
||||
LL | Self::SVariant { v: () };
|
||||
| ^^ expected type parameter `T`, found `()`
|
||||
@ -125,7 +125,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/enum-variant-generic-args.rs:28:35
|
||||
|
|
||||
LL | impl<T> Enum<T> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
...
|
||||
LL | Self::SVariant::<()> { v: () };
|
||||
| ^^ expected type parameter `T`, found `()`
|
||||
@ -158,7 +158,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/enum-variant-generic-args.rs:31:35
|
||||
|
|
||||
LL | impl<T> Enum<T> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
...
|
||||
LL | Self::<()>::SVariant { v: () };
|
||||
| ^^ expected type parameter `T`, found `()`
|
||||
@ -206,7 +206,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/enum-variant-generic-args.rs:34:41
|
||||
|
|
||||
LL | impl<T> Enum<T> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
...
|
||||
LL | Self::<()>::SVariant::<()> { v: () };
|
||||
| ^^ expected type parameter `T`, found `()`
|
||||
|
@ -40,7 +40,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/bad-index-due-to-nested.rs:20:9
|
||||
|
|
||||
LL | fn index<'a, K, V>(map: &'a HashMap<K, V>, k: K) -> &'a V {
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
LL | map[k]
|
||||
| ^ expected `&K`, found type parameter `K`
|
||||
|
|
||||
@ -55,7 +55,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/bad-index-due-to-nested.rs:20:5
|
||||
|
|
||||
LL | fn index<'a, K, V>(map: &'a HashMap<K, V>, k: K) -> &'a V {
|
||||
| - this type parameter ----- expected `&'a V` because of return type
|
||||
| - found this type parameter ----- expected `&'a V` because of return type
|
||||
LL | map[k]
|
||||
| ^^^^^^ expected `&V`, found type parameter `V`
|
||||
|
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-13853.rs:14:9
|
||||
|
|
||||
LL | fn nodes<'a, I: Iterator<Item=&'a N>>(&self) -> I
|
||||
| - this type parameter - expected `I` because of return type
|
||||
| - expected this type parameter - expected `I` because of return type
|
||||
...
|
||||
LL | self.iter()
|
||||
| ^^^^^^^^^^^ expected type parameter `I`, found `Iter<'_, N>`
|
||||
|
Loading…
Reference in New Issue
Block a user