Skip to content

Commit 5931117

Browse files
next-coherence crater part 2
1 parent 8e47113 commit 5931117

15 files changed

+39
-57
lines changed

compiler/rustc_interface/src/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ fn test_unstable_options_tracking_hash() {
844844
tracked!(thir_unsafeck, true);
845845
tracked!(tiny_const_eval_limit, true);
846846
tracked!(tls_model, Some(TlsModel::GeneralDynamic));
847-
tracked!(trait_solver, TraitSolver::NextCoherence);
847+
tracked!(trait_solver, TraitSolver::Next);
848848
tracked!(translate_remapped_path_to_local_path, false);
849849
tracked!(trap_unreachable, Some(false));
850850
tracked!(treat_err_as_bug, NonZeroUsize::new(1));

compiler/rustc_session/src/options.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ mod parse {
10091009
Some("next") => *slot = TraitSolver::Next,
10101010
Some("next-coherence") => *slot = TraitSolver::NextCoherence,
10111011
// default trait solver is subject to change..
1012-
Some("default") => *slot = TraitSolver::Classic,
1012+
Some("default") => *slot = TraitSolver::NextCoherence,
10131013
_ => return false,
10141014
}
10151015
true
@@ -1830,8 +1830,8 @@ written to standard error output)"),
18301830
"for every macro invocation, print its name and arguments (default: no)"),
18311831
track_diagnostics: bool = (false, parse_bool, [UNTRACKED],
18321832
"tracks where in rustc a diagnostic was emitted"),
1833-
trait_solver: TraitSolver = (TraitSolver::Classic, parse_trait_solver, [TRACKED],
1834-
"specify the trait solver mode used by rustc (default: classic)"),
1833+
trait_solver: TraitSolver = (TraitSolver::NextCoherence, parse_trait_solver, [TRACKED],
1834+
"specify the trait solver mode used by rustc (default: next-coherence)"),
18351835
// Diagnostics are considered side-effects of a query (see `QuerySideEffects`) and are saved
18361836
// alongside query results and changes to translation options can affect diagnostics - so
18371837
// translation options should be tracked.

