diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index b0510f9a75b3b..6b59794df71d1 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -1292,6 +1292,11 @@ fn check_impl<'tcx>( // therefore don't need to be WF (the trait's `Self: Trait` predicate // won't hold). let trait_ref = tcx.impl_trait_ref(item.owner_id).unwrap().instantiate_identity(); + if let Err(guar) = tcx.ensure().coherent_trait(trait_ref.def_id) { + // Avoid bogus "type annotations needed `Foo: Bar`" errors on `impl Bar for Foo` in case + // other `Foo` impls are incoherent. + wfcx.infcx.set_tainted_by_errors(guar); + } let trait_ref = wfcx.normalize( ast_trait_ref.path.span, Some(WellFormedLoc::Ty(item.hir_id().expect_owner().def_id)), diff --git a/tests/ui/async-await/in-trait/coherence-constrained.rs b/tests/ui/async-await/in-trait/coherence-constrained.rs index b4008ae79fc93..8b4363b51031f 100644 --- a/tests/ui/async-await/in-trait/coherence-constrained.rs +++ b/tests/ui/async-await/in-trait/coherence-constrained.rs @@ -11,7 +11,6 @@ trait Foo { struct Bar; impl Foo for Bar { - //~^ ERROR type annotations needed type T = (); //~^ ERROR type annotations needed @@ -22,7 +21,6 @@ impl Foo for Bar { impl Foo for Bar { //~^ ERROR conflicting implementations of trait `Foo` for type `Bar` - //~| ERROR type annotations needed type T = (); //~^ ERROR type annotations needed diff --git a/tests/ui/async-await/in-trait/coherence-constrained.stderr b/tests/ui/async-await/in-trait/coherence-constrained.stderr index 1fe0e42067b17..f01d3d49a82ec 100644 --- a/tests/ui/async-await/in-trait/coherence-constrained.stderr +++ b/tests/ui/async-await/in-trait/coherence-constrained.stderr @@ -1,17 +1,17 @@ error[E0284]: type annotations needed: cannot satisfy `::T == ()` - --> $DIR/coherence-constrained.rs:18:5 + --> $DIR/coherence-constrained.rs:17:5 | LL | async fn foo(&self) {} | ^^^^^^^^^^^^^^^^^^^ cannot satisfy `::T == ()` error[E0284]: type annotations needed: cannot satisfy `::T == ()` - --> $DIR/coherence-constrained.rs:29:5 + --> $DIR/coherence-constrained.rs:27:5 | LL | async fn foo(&self) {} | ^^^^^^^^^^^^^^^^^^^ cannot satisfy `::T == ()` error[E0119]: conflicting implementations of trait `Foo` for type `Bar` - --> $DIR/coherence-constrained.rs:23:1 + --> $DIR/coherence-constrained.rs:22:1 | LL | impl Foo for Bar { | ---------------- first implementation here @@ -19,23 +19,8 @@ LL | impl Foo for Bar { LL | impl Foo for Bar { | ^^^^^^^^^^^^^^^^ conflicting implementation for `Bar` -error[E0283]: type annotations needed: cannot satisfy `Bar: Foo` - --> $DIR/coherence-constrained.rs:13:14 - | -LL | impl Foo for Bar { - | ^^^ - | -note: multiple `impl`s satisfying `Bar: Foo` found - --> $DIR/coherence-constrained.rs:13:1 - | -LL | impl Foo for Bar { - | ^^^^^^^^^^^^^^^^ -... -LL | impl Foo for Bar { - | ^^^^^^^^^^^^^^^^ - error[E0284]: type annotations needed - --> $DIR/coherence-constrained.rs:15:14 + --> $DIR/coherence-constrained.rs:14:14 | LL | type T = (); | ^^ cannot infer type @@ -43,7 +28,7 @@ LL | type T = (); = note: cannot satisfy `::T == _` error[E0284]: type annotations needed: cannot satisfy `::{opaque#0}<'_> == impl Future` - --> $DIR/coherence-constrained.rs:18:5 + --> $DIR/coherence-constrained.rs:17:5 | LL | async fn foo(&self) {} | ^^^^^^^^^^^^^^^^^^^ cannot satisfy `::{opaque#0}<'_> == impl Future` @@ -56,23 +41,8 @@ LL | async fn foo(&self) -> Self::T; | = note: cannot satisfy `::{opaque#0}<'_> == _` -error[E0283]: type annotations needed: cannot satisfy `Bar: Foo` - --> $DIR/coherence-constrained.rs:23:14 - | -LL | impl Foo for Bar { - | ^^^ - | -note: multiple `impl`s satisfying `Bar: Foo` found - --> $DIR/coherence-constrained.rs:13:1 - | -LL | impl Foo for Bar { - | ^^^^^^^^^^^^^^^^ -... -LL | impl Foo for Bar { - | ^^^^^^^^^^^^^^^^ - error[E0284]: type annotations needed - --> $DIR/coherence-constrained.rs:26:14 + --> $DIR/coherence-constrained.rs:24:14 | LL | type T = (); | ^^ cannot infer type @@ -80,7 +50,7 @@ LL | type T = (); = note: cannot satisfy `::T == _` error[E0284]: type annotations needed: cannot satisfy `::{opaque#0}<'_> == impl Future` - --> $DIR/coherence-constrained.rs:29:5 + --> $DIR/coherence-constrained.rs:27:5 | LL | async fn foo(&self) {} | ^^^^^^^^^^^^^^^^^^^ cannot satisfy `::{opaque#0}<'_> == impl Future` @@ -94,7 +64,7 @@ LL | async fn foo(&self) -> Self::T; = note: cannot satisfy `::{opaque#0}<'_> == _` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 11 previous errors +error: aborting due to 9 previous errors -Some errors have detailed explanations: E0119, E0283, E0284. +Some errors have detailed explanations: E0119, E0284. For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/async-await/issue-67651.rs b/tests/ui/async-await/issue-67651.rs index 2260b17b3e9e1..110c15f555990 100644 --- a/tests/ui/async-await/issue-67651.rs +++ b/tests/ui/async-await/issue-67651.rs @@ -5,14 +5,11 @@ trait From { } impl From for () { -//~^ ERROR type annotations needed fn from() {} } impl From for () { //~^ ERROR conflicting implementations of trait -//~| ERROR type annotations needed - fn from() {} } fn bar() -> impl core::future::Future { diff --git a/tests/ui/async-await/issue-67651.stderr b/tests/ui/async-await/issue-67651.stderr index cea2d85c192c1..c336904e470d3 100644 --- a/tests/ui/async-await/issue-67651.stderr +++ b/tests/ui/async-await/issue-67651.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `From` for type `()` - --> $DIR/issue-67651.rs:12:1 + --> $DIR/issue-67651.rs:11:1 | LL | impl From for () { | ---------------- first implementation here @@ -7,38 +7,8 @@ LL | impl From for () { LL | impl From for () { | ^^^^^^^^^^^^^^^^ conflicting implementation for `()` -error[E0283]: type annotations needed: cannot satisfy `(): From` - --> $DIR/issue-67651.rs:7:15 - | -LL | impl From for () { - | ^^ - | -note: multiple `impl`s satisfying `(): From` found - --> $DIR/issue-67651.rs:7:1 - | -LL | impl From for () { - | ^^^^^^^^^^^^^^^^ -... -LL | impl From for () { - | ^^^^^^^^^^^^^^^^ - -error[E0283]: type annotations needed: cannot satisfy `(): From` - --> $DIR/issue-67651.rs:12:15 - | -LL | impl From for () { - | ^^ - | -note: multiple `impl`s satisfying `(): From` found - --> $DIR/issue-67651.rs:7:1 - | -LL | impl From for () { - | ^^^^^^^^^^^^^^^^ -... -LL | impl From for () { - | ^^^^^^^^^^^^^^^^ - error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type - --> $DIR/issue-67651.rs:19:18 + --> $DIR/issue-67651.rs:16:18 | LL | fn from(); | ---------- `From::from` defined here @@ -51,7 +21,7 @@ help: use a fully-qualified path to a specific available implementation LL | async move { ::from() } | +++++++++++++++++++ + -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0119, E0283, E0790. +Some errors have detailed explanations: E0119, E0790. For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.rs b/tests/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.rs index 07328abbf0b49..bccbac2ff1606 100644 --- a/tests/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.rs +++ b/tests/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.rs @@ -14,7 +14,6 @@ impl Go for MyThingy { impl GoMut for MyThingy { //~^ ERROR E0119 -//~| ERROR E0283 fn go_mut(&mut self, arg: isize) { } } diff --git a/tests/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.stderr b/tests/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.stderr index 6e9cf8eac84fe..4b86cffbe479f 100644 --- a/tests/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.stderr +++ b/tests/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.stderr @@ -8,22 +8,6 @@ LL | impl GoMut for MyThingy { - impl GoMut for G where G: Go; -error[E0283]: type annotations needed: cannot satisfy `MyThingy: GoMut` - --> $DIR/coherence-blanket-conflicts-with-specific-cross-crate.rs:15:16 - | -LL | impl GoMut for MyThingy { - | ^^^^^^^^ - | -note: multiple `impl`s satisfying `MyThingy: GoMut` found - --> $DIR/coherence-blanket-conflicts-with-specific-cross-crate.rs:15:1 - | -LL | impl GoMut for MyThingy { - | ^^^^^^^^^^^^^^^^^^^^^^^ - = note: and another `impl` found in the `go_trait` crate: - - impl GoMut for G - where G: Go; - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0119, E0283. -For more information about an error, try `rustc --explain E0119`. +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs b/tests/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs index bb1390dda7ffa..cdec81271d090 100644 --- a/tests/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs +++ b/tests/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs @@ -21,7 +21,6 @@ struct MyType { impl MyTrait for MyType { //~^ ERROR E0119 -//~| ERROR type annotations needed fn get(&self) -> usize { (*self).clone() } //~^ ERROR incompatible type } diff --git a/tests/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr b/tests/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr index 7c04d471cff24..471dfe1cae79d 100644 --- a/tests/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr +++ b/tests/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr @@ -7,23 +7,8 @@ LL | impl MyTrait for T { LL | impl MyTrait for MyType { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` -error[E0283]: type annotations needed: cannot satisfy `MyType: MyTrait` - --> $DIR/coherence-blanket-conflicts-with-specific-multidispatch.rs:22:26 - | -LL | impl MyTrait for MyType { - | ^^^^^^ - | -note: multiple `impl`s satisfying `MyType: MyTrait` found - --> $DIR/coherence-blanket-conflicts-with-specific-multidispatch.rs:11:1 - | -LL | impl MyTrait for T { - | ^^^^^^^^^^^^^^^^^^^^^^^^ -... -LL | impl MyTrait for MyType { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - error[E0053]: method `get` has an incompatible type for trait - --> $DIR/coherence-blanket-conflicts-with-specific-multidispatch.rs:25:22 + --> $DIR/coherence-blanket-conflicts-with-specific-multidispatch.rs:24:22 | LL | fn get(&self) -> usize { (*self).clone() } | ^^^^^ @@ -39,7 +24,7 @@ LL | fn get(&self) -> T; = note: expected signature `fn(&MyType) -> MyType` found signature `fn(&MyType) -> usize` -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0053, E0119, E0283. +Some errors have detailed explanations: E0053, E0119. For more information about an error, try `rustc --explain E0053`. diff --git a/tests/ui/coherence/coherence-blanket-conflicts-with-specific-trait.rs b/tests/ui/coherence/coherence-blanket-conflicts-with-specific-trait.rs index a64a8098e0a8c..02f9217da6840 100644 --- a/tests/ui/coherence/coherence-blanket-conflicts-with-specific-trait.rs +++ b/tests/ui/coherence/coherence-blanket-conflicts-with-specific-trait.rs @@ -19,7 +19,6 @@ struct MyType { impl MyTrait for MyType { //~^ ERROR E0119 -//~| ERROR type annotations needed fn get(&self) -> usize { self.dummy } } diff --git a/tests/ui/coherence/coherence-blanket-conflicts-with-specific-trait.stderr b/tests/ui/coherence/coherence-blanket-conflicts-with-specific-trait.stderr index 13b71de6b8ab6..b681285341bf4 100644 --- a/tests/ui/coherence/coherence-blanket-conflicts-with-specific-trait.stderr +++ b/tests/ui/coherence/coherence-blanket-conflicts-with-specific-trait.stderr @@ -7,22 +7,6 @@ LL | impl MyTrait for T { LL | impl MyTrait for MyType { | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` -error[E0283]: type annotations needed: cannot satisfy `MyType: MyTrait` - --> $DIR/coherence-blanket-conflicts-with-specific-trait.rs:20:18 - | -LL | impl MyTrait for MyType { - | ^^^^^^ - | -note: multiple `impl`s satisfying `MyType: MyTrait` found - --> $DIR/coherence-blanket-conflicts-with-specific-trait.rs:12:1 - | -LL | impl MyTrait for T { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -... -LL | impl MyTrait for MyType { - | ^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0119, E0283. -For more information about an error, try `rustc --explain E0119`. +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/coherence-blanket-conflicts-with-specific.rs b/tests/ui/coherence/coherence-blanket-conflicts-with-specific.rs index 4131aebb7d0e5..5a562ff6ab937 100644 --- a/tests/ui/coherence/coherence-blanket-conflicts-with-specific.rs +++ b/tests/ui/coherence/coherence-blanket-conflicts-with-specific.rs @@ -18,7 +18,6 @@ struct MyType { impl MyTrait for MyType { //~^ ERROR E0119 -//~| ERROR type annotations needed fn get(&self) -> usize { self.dummy } } diff --git a/tests/ui/coherence/coherence-blanket-conflicts-with-specific.stderr b/tests/ui/coherence/coherence-blanket-conflicts-with-specific.stderr index 272568d529ed9..164edff4a7b6e 100644 --- a/tests/ui/coherence/coherence-blanket-conflicts-with-specific.stderr +++ b/tests/ui/coherence/coherence-blanket-conflicts-with-specific.stderr @@ -7,22 +7,6 @@ LL | impl MyTrait for T { LL | impl MyTrait for MyType { | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` -error[E0283]: type annotations needed: cannot satisfy `MyType: MyTrait` - --> $DIR/coherence-blanket-conflicts-with-specific.rs:19:18 - | -LL | impl MyTrait for MyType { - | ^^^^^^ - | -note: multiple `impl`s satisfying `MyType: MyTrait` found - --> $DIR/coherence-blanket-conflicts-with-specific.rs:11:1 - | -LL | impl MyTrait for T { - | ^^^^^^^^^^^^^^^^^^^^^ -... -LL | impl MyTrait for MyType { - | ^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0119, E0283. -For more information about an error, try `rustc --explain E0119`. +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/coherence-conflicting-negative-trait-impl.rs b/tests/ui/coherence/coherence-conflicting-negative-trait-impl.rs index 6a7056fba2eb0..76a57936e6985 100644 --- a/tests/ui/coherence/coherence-conflicting-negative-trait-impl.rs +++ b/tests/ui/coherence/coherence-conflicting-negative-trait-impl.rs @@ -7,7 +7,6 @@ trait MyTrait {} struct TestType(::std::marker::PhantomData); unsafe impl Send for TestType {} -//~^ ERROR: type annotations needed impl !Send for TestType {} //~ ERROR found both positive and negative implementation diff --git a/tests/ui/coherence/coherence-conflicting-negative-trait-impl.stderr b/tests/ui/coherence/coherence-conflicting-negative-trait-impl.stderr index c7c18e43fca89..020199da99141 100644 --- a/tests/ui/coherence/coherence-conflicting-negative-trait-impl.stderr +++ b/tests/ui/coherence/coherence-conflicting-negative-trait-impl.stderr @@ -1,14 +1,14 @@ error[E0751]: found both positive and negative implementation of trait `Send` for type `TestType<_>`: - --> $DIR/coherence-conflicting-negative-trait-impl.rs:12:1 + --> $DIR/coherence-conflicting-negative-trait-impl.rs:11:1 | LL | unsafe impl Send for TestType {} | ------------------------------------------------------ positive implementation here -... +LL | LL | impl !Send for TestType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ negative implementation here error[E0119]: conflicting implementations of trait `Send` for type `TestType<_>` - --> $DIR/coherence-conflicting-negative-trait-impl.rs:14:1 + --> $DIR/coherence-conflicting-negative-trait-impl.rs:13:1 | LL | unsafe impl Send for TestType {} | ------------------------------------------------------ first implementation here @@ -17,7 +17,7 @@ LL | unsafe impl Send for TestType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>` warning: cross-crate traits with a default impl, like `Send`, should not be specialized - --> $DIR/coherence-conflicting-negative-trait-impl.rs:16:1 + --> $DIR/coherence-conflicting-negative-trait-impl.rs:15:1 | LL | impl !Send for TestType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -32,25 +32,7 @@ LL | struct TestType(::std::marker::PhantomData); | ^^^^^^^^^^^^^^^^^^ = note: `#[warn(suspicious_auto_trait_impls)]` on by default -error[E0283]: type annotations needed: cannot satisfy `TestType: Send` - --> $DIR/coherence-conflicting-negative-trait-impl.rs:9:44 - | -LL | unsafe impl Send for TestType {} - | ^^^^^^^^^^^ - | -note: multiple `impl`s satisfying `TestType: Send` found - --> $DIR/coherence-conflicting-negative-trait-impl.rs:9:1 - | -LL | unsafe impl Send for TestType {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -... -LL | impl !Send for TestType {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | -LL | unsafe impl Send for TestType {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 2 previous errors; 1 warning emitted -Some errors have detailed explanations: E0119, E0283, E0751. +Some errors have detailed explanations: E0119, E0751. For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.rs b/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.rs index fd34967d9045d..99f805f7f0f63 100644 --- a/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.rs +++ b/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.rs @@ -14,10 +14,8 @@ trait Trait {} impl Trait for for<'r> fn(fn(&'r ())) {} -//~^ ERROR type annotations needed impl<'a> Trait for fn(fn(&'a ())) {} //~^ ERROR conflicting implementations -//~| ERROR type annotations needed // // Note in particular that we do NOT get a future-compatibility warning // here. This is because the new leak-check proposed in [MCP 295] does not diff --git a/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.stderr b/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.stderr index fe7b63efb2d8e..316da26b54d4a 100644 --- a/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.stderr +++ b/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.stderr @@ -1,45 +1,13 @@ error[E0119]: conflicting implementations of trait `Trait` for type `for<'r> fn(fn(&'r ()))` - --> $DIR/coherence-fn-covariant-bound-vs-static.rs:18:1 + --> $DIR/coherence-fn-covariant-bound-vs-static.rs:17:1 | LL | impl Trait for for<'r> fn(fn(&'r ())) {} | ------------------------------------- first implementation here -LL | LL | impl<'a> Trait for fn(fn(&'a ())) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'r> fn(fn(&'r ()))` | = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details -error[E0283]: type annotations needed: cannot satisfy `for<'r> fn(fn(&'r ())): Trait` - --> $DIR/coherence-fn-covariant-bound-vs-static.rs:16:16 - | -LL | impl Trait for for<'r> fn(fn(&'r ())) {} - | ^^^^^^^^^^^^^^^^^^^^^^ - | -note: multiple `impl`s satisfying `for<'r> fn(fn(&'r ())): Trait` found - --> $DIR/coherence-fn-covariant-bound-vs-static.rs:16:1 - | -LL | impl Trait for for<'r> fn(fn(&'r ())) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | -LL | impl<'a> Trait for fn(fn(&'a ())) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0283]: type annotations needed: cannot satisfy `fn(fn(&'a ())): Trait` - --> $DIR/coherence-fn-covariant-bound-vs-static.rs:18:20 - | -LL | impl<'a> Trait for fn(fn(&'a ())) {} - | ^^^^^^^^^^^^^^ - | -note: multiple `impl`s satisfying `fn(fn(&'a ())): Trait` found - --> $DIR/coherence-fn-covariant-bound-vs-static.rs:16:1 - | -LL | impl Trait for for<'r> fn(fn(&'r ())) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | -LL | impl<'a> Trait for fn(fn(&'a ())) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 3 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0119, E0283. -For more information about an error, try `rustc --explain E0119`. +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/coherence-fn-inputs.rs b/tests/ui/coherence/coherence-fn-inputs.rs index 7168a011b71e9..3afec5c5459af 100644 --- a/tests/ui/coherence/coherence-fn-inputs.rs +++ b/tests/ui/coherence/coherence-fn-inputs.rs @@ -12,10 +12,8 @@ trait Trait {} impl Trait for for<'a, 'b> fn(&'a u32, &'b u32) {} -//~^ ERROR type annotations needed impl Trait for for<'c> fn(&'c u32, &'c u32) { //~^ ERROR conflicting implementations - //~| ERROR type annotations needed // // Note in particular that we do NOT get a future-compatibility warning // here. This is because the new leak-check proposed in [MCP 295] does not diff --git a/tests/ui/coherence/coherence-fn-inputs.stderr b/tests/ui/coherence/coherence-fn-inputs.stderr index 8d922c5333c6a..246ec5947b3e4 100644 --- a/tests/ui/coherence/coherence-fn-inputs.stderr +++ b/tests/ui/coherence/coherence-fn-inputs.stderr @@ -1,45 +1,13 @@ error[E0119]: conflicting implementations of trait `Trait` for type `for<'a, 'b> fn(&'a u32, &'b u32)` - --> $DIR/coherence-fn-inputs.rs:16:1 + --> $DIR/coherence-fn-inputs.rs:15:1 | LL | impl Trait for for<'a, 'b> fn(&'a u32, &'b u32) {} | ----------------------------------------------- first implementation here -LL | LL | impl Trait for for<'c> fn(&'c u32, &'c u32) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a u32, &'b u32)` | = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details -error[E0283]: type annotations needed: cannot satisfy `for<'a, 'b> fn(&'a u32, &'b u32): Trait` - --> $DIR/coherence-fn-inputs.rs:14:16 - | -LL | impl Trait for for<'a, 'b> fn(&'a u32, &'b u32) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: multiple `impl`s satisfying `for<'a, 'b> fn(&'a u32, &'b u32): Trait` found - --> $DIR/coherence-fn-inputs.rs:14:1 - | -LL | impl Trait for for<'a, 'b> fn(&'a u32, &'b u32) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | -LL | impl Trait for for<'c> fn(&'c u32, &'c u32) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0283]: type annotations needed: cannot satisfy `for<'c> fn(&'c u32, &'c u32): Trait` - --> $DIR/coherence-fn-inputs.rs:16:16 - | -LL | impl Trait for for<'c> fn(&'c u32, &'c u32) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: multiple `impl`s satisfying `for<'c> fn(&'c u32, &'c u32): Trait` found - --> $DIR/coherence-fn-inputs.rs:14:1 - | -LL | impl Trait for for<'a, 'b> fn(&'a u32, &'b u32) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | -LL | impl Trait for for<'c> fn(&'c u32, &'c u32) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 3 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0119, E0283. -For more information about an error, try `rustc --explain E0119`. +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.rs b/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.rs index 930fb6c28a9e6..db2e2b4509a2a 100644 --- a/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.rs +++ b/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.rs @@ -17,7 +17,6 @@ impl Marker1 for dyn Object + Marker2 {} //~ ERROR E0371 // ...and also a direct component. impl Marker2 for dyn Object + Marker2 {} //~ ERROR E0371 //~^ ERROR E0321 - //~| ERROR type annotations needed // A non-principal trait-object type is orphan even in its crate. unsafe impl Send for dyn Marker2 {} //~ ERROR E0117 diff --git a/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr b/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr index 3ffeb99544318..2a8713bc32794 100644 --- a/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr +++ b/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr @@ -27,7 +27,7 @@ LL | impl Marker2 for dyn Object + Marker2 {} = note: a trait object implements `Marker2` if and only if `Marker2` is one of the trait object's trait bounds error[E0321]: traits with a default impl, like `Marker2`, cannot be implemented for trait object `(dyn Object + 'static)` - --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:27:1 + --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:26:1 | LL | impl Marker2 for dyn Object {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -35,7 +35,7 @@ LL | impl Marker2 for dyn Object {} = note: a trait object implements `Marker2` if and only if `Marker2` is one of the trait object's trait bounds error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:23:1 + --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:22:1 | LL | unsafe impl Send for dyn Marker2 {} | ^^^^^^^^^^^^^^^^^^^^^----------- @@ -46,35 +46,26 @@ LL | unsafe impl Send for dyn Marker2 {} = note: define and implement a trait or new type instead error[E0321]: cross-crate traits with a default impl, like `Send`, can only be implemented for a struct/enum type, not `(dyn Object + 'static)` - --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:28:1 + --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:27:1 | LL | unsafe impl Send for dyn Object {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type error[E0321]: cross-crate traits with a default impl, like `Send`, can only be implemented for a struct/enum type, not `(dyn Object + Marker2 + 'static)` - --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:29:1 + --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:28:1 | LL | unsafe impl Send for dyn Object + Marker2 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type error[E0321]: traits with a default impl, like `Marker3`, cannot be implemented for generic type `T` - --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:33:1 + --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:32:1 | LL | impl Marker3 for T {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: a trait object implements `Marker3` if and only if `Marker3` is one of the trait object's trait bounds -error[E0283]: type annotations needed: cannot satisfy `(dyn Object + Marker2 + 'static): Marker2` - --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:18:18 - | -LL | impl Marker2 for dyn Object + Marker2 {} - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: cannot satisfy `(dyn Object + Marker2 + 'static): Marker2` - = help: the trait `Marker2` is implemented for `(dyn Object + Marker2 + 'static)` - -error: aborting due to 10 previous errors +error: aborting due to 9 previous errors -Some errors have detailed explanations: E0117, E0283, E0321, E0371. +Some errors have detailed explanations: E0117, E0321, E0371. For more information about an error, try `rustc --explain E0117`. diff --git a/tests/ui/coherence/coherence-impls-copy.rs b/tests/ui/coherence/coherence-impls-copy.rs index a2fcbe2e91a91..e24bc03b495aa 100644 --- a/tests/ui/coherence/coherence-impls-copy.rs +++ b/tests/ui/coherence/coherence-impls-copy.rs @@ -4,7 +4,6 @@ use std::marker::Copy; impl Copy for i32 {} //~^ ERROR E0117 -//~| ERROR type annotations needed enum TestE { A } @@ -27,16 +26,13 @@ impl Clone for MyType { fn clone(&self) -> Self { *self } } impl Copy for (MyType, MyType) {} //~^ ERROR E0206 //~| ERROR E0117 -//~| ERROR type annotations needed impl Copy for &'static NotSync {} //~^ ERROR E0119 -//~| ERROR type annotations needed impl Copy for [MyType] {} //~^ ERROR E0206 //~| ERROR E0117 //~| ERROR E0277 impl Copy for &'static [NotSync] {} //~^ ERROR E0117 -//~| ERROR E0283 fn main() { } diff --git a/tests/ui/coherence/coherence-impls-copy.stderr b/tests/ui/coherence/coherence-impls-copy.stderr index 1b4299fc60d1f..0c3ffe9bd0843 100644 --- a/tests/ui/coherence/coherence-impls-copy.stderr +++ b/tests/ui/coherence/coherence-impls-copy.stderr @@ -10,7 +10,7 @@ LL | impl Copy for i32 {} = note: define and implement a trait or new type instead error[E0119]: conflicting implementations of trait `Copy` for type `&NotSync` - --> $DIR/coherence-impls-copy.rs:31:1 + --> $DIR/coherence-impls-copy.rs:29:1 | LL | impl Copy for &'static NotSync {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -20,7 +20,7 @@ LL | impl Copy for &'static NotSync {} where T: ?Sized; error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-copy.rs:38:1 + --> $DIR/coherence-impls-copy.rs:35:1 | LL | impl Copy for &'static [NotSync] {} | ^^^^^^^^^^^^^^------------------ @@ -31,7 +31,7 @@ LL | impl Copy for &'static [NotSync] {} = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-copy.rs:27:1 + --> $DIR/coherence-impls-copy.rs:26:1 | LL | impl Copy for (MyType, MyType) {} | ^^^^^^^^^^^^^^---------------- @@ -42,7 +42,7 @@ LL | impl Copy for (MyType, MyType) {} = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-copy.rs:34:1 + --> $DIR/coherence-impls-copy.rs:31:1 | LL | impl Copy for [MyType] {} | ^^^^^^^^^^^^^^-------- @@ -53,38 +53,25 @@ LL | impl Copy for [MyType] {} = note: define and implement a trait or new type instead error[E0206]: the trait `Copy` cannot be implemented for this type - --> $DIR/coherence-impls-copy.rs:22:15 + --> $DIR/coherence-impls-copy.rs:21:15 | LL | impl Copy for &'static mut MyType {} | ^^^^^^^^^^^^^^^^^^^ type is not a structure or enumeration error[E0206]: the trait `Copy` cannot be implemented for this type - --> $DIR/coherence-impls-copy.rs:27:15 + --> $DIR/coherence-impls-copy.rs:26:15 | LL | impl Copy for (MyType, MyType) {} | ^^^^^^^^^^^^^^^^ type is not a structure or enumeration error[E0206]: the trait `Copy` cannot be implemented for this type - --> $DIR/coherence-impls-copy.rs:34:15 + --> $DIR/coherence-impls-copy.rs:31:15 | LL | impl Copy for [MyType] {} | ^^^^^^^^ type is not a structure or enumeration -error[E0283]: type annotations needed: cannot satisfy `i32: Copy` - --> $DIR/coherence-impls-copy.rs:5:15 - | -LL | impl Copy for i32 {} - | ^^^ - | -note: multiple `impl`s satisfying `i32: Copy` found - --> $DIR/coherence-impls-copy.rs:5:1 - | -LL | impl Copy for i32 {} - | ^^^^^^^^^^^^^^^^^ - = note: and another `impl` found in the `core` crate: `impl Copy for i32;` - error[E0277]: the trait bound `&'static mut MyType: Clone` is not satisfied - --> $DIR/coherence-impls-copy.rs:22:15 + --> $DIR/coherence-impls-copy.rs:21:15 | LL | impl Copy for &'static mut MyType {} | ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `&'static mut MyType` @@ -93,32 +80,8 @@ LL | impl Copy for &'static mut MyType {} note: required by a bound in `Copy` --> $SRC_DIR/core/src/marker.rs:LL:COL -error[E0283]: type annotations needed: cannot satisfy `(MyType, MyType): Copy` - --> $DIR/coherence-impls-copy.rs:27:15 - | -LL | impl Copy for (MyType, MyType) {} - | ^^^^^^^^^^^^^^^^ - | - = note: cannot satisfy `(MyType, MyType): Copy` - = help: the trait `Copy` is implemented for `(MyType, MyType)` - -error[E0283]: type annotations needed: cannot satisfy `&'static NotSync: Copy` - --> $DIR/coherence-impls-copy.rs:31:15 - | -LL | impl Copy for &'static NotSync {} - | ^^^^^^^^^^^^^^^^ - | -note: multiple `impl`s satisfying `&'static NotSync: Copy` found - --> $DIR/coherence-impls-copy.rs:31:1 - | -LL | impl Copy for &'static NotSync {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: and another `impl` found in the `core` crate: - - impl Copy for &T - where T: ?Sized; - error[E0277]: the trait bound `[MyType]: Clone` is not satisfied - --> $DIR/coherence-impls-copy.rs:34:15 + --> $DIR/coherence-impls-copy.rs:31:15 | LL | impl Copy for [MyType] {} | ^^^^^^^^ the trait `Clone` is not implemented for `[MyType]` @@ -127,22 +90,7 @@ LL | impl Copy for [MyType] {} note: required by a bound in `Copy` --> $SRC_DIR/core/src/marker.rs:LL:COL -error[E0283]: type annotations needed: cannot satisfy `&'static [NotSync]: Copy` - --> $DIR/coherence-impls-copy.rs:38:15 - | -LL | impl Copy for &'static [NotSync] {} - | ^^^^^^^^^^^^^^^^^^ - | -note: multiple `impl`s satisfying `&'static [NotSync]: Copy` found - --> $DIR/coherence-impls-copy.rs:38:1 - | -LL | impl Copy for &'static [NotSync] {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: and another `impl` found in the `core` crate: - - impl Copy for &T - where T: ?Sized; - -error: aborting due to 14 previous errors +error: aborting due to 10 previous errors -Some errors have detailed explanations: E0117, E0119, E0206, E0277, E0283. +Some errors have detailed explanations: E0117, E0119, E0206, E0277. For more information about an error, try `rustc --explain E0117`. diff --git a/tests/ui/coherence/coherence-no-direct-lifetime-dispatch.rs b/tests/ui/coherence/coherence-no-direct-lifetime-dispatch.rs index dc13d838b86bb..5f998f09f071e 100644 --- a/tests/ui/coherence/coherence-no-direct-lifetime-dispatch.rs +++ b/tests/ui/coherence/coherence-no-direct-lifetime-dispatch.rs @@ -3,9 +3,6 @@ trait MyTrait { fn foo() {} } impl MyTrait for T {} -//~^ ERROR type annotations needed impl MyTrait for T {} //~^ ERROR E0119 -//~| ERROR type annotations needed - fn main() {} diff --git a/tests/ui/coherence/coherence-no-direct-lifetime-dispatch.stderr b/tests/ui/coherence/coherence-no-direct-lifetime-dispatch.stderr index b8e708974a6d8..ca8d7a5c4c3b2 100644 --- a/tests/ui/coherence/coherence-no-direct-lifetime-dispatch.stderr +++ b/tests/ui/coherence/coherence-no-direct-lifetime-dispatch.stderr @@ -1,43 +1,11 @@ error[E0119]: conflicting implementations of trait `MyTrait` - --> $DIR/coherence-no-direct-lifetime-dispatch.rs:7:1 + --> $DIR/coherence-no-direct-lifetime-dispatch.rs:6:1 | LL | impl MyTrait for T {} | --------------------- first implementation here -LL | LL | impl MyTrait for T {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation -error[E0283]: type annotations needed: cannot satisfy `T: MyTrait` - --> $DIR/coherence-no-direct-lifetime-dispatch.rs:5:21 - | -LL | impl MyTrait for T {} - | ^ - | -note: multiple `impl`s satisfying `T: MyTrait` found - --> $DIR/coherence-no-direct-lifetime-dispatch.rs:5:1 - | -LL | impl MyTrait for T {} - | ^^^^^^^^^^^^^^^^^^^^^ -LL | -LL | impl MyTrait for T {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0283]: type annotations needed: cannot satisfy `T: MyTrait` - --> $DIR/coherence-no-direct-lifetime-dispatch.rs:7:30 - | -LL | impl MyTrait for T {} - | ^ - | -note: multiple `impl`s satisfying `T: MyTrait` found - --> $DIR/coherence-no-direct-lifetime-dispatch.rs:5:1 - | -LL | impl MyTrait for T {} - | ^^^^^^^^^^^^^^^^^^^^^ -LL | -LL | impl MyTrait for T {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 3 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0119, E0283. -For more information about an error, try `rustc --explain E0119`. +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/coherence-overlap-messages.rs b/tests/ui/coherence/coherence-overlap-messages.rs index 2a14c2aba135b..1258a2371142f 100644 --- a/tests/ui/coherence/coherence-overlap-messages.rs +++ b/tests/ui/coherence/coherence-overlap-messages.rs @@ -1,10 +1,8 @@ trait Foo { fn foo() {} } impl Foo for T {} -//~^ ERROR E0283 impl Foo for U {} //~^ ERROR E0119 -//~| ERROR E0283 trait Bar { fn bar() {} } @@ -24,9 +22,7 @@ trait Quux { fn quux() {} } impl Quux for T {} impl Quux for T {} //~^ ERROR E0119 -//~| ERROR E0283 impl Quux for T {} //~^ ERROR E0119 -//~| ERROR E0283 fn main() {} diff --git a/tests/ui/coherence/coherence-overlap-messages.stderr b/tests/ui/coherence/coherence-overlap-messages.stderr index d1ce614f7718b..5a97296eebd9b 100644 --- a/tests/ui/coherence/coherence-overlap-messages.stderr +++ b/tests/ui/coherence/coherence-overlap-messages.stderr @@ -1,14 +1,13 @@ error[E0119]: conflicting implementations of trait `Foo` - --> $DIR/coherence-overlap-messages.rs:5:1 + --> $DIR/coherence-overlap-messages.rs:4:1 | LL | impl Foo for T {} | ----------------- first implementation here -LL | LL | impl Foo for U {} | ^^^^^^^^^^^^^^^^^ conflicting implementation error[E0119]: conflicting implementations of trait `Bar` for type `(u8, u8)` - --> $DIR/coherence-overlap-messages.rs:13:1 + --> $DIR/coherence-overlap-messages.rs:11:1 | LL | impl Bar for (T, u8) {} | ----------------------- first implementation here @@ -16,7 +15,7 @@ LL | impl Bar for (u8, T) {} | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(u8, u8)` error[E0119]: conflicting implementations of trait `Baz` for type `u8` - --> $DIR/coherence-overlap-messages.rs:19:1 + --> $DIR/coherence-overlap-messages.rs:17:1 | LL | impl Baz for T {} | --------------------- first implementation here @@ -24,7 +23,7 @@ LL | impl Baz for u8 {} | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u8` error[E0119]: conflicting implementations of trait `Quux<_, _>` - --> $DIR/coherence-overlap-messages.rs:25:1 + --> $DIR/coherence-overlap-messages.rs:23:1 | LL | impl Quux for T {} | ------------------------------ first implementation here @@ -32,7 +31,7 @@ LL | impl Quux for T {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation error[E0119]: conflicting implementations of trait `Quux<_, _>` - --> $DIR/coherence-overlap-messages.rs:28:1 + --> $DIR/coherence-overlap-messages.rs:25:1 | LL | impl Quux for T {} | ------------------------------ first implementation here @@ -40,66 +39,6 @@ LL | impl Quux for T {} LL | impl Quux for T {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation -error[E0283]: type annotations needed: cannot satisfy `T: Foo` - --> $DIR/coherence-overlap-messages.rs:3:17 - | -LL | impl Foo for T {} - | ^ - | -note: multiple `impl`s satisfying `T: Foo` found - --> $DIR/coherence-overlap-messages.rs:3:1 - | -LL | impl Foo for T {} - | ^^^^^^^^^^^^^^^^^ -LL | -LL | impl Foo for U {} - | ^^^^^^^^^^^^^^^^^ - -error[E0283]: type annotations needed: cannot satisfy `U: Foo` - --> $DIR/coherence-overlap-messages.rs:5:17 - | -LL | impl Foo for U {} - | ^ - | -note: multiple `impl`s satisfying `U: Foo` found - --> $DIR/coherence-overlap-messages.rs:3:1 - | -LL | impl Foo for T {} - | ^^^^^^^^^^^^^^^^^ -LL | -LL | impl Foo for U {} - | ^^^^^^^^^^^^^^^^^ - -error[E0283]: type annotations needed: cannot satisfy `T: Quux` - --> $DIR/coherence-overlap-messages.rs:25:27 - | -LL | impl Quux for T {} - | ^ - | -note: multiple `impl`s satisfying `T: Quux` found - --> $DIR/coherence-overlap-messages.rs:24:1 - | -LL | impl Quux for T {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | impl Quux for T {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0283]: type annotations needed: cannot satisfy `T: Quux` - --> $DIR/coherence-overlap-messages.rs:28:27 - | -LL | impl Quux for T {} - | ^ - | -note: multiple `impl`s satisfying `T: Quux` found - --> $DIR/coherence-overlap-messages.rs:24:1 - | -LL | impl Quux for T {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -... -LL | impl Quux for T {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 9 previous errors +error: aborting due to 5 previous errors -Some errors have detailed explanations: E0119, E0283. -For more information about an error, try `rustc --explain E0119`. +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/coherence-overlap-trait-alias.rs b/tests/ui/coherence/coherence-overlap-trait-alias.rs index 25794871a74d2..d42a666c54f7a 100644 --- a/tests/ui/coherence/coherence-overlap-trait-alias.rs +++ b/tests/ui/coherence/coherence-overlap-trait-alias.rs @@ -14,6 +14,5 @@ trait C {} impl C for T {} impl C for u32 {} //~^ ERROR conflicting implementations of trait `C` for type `u32` -//~| ERROR type annotations needed fn main() {} diff --git a/tests/ui/coherence/coherence-overlap-trait-alias.stderr b/tests/ui/coherence/coherence-overlap-trait-alias.stderr index 5c5381b4056af..4f277ad68a67d 100644 --- a/tests/ui/coherence/coherence-overlap-trait-alias.stderr +++ b/tests/ui/coherence/coherence-overlap-trait-alias.stderr @@ -6,21 +6,6 @@ LL | impl C for T {} LL | impl C for u32 {} | ^^^^^^^^^^^^^^ conflicting implementation for `u32` -error[E0283]: type annotations needed: cannot satisfy `u32: C` - --> $DIR/coherence-overlap-trait-alias.rs:15:12 - | -LL | impl C for u32 {} - | ^^^ - | -note: multiple `impl`s satisfying `u32: C` found - --> $DIR/coherence-overlap-trait-alias.rs:14:1 - | -LL | impl C for T {} - | ^^^^^^^^^^^^^^^^^^^ -LL | impl C for u32 {} - | ^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0119, E0283. -For more information about an error, try `rustc --explain E0119`. +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/coherence-projection-conflict-ty-param.rs b/tests/ui/coherence/coherence-projection-conflict-ty-param.rs index c3056d1e767ca..3e4141fa8cb1e 100644 --- a/tests/ui/coherence/coherence-projection-conflict-ty-param.rs +++ b/tests/ui/coherence/coherence-projection-conflict-ty-param.rs @@ -6,7 +6,6 @@ use std::marker::PhantomData; pub trait Foo

{ fn foo() {} } impl > Foo

for Option {} -//~^ ERROR type annotations needed impl Foo for Option { } //~^ ERROR E0119 diff --git a/tests/ui/coherence/coherence-projection-conflict-ty-param.stderr b/tests/ui/coherence/coherence-projection-conflict-ty-param.stderr index 2d54a6c1bef0f..f074467bbaa75 100644 --- a/tests/ui/coherence/coherence-projection-conflict-ty-param.stderr +++ b/tests/ui/coherence/coherence-projection-conflict-ty-param.stderr @@ -1,28 +1,12 @@ error[E0119]: conflicting implementations of trait `Foo<_>` for type `Option<_>` - --> $DIR/coherence-projection-conflict-ty-param.rs:11:1 + --> $DIR/coherence-projection-conflict-ty-param.rs:10:1 | LL | impl > Foo

for Option {} | ---------------------------------------- first implementation here -... +LL | LL | impl Foo for Option { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Option<_>` -error[E0283]: type annotations needed: cannot satisfy `Option: Foo

` - --> $DIR/coherence-projection-conflict-ty-param.rs:8:32 - | -LL | impl > Foo

for Option {} - | ^^^^^^^^^ - | -note: multiple `impl`s satisfying `Option: Foo

` found - --> $DIR/coherence-projection-conflict-ty-param.rs:8:1 - | -LL | impl > Foo

for Option {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -... -LL | impl Foo for Option { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0119, E0283. -For more information about an error, try `rustc --explain E0119`. +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/coherence-projection-conflict.rs b/tests/ui/coherence/coherence-projection-conflict.rs index 8e06c799f44cc..daab2a2f8b403 100644 --- a/tests/ui/coherence/coherence-projection-conflict.rs +++ b/tests/ui/coherence/coherence-projection-conflict.rs @@ -7,7 +7,6 @@ pub trait Bar { } impl Foo for i32 { } -//~^ ERROR type annotations needed impl Foo for A { } //~^ ERROR E0119 diff --git a/tests/ui/coherence/coherence-projection-conflict.stderr b/tests/ui/coherence/coherence-projection-conflict.stderr index 5c9403e6e4e03..c916091e62db2 100644 --- a/tests/ui/coherence/coherence-projection-conflict.stderr +++ b/tests/ui/coherence/coherence-projection-conflict.stderr @@ -1,28 +1,12 @@ error[E0119]: conflicting implementations of trait `Foo` for type `i32` - --> $DIR/coherence-projection-conflict.rs:12:1 + --> $DIR/coherence-projection-conflict.rs:11:1 | LL | impl Foo for i32 { } | --------------------- first implementation here -... +LL | LL | impl Foo for A { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` -error[E0283]: type annotations needed: cannot satisfy `i32: Foo` - --> $DIR/coherence-projection-conflict.rs:9:19 - | -LL | impl Foo for i32 { } - | ^^^ - | -note: multiple `impl`s satisfying `i32: Foo` found - --> $DIR/coherence-projection-conflict.rs:9:1 - | -LL | impl Foo for i32 { } - | ^^^^^^^^^^^^^^^^^^^^^ -... -LL | impl Foo for A { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0119, E0283. -For more information about an error, try `rustc --explain E0119`. +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/coherence-tuple-conflict.rs b/tests/ui/coherence/coherence-tuple-conflict.rs index f17e3de339bd3..8cc829726681f 100644 --- a/tests/ui/coherence/coherence-tuple-conflict.rs +++ b/tests/ui/coherence/coherence-tuple-conflict.rs @@ -8,7 +8,7 @@ trait MyTrait { fn get(&self) -> usize; } -impl MyTrait for (T,T) { //~ ERROR: type annotations needed +impl MyTrait for (T,T) { fn get(&self) -> usize { 0 } } diff --git a/tests/ui/coherence/coherence-tuple-conflict.stderr b/tests/ui/coherence/coherence-tuple-conflict.stderr index 4f81575e964b0..4e02c0eb43c7c 100644 --- a/tests/ui/coherence/coherence-tuple-conflict.stderr +++ b/tests/ui/coherence/coherence-tuple-conflict.stderr @@ -7,22 +7,6 @@ LL | impl MyTrait for (T,T) { LL | impl MyTrait for (A,B) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_, _)` -error[E0283]: type annotations needed: cannot satisfy `(T, T): MyTrait` - --> $DIR/coherence-tuple-conflict.rs:11:21 - | -LL | impl MyTrait for (T,T) { - | ^^^^^ - | -note: multiple `impl`s satisfying `(T, T): MyTrait` found - --> $DIR/coherence-tuple-conflict.rs:11:1 - | -LL | impl MyTrait for (T,T) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ -... -LL | impl MyTrait for (A,B) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0119, E0283. -For more information about an error, try `rustc --explain E0119`. +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/coherence-with-closure.rs b/tests/ui/coherence/coherence-with-closure.rs index 4e184ff990cad..5b6a62b24d4b3 100644 --- a/tests/ui/coherence/coherence-with-closure.rs +++ b/tests/ui/coherence/coherence-with-closure.rs @@ -8,7 +8,6 @@ fn defining_use() -> OpaqueClosure { struct Wrapper(T); trait Trait {} impl Trait for Wrapper {} -//~^ ERROR: type annotations needed impl Trait for Wrapper {} //~^ ERROR conflicting implementations of trait `Trait` for type `Wrapper` diff --git a/tests/ui/coherence/coherence-with-closure.stderr b/tests/ui/coherence/coherence-with-closure.stderr index cadac05dddce9..501279ffe6a72 100644 --- a/tests/ui/coherence/coherence-with-closure.stderr +++ b/tests/ui/coherence/coherence-with-closure.stderr @@ -1,28 +1,11 @@ error[E0119]: conflicting implementations of trait `Trait` for type `Wrapper` - --> $DIR/coherence-with-closure.rs:12:1 + --> $DIR/coherence-with-closure.rs:11:1 | LL | impl Trait for Wrapper {} | ------------------------------------- first implementation here -LL | LL | impl Trait for Wrapper {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Wrapper` -error[E0283]: type annotations needed: cannot satisfy `Wrapper: Trait` - --> $DIR/coherence-with-closure.rs:10:16 - | -LL | impl Trait for Wrapper {} - | ^^^^^^^^^^^^^^^^^^^^^^ - | -note: multiple `impl`s satisfying `Wrapper: Trait` found - --> $DIR/coherence-with-closure.rs:10:1 - | -LL | impl Trait for Wrapper {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | -LL | impl Trait for Wrapper {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0119, E0283. -For more information about an error, try `rustc --explain E0119`. +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/coherence-with-coroutine.rs b/tests/ui/coherence/coherence-with-coroutine.rs index dafbd9cc0cd34..21857d7fe66ee 100644 --- a/tests/ui/coherence/coherence-with-coroutine.rs +++ b/tests/ui/coherence/coherence-with-coroutine.rs @@ -18,7 +18,6 @@ fn defining_use() -> OpaqueCoroutine { struct Wrapper(T); trait Trait {} impl Trait for Wrapper {} -//[stock]~^ ERROR type annotations needed impl Trait for Wrapper {} //[stock]~^ ERROR conflicting implementations of trait `Trait` for type `Wrapper` diff --git a/tests/ui/coherence/coherence-with-coroutine.stock.stderr b/tests/ui/coherence/coherence-with-coroutine.stock.stderr index 85fb9361905e2..9cf20ea493649 100644 --- a/tests/ui/coherence/coherence-with-coroutine.stock.stderr +++ b/tests/ui/coherence/coherence-with-coroutine.stock.stderr @@ -1,28 +1,11 @@ error[E0119]: conflicting implementations of trait `Trait` for type `Wrapper` - --> $DIR/coherence-with-coroutine.rs:22:1 + --> $DIR/coherence-with-coroutine.rs:21:1 | LL | impl Trait for Wrapper {} | --------------------------------------- first implementation here -LL | LL | impl Trait for Wrapper {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Wrapper` -error[E0283]: type annotations needed: cannot satisfy `Wrapper: Trait` - --> $DIR/coherence-with-coroutine.rs:20:16 - | -LL | impl Trait for Wrapper {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: multiple `impl`s satisfying `Wrapper: Trait` found - --> $DIR/coherence-with-coroutine.rs:20:1 - | -LL | impl Trait for Wrapper {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | -LL | impl Trait for Wrapper {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0119, E0283. -For more information about an error, try `rustc --explain E0119`. +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/error-codes/E0119.rs b/tests/ui/error-codes/E0119.rs index 8b30621cc2d64..7f89e5a1a52df 100644 --- a/tests/ui/error-codes/E0119.rs +++ b/tests/ui/error-codes/E0119.rs @@ -11,7 +11,6 @@ struct Foo { } impl MyTrait for Foo { //~ ERROR E0119 - //~^ ERROR type annotations needed fn get(&self) -> usize { self.value } } diff --git a/tests/ui/error-codes/E0119.stderr b/tests/ui/error-codes/E0119.stderr index bc61940a2a4d2..838dba081b9ed 100644 --- a/tests/ui/error-codes/E0119.stderr +++ b/tests/ui/error-codes/E0119.stderr @@ -7,22 +7,6 @@ LL | impl MyTrait for T { LL | impl MyTrait for Foo { | ^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Foo` -error[E0283]: type annotations needed: cannot satisfy `Foo: MyTrait` - --> $DIR/E0119.rs:13:18 - | -LL | impl MyTrait for Foo { - | ^^^ - | -note: multiple `impl`s satisfying `Foo: MyTrait` found - --> $DIR/E0119.rs:5:1 - | -LL | impl MyTrait for T { - | ^^^^^^^^^^^^^^^^^^^^^ -... -LL | impl MyTrait for Foo { - | ^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0119, E0283. -For more information about an error, try `rustc --explain E0119`. +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/error-codes/E0476.next.stderr b/tests/ui/error-codes/E0476.next.stderr index 92eaa2f73b37d..454dbecc7d01f 100644 --- a/tests/ui/error-codes/E0476.next.stderr +++ b/tests/ui/error-codes/E0476.next.stderr @@ -25,22 +25,7 @@ note: source pointer is only valid for the lifetime `'b` as defined here LL | impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper> for &'b Wrapper where S: Unsize {} | ^^ -error[E0283]: type annotations needed: cannot satisfy `&'b Wrapper: CoerceUnsized<&'a Wrapper>` - --> $DIR/E0476.rs:11:54 - | -LL | impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper> for &'b Wrapper where S: Unsize {} - | ^^^^^^^^^^^^^^ - | -note: multiple `impl`s satisfying `&'b Wrapper: CoerceUnsized<&'a Wrapper>` found - --> $DIR/E0476.rs:11:1 - | -LL | impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper> for &'b Wrapper where S: Unsize {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: and another `impl` found in the `core` crate: - - impl<'a, 'b, T, U> CoerceUnsized<&'a U> for &'b T - where 'b: 'a, T: Unsize, T: ?Sized, U: ?Sized; - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0119, E0283, E0476. +Some errors have detailed explanations: E0119, E0476. For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/error-codes/E0476.old.stderr b/tests/ui/error-codes/E0476.old.stderr index 92eaa2f73b37d..454dbecc7d01f 100644 --- a/tests/ui/error-codes/E0476.old.stderr +++ b/tests/ui/error-codes/E0476.old.stderr @@ -25,22 +25,7 @@ note: source pointer is only valid for the lifetime `'b` as defined here LL | impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper> for &'b Wrapper where S: Unsize {} | ^^ -error[E0283]: type annotations needed: cannot satisfy `&'b Wrapper: CoerceUnsized<&'a Wrapper>` - --> $DIR/E0476.rs:11:54 - | -LL | impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper> for &'b Wrapper where S: Unsize {} - | ^^^^^^^^^^^^^^ - | -note: multiple `impl`s satisfying `&'b Wrapper: CoerceUnsized<&'a Wrapper>` found - --> $DIR/E0476.rs:11:1 - | -LL | impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper> for &'b Wrapper where S: Unsize {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: and another `impl` found in the `core` crate: - - impl<'a, 'b, T, U> CoerceUnsized<&'a U> for &'b T - where 'b: 'a, T: Unsize, T: ?Sized, U: ?Sized; - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0119, E0283, E0476. +Some errors have detailed explanations: E0119, E0476. For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/error-codes/E0476.rs b/tests/ui/error-codes/E0476.rs index 941cedbe78b0c..d87916198c564 100644 --- a/tests/ui/error-codes/E0476.rs +++ b/tests/ui/error-codes/E0476.rs @@ -11,6 +11,5 @@ struct Wrapper(T); impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper> for &'b Wrapper where S: Unsize {} //~^ ERROR lifetime of the source pointer does not outlive lifetime bound of the object type [E0476] //~^^ ERROR E0119 -//~| ERROR type annotations needed fn main() {} diff --git a/tests/ui/error-codes/e0119/conflict-with-std.rs b/tests/ui/error-codes/e0119/conflict-with-std.rs index 2896497d31875..c0fb19c6a729c 100644 --- a/tests/ui/error-codes/e0119/conflict-with-std.rs +++ b/tests/ui/error-codes/e0119/conflict-with-std.rs @@ -3,7 +3,6 @@ use std::convert::{TryFrom, AsRef}; struct Q; impl AsRef for Box { //~ ERROR conflicting implementations - //~^ ERROR type annotations needed fn as_ref(&self) -> &Q { &**self } @@ -11,7 +10,6 @@ impl AsRef for Box { //~ ERROR conflicting implementations struct S; impl From for S { //~ ERROR conflicting implementations - //~^ ERROR type annotations needed fn from(s: S) -> S { s } @@ -19,7 +17,6 @@ impl From for S { //~ ERROR conflicting implementations struct X; impl TryFrom for X { //~ ERROR conflicting implementations - //~^ ERROR type annotations needed type Error = (); //~ ERROR type annotations needed fn try_from(u: X) -> Result { //~ ERROR type annotations needed Ok(u) diff --git a/tests/ui/error-codes/e0119/conflict-with-std.stderr b/tests/ui/error-codes/e0119/conflict-with-std.stderr index 8a37c44824b3a..0917ba597d684 100644 --- a/tests/ui/error-codes/e0119/conflict-with-std.stderr +++ b/tests/ui/error-codes/e0119/conflict-with-std.stderr @@ -9,7 +9,7 @@ LL | impl AsRef for Box { where A: Allocator, T: ?Sized; error[E0119]: conflicting implementations of trait `From` for type `S` - --> $DIR/conflict-with-std.rs:13:1 + --> $DIR/conflict-with-std.rs:12:1 | LL | impl From for S { | ^^^^^^^^^^^^^^^^^^ @@ -18,7 +18,7 @@ LL | impl From for S { - impl From for T; error[E0119]: conflicting implementations of trait `TryFrom` for type `X` - --> $DIR/conflict-with-std.rs:21:1 + --> $DIR/conflict-with-std.rs:19:1 | LL | impl TryFrom for X { | ^^^^^^^^^^^^^^^^^^^^^ @@ -27,51 +27,8 @@ LL | impl TryFrom for X { - impl TryFrom for T where U: Into; -error[E0283]: type annotations needed: cannot satisfy `Box: AsRef` - --> $DIR/conflict-with-std.rs:5:19 - | -LL | impl AsRef for Box { - | ^^^^^^ - | -note: multiple `impl`s satisfying `Box: AsRef` found - --> $DIR/conflict-with-std.rs:5:1 - | -LL | impl AsRef for Box { - | ^^^^^^^^^^^^^^^^^^^^^^^^ - = note: and another `impl` found in the `alloc` crate: - - impl AsRef for Box - where A: Allocator, T: ?Sized; - -error[E0283]: type annotations needed: cannot satisfy `S: From` - --> $DIR/conflict-with-std.rs:13:18 - | -LL | impl From for S { - | ^ - | -note: multiple `impl`s satisfying `S: From` found - --> $DIR/conflict-with-std.rs:13:1 - | -LL | impl From for S { - | ^^^^^^^^^^^^^^^^^^ - = note: and another `impl` found in the `core` crate: `impl From for T;` - -error[E0283]: type annotations needed: cannot satisfy `X: TryFrom` - --> $DIR/conflict-with-std.rs:21:21 - | -LL | impl TryFrom for X { - | ^ - | -note: multiple `impl`s satisfying `X: TryFrom` found - --> $DIR/conflict-with-std.rs:21:1 - | -LL | impl TryFrom for X { - | ^^^^^^^^^^^^^^^^^^^^^ - = note: and another `impl` found in the `core` crate: - - impl TryFrom for T - where U: Into; - error[E0284]: type annotations needed - --> $DIR/conflict-with-std.rs:23:18 + --> $DIR/conflict-with-std.rs:20:18 | LL | type Error = (); | ^^ cannot infer type @@ -79,12 +36,12 @@ LL | type Error = (); = note: cannot satisfy `>::Error == _` error[E0284]: type annotations needed: cannot satisfy `>::Error == ()` - --> $DIR/conflict-with-std.rs:24:5 + --> $DIR/conflict-with-std.rs:21:5 | LL | fn try_from(u: X) -> Result { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `>::Error == ()` -error: aborting due to 8 previous errors +error: aborting due to 5 previous errors -Some errors have detailed explanations: E0119, E0283, E0284. +Some errors have detailed explanations: E0119, E0284. For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/errors/issue-99572-impl-trait-on-pointer.rs b/tests/ui/errors/issue-99572-impl-trait-on-pointer.rs index 4194d036e20f2..272c6bd3fb782 100644 --- a/tests/ui/errors/issue-99572-impl-trait-on-pointer.rs +++ b/tests/ui/errors/issue-99572-impl-trait-on-pointer.rs @@ -20,9 +20,6 @@ impl marker::Copy for *mut T { //~| NOTE impl doesn't use only types from inside the current crate //~| NOTE `*mut T` is not defined in the current crate because raw pointers are always foreign //~| NOTE define and implement a trait or new type instead -//~| ERROR type annotations needed -//~| NOTE: multiple `impl`s satisfying -//~| NOTE: and another `impl` found in the `core` crate } fn main() {} diff --git a/tests/ui/errors/issue-99572-impl-trait-on-pointer.stderr b/tests/ui/errors/issue-99572-impl-trait-on-pointer.stderr index 5cae253764541..78d7a47deaac3 100644 --- a/tests/ui/errors/issue-99572-impl-trait-on-pointer.stderr +++ b/tests/ui/errors/issue-99572-impl-trait-on-pointer.stderr @@ -26,22 +26,6 @@ LL | impl marker::Copy for *mut T { | = note: define and implement a trait or new type instead -error[E0283]: type annotations needed: cannot satisfy `*mut T: Copy` - --> $DIR/issue-99572-impl-trait-on-pointer.rs:18:26 - | -LL | impl marker::Copy for *mut T { - | ^^^^^^ - | -note: multiple `impl`s satisfying `*mut T: Copy` found - --> $DIR/issue-99572-impl-trait-on-pointer.rs:18:1 - | -LL | impl marker::Copy for *mut T { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: and another `impl` found in the `core` crate: - - impl Copy for *mut T - where T: ?Sized; - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0117, E0283. -For more information about an error, try `rustc --explain E0117`. +For more information about this error, try `rustc --explain E0117`. diff --git a/tests/ui/impl-trait/auto-trait-coherence.old.stderr b/tests/ui/impl-trait/auto-trait-coherence.old.stderr index ffb62d3fcce1a..3f979d1a50b33 100644 --- a/tests/ui/impl-trait/auto-trait-coherence.old.stderr +++ b/tests/ui/impl-trait/auto-trait-coherence.old.stderr @@ -7,22 +7,6 @@ LL | impl AnotherTrait for T {} LL | impl AnotherTrait for D { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D` -error[E0283]: type annotations needed: cannot satisfy `D: AnotherTrait` - --> $DIR/auto-trait-coherence.rs:24:23 - | -LL | impl AnotherTrait for D { - | ^^^^^^^^^^^^^ - | -note: multiple `impl`s satisfying `D: AnotherTrait` found - --> $DIR/auto-trait-coherence.rs:19:1 - | -LL | impl AnotherTrait for T {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -... -LL | impl AnotherTrait for D { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0119, E0283. -For more information about an error, try `rustc --explain E0119`. +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/impl-trait/auto-trait-coherence.rs b/tests/ui/impl-trait/auto-trait-coherence.rs index e7aa5f299b347..e4226b2007483 100644 --- a/tests/ui/impl-trait/auto-trait-coherence.rs +++ b/tests/ui/impl-trait/auto-trait-coherence.rs @@ -23,7 +23,6 @@ impl AnotherTrait for T {} // in the future.) impl AnotherTrait for D { //~^ ERROR conflicting implementations of trait `AnotherTrait` for type `D` - //[old]~^^ ERROR type annotations needed } fn main() {} diff --git a/tests/ui/issues/issue-106755.rs b/tests/ui/issues/issue-106755.rs index b2ff12b6d7a1e..5eabc3bfb1384 100644 --- a/tests/ui/issues/issue-106755.rs +++ b/tests/ui/issues/issue-106755.rs @@ -9,7 +9,6 @@ trait MyTrait {} struct TestType(::std::marker::PhantomData); unsafe impl Send for TestType {} -//~^ ERROR: type annotations needed impl !Send for TestType {} //~ ERROR found both positive and negative implementation diff --git a/tests/ui/issues/issue-106755.stderr b/tests/ui/issues/issue-106755.stderr index 534d772d9e7e6..6b3a8427e7738 100644 --- a/tests/ui/issues/issue-106755.stderr +++ b/tests/ui/issues/issue-106755.stderr @@ -1,14 +1,14 @@ error[E0751]: found both positive and negative implementation of trait `Send` for type `TestType<_>`: - --> $DIR/issue-106755.rs:14:1 + --> $DIR/issue-106755.rs:13:1 | LL | unsafe impl Send for TestType {} | ------------------------------------------------------ positive implementation here -... +LL | LL | impl !Send for TestType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ negative implementation here error[E0119]: conflicting implementations of trait `Send` for type `TestType<_>` - --> $DIR/issue-106755.rs:16:1 + --> $DIR/issue-106755.rs:15:1 | LL | unsafe impl Send for TestType {} | ------------------------------------------------------ first implementation here @@ -17,7 +17,7 @@ LL | unsafe impl Send for TestType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>` warning: cross-crate traits with a default impl, like `Send`, should not be specialized - --> $DIR/issue-106755.rs:18:1 + --> $DIR/issue-106755.rs:17:1 | LL | impl !Send for TestType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -32,25 +32,7 @@ LL | struct TestType(::std::marker::PhantomData); | ^^^^^^^^^^^^^^^^^^ = note: `#[warn(suspicious_auto_trait_impls)]` on by default -error[E0283]: type annotations needed: cannot satisfy `TestType: Send` - --> $DIR/issue-106755.rs:11:44 - | -LL | unsafe impl Send for TestType {} - | ^^^^^^^^^^^ - | -note: multiple `impl`s satisfying `TestType: Send` found - --> $DIR/issue-106755.rs:11:1 - | -LL | unsafe impl Send for TestType {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -... -LL | impl !Send for TestType {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | -LL | unsafe impl Send for TestType {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 2 previous errors; 1 warning emitted -Some errors have detailed explanations: E0119, E0283, E0751. +Some errors have detailed explanations: E0119, E0751. For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/issues/issue-28568.rs b/tests/ui/issues/issue-28568.rs index a93119fa602f3..010186cce4522 100644 --- a/tests/ui/issues/issue-28568.rs +++ b/tests/ui/issues/issue-28568.rs @@ -1,14 +1,12 @@ struct MyStruct; impl Drop for MyStruct { -//~^ ERROR: type annotations needed - fn drop(&mut self) { } + fn drop(&mut self) {} } impl Drop for MyStruct { -//~^ ERROR conflicting implementations of trait -//~| ERROR: type annotations needed - fn drop(&mut self) { } + //~^ ERROR conflicting implementations of trait + fn drop(&mut self) {} } fn main() {} diff --git a/tests/ui/issues/issue-28568.stderr b/tests/ui/issues/issue-28568.stderr index 399ff38cdec23..c8db0403e59a2 100644 --- a/tests/ui/issues/issue-28568.stderr +++ b/tests/ui/issues/issue-28568.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `Drop` for type `MyStruct` - --> $DIR/issue-28568.rs:8:1 + --> $DIR/issue-28568.rs:7:1 | LL | impl Drop for MyStruct { | ---------------------- first implementation here @@ -7,37 +7,6 @@ LL | impl Drop for MyStruct { LL | impl Drop for MyStruct { | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyStruct` -error[E0283]: type annotations needed: cannot satisfy `MyStruct: Drop` - --> $DIR/issue-28568.rs:3:15 - | -LL | impl Drop for MyStruct { - | ^^^^^^^^ - | -note: multiple `impl`s satisfying `MyStruct: Drop` found - --> $DIR/issue-28568.rs:3:1 - | -LL | impl Drop for MyStruct { - | ^^^^^^^^^^^^^^^^^^^^^^ -... -LL | impl Drop for MyStruct { - | ^^^^^^^^^^^^^^^^^^^^^^ - -error[E0283]: type annotations needed: cannot satisfy `MyStruct: Drop` - --> $DIR/issue-28568.rs:8:15 - | -LL | impl Drop for MyStruct { - | ^^^^^^^^ - | -note: multiple `impl`s satisfying `MyStruct: Drop` found - --> $DIR/issue-28568.rs:3:1 - | -LL | impl Drop for MyStruct { - | ^^^^^^^^^^^^^^^^^^^^^^ -... -LL | impl Drop for MyStruct { - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 3 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0119, E0283. -For more information about an error, try `rustc --explain E0119`. +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/marker_trait_attr/unsound-overlap.rs b/tests/ui/marker_trait_attr/unsound-overlap.rs index 84af13121c34b..68636617dead3 100644 --- a/tests/ui/marker_trait_attr/unsound-overlap.rs +++ b/tests/ui/marker_trait_attr/unsound-overlap.rs @@ -19,7 +19,6 @@ impl TraitWithAssoc for T { impl TraitWithAssoc for ((&str,),) { //~^ ERROR conflicting implementations - //~| ERROR type annotations needed type Assoc = ((&'static str,),); //~^ ERROR type annotations needed } diff --git a/tests/ui/marker_trait_attr/unsound-overlap.stderr b/tests/ui/marker_trait_attr/unsound-overlap.stderr index 987d11884e1dd..4c3a1a01aa92b 100644 --- a/tests/ui/marker_trait_attr/unsound-overlap.stderr +++ b/tests/ui/marker_trait_attr/unsound-overlap.stderr @@ -7,30 +7,15 @@ LL | impl TraitWithAssoc for T { LL | impl TraitWithAssoc for ((&str,),) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `((&str,),)` -error[E0283]: type annotations needed: cannot satisfy `((&str,),): TraitWithAssoc` - --> $DIR/unsound-overlap.rs:20:25 - | -LL | impl TraitWithAssoc for ((&str,),) { - | ^^^^^^^^^^ - | -note: multiple `impl`s satisfying `((&str,),): TraitWithAssoc` found - --> $DIR/unsound-overlap.rs:16:1 - | -LL | impl TraitWithAssoc for T { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -... -LL | impl TraitWithAssoc for ((&str,),) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - error[E0284]: type annotations needed - --> $DIR/unsound-overlap.rs:23:18 + --> $DIR/unsound-overlap.rs:22:18 | LL | type Assoc = ((&'static str,),); | ^^^^^^^^^^^^^^^^^^ cannot infer type | = note: cannot satisfy `<((&str,),) as TraitWithAssoc>::Assoc == _` -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0119, E0283, E0284. +Some errors have detailed explanations: E0119, E0284. For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-and-non-const-impl.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-and-non-const-impl.stderr index f7fa4833c9501..48e11fce4152b 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-and-non-const-impl.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-and-non-const-impl.stderr @@ -19,19 +19,6 @@ LL | impl std::ops::Add for Int { LL | impl const std::ops::Add for Int { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Int` -error[E0283]: type annotations needed: cannot satisfy `i32: Add` - --> $DIR/const-and-non-const-impl.rs:7:30 - | -LL | impl const std::ops::Add for i32 { - | ^^^ - | -note: multiple `impl`s satisfying `i32: Add` found - --> $DIR/const-and-non-const-impl.rs:7:1 - | -LL | impl const std::ops::Add for i32 { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: and another `impl` found in the `core` crate: `impl Add for i32;` - error[E0284]: type annotations needed --> $DIR/const-and-non-const-impl.rs:8:19 | @@ -46,21 +33,6 @@ error[E0284]: type annotations needed: cannot satisfy `::Output == i LL | fn add(self, rhs: Self) -> Self { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `::Output == i32` -error[E0283]: type annotations needed: cannot satisfy `Int: Add` - --> $DIR/const-and-non-const-impl.rs:15:24 - | -LL | impl std::ops::Add for Int { - | ^^^ - | -note: multiple `impl`s satisfying `Int: Add` found - --> $DIR/const-and-non-const-impl.rs:15:1 - | -LL | impl std::ops::Add for Int { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -... -LL | impl const std::ops::Add for Int { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - error[E0284]: type annotations needed --> $DIR/const-and-non-const-impl.rs:16:19 | @@ -75,21 +47,6 @@ error[E0284]: type annotations needed: cannot satisfy `::Output == I LL | fn add(self, rhs: Self) -> Self { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `::Output == Int` -error[E0283]: type annotations needed: cannot satisfy `Int: Add` - --> $DIR/const-and-non-const-impl.rs:23:30 - | -LL | impl const std::ops::Add for Int { - | ^^^ - | -note: multiple `impl`s satisfying `Int: Add` found - --> $DIR/const-and-non-const-impl.rs:15:1 - | -LL | impl std::ops::Add for Int { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -... -LL | impl const std::ops::Add for Int { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - error[E0284]: type annotations needed --> $DIR/const-and-non-const-impl.rs:24:19 | @@ -104,7 +61,7 @@ error[E0284]: type annotations needed: cannot satisfy `::Output == I LL | fn add(self, rhs: Self) -> Self { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `::Output == Int` -error: aborting due to 11 previous errors +error: aborting due to 8 previous errors -Some errors have detailed explanations: E0117, E0119, E0283, E0284. +Some errors have detailed explanations: E0117, E0119, E0284. For more information about an error, try `rustc --explain E0117`. diff --git a/tests/ui/specialization/specialization-feature-gate-overlap.rs b/tests/ui/specialization/specialization-feature-gate-overlap.rs index 48be288c75372..b83c84ab82c01 100644 --- a/tests/ui/specialization/specialization-feature-gate-overlap.rs +++ b/tests/ui/specialization/specialization-feature-gate-overlap.rs @@ -11,7 +11,6 @@ impl Foo for T { } impl Foo for u8 { //~ ERROR E0119 - //~^ ERROR E0283 fn foo(&self) {} } diff --git a/tests/ui/specialization/specialization-feature-gate-overlap.stderr b/tests/ui/specialization/specialization-feature-gate-overlap.stderr index 62048243af976..f42289fb96287 100644 --- a/tests/ui/specialization/specialization-feature-gate-overlap.stderr +++ b/tests/ui/specialization/specialization-feature-gate-overlap.stderr @@ -7,22 +7,6 @@ LL | impl Foo for T { LL | impl Foo for u8 { | ^^^^^^^^^^^^^^^ conflicting implementation for `u8` -error[E0283]: type annotations needed: cannot satisfy `u8: Foo` - --> $DIR/specialization-feature-gate-overlap.rs:13:14 - | -LL | impl Foo for u8 { - | ^^ - | -note: multiple `impl`s satisfying `u8: Foo` found - --> $DIR/specialization-feature-gate-overlap.rs:9:1 - | -LL | impl Foo for T { - | ^^^^^^^^^^^^^^^^^ -... -LL | impl Foo for u8 { - | ^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0119, E0283. -For more information about an error, try `rustc --explain E0119`. +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/traits/alias/issue-83613.rs b/tests/ui/traits/alias/issue-83613.rs index dbef6bafdec11..2462e703a7165 100644 --- a/tests/ui/traits/alias/issue-83613.rs +++ b/tests/ui/traits/alias/issue-83613.rs @@ -9,5 +9,4 @@ trait AnotherTrait {} impl AnotherTrait for T {} impl AnotherTrait for OpaqueType {} //~^ ERROR conflicting implementations of trait `AnotherTrait` for type `OpaqueType` -//~| ERROR type annotations needed fn main() {} diff --git a/tests/ui/traits/alias/issue-83613.stderr b/tests/ui/traits/alias/issue-83613.stderr index 6f8692ef1c711..847fda417766a 100644 --- a/tests/ui/traits/alias/issue-83613.stderr +++ b/tests/ui/traits/alias/issue-83613.stderr @@ -6,21 +6,6 @@ LL | impl AnotherTrait for T {} LL | impl AnotherTrait for OpaqueType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `OpaqueType` -error[E0283]: type annotations needed: cannot satisfy `OpaqueType: AnotherTrait` - --> $DIR/issue-83613.rs:10:23 - | -LL | impl AnotherTrait for OpaqueType {} - | ^^^^^^^^^^ - | -note: multiple `impl`s satisfying `OpaqueType: AnotherTrait` found - --> $DIR/issue-83613.rs:9:1 - | -LL | impl AnotherTrait for T {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | impl AnotherTrait for OpaqueType {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0119, E0283. -For more information about an error, try `rustc --explain E0119`. +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/traits/issue-33140-hack-boundaries.rs b/tests/ui/traits/issue-33140-hack-boundaries.rs index 8b6d8b41bf567..d091162fced6b 100644 --- a/tests/ui/traits/issue-33140-hack-boundaries.rs +++ b/tests/ui/traits/issue-33140-hack-boundaries.rs @@ -15,10 +15,8 @@ trait Trait1 { } impl Trait1 for dyn Send {} -//~^ ERROR E0283 impl Trait1 for dyn Send {} //~^ ERROR E0119 -//~| ERROR E0283 // Problem 2: negative impl trait Trait2 {} @@ -31,10 +29,8 @@ impl !Trait2 for dyn Send {} trait Trait3 {} impl Trait3 for dyn Send {} -//~^ ERROR E0283 impl Trait3 for dyn Send {} //~^ ERROR E0119 -//~| ERROR E0283 // Problem 4a: not a trait object - generic trait Trait4a {} @@ -42,42 +38,33 @@ trait Trait4a {} impl Trait4a for T {} impl Trait4a for dyn Send {} //~^ ERROR E0119 -//~| ERROR E0283 // Problem 4b: not a trait object - misc trait Trait4b {} impl Trait4b for () {} -//~^ ERROR E0283 impl Trait4b for () {} //~^ ERROR E0119 -//~| ERROR E0283 // Problem 4c: not a principal-less trait object trait Trait4c {} impl Trait4c for dyn Trait1 + Send {} -//~^ ERROR E0283 impl Trait4c for dyn Trait1 + Send {} //~^ ERROR E0119 -//~| ERROR E0283 // Problem 4d: lifetimes trait Trait4d {} impl<'a> Trait4d for dyn Send + 'a {} -//~^ ERROR E0283 impl<'a> Trait4d for dyn Send + 'a {} //~^ ERROR E0119 -//~| ERROR E0283 // Problem 5: where-clauses trait Trait5 {} impl Trait5 for dyn Send {} -//~^ ERROR E0283 impl Trait5 for dyn Send where u32: Copy {} //~^ ERROR E0119 -//~| ERROR E0283 fn main() {} diff --git a/tests/ui/traits/issue-33140-hack-boundaries.stderr b/tests/ui/traits/issue-33140-hack-boundaries.stderr index be6a00b4920d0..06e1dfd372751 100644 --- a/tests/ui/traits/issue-33140-hack-boundaries.stderr +++ b/tests/ui/traits/issue-33140-hack-boundaries.stderr @@ -1,14 +1,13 @@ error[E0119]: conflicting implementations of trait `Trait1` for type `(dyn Send + 'static)` - --> $DIR/issue-33140-hack-boundaries.rs:19:1 + --> $DIR/issue-33140-hack-boundaries.rs:18:1 | LL | impl Trait1 for dyn Send {} | ------------------------ first implementation here -LL | LL | impl Trait1 for dyn Send {} | ^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + 'static)` error[E0751]: found both positive and negative implementation of trait `Trait2` for type `(dyn Send + 'static)`: - --> $DIR/issue-33140-hack-boundaries.rs:27:1 + --> $DIR/issue-33140-hack-boundaries.rs:25:1 | LL | impl Trait2 for dyn Send {} | ------------------------ positive implementation here @@ -16,16 +15,15 @@ LL | impl !Trait2 for dyn Send {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ negative implementation here error[E0119]: conflicting implementations of trait `Trait3<(dyn Sync + 'static)>` for type `(dyn Send + 'static)` - --> $DIR/issue-33140-hack-boundaries.rs:35:1 + --> $DIR/issue-33140-hack-boundaries.rs:32:1 | LL | impl Trait3 for dyn Send {} | ---------------------------------- first implementation here -LL | LL | impl Trait3 for dyn Send {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + 'static)` error[E0119]: conflicting implementations of trait `Trait4a` for type `(dyn Send + 'static)` - --> $DIR/issue-33140-hack-boundaries.rs:43:1 + --> $DIR/issue-33140-hack-boundaries.rs:39:1 | LL | impl Trait4a for T {} | ----------------------------- first implementation here @@ -33,238 +31,40 @@ LL | impl Trait4a for dyn Send {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + 'static)` error[E0119]: conflicting implementations of trait `Trait4b` for type `()` - --> $DIR/issue-33140-hack-boundaries.rs:52:1 + --> $DIR/issue-33140-hack-boundaries.rs:46:1 | LL | impl Trait4b for () {} | ------------------- first implementation here -LL | LL | impl Trait4b for () {} | ^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()` error[E0119]: conflicting implementations of trait `Trait4c` for type `(dyn Trait1 + Send + 'static)` - --> $DIR/issue-33140-hack-boundaries.rs:61:1 + --> $DIR/issue-33140-hack-boundaries.rs:53:1 | LL | impl Trait4c for dyn Trait1 + Send {} | ---------------------------------- first implementation here -LL | LL | impl Trait4c for dyn Trait1 + Send {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Trait1 + Send + 'static)` error[E0119]: conflicting implementations of trait `Trait4d` for type `dyn Send` - --> $DIR/issue-33140-hack-boundaries.rs:70:1 + --> $DIR/issue-33140-hack-boundaries.rs:60:1 | LL | impl<'a> Trait4d for dyn Send + 'a {} | ---------------------------------- first implementation here -LL | LL | impl<'a> Trait4d for dyn Send + 'a {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `dyn Send` error[E0119]: conflicting implementations of trait `Trait5` for type `(dyn Send + 'static)` - --> $DIR/issue-33140-hack-boundaries.rs:79:1 + --> $DIR/issue-33140-hack-boundaries.rs:67:1 | LL | impl Trait5 for dyn Send {} | ------------------------ first implementation here -LL | LL | impl Trait5 for dyn Send where u32: Copy {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + 'static)` -error[E0283]: type annotations needed: cannot satisfy `(dyn Send + 'static): Trait1` - --> $DIR/issue-33140-hack-boundaries.rs:17:17 - | -LL | impl Trait1 for dyn Send {} - | ^^^^^^^^ - | -note: multiple `impl`s satisfying `(dyn Send + 'static): Trait1` found - --> $DIR/issue-33140-hack-boundaries.rs:17:1 - | -LL | impl Trait1 for dyn Send {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ -LL | -LL | impl Trait1 for dyn Send {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0283]: type annotations needed: cannot satisfy `(dyn Send + 'static): Trait1` - --> $DIR/issue-33140-hack-boundaries.rs:19:17 - | -LL | impl Trait1 for dyn Send {} - | ^^^^^^^^ - | -note: multiple `impl`s satisfying `(dyn Send + 'static): Trait1` found - --> $DIR/issue-33140-hack-boundaries.rs:17:1 - | -LL | impl Trait1 for dyn Send {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ -LL | -LL | impl Trait1 for dyn Send {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0283]: type annotations needed: cannot satisfy `(dyn Send + 'static): Trait3<(dyn Sync + 'static)>` - --> $DIR/issue-33140-hack-boundaries.rs:33:27 - | -LL | impl Trait3 for dyn Send {} - | ^^^^^^^^ - | -note: multiple `impl`s satisfying `(dyn Send + 'static): Trait3<(dyn Sync + 'static)>` found - --> $DIR/issue-33140-hack-boundaries.rs:33:1 - | -LL | impl Trait3 for dyn Send {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | -LL | impl Trait3 for dyn Send {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0283]: type annotations needed: cannot satisfy `(dyn Send + 'static): Trait3<(dyn Sync + 'static)>` - --> $DIR/issue-33140-hack-boundaries.rs:35:27 - | -LL | impl Trait3 for dyn Send {} - | ^^^^^^^^ - | -note: multiple `impl`s satisfying `(dyn Send + 'static): Trait3<(dyn Sync + 'static)>` found - --> $DIR/issue-33140-hack-boundaries.rs:33:1 - | -LL | impl Trait3 for dyn Send {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | -LL | impl Trait3 for dyn Send {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0283]: type annotations needed: cannot satisfy `(dyn Send + 'static): Trait4a` - --> $DIR/issue-33140-hack-boundaries.rs:43:18 - | -LL | impl Trait4a for dyn Send {} - | ^^^^^^^^ - | -note: multiple `impl`s satisfying `(dyn Send + 'static): Trait4a` found - --> $DIR/issue-33140-hack-boundaries.rs:42:1 - | -LL | impl Trait4a for T {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | impl Trait4a for dyn Send {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0283]: type annotations needed: cannot satisfy `(): Trait4b` - --> $DIR/issue-33140-hack-boundaries.rs:50:18 - | -LL | impl Trait4b for () {} - | ^^ - | -note: multiple `impl`s satisfying `(): Trait4b` found - --> $DIR/issue-33140-hack-boundaries.rs:50:1 - | -LL | impl Trait4b for () {} - | ^^^^^^^^^^^^^^^^^^^ -LL | -LL | impl Trait4b for () {} - | ^^^^^^^^^^^^^^^^^^^ - -error[E0283]: type annotations needed: cannot satisfy `(): Trait4b` - --> $DIR/issue-33140-hack-boundaries.rs:52:18 - | -LL | impl Trait4b for () {} - | ^^ - | -note: multiple `impl`s satisfying `(): Trait4b` found - --> $DIR/issue-33140-hack-boundaries.rs:50:1 - | -LL | impl Trait4b for () {} - | ^^^^^^^^^^^^^^^^^^^ -LL | -LL | impl Trait4b for () {} - | ^^^^^^^^^^^^^^^^^^^ - -error[E0283]: type annotations needed: cannot satisfy `(dyn Trait1 + Send + 'static): Trait4c` - --> $DIR/issue-33140-hack-boundaries.rs:59:18 - | -LL | impl Trait4c for dyn Trait1 + Send {} - | ^^^^^^^^^^^^^^^^^ - | -note: multiple `impl`s satisfying `(dyn Trait1 + Send + 'static): Trait4c` found - --> $DIR/issue-33140-hack-boundaries.rs:59:1 - | -LL | impl Trait4c for dyn Trait1 + Send {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | -LL | impl Trait4c for dyn Trait1 + Send {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0283]: type annotations needed: cannot satisfy `(dyn Trait1 + Send + 'static): Trait4c` - --> $DIR/issue-33140-hack-boundaries.rs:61:18 - | -LL | impl Trait4c for dyn Trait1 + Send {} - | ^^^^^^^^^^^^^^^^^ - | -note: multiple `impl`s satisfying `(dyn Trait1 + Send + 'static): Trait4c` found - --> $DIR/issue-33140-hack-boundaries.rs:59:1 - | -LL | impl Trait4c for dyn Trait1 + Send {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | -LL | impl Trait4c for dyn Trait1 + Send {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0283]: type annotations needed: cannot satisfy `(dyn Send + 'a): Trait4d` - --> $DIR/issue-33140-hack-boundaries.rs:68:22 - | -LL | impl<'a> Trait4d for dyn Send + 'a {} - | ^^^^^^^^^^^^^ - | -note: multiple `impl`s satisfying `(dyn Send + 'a): Trait4d` found - --> $DIR/issue-33140-hack-boundaries.rs:68:1 - | -LL | impl<'a> Trait4d for dyn Send + 'a {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | -LL | impl<'a> Trait4d for dyn Send + 'a {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0283]: type annotations needed: cannot satisfy `(dyn Send + 'a): Trait4d` - --> $DIR/issue-33140-hack-boundaries.rs:70:22 - | -LL | impl<'a> Trait4d for dyn Send + 'a {} - | ^^^^^^^^^^^^^ - | -note: multiple `impl`s satisfying `(dyn Send + 'a): Trait4d` found - --> $DIR/issue-33140-hack-boundaries.rs:68:1 - | -LL | impl<'a> Trait4d for dyn Send + 'a {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | -LL | impl<'a> Trait4d for dyn Send + 'a {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0283]: type annotations needed: cannot satisfy `(dyn Send + 'static): Trait5` - --> $DIR/issue-33140-hack-boundaries.rs:77:17 - | -LL | impl Trait5 for dyn Send {} - | ^^^^^^^^ - | -note: multiple `impl`s satisfying `(dyn Send + 'static): Trait5` found - --> $DIR/issue-33140-hack-boundaries.rs:77:1 - | -LL | impl Trait5 for dyn Send {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ -LL | -LL | impl Trait5 for dyn Send where u32: Copy {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0283]: type annotations needed: cannot satisfy `(dyn Send + 'static): Trait5` - --> $DIR/issue-33140-hack-boundaries.rs:79:17 - | -LL | impl Trait5 for dyn Send where u32: Copy {} - | ^^^^^^^^ - | -note: multiple `impl`s satisfying `(dyn Send + 'static): Trait5` found - --> $DIR/issue-33140-hack-boundaries.rs:77:1 - | -LL | impl Trait5 for dyn Send {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ -LL | -LL | impl Trait5 for dyn Send where u32: Copy {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 21 previous errors +error: aborting due to 8 previous errors -Some errors have detailed explanations: E0119, E0283, E0751. +Some errors have detailed explanations: E0119, E0751. For more information about an error, try `rustc --explain E0119`. Future incompatibility report: Future breakage diagnostic: warning: conflicting implementations of trait `Trait0` for type `(dyn Send + 'static)`: (E0119) diff --git a/tests/ui/type-alias-impl-trait/issue-104817.rs b/tests/ui/type-alias-impl-trait/issue-104817.rs index 45e2aa33a15b4..0d3bace4db1f4 100644 --- a/tests/ui/type-alias-impl-trait/issue-104817.rs +++ b/tests/ui/type-alias-impl-trait/issue-104817.rs @@ -15,6 +15,5 @@ trait AnotherTrait {} impl AnotherTrait for T {} impl AnotherTrait for OpaqueType {} //[stock]~^ conflicting implementations of trait `AnotherTrait` for type `OpaqueType` -//[stock]~| type annotations needed fn main() {} diff --git a/tests/ui/type-alias-impl-trait/issue-104817.stock.stderr b/tests/ui/type-alias-impl-trait/issue-104817.stock.stderr index f7ee6c9a4c5d7..41c5206d9e88a 100644 --- a/tests/ui/type-alias-impl-trait/issue-104817.stock.stderr +++ b/tests/ui/type-alias-impl-trait/issue-104817.stock.stderr @@ -6,21 +6,6 @@ LL | impl AnotherTrait for T {} LL | impl AnotherTrait for OpaqueType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `OpaqueType` -error[E0283]: type annotations needed: cannot satisfy `OpaqueType: AnotherTrait` - --> $DIR/issue-104817.rs:16:23 - | -LL | impl AnotherTrait for OpaqueType {} - | ^^^^^^^^^^ - | -note: multiple `impl`s satisfying `OpaqueType: AnotherTrait` found - --> $DIR/issue-104817.rs:15:1 - | -LL | impl AnotherTrait for T {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | impl AnotherTrait for OpaqueType {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0119, E0283. -For more information about an error, try `rustc --explain E0119`. +For more information about this error, try `rustc --explain E0119`.