diff options
| author | Michael Goulet <michael@errs.io> | 2022-08-17 00:21:40 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-08-21 02:35:11 +0000 |
| commit | c8746766cb2e375c8b9eeb1bab656aca4cc2a9d1 (patch) | |
| tree | 5d445492be1b740eaee20d4dc667cbe8221ba8b3 /src/test | |
| parent | 70b29f7c2d6d4b86d5b1492f3aa63969a62b25bf (diff) | |
| download | rust-c8746766cb2e375c8b9eeb1bab656aca4cc2a9d1.tar.gz rust-c8746766cb2e375c8b9eeb1bab656aca4cc2a9d1.zip | |
Rework ambiguity errors
Diffstat (limited to 'src/test')
10 files changed, 47 insertions, 142 deletions
diff --git a/src/test/ui/error-codes/E0283.stderr b/src/test/ui/error-codes/E0283.stderr index 162d4922d00..90a28874ead 100644 --- a/src/test/ui/error-codes/E0283.stderr +++ b/src/test/ui/error-codes/E0283.stderr @@ -12,24 +12,11 @@ help: use a fully-qualified path to a specific available implementation (2 found LL | let cont: u32 = <::Impl as Generator>::create(); | ++++++++++ + -error[E0282]: type annotations needed - --> $DIR/E0283.rs:35:24 - | -LL | let bar = foo_impl.into() * 1u32; - | ^^^^ - | -help: try using a fully qualified path to specify the expected types - | -LL | let bar = <Impl as Into<T>>::into(foo_impl) * 1u32; - | ++++++++++++++++++++++++ ~ - error[E0283]: type annotations needed --> $DIR/E0283.rs:35:24 | LL | let bar = foo_impl.into() * 1u32; - | -------- ^^^^ - | | - | type must be known at this point + | ^^^^ | note: multiple `impl`s satisfying `Impl: Into<_>` found --> $DIR/E0283.rs:17:1 @@ -44,7 +31,7 @@ help: try using a fully qualified path to specify the expected types LL | let bar = <Impl as Into<T>>::into(foo_impl) * 1u32; | ++++++++++++++++++++++++ ~ -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0282, E0283, E0790. -For more information about an error, try `rustc --explain E0282`. +Some errors have detailed explanations: E0283, E0790. +For more information about an error, try `rustc --explain E0283`. diff --git a/src/test/ui/inference/issue-72690.stderr b/src/test/ui/inference/issue-72690.stderr index 3504b294ab2..d4eeda07366 100644 --- a/src/test/ui/inference/issue-72690.stderr +++ b/src/test/ui/inference/issue-72690.stderr @@ -12,9 +12,7 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:7:22 | LL | String::from("x".as_ref()); - | --- ^^^^^^ - | | - | type must be known at this point + | ^^^^^^ | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - impl AsRef<OsStr> for str; @@ -41,9 +39,7 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:12:26 | LL | |x| String::from("x".as_ref()); - | --- ^^^^^^ - | | - | type must be known at this point + | ^^^^^^ | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - impl AsRef<OsStr> for str; @@ -59,9 +55,7 @@ error[E0283]: type annotations needed for `&T` --> $DIR/issue-72690.rs:17:9 | LL | let _ = "x".as_ref(); - | ^ --- ------ required by a bound introduced by this call - | | - | type must be known at this point + | ^ ------ type must be known at this point | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - impl AsRef<OsStr> for str; @@ -87,9 +81,7 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:21:22 | LL | String::from("x".as_ref()); - | --- ^^^^^^ - | | - | type must be known at this point + | ^^^^^^ | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - impl AsRef<OsStr> for str; @@ -115,9 +107,7 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:28:22 | LL | String::from("x".as_ref()); - | --- ^^^^^^ - | | - | type must be known at this point + | ^^^^^^ | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - impl AsRef<OsStr> for str; @@ -143,9 +133,7 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:37:22 | LL | String::from("x".as_ref()); - | --- ^^^^^^ - | | - | type must be known at this point + | ^^^^^^ | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - impl AsRef<OsStr> for str; @@ -171,9 +159,7 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:46:22 | LL | String::from("x".as_ref()); - | --- ^^^^^^ - | | - | type must be known at this point + | ^^^^^^ | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - impl AsRef<OsStr> for str; @@ -199,9 +185,7 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:53:22 | LL | String::from("x".as_ref()); - | --- ^^^^^^ - | | - | type must be known at this point + | ^^^^^^ | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - impl AsRef<OsStr> for str; @@ -227,9 +211,7 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:62:22 | LL | String::from("x".as_ref()); - | --- ^^^^^^ - | | - | type must be known at this point + | ^^^^^^ | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - impl AsRef<OsStr> for str; diff --git a/src/test/ui/issues/issue-69455.stderr b/src/test/ui/issues/issue-69455.stderr index 3e40777c8d0..9d11cf19ea7 100644 --- a/src/test/ui/issues/issue-69455.stderr +++ b/src/test/ui/issues/issue-69455.stderr @@ -14,10 +14,9 @@ error[E0283]: type annotations needed --> $DIR/issue-69455.rs:29:41 | LL | println!("{}", 23u64.test(xs.iter().sum())); - | ----- ---- ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum` - | | | - | | required by a bound introduced by this call - | type must be known at this point + | ---- ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum` + | | + | required by a bound introduced by this call | note: multiple `impl`s satisfying `u64: Test<_>` found --> $DIR/issue-69455.rs:11:1 diff --git a/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr b/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr index 754735988e4..e0f8a5447b0 100644 --- a/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr +++ b/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr @@ -13,9 +13,7 @@ error[E0283]: type annotations needed --> $DIR/method-ambig-one-trait-unknown-int-type.rs:26:7 | LL | x.foo(); - | - ^^^ - | | - | type must be known at this point + | ^^^ | note: multiple `impl`s satisfying `Vec<_>: Foo` found --> $DIR/method-ambig-one-trait-unknown-int-type.rs:9:1 diff --git a/src/test/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr b/src/test/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr index e8d90fb336e..57b2587ae5c 100644 --- a/src/test/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr +++ b/src/test/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr @@ -13,9 +13,7 @@ error[E0283]: type annotations needed --> $DIR/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs:17:11 | LL | thing.method(42); - | ----- ^^^^^^ - | | - | type must be known at this point + | ^^^^^^ | note: multiple `impl`s satisfying `Thing<bool>: Method<_>` found --> $DIR/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs:7:1 diff --git a/src/test/ui/traits/issue-77982.stderr b/src/test/ui/traits/issue-77982.stderr index 93a36a22874..e210f11b3e0 100644 --- a/src/test/ui/traits/issue-77982.stderr +++ b/src/test/ui/traits/issue-77982.stderr @@ -24,9 +24,8 @@ error[E0283]: type annotations needed --> $DIR/issue-77982.rs:8:10 | LL | opts.get(opt.as_ref()); - | ^^^ --- ------ required by a bound introduced by this call - | | | - | | type must be known at this point + | ^^^ ------ type must be known at this point + | | | cannot infer type of the type parameter `Q` declared on the associated function `get` | = note: multiple `impl`s satisfying `String: AsRef<_>` found in the following crates: `alloc`, `std`: @@ -39,24 +38,13 @@ help: consider specifying the generic argument LL | opts.get::<Q>(opt.as_ref()); | +++++ -error[E0282]: type annotations needed - --> $DIR/issue-77982.rs:13:59 - | -LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect(); - | ^^^^ - | -help: try using a fully qualified path to specify the expected types - | -LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(<u32 as Into<T>>::into(0u32))).collect(); - | +++++++++++++++++++++++ ~ - error[E0283]: type annotations needed --> $DIR/issue-77982.rs:13:59 | LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect(); | --------- ^^^^ | | - | type must be known at this point + | required by a bound introduced by this call | = note: multiple `impl`s satisfying `u32: From<_>` found in the following crates: `core`, `std`: - impl From<Ipv4Addr> for u32; @@ -73,9 +61,7 @@ error[E0283]: type annotations needed for `Box<T>` --> $DIR/issue-77982.rs:36:9 | LL | let _ = ().foo(); - | ^ -- --- required by a bound introduced by this call - | | - | type must be known at this point + | ^ --- type must be known at this point | note: multiple `impl`s satisfying `(): Foo<'_, _>` found --> $DIR/issue-77982.rs:29:1 @@ -93,9 +79,7 @@ error[E0283]: type annotations needed for `Box<T>` --> $DIR/issue-77982.rs:40:9 | LL | let _ = (&()).bar(); - | ^ ----- --- required by a bound introduced by this call - | | - | type must be known at this point + | ^ --- type must be known at this point | note: multiple `impl`s satisfying `&(): Bar<'_, _>` found --> $DIR/issue-77982.rs:32:1 @@ -109,7 +93,6 @@ help: consider giving this pattern a type, where the type for type parameter `T` LL | let _: Box<T> = (&()).bar(); | ++++++++ -error: aborting due to 6 previous errors +error: aborting due to 5 previous errors -Some errors have detailed explanations: E0282, E0283. -For more information about an error, try `rustc --explain E0282`. +For more information about this error, try `rustc --explain E0283`. diff --git a/src/test/ui/traits/multidispatch-convert-ambig-dest.stderr b/src/test/ui/traits/multidispatch-convert-ambig-dest.stderr index 83fb04646c5..6e6172eea47 100644 --- a/src/test/ui/traits/multidispatch-convert-ambig-dest.stderr +++ b/src/test/ui/traits/multidispatch-convert-ambig-dest.stderr @@ -13,7 +13,7 @@ error[E0283]: type annotations needed --> $DIR/multidispatch-convert-ambig-dest.rs:26:5 | LL | test(22, std::default::Default::default()); - | ^^^^ -- type must be known at this point + | ^^^^ -------------------------------- type must be known at this point | | | cannot infer type of the type parameter `U` declared on the function `test` | diff --git a/src/test/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr b/src/test/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr index 294af653475..53178328c56 100644 --- a/src/test/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr +++ b/src/test/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr @@ -13,9 +13,7 @@ error[E0283]: type annotations needed --> $DIR/not-suggest-non-existing-fully-qualified-path.rs:21:7 | LL | a.method(); - | - ^^^^^^ - | | - | type must be known at this point + | ^^^^^^ | note: multiple `impl`s satisfying `B: I<_>` found --> $DIR/not-suggest-non-existing-fully-qualified-path.rs:5:1 diff --git a/src/test/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr b/src/test/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr index 07f7bfb7cb4..68b31a1ca34 100644 --- a/src/test/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr +++ b/src/test/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr @@ -13,9 +13,7 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:45:11 | LL | thing.method(); - | ----- ^^^^^^ - | | - | type must be known at this point + | ^^^^^^ | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:10:1 @@ -34,9 +32,7 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:48:11 | LL | thing.mut_method(); - | ----- ^^^^^^^^^^ - | | - | type must be known at this point + | ^^^^^^^^^^ | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:10:1 @@ -55,9 +51,7 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:49:11 | LL | thing.by_self(); - | ----- ^^^^^^^ - | | - | type must be known at this point + | ^^^^^^^ | note: multiple `impl`s satisfying `&Thing: MethodRef<_>` found --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:22:1 @@ -76,9 +70,7 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:52:14 | LL | deref_to.method(); - | -------- ^^^^^^ - | | - | type must be known at this point + | ^^^^^^ | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:10:1 @@ -97,9 +89,7 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:53:14 | LL | deref_to.mut_method(); - | -------- ^^^^^^^^^^ - | | - | type must be known at this point + | ^^^^^^^^^^ | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:10:1 @@ -118,9 +108,7 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:54:14 | LL | deref_to.by_self(); - | -------- ^^^^^^^ - | | - | type must be known at this point + | ^^^^^^^ | note: multiple `impl`s satisfying `&Thing: MethodRef<_>` found --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:22:1 @@ -139,9 +127,7 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:57:20 | LL | deref_deref_to.method(); - | -------------- ^^^^^^ - | | - | type must be known at this point + | ^^^^^^ | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:10:1 @@ -160,9 +146,7 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:58:20 | LL | deref_deref_to.mut_method(); - | -------------- ^^^^^^^^^^ - | | - | type must be known at this point + | ^^^^^^^^^^ | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:10:1 @@ -181,9 +165,7 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:59:20 | LL | deref_deref_to.by_self(); - | -------------- ^^^^^^^ - | | - | type must be known at this point + | ^^^^^^^ | note: multiple `impl`s satisfying `&Thing: MethodRef<_>` found --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:22:1 diff --git a/src/test/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr b/src/test/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr index bcc25e103b1..27518a54e75 100644 --- a/src/test/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr +++ b/src/test/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr @@ -13,9 +13,7 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:45:15 | LL | ref_thing.method(); - | --------- ^^^^^^ - | | - | type must be known at this point + | ^^^^^^ | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:10:1 @@ -34,9 +32,7 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:48:15 | LL | ref_thing.by_self(); - | --------- ^^^^^^^ - | | - | type must be known at this point + | ^^^^^^^ | note: multiple `impl`s satisfying `&Thing: MethodRef<_>` found --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:23:1 @@ -55,9 +51,7 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:51:15 | LL | mut_thing.method(); - | --------- ^^^^^^ - | | - | type must be known at this point + | ^^^^^^ | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:10:1 @@ -76,9 +70,7 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:52:15 | LL | mut_thing.mut_method(); - | --------- ^^^^^^^^^^ - | | - | type must be known at this point + | ^^^^^^^^^^ | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:10:1 @@ -97,9 +89,7 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:53:15 | LL | mut_thing.by_self(); - | --------- ^^^^^^^ - | | - | type must be known at this point + | ^^^^^^^ | note: multiple `impl`s satisfying `&Thing: MethodRef<_>` found --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:23:1 @@ -118,9 +108,7 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:56:14 | LL | deref_to.method(); - | -------- ^^^^^^ - | | - | type must be known at this point + | ^^^^^^ | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:10:1 @@ -139,9 +127,7 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:57:14 | LL | deref_to.mut_method(); - | -------- ^^^^^^^^^^ - | | - | type must be known at this point + | ^^^^^^^^^^ | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:10:1 @@ -160,9 +146,7 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:58:14 | LL | deref_to.by_self(); - | -------- ^^^^^^^ - | | - | type must be known at this point + | ^^^^^^^ | note: multiple `impl`s satisfying `&Thing: MethodRef<_>` found --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:23:1 @@ -181,9 +165,7 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:61:20 | LL | deref_deref_to.method(); - | -------------- ^^^^^^ - | | - | type must be known at this point + | ^^^^^^ | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:10:1 @@ -202,9 +184,7 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:62:20 | LL | deref_deref_to.mut_method(); - | -------------- ^^^^^^^^^^ - | | - | type must be known at this point + | ^^^^^^^^^^ | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:10:1 @@ -223,9 +203,7 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:63:20 | LL | deref_deref_to.by_self(); - | -------------- ^^^^^^^ - | | - | type must be known at this point + | ^^^^^^^ | note: multiple `impl`s satisfying `&Thing: MethodRef<_>` found --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:23:1 |
