diff --git a/compiler/rustc_hir_typeck/src/method/probe.rs b/compiler/rustc_hir_typeck/src/method/probe.rs index ae34ddeaa87d4..cc5d058dd6c54 100644 --- a/compiler/rustc_hir_typeck/src/method/probe.rs +++ b/compiler/rustc_hir_typeck/src/method/probe.rs @@ -556,6 +556,7 @@ fn method_autoderef_steps<'tcx>( let final_ty = autoderef.final_ty(true); let opt_bad_ty = match final_ty.kind() { + ty::Infer(ty::TyVar(_)) if !reached_raw_pointer => None, ty::Infer(ty::TyVar(_)) | ty::Error(_) => Some(MethodAutoderefBadTy { reached_raw_pointer, ty: infcx.make_query_response_ignoring_pending_obligations(inference_vars, final_ty), diff --git a/tests/crashes/121613-2.rs b/tests/crashes/121613-2.rs deleted file mode 100644 index ddc4f37c96a2f..0000000000000 --- a/tests/crashes/121613-2.rs +++ /dev/null @@ -1,28 +0,0 @@ -//@ known-bug: #121613 -fn main() { - // destructure through a qualified path - let ::Assoc { br } = StructStruct { br: 2 }; - //~^ ERROR usage of qualified paths in this context is experimental - let _ = ::Assoc { br: 2 }; - //~^ ERROR usage of qualified paths in this context is experimental - let ::V(..) = E::V(|a, b| a.cmp(b)); - //~^ ERROR usage of qualified paths in this context is experimental -} - -struct StructStruct { - br: i8, -} - -struct Foo; - -trait A { - type Assoc; -} - -impl A for Foo { - type Assoc = StructStruct; -} - -enum E { - V(u8) -} diff --git a/tests/crashes/121613.rs b/tests/ui/associated-types/param_mismatch_on_associatedtype_constructor.rs similarity index 51% rename from tests/crashes/121613.rs rename to tests/ui/associated-types/param_mismatch_on_associatedtype_constructor.rs index ec9ba82a68c5f..be3adfe8665fe 100644 --- a/tests/crashes/121613.rs +++ b/tests/ui/associated-types/param_mismatch_on_associatedtype_constructor.rs @@ -1,8 +1,14 @@ -//@ known-bug: #121613 +//! This test used to ICE #121613 +//! Using a generic parameter where there are none expected +//! caused an ICE, hiding the important later errors. + +#![feature(more_qualified_paths)] + fn main() { let _ = ::Assoc { br: 2 }; let ::V(..) = E::V(|a, b| a.cmp(b)); + //~^ ERROR: multiple applicable items in scope } struct StructStruct { diff --git a/tests/ui/associated-types/param_mismatch_on_associatedtype_constructor.stderr b/tests/ui/associated-types/param_mismatch_on_associatedtype_constructor.stderr new file mode 100644 index 0000000000000..babb350f62915 --- /dev/null +++ b/tests/ui/associated-types/param_mismatch_on_associatedtype_constructor.stderr @@ -0,0 +1,22 @@ +error[E0034]: multiple applicable items in scope + --> $DIR/param_mismatch_on_associatedtype_constructor.rs:10:36 + | +LL | let ::V(..) = E::V(|a, b| a.cmp(b)); + | ^^^ multiple `cmp` found + | +note: candidate #1 is defined in the trait `Iterator` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL +note: candidate #2 is defined in the trait `Ord` + --> $SRC_DIR/core/src/cmp.rs:LL:COL +help: disambiguate the method for candidate #1 + | +LL | let ::V(..) = E::V(|a, b| Iterator::cmp(a, b)); + | ~~~~~~~~~~~~~~~~~~~ +help: disambiguate the method for candidate #2 + | +LL | let ::V(..) = E::V(|a, b| Ord::cmp(&a, b)); + | ~~~~~~~~~~~~~~~ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0034`. diff --git a/tests/ui/autoref-autoderef/deref-ambiguity-becomes-nonambiguous.rs b/tests/ui/autoref-autoderef/deref-ambiguity-becomes-nonambiguous.rs index d8034d57e8d56..98140510f0a48 100644 --- a/tests/ui/autoref-autoderef/deref-ambiguity-becomes-nonambiguous.rs +++ b/tests/ui/autoref-autoderef/deref-ambiguity-becomes-nonambiguous.rs @@ -29,7 +29,6 @@ impl Deref for Value> { fn main() { let var_fn = Value::wrap(); - //~^ ERROR type annotations needed for `Value>` // The combination of `Value: Wrap` obligation plus the autoderef steps // (caused by the `Deref` impl above) actually means that the self type @@ -37,4 +36,5 @@ fn main() { // However, that's only known to us on the error path -- we still need // to emit an ambiguity error, though. let _ = var_fn.clone(); + //~^ ERROR: the size for values of type `dyn Fn(_, _) -> _` cannot be known } diff --git a/tests/ui/autoref-autoderef/deref-ambiguity-becomes-nonambiguous.stderr b/tests/ui/autoref-autoderef/deref-ambiguity-becomes-nonambiguous.stderr index 19c3c64181985..9df15b801e42c 100644 --- a/tests/ui/autoref-autoderef/deref-ambiguity-becomes-nonambiguous.stderr +++ b/tests/ui/autoref-autoderef/deref-ambiguity-becomes-nonambiguous.stderr @@ -1,17 +1,18 @@ -error[E0282]: type annotations needed for `Value>` - --> $DIR/deref-ambiguity-becomes-nonambiguous.rs:31:9 +error[E0277]: the size for values of type `dyn Fn(_, _) -> _` cannot be known at compilation time + --> $DIR/deref-ambiguity-becomes-nonambiguous.rs:38:13 | -LL | let var_fn = Value::wrap(); - | ^^^^^^ -... LL | let _ = var_fn.clone(); - | ----- type must be known at this point + | ^^^^^^^^^^^^^^ doesn't have a size known at compile-time | -help: consider giving `var_fn` an explicit type, where the placeholders `_` are specified + = help: the trait `Sized` is not implemented for `dyn Fn(_, _) -> _`, which is required by `Value>: Deref` +note: required for `Value _>>` to implement `Deref` + --> $DIR/deref-ambiguity-becomes-nonambiguous.rs:22:9 | -LL | let var_fn: Value> = Value::wrap(); - | ++++++++++++++ +LL | impl Deref for Value> { + | - ^^^^^ ^^^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0282`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.next.stderr b/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.next.stderr index 4bb9047b3035d..481a0889a0662 100644 --- a/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.next.stderr +++ b/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.next.stderr @@ -5,7 +5,7 @@ LL | needs_foo(|x| { | ^ ... LL | x.to_string(); - | --------- type must be known at this point + | ------------- type must be known at this point | help: consider giving this closure parameter an explicit type | diff --git a/tests/ui/impl-trait/call_method_ambiguous.next.stderr b/tests/ui/impl-trait/call_method_ambiguous.next.stderr index dfbe241f9e6a4..534f3dd10e657 100644 --- a/tests/ui/impl-trait/call_method_ambiguous.next.stderr +++ b/tests/ui/impl-trait/call_method_ambiguous.next.stderr @@ -5,7 +5,7 @@ LL | let mut iter = foo(n - 1, m); | ^^^^^^^^ LL | LL | assert_eq!(iter.get(), 1); - | --- type must be known at this point + | ---------- type must be known at this point | help: consider giving `iter` an explicit type | diff --git a/tests/ui/impl-trait/call_method_on_inherent_impl.next.stderr b/tests/ui/impl-trait/call_method_on_inherent_impl.next.stderr index 7bbf5f5153a59..323c8e85f963f 100644 --- a/tests/ui/impl-trait/call_method_on_inherent_impl.next.stderr +++ b/tests/ui/impl-trait/call_method_on_inherent_impl.next.stderr @@ -5,7 +5,7 @@ LL | let x = my_foo(); | ^ LL | LL | x.my_debug(); - | -------- type must be known at this point + | ------------ type must be known at this point | help: consider giving `x` an explicit type | diff --git a/tests/ui/impl-trait/call_method_on_inherent_impl_on_rigid_type.next.stderr b/tests/ui/impl-trait/call_method_on_inherent_impl_on_rigid_type.next.stderr index 079389ebf7cfb..80b6039262e8f 100644 --- a/tests/ui/impl-trait/call_method_on_inherent_impl_on_rigid_type.next.stderr +++ b/tests/ui/impl-trait/call_method_on_inherent_impl_on_rigid_type.next.stderr @@ -4,7 +4,7 @@ error[E0282]: type annotations needed for `&_` LL | let x = &my_foo(); | ^ LL | x.my_debug(); - | -------- type must be known at this point + | ------------ type must be known at this point | help: consider giving `x` an explicit type, where the placeholders `_` are specified | diff --git a/tests/ui/impl-trait/call_method_on_inherent_impl_ref.next.stderr b/tests/ui/impl-trait/call_method_on_inherent_impl_ref.next.stderr index 5dea3a715e9bc..774796a60ab2d 100644 --- a/tests/ui/impl-trait/call_method_on_inherent_impl_ref.next.stderr +++ b/tests/ui/impl-trait/call_method_on_inherent_impl_ref.next.stderr @@ -5,7 +5,7 @@ LL | let x = my_foo(); | ^ LL | LL | x.my_debug(); - | -------- type must be known at this point + | ------------ type must be known at this point | help: consider giving `x` an explicit type | @@ -19,7 +19,7 @@ LL | let x = &my_bar(); | ^ LL | LL | x.my_debug(); - | -------- type must be known at this point + | ------------ type must be known at this point | help: consider giving `x` an explicit type, where the placeholders `_` are specified | diff --git a/tests/ui/impl-trait/hidden-type-is-opaque-2.default.stderr b/tests/ui/impl-trait/hidden-type-is-opaque-2.default.stderr index 554979408aba8..41281b22895a4 100644 --- a/tests/ui/impl-trait/hidden-type-is-opaque-2.default.stderr +++ b/tests/ui/impl-trait/hidden-type-is-opaque-2.default.stderr @@ -1,31 +1,15 @@ -error[E0282]: type annotations needed - --> $DIR/hidden-type-is-opaque-2.rs:10:17 +error[E0599]: no method named `reify_as` found for type `_` in the current scope + --> $DIR/hidden-type-is-opaque-2.rs:11:14 | -LL | Thunk::new(|mut cont| { - | ^^^^^^^^ -LL | LL | cont.reify_as(); - | -------- type must be known at this point - | -help: consider giving this closure parameter an explicit type - | -LL | Thunk::new(|mut cont: /* Type */| { - | ++++++++++++ + | ^^^^^^^^ method not found in `_` -error[E0282]: type annotations needed - --> $DIR/hidden-type-is-opaque-2.rs:20:17 +error[E0599]: no method named `reify_as` found for type `_` in the current scope + --> $DIR/hidden-type-is-opaque-2.rs:21:14 | -LL | Thunk::new(|mut cont| { - | ^^^^^^^^ -LL | LL | cont.reify_as(); - | -------- type must be known at this point - | -help: consider giving this closure parameter an explicit type - | -LL | Thunk::new(|mut cont: /* Type */| { - | ++++++++++++ + | ^^^^^^^^ method not found in `_` error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0282`. +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/impl-trait/hidden-type-is-opaque-2.next.stderr b/tests/ui/impl-trait/hidden-type-is-opaque-2.next.stderr index 554979408aba8..41281b22895a4 100644 --- a/tests/ui/impl-trait/hidden-type-is-opaque-2.next.stderr +++ b/tests/ui/impl-trait/hidden-type-is-opaque-2.next.stderr @@ -1,31 +1,15 @@ -error[E0282]: type annotations needed - --> $DIR/hidden-type-is-opaque-2.rs:10:17 +error[E0599]: no method named `reify_as` found for type `_` in the current scope + --> $DIR/hidden-type-is-opaque-2.rs:11:14 | -LL | Thunk::new(|mut cont| { - | ^^^^^^^^ -LL | LL | cont.reify_as(); - | -------- type must be known at this point - | -help: consider giving this closure parameter an explicit type - | -LL | Thunk::new(|mut cont: /* Type */| { - | ++++++++++++ + | ^^^^^^^^ method not found in `_` -error[E0282]: type annotations needed - --> $DIR/hidden-type-is-opaque-2.rs:20:17 +error[E0599]: no method named `reify_as` found for type `_` in the current scope + --> $DIR/hidden-type-is-opaque-2.rs:21:14 | -LL | Thunk::new(|mut cont| { - | ^^^^^^^^ -LL | LL | cont.reify_as(); - | -------- type must be known at this point - | -help: consider giving this closure parameter an explicit type - | -LL | Thunk::new(|mut cont: /* Type */| { - | ++++++++++++ + | ^^^^^^^^ method not found in `_` error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0282`. +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/impl-trait/hidden-type-is-opaque-2.rs b/tests/ui/impl-trait/hidden-type-is-opaque-2.rs index 78ac8363ba930..bc5945c6d120d 100644 --- a/tests/ui/impl-trait/hidden-type-is-opaque-2.rs +++ b/tests/ui/impl-trait/hidden-type-is-opaque-2.rs @@ -8,8 +8,8 @@ fn reify_as() -> Thunk Continuation> { Thunk::new(|mut cont| { - //~^ ERROR type annotations needed cont.reify_as(); + //~^ ERROR: no method named `reify_as` found for type `_` cont }) } @@ -18,8 +18,8 @@ type Tait = impl FnOnce(Continuation) -> Continuation; fn reify_as_tait() -> Thunk { Thunk::new(|mut cont| { - //~^ ERROR type annotations needed cont.reify_as(); + //~^ ERROR: no method named `reify_as` found for type `_` cont }) } diff --git a/tests/ui/impl-trait/method-resolution4.next.stderr b/tests/ui/impl-trait/method-resolution4.next.stderr index 1a4bc1f6d9165..f3a8acc16054c 100644 --- a/tests/ui/impl-trait/method-resolution4.next.stderr +++ b/tests/ui/impl-trait/method-resolution4.next.stderr @@ -1,8 +1,8 @@ error[E0282]: type annotations needed - --> $DIR/method-resolution4.rs:13:20 + --> $DIR/method-resolution4.rs:13:9 | LL | foo(false).next().unwrap(); - | ^^^^ cannot infer type + | ^^^^^^^^^^^^^^^^^ cannot infer type error[E0308]: mismatched types --> $DIR/method-resolution4.rs:16:5 diff --git a/tests/ui/impl-trait/recursive-bound-eval.current.stderr b/tests/ui/impl-trait/recursive-bound-eval.current.stderr deleted file mode 100644 index da1471932292c..0000000000000 --- a/tests/ui/impl-trait/recursive-bound-eval.current.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/recursive-bound-eval.rs:18:28 - | -LL | move || recursive_fn().parse() - | ^^^^^ cannot infer type - -error[E0599]: no method named `parse` found for opaque type `impl Parser<_>` in the current scope - --> $DIR/recursive-bound-eval.rs:18:28 - | -LL | move || recursive_fn().parse() - | ^^^^^ method not found in `impl Parser<_>` - | - = help: items from traits can only be used if the trait is implemented and in scope -help: trait `Parser` which provides `parse` is implemented but not in scope; perhaps you want to import it - | -LL + use Parser; - | - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0282, E0599. -For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/impl-trait/recursive-bound-eval.next.stderr b/tests/ui/impl-trait/recursive-bound-eval.next.stderr index 8435b3375bb02..b44c9c921522f 100644 --- a/tests/ui/impl-trait/recursive-bound-eval.next.stderr +++ b/tests/ui/impl-trait/recursive-bound-eval.next.stderr @@ -1,8 +1,8 @@ error[E0282]: type annotations needed - --> $DIR/recursive-bound-eval.rs:18:28 + --> $DIR/recursive-bound-eval.rs:19:13 | LL | move || recursive_fn().parse() - | ^^^^^ cannot infer type + | ^^^^^^^^^^^^^^^^^^^^^^ cannot infer type error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/recursive-bound-eval.rs b/tests/ui/impl-trait/recursive-bound-eval.rs index 608eef54cb1a6..95e555f9b38c3 100644 --- a/tests/ui/impl-trait/recursive-bound-eval.rs +++ b/tests/ui/impl-trait/recursive-bound-eval.rs @@ -3,6 +3,7 @@ //@revisions: next current //@[next] compile-flags: -Znext-solver +//@[current] check-pass pub trait Parser { fn parse(&self) -> E; @@ -16,8 +17,7 @@ impl E> Parser for T { pub fn recursive_fn() -> impl Parser { move || recursive_fn().parse() - //~^ ERROR: type annotations needed - //[current]~^^ ERROR: no method named `parse` found for opaque type + //[next]~^ ERROR: type annotations needed } fn main() {} diff --git a/tests/ui/impl-trait/recursive-coroutine-boxed.next.stderr b/tests/ui/impl-trait/recursive-coroutine-boxed.next.stderr deleted file mode 100644 index 96db2030a405c..0000000000000 --- a/tests/ui/impl-trait/recursive-coroutine-boxed.next.stderr +++ /dev/null @@ -1,40 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/recursive-coroutine-boxed.rs:15:23 - | -LL | let mut gen = Box::pin(foo()); - | ^^^^^^^^ cannot infer type of the type parameter `T` declared on the struct `Box` -LL | -LL | let mut r = gen.as_mut().resume(()); - | ------ type must be known at this point - | -help: consider specifying the generic argument - | -LL | let mut gen = Box::::pin(foo()); - | +++++ - -error[E0308]: mismatched types - --> $DIR/recursive-coroutine-boxed.rs:14:18 - | -LL | fn foo() -> impl Coroutine { - | --------------------------------------- - | | - | the expected opaque type - | expected `impl Coroutine` because of return type -... -LL | #[coroutine] || { - | __________________^ -LL | | let mut gen = Box::pin(foo()); -LL | | -LL | | let mut r = gen.as_mut().resume(()); -... | -LL | | } -LL | | } - | |_____^ types differ - | - = note: expected opaque type `impl Coroutine` - found coroutine `{coroutine@$DIR/recursive-coroutine-boxed.rs:14:18: 14:20}` - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0282, E0308. -For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/impl-trait/recursive-coroutine-boxed.rs b/tests/ui/impl-trait/recursive-coroutine-boxed.rs index 24a77d7311419..3f7495679a907 100644 --- a/tests/ui/impl-trait/recursive-coroutine-boxed.rs +++ b/tests/ui/impl-trait/recursive-coroutine-boxed.rs @@ -1,19 +1,15 @@ //@ revisions: current next //@ ignore-compare-mode-next-solver (explicit revisions) -//@[current] check-pass +//@ check-pass //@[next] compile-flags: -Znext-solver #![feature(coroutines, coroutine_trait)] use std::ops::{Coroutine, CoroutineState}; fn foo() -> impl Coroutine { - // FIXME(-Znext-solver): this fails with a mismatched types as the - // hidden type of the opaque ends up as {type error}. We should not - // emit errors for such goals. - #[coroutine] || { //[next]~ ERROR mismatched types + #[coroutine] || { let mut gen = Box::pin(foo()); - //[next]~^ ERROR type annotations needed let mut r = gen.as_mut().resume(()); while let CoroutineState::Yielded(v) = r { yield v; diff --git a/tests/ui/issues/issue-20261.stderr b/tests/ui/issues/issue-20261.stderr index 6738708ca225d..02c2ac124a603 100644 --- a/tests/ui/issues/issue-20261.stderr +++ b/tests/ui/issues/issue-20261.stderr @@ -1,8 +1,8 @@ error[E0282]: type annotations needed - --> $DIR/issue-20261.rs:4:11 + --> $DIR/issue-20261.rs:4:9 | LL | i.clone(); - | ^^^^^ cannot infer type + | ^^^^^^^^^ cannot infer type error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-2151.stderr b/tests/ui/issues/issue-2151.stderr index 59fef42eb5e8b..b739f4a627c24 100644 --- a/tests/ui/issues/issue-2151.stderr +++ b/tests/ui/issues/issue-2151.stderr @@ -4,7 +4,7 @@ error[E0282]: type annotations needed LL | let x = panic!(); | ^ LL | x.clone(); - | ----- type must be known at this point + | --------- type must be known at this point | help: consider giving `x` an explicit type | diff --git a/tests/ui/lazy-type-alias-impl-trait/branches3.stderr b/tests/ui/lazy-type-alias-impl-trait/branches3.stderr index 270fbfa81bb89..79a95553994a9 100644 --- a/tests/ui/lazy-type-alias-impl-trait/branches3.stderr +++ b/tests/ui/lazy-type-alias-impl-trait/branches3.stderr @@ -2,7 +2,7 @@ error[E0282]: type annotations needed --> $DIR/branches3.rs:8:10 | LL | |s| s.len() - | ^ --- type must be known at this point + | ^ ------- type must be known at this point | help: consider giving this closure parameter an explicit type | @@ -13,7 +13,7 @@ error[E0282]: type annotations needed --> $DIR/branches3.rs:15:10 | LL | |s| s.len() - | ^ --- type must be known at this point + | ^ ------- type must be known at this point | help: consider giving this closure parameter an explicit type | @@ -24,7 +24,7 @@ error[E0282]: type annotations needed --> $DIR/branches3.rs:23:10 | LL | |s| s.len() - | ^ --- type must be known at this point + | ^ ------- type must be known at this point | help: consider giving this closure parameter an explicit type | @@ -35,7 +35,7 @@ error[E0282]: type annotations needed --> $DIR/branches3.rs:30:10 | LL | |s| s.len() - | ^ --- type must be known at this point + | ^ ------- type must be known at this point | help: consider giving this closure parameter an explicit type | diff --git a/tests/ui/methods/suggest-method-on-call-for-ambig-receiver.stderr b/tests/ui/methods/suggest-method-on-call-for-ambig-receiver.stderr index 40d8301c24e5c..54edeb2443a23 100644 --- a/tests/ui/methods/suggest-method-on-call-for-ambig-receiver.stderr +++ b/tests/ui/methods/suggest-method-on-call-for-ambig-receiver.stderr @@ -3,6 +3,12 @@ error[E0425]: cannot find function `consume` in this scope | LL | consume(right); | ^^^^^^^ not found in this scope + | +help: use the `.` operator to call the method `BufRead::consume` on `&mut _` + | +LL - consume(right); +LL + right.consume(); + | error: aborting due to 1 previous error diff --git a/tests/ui/span/issue-42234-unknown-receiver-type.full.stderr b/tests/ui/span/issue-42234-unknown-receiver-type.full.stderr index 6435a7b84bc19..ddf11c74908aa 100644 --- a/tests/ui/span/issue-42234-unknown-receiver-type.full.stderr +++ b/tests/ui/span/issue-42234-unknown-receiver-type.full.stderr @@ -1,23 +1,14 @@ -error[E0282]: type annotations needed - --> $DIR/issue-42234-unknown-receiver-type.rs:9:24 +error[E0599]: no method named `method_that_could_exist_on_some_type` found for type `_` in the current scope + --> $DIR/issue-42234-unknown-receiver-type.rs:10:16 | -LL | let x: Option<_> = None; - | ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option` LL | x.unwrap().method_that_could_exist_on_some_type(); - | ------------------------------------ type must be known at this point - | -help: consider specifying the generic argument - | -LL | let x: Option<_> = None::; - | +++++ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ method not found in `_` error[E0282]: type annotations needed - --> $DIR/issue-42234-unknown-receiver-type.rs:15:10 + --> $DIR/issue-42234-unknown-receiver-type.rs:16:10 | LL | .sum::<_>() | ^^^ cannot infer type of the type parameter `S` declared on the method `sum` -LL | .to_string() - | --------- type must be known at this point | help: consider specifying the generic argument | @@ -26,4 +17,5 @@ LL | .sum::<_>() error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0282`. +Some errors have detailed explanations: E0282, E0599. +For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/span/issue-42234-unknown-receiver-type.generic_arg.stderr b/tests/ui/span/issue-42234-unknown-receiver-type.generic_arg.stderr index 74c46f6471237..8177b21904fa0 100644 --- a/tests/ui/span/issue-42234-unknown-receiver-type.generic_arg.stderr +++ b/tests/ui/span/issue-42234-unknown-receiver-type.generic_arg.stderr @@ -1,23 +1,14 @@ -error[E0282]: type annotations needed - --> $DIR/issue-42234-unknown-receiver-type.rs:9:24 +error[E0599]: no method named `method_that_could_exist_on_some_type` found for type `_` in the current scope + --> $DIR/issue-42234-unknown-receiver-type.rs:10:16 | -LL | let x: Option<_> = None; - | ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option` LL | x.unwrap().method_that_could_exist_on_some_type(); - | ------------------------------------ type must be known at this point - | -help: consider specifying the generic argument - | -LL | let x: Option<_> = None::; - | +++++ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ method not found in `_` error[E0282]: type annotations needed - --> $DIR/issue-42234-unknown-receiver-type.rs:15:10 + --> $DIR/issue-42234-unknown-receiver-type.rs:16:10 | LL | .sum::<_>() | ^^^ cannot infer type of the type parameter `S` declared on the method `sum` -LL | .to_string() - | --------- type must be known at this point | help: consider specifying the generic argument | @@ -26,4 +17,5 @@ LL | .sum::() error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0282`. +Some errors have detailed explanations: E0282, E0599. +For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/span/issue-42234-unknown-receiver-type.rs b/tests/ui/span/issue-42234-unknown-receiver-type.rs index 53d1e3eed820e..3712305e8f16c 100644 --- a/tests/ui/span/issue-42234-unknown-receiver-type.rs +++ b/tests/ui/span/issue-42234-unknown-receiver-type.rs @@ -6,8 +6,9 @@ // the fix of which this tests). fn shines_a_beacon_through_the_darkness() { - let x: Option<_> = None; //~ ERROR type annotations needed + let x: Option<_> = None; x.unwrap().method_that_could_exist_on_some_type(); + //~^ ERROR no method named `method_that_could_exist_on_some_type` found for type `_` } fn courier_to_des_moines_and_points_west(data: &[u32]) -> String { diff --git a/tests/ui/type-alias-impl-trait/closures_in_branches.stderr b/tests/ui/type-alias-impl-trait/closures_in_branches.stderr index d6defe35866c5..1df9ad9354fe7 100644 --- a/tests/ui/type-alias-impl-trait/closures_in_branches.stderr +++ b/tests/ui/type-alias-impl-trait/closures_in_branches.stderr @@ -2,7 +2,7 @@ error[E0282]: type annotations needed --> $DIR/closures_in_branches.rs:7:10 | LL | |x| x.len() - | ^ --- type must be known at this point + | ^ ------- type must be known at this point | help: consider giving this closure parameter an explicit type | @@ -13,7 +13,7 @@ error[E0282]: type annotations needed --> $DIR/closures_in_branches.rs:21:10 | LL | |x| x.len() - | ^ --- type must be known at this point + | ^ ------- type must be known at this point | help: consider giving this closure parameter an explicit type | diff --git a/tests/ui/type-alias-impl-trait/method_resolution_trait_method_from_opaque.next.stderr b/tests/ui/type-alias-impl-trait/method_resolution_trait_method_from_opaque.next.stderr index 870938032e579..e6853c932c0ab 100644 --- a/tests/ui/type-alias-impl-trait/method_resolution_trait_method_from_opaque.next.stderr +++ b/tests/ui/type-alias-impl-trait/method_resolution_trait_method_from_opaque.next.stderr @@ -1,8 +1,8 @@ error[E0282]: type annotations needed - --> $DIR/method_resolution_trait_method_from_opaque.rs:26:18 + --> $DIR/method_resolution_trait_method_from_opaque.rs:26:9 | LL | self.bar.next().unwrap(); - | ^^^^ cannot infer type + | ^^^^^^^^^^^^^^^ cannot infer type error: aborting due to 1 previous error diff --git a/tests/ui/typeck/issue-13853.rs b/tests/ui/typeck/issue-13853.rs index ed44d5062614f..dc3bc556ddbfb 100644 --- a/tests/ui/typeck/issue-13853.rs +++ b/tests/ui/typeck/issue-13853.rs @@ -25,7 +25,7 @@ impl Node for Stuff { fn iterate>(graph: &G) { for node in graph.iter() { //~ ERROR no method named `iter` found - node.zomg(); //~ ERROR type annotations needed + node.zomg(); //~ ERROR no method named `zomg` found for type `_` } } diff --git a/tests/ui/typeck/issue-13853.stderr b/tests/ui/typeck/issue-13853.stderr index 9b8698d6ed2c0..a61308579e25a 100644 --- a/tests/ui/typeck/issue-13853.stderr +++ b/tests/ui/typeck/issue-13853.stderr @@ -17,11 +17,21 @@ error[E0599]: no method named `iter` found for reference `&G` in the current sco LL | for node in graph.iter() { | ^^^^ method not found in `&G` -error[E0282]: type annotations needed +error[E0599]: no method named `zomg` found for type `_` in the current scope --> $DIR/issue-13853.rs:28:14 | LL | node.zomg(); - | ^^^^ cannot infer type + | -----^^^^-- + | | | + | | this is an associated function, not a method + | help: use associated function syntax instead: `_::zomg()` + | + = note: found the following associated functions; to be used as methods, functions must have a `self` parameter +note: the candidate is defined in the trait `Node` + --> $DIR/issue-13853.rs:2:5 + | +LL | fn zomg(); + | ^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/issue-13853.rs:37:13 @@ -45,5 +55,5 @@ LL | iterate(&graph); error: aborting due to 4 previous errors -Some errors have detailed explanations: E0282, E0308, E0599. -For more information about an error, try `rustc --explain E0282`. +Some errors have detailed explanations: E0308, E0599. +For more information about an error, try `rustc --explain E0308`.