tests/ui/associated-types/associated-types-coherence-failure.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `Cow<'_, _>`
1+
error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `<_ as ToOwned>::Owned`
22
--> $DIR/associated-types-coherence-failure.rs:21:1
33
|
44
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for <B as ToOwned>::Owned where B: ToOwned {
55
| ------------------------------------------------------------ first implementation here
66
...
77
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for Cow<'a, B> where B: ToOwned {
8-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Cow<'_, _>`
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `<_ as ToOwned>::Owned`
99

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

1919
error: aborting due to 2 previous errors
2020

tests/ui/coherence/coherence-negative-outlives-lifetimes.stock.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ LL | impl<'a, T: MyPredicate<'a>> MyTrait<'a> for T {}
55
| ---------------------------------------------- first implementation here
66
LL | impl<'a, T> MyTrait<'a> for &'a T {}
77
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
8+
|
9+
= note: downstream crates may implement trait `MyPredicate<'_>` for type `&_`
810

911
error: aborting due to previous error
1012

tests/ui/coherence/coherence-overlap-negate-not-use-feature-gate.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ LL | impl<T: DerefMut> Foo for T {}
55
| --------------------------- first implementation here
66
LL | impl<U> Foo for &U {}
77
| ^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
8+
|
9+
= note: downstream crates may implement trait `std::ops::DerefMut` for type `&_`
810

911
error: aborting due to previous error
1012

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

2012
error: aborting due to previous error
2113

14+
For more information about this error, try `rustc --explain E0119`.

tests/ui/error-codes/E0476.stderr

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <Wrapper<_> as std::marker::Unsize<Wrapper<_>>>
2+
WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <Wrapper<_> as std::marker::Unsize<Wrapper<_>>>
3+
WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <Wrapper<_> as std::marker::Unsize<Wrapper<_>>>
4+
WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <Wrapper<_> as std::marker::Unsize<Wrapper<_>>>
15
error[E0119]: conflicting implementations of trait `CoerceUnsized<&Wrapper<_>>` for type `&Wrapper<_>`
26
--> $DIR/E0476.rs:9:1
37
|

tests/ui/error-codes/e0119/issue-23563.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0119]: conflicting implementations of trait `LolFrom<&[_]>` for type `LocalType<_>`
1+
error[E0119]: conflicting implementations of trait `LolFrom<&[u8]>` for type `LocalType<u8>`
22
--> $DIR/issue-23563.rs:13:1
33
|
44
LL | impl<'a, T> LolFrom<&'a [T]> for LocalType<T> {

tests/ui/feature-gates/feature-gate-with_negative_coherence.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ LL | impl<T: std::ops::DerefMut> Foo for T { }
66
LL |
77
LL | impl<T> Foo for &T { }
88
| ^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
9+
|
10+
= note: downstream crates may implement trait `std::ops::DerefMut` for type `&_`
911

1012
error: aborting due to previous error
1113

tests/ui/impl-trait/negative-reasoning.stderr

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ LL | impl<T: std::fmt::Debug> AnotherTrait for T {}
66
...
77
LL | impl AnotherTrait for D<OpaqueType> {
88
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<OpaqueType>`
9-
|
10-
= note: upstream crates may add a new impl of trait `std::fmt::Debug` for type `OpaqueType` in future versions
119

1210
error: aborting due to previous error
1311

tests/ui/never_type/never-from-impl-is-reserved.stderr

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ LL | impl MyTrait for MyFoo {}
66
LL | // This will conflict with the first impl if we impl `for<T> T: From<!>`.
77
LL | impl<T> MyTrait for T where T: From<!> {}
88
| ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyFoo`
9-
|
10-
= note: permitting this impl would forbid us from adding `impl<T> From<!> for T` later; see rust-lang/rust#64715 for details
119

1210
error: aborting due to previous error
1311

tests/ui/traits/issue-105231.stderr

+7-8
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@ LL |
1414
LL ~ struct B<T>(Box<A<A<T>>>);
1515
|
1616

17-
error[E0275]: overflow evaluating the requirement `A<A<A<A<A<A<A<...>>>>>>>: Send`
17+
error[E0119]: conflicting implementations of trait `Foo` for type `B<u8>`
18+
--> $DIR/issue-105231.rs:7:1
1819
|
19-
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_105231`)
20-
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>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
21-
--> $DIR/issue-105231.rs:4:8
22-
|
23-
LL | struct B<T>(A<A<T>>);
24-
| ^
20+
LL | impl<T> Foo for T where T: Send {}
21+
| ----------------- first implementation here
22+
LL | impl Foo for B<u8> {}
23+
| ^^^^^^^^^^^^^^^^^^ conflicting implementation for `B<u8>`
2524

2625
error: aborting due to 2 previous errors
2726

28-
Some errors have detailed explanations: E0072, E0275.
27+
Some errors have detailed explanations: E0072, E0119.
2928
For more information about an error, try `rustc --explain E0072`.

tests/ui/traits/reservation-impl/coherence-conflict.old.stderr

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ LL | impl OtherTrait for () {}
55
| ---------------------- first implementation here
66
LL | impl<T: MyTrait> OtherTrait for T {}
77
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
8-
|
9-
= note: this impl is reserved
108

119
error: aborting due to previous error
1210

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

2210
error: aborting due to previous error
2311

24-
For more information about this error, try `rustc --explain E0275`.
12+
For more information about this error, try `rustc --explain E0119`.

tests/ui/type-alias-impl-trait/coherence_cross_crate.stderr

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ LL | impl OtherTrait for Alias {}
55
| ------------------------- first implementation here
66
LL | impl OtherTrait for i32 {}
77
| ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Alias`
8-
|
9-
= note: upstream crates may add a new impl of trait `coherence_cross_crate_trait_decl::SomeTrait` for type `i32` in future versions
108

119
error: aborting due to previous error
1210

0 commit comments

Comments
 (0)