Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 02189e5

Browse files
committed
stabilize -Znext-solver=coherence
1 parent 5714c1f commit 02189e5

File tree

53 files changed

+307
-225
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+307
-225
lines changed

compiler/rustc_session/src/config.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,16 @@ pub struct NextSolverConfig {
790790
pub dump_tree: DumpSolverProofTree,
791791
}
792792

793+
impl Default for NextSolverConfig {
794+
fn default() -> Self {
795+
NextSolverConfig {
796+
coherence: true,
797+
globally: false,
798+
dump_tree: DumpSolverProofTree::default(),
799+
}
800+
}
801+
}
802+
793803
#[derive(Default, Debug, Copy, Clone, Hash, PartialEq, Eq)]
794804
pub enum DumpSolverProofTree {
795805
Always,

compiler/rustc_session/src/options.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ mod desc {
399399
pub const parse_instrument_xray: &str = "either a boolean (`yes`, `no`, `on`, `off`, etc), or a comma separated list of settings: `always` or `never` (mutually exclusive), `ignore-loops`, `instruction-threshold=N`, `skip-entry`, `skip-exit`";
400400
pub const parse_unpretty: &str = "`string` or `string=string`";
401401
pub const parse_treat_err_as_bug: &str = "either no value or a non-negative number";
402-
pub const parse_next_solver_config: &str = "a comma separated list of solver configurations: `globally` (default), `coherence`, `dump-tree`, `dump-tree-on-error";
402+
pub const parse_next_solver_config: &str = "a comma separated list of solver configurations: `globally` (default), `no`, `dump-tree`, `dump-tree-on-error";
403403
pub const parse_lto: &str =
404404
"either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, `fat`, or omitted";
405405
pub const parse_linker_plugin_lto: &str =
@@ -1061,6 +1061,10 @@ mod parse {
10611061
let mut dump_tree = None;
10621062
for c in config.split(',') {
10631063
match c {
1064+
"no" => {
1065+
*slot = None;
1066+
return true;
1067+
}
10641068
"globally" => globally = true,
10651069
"coherence" => {
10661070
globally = false;
@@ -1815,7 +1819,7 @@ options! {
18151819
"the size at which the `large_assignments` lint starts to be emitted"),
18161820
mutable_noalias: bool = (true, parse_bool, [TRACKED],
18171821
"emit noalias metadata for mutable references (default: yes)"),
1818-
next_solver: Option<NextSolverConfig> = (None, parse_next_solver_config, [TRACKED],
1822+
next_solver: Option<NextSolverConfig> = (Some(NextSolverConfig::default()), parse_next_solver_config, [TRACKED],
18191823
"enable and configure the next generation trait solver used by rustc"),
18201824
nll_facts: bool = (false, parse_bool, [UNTRACKED],
18211825
"dump facts from NLL analysis into side files (default: no)"),

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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 2 additions & 0 deletions
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 1 previous error
1012

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

Lines changed: 2 additions & 0 deletions
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 1 previous error
1012

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

Lines changed: 2 additions & 0 deletions
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 1 previous error
1012

tests/ui/coherence/coherence-overlap-unnormalizable-projection-0.classic.stderr

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ LL | impl<T> Trait for Box<T> {}
1212
| ^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Box<_>`
1313
|
1414
= note: downstream crates may implement trait `WithAssoc<'a>` for type `std::boxed::Box<_>`
15-
= note: downstream crates may implement trait `WhereBound` for type `<std::boxed::Box<_> as WithAssoc<'a>>::Assoc`
1615

1716
error: aborting due to 1 previous error
1817

tests/ui/coherence/negative-coherence-check-placeholder-outlives.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ LL | impl<T> Bar for T where T: Foo {}
55
| ------------------------------ first implementation here
66
LL | impl<T> Bar for Box<T> {}
77
| ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Box<_>`
8+
|
9+
= note: downstream crates may implement trait `Foo` for type `std::boxed::Box<_>`
810

911
error: aborting due to 1 previous error
1012

tests/ui/coherence/negative-coherence-considering-regions.any_lt.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ LL | impl<T> Bar for T where T: Foo {}
66
...
77
LL | impl<T> Bar for &T {}
88
| ^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
9+
|
10+
= note: downstream crates may implement trait `Foo` for type `&_`
911

1012
error: aborting due to 1 previous error
1113

tests/ui/coherence/negative-coherence-placeholder-region-constraints-on-unification.explicit.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ LL | impl<T: ?Sized> FnMarker for fn(&T) {}
88
|
99
= warning: the behavior may change in a future release
1010
= note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105>
11+
= note: downstream crates may implement trait `Marker` for type `&_`
1112
= note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details
1213
note: the lint level is defined here
1314
--> $DIR/negative-coherence-placeholder-region-constraints-on-unification.rs:4:11

0 commit comments

Comments
 (0)