Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[crater] next-coherence crater part 2 #116357

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_interface/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ fn test_unstable_options_tracking_hash() {
tracked!(thir_unsafeck, true);
tracked!(tiny_const_eval_limit, true);
tracked!(tls_model, Some(TlsModel::GeneralDynamic));
tracked!(trait_solver, TraitSolver::NextCoherence);
tracked!(trait_solver, TraitSolver::Next);
tracked!(translate_remapped_path_to_local_path, false);
tracked!(trap_unreachable, Some(false));
tracked!(treat_err_as_bug, NonZeroUsize::new(1));
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ mod parse {
Some("next") => *slot = TraitSolver::Next,
Some("next-coherence") => *slot = TraitSolver::NextCoherence,
// default trait solver is subject to change..
Some("default") => *slot = TraitSolver::Classic,
Some("default") => *slot = TraitSolver::NextCoherence,
_ => return false,
}
true
Expand Down Expand Up @@ -1830,8 +1830,8 @@ written to standard error output)"),
"for every macro invocation, print its name and arguments (default: no)"),
track_diagnostics: bool = (false, parse_bool, [UNTRACKED],
"tracks where in rustc a diagnostic was emitted"),
trait_solver: TraitSolver = (TraitSolver::Classic, parse_trait_solver, [TRACKED],
"specify the trait solver mode used by rustc (default: classic)"),
trait_solver: TraitSolver = (TraitSolver::NextCoherence, parse_trait_solver, [TRACKED],
"specify the trait solver mode used by rustc (default: next-coherence)"),
// Diagnostics are considered side-effects of a query (see `QuerySideEffects`) and are saved
// alongside query results and changes to translation options can affect diagnostics - so
// translation options should be tracked.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `Cow<'_, _>`
error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `<_ as ToOwned>::Owned`
--> $DIR/associated-types-coherence-failure.rs:21:1
|
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for <B as ToOwned>::Owned where B: ToOwned {
| ------------------------------------------------------------ first implementation here
...
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for Cow<'a, B> where B: ToOwned {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Cow<'_, _>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `<_ as ToOwned>::Owned`

error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `&_`
error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `<_ as ToOwned>::Owned`
--> $DIR/associated-types-coherence-failure.rs:28:1
|
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for <B as ToOwned>::Owned where B: ToOwned {
| ------------------------------------------------------------ first implementation here
...
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for &'a B where B: ToOwned {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `<_ as ToOwned>::Owned`

error: aborting due to 2 previous errors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ LL | impl<'a, T: MyPredicate<'a>> MyTrait<'a> for T {}
| ---------------------------------------------- first implementation here
LL | impl<'a, T> MyTrait<'a> for &'a T {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
|
= note: downstream crates may implement trait `MyPredicate<'_>` for type `&_`

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ LL | impl<T: DerefMut> Foo for T {}
| --------------------------- first implementation here
LL | impl<U> Foo for &U {}
| ^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
|
= note: downstream crates may implement trait `std::ops::DerefMut` for type `&_`

error: aborting due to previous error

Expand Down
19 changes: 6 additions & 13 deletions tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
error: implementations of `PartialEq<Interval<_>>` for `Interval<_>` will conflict in the future
--> $DIR/warn-when-cycle-is-error-in-coherence.rs:13:1
error[E0119]: conflicting implementations of trait `PartialEq<Interval<_>>` for type `Interval<_>`
--> $DIR/warn-when-cycle-is-error-in-coherence.rs:7:10
|
LL | #[derive(PartialEq, Default)]
| --------- the second impl is here
| ^^^^^^^^^ conflicting implementation for `Interval<_>`
...
LL | impl<T, Q> PartialEq<Q> for Interval<T>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the first impl is here
| --------------------------------------- first implementation here
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #114040 <https://github.com/rust-lang/rust/issues/114040>
= note: impls that are not considered to overlap may be considered to overlap in the future
= note: `Interval<_>: PartialOrd` may be considered to hold in future releases, causing the impls to overlap
note: the lint level is defined here
--> $DIR/warn-when-cycle-is-error-in-coherence.rs:1:9
|
LL | #![deny(coinductive_overlap_in_coherence)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

For more information about this error, try `rustc --explain E0119`.
4 changes: 4 additions & 0 deletions tests/ui/error-codes/E0476.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <Wrapper<_> as std::marker::Unsize<Wrapper<_>>>
WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <Wrapper<_> as std::marker::Unsize<Wrapper<_>>>
WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <Wrapper<_> as std::marker::Unsize<Wrapper<_>>>
WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <Wrapper<_> as std::marker::Unsize<Wrapper<_>>>
error[E0119]: conflicting implementations of trait `CoerceUnsized<&Wrapper<_>>` for type `&Wrapper<_>`
--> $DIR/E0476.rs:9:1
|
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/error-codes/e0119/issue-23563.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0119]: conflicting implementations of trait `LolFrom<&[_]>` for type `LocalType<_>`
error[E0119]: conflicting implementations of trait `LolFrom<&[u8]>` for type `LocalType<u8>`
--> $DIR/issue-23563.rs:13:1
|
LL | impl<'a, T> LolFrom<&'a [T]> for LocalType<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ LL | impl<T: std::ops::DerefMut> Foo for T { }
LL |
LL | impl<T> Foo for &T { }
| ^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
|
= note: downstream crates may implement trait `std::ops::DerefMut` for type `&_`

error: aborting due to previous error

Expand Down
2 changes: 0 additions & 2 deletions tests/ui/impl-trait/negative-reasoning.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ LL | impl<T: std::fmt::Debug> AnotherTrait for T {}
...
LL | impl AnotherTrait for D<OpaqueType> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<OpaqueType>`
|
= note: upstream crates may add a new impl of trait `std::fmt::Debug` for type `OpaqueType` in future versions

error: aborting due to previous error

Expand Down
2 changes: 0 additions & 2 deletions tests/ui/never_type/never-from-impl-is-reserved.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ LL | impl MyTrait for MyFoo {}
LL | // This will conflict with the first impl if we impl `for<T> T: From<!>`.
LL | impl<T> MyTrait for T where T: From<!> {}
| ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyFoo`
|
= note: permitting this impl would forbid us from adding `impl<T> From<!> for T` later; see rust-lang/rust#64715 for details

error: aborting due to previous error

Expand Down
15 changes: 7 additions & 8 deletions tests/ui/traits/issue-105231.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@ LL |
LL ~ struct B<T>(Box<A<A<T>>>);
|

error[E0275]: overflow evaluating the requirement `A<A<A<A<A<A<A<...>>>>>>>: Send`
error[E0119]: conflicting implementations of trait `Foo` for type `B<u8>`
--> $DIR/issue-105231.rs:7:1
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_105231`)
note: required because it appears within the type `B<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<u8>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
--> $DIR/issue-105231.rs:4:8
|
LL | struct B<T>(A<A<T>>);
| ^
LL | impl<T> Foo for T where T: Send {}
| ----------------- first implementation here
LL | impl Foo for B<u8> {}
| ^^^^^^^^^^^^^^^^^^ conflicting implementation for `B<u8>`

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0072, E0275.
Some errors have detailed explanations: E0072, E0119.
For more information about an error, try `rustc --explain E0072`.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ LL | impl OtherTrait for () {}
| ---------------------- first implementation here
LL | impl<T: MyTrait> OtherTrait for T {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
|
= note: this impl is reserved

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
error[E0275]: overflow evaluating the requirement `Runtime<RootDatabase>: RefUnwindSafe`
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`cycle_via_builtin_auto_trait_impl`)
note: required because it appears within the type `RootDatabase`
--> $DIR/cycle-via-builtin-auto-trait-impl.rs:13:8
|
LL | struct RootDatabase {
| ^^^^^^^^^^^^
note: required for `RootDatabase` to implement `Database`
--> $DIR/cycle-via-builtin-auto-trait-impl.rs:17:24
error[E0119]: conflicting implementations of trait `Database` for type `RootDatabase`
--> $DIR/cycle-via-builtin-auto-trait-impl.rs:20:1
|
LL | impl<T: RefUnwindSafe> Database for T {
| ------------- ^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
note: required because it appears within the type `Runtime<RootDatabase>`
--> $DIR/cycle-via-builtin-auto-trait-impl.rs:24:8
|
LL | struct Runtime<DB: Database> {
| ^^^^^^^
| ------------------------------------- first implementation here
...
LL | impl Database for RootDatabase {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `RootDatabase`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0275`.
For more information about this error, try `rustc --explain E0119`.
2 changes: 0 additions & 2 deletions tests/ui/type-alias-impl-trait/coherence_cross_crate.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ LL | impl OtherTrait for Alias {}
| ------------------------- first implementation here
LL | impl OtherTrait for i32 {}
| ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Alias`
|
= note: upstream crates may add a new impl of trait `coherence_cross_crate_trait_decl::SomeTrait` for type `i32` in future versions

error: aborting due to previous error

Expand Down