Skip to content

Commit f899a56

Browse files
committed
stabilize -Znext-solver=coherence
1 parent 0700ec0 commit f899a56

File tree

43 files changed

+241
-156
lines changed

Some content is hidden

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

43 files changed

+241
-156
lines changed

compiler/rustc_session/src/config.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,16 @@ pub struct NextSolverConfig {
736736
pub dump_tree: DumpSolverProofTree,
737737
}
738738

739+
impl Default for NextSolverConfig {
740+
fn default() -> Self {
741+
NextSolverConfig {
742+
coherence: true,
743+
globally: false,
744+
dump_tree: DumpSolverProofTree::default(),
745+
}
746+
}
747+
}
748+
739749
#[derive(Default, Debug, Copy, Clone, Hash, PartialEq, Eq)]
740750
pub enum DumpSolverProofTree {
741751
Always,

compiler/rustc_session/src/options.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ mod desc {
398398
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`";
399399
pub const parse_unpretty: &str = "`string` or `string=string`";
400400
pub const parse_treat_err_as_bug: &str = "either no value or a non-negative number";
401-
pub const parse_next_solver_config: &str = "a comma separated list of solver configurations: `globally` (default), `coherence`, `dump-tree`, `dump-tree-on-error";
401+
pub const parse_next_solver_config: &str = "a comma separated list of solver configurations: `globally` (default), `no`, `dump-tree`, `dump-tree-on-error";
402402
pub const parse_lto: &str =
403403
"either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, `fat`, or omitted";
404404
pub const parse_linker_plugin_lto: &str =
@@ -1023,6 +1023,10 @@ mod parse {
10231023
let mut dump_tree = None;
10241024
for c in config.split(',') {
10251025
match c {
1026+
"no" => {
1027+
*slot = None;
1028+
return true;
1029+
}
10261030
"globally" => globally = true,
10271031
"coherence" => {
10281032
globally = false;
@@ -1736,7 +1740,7 @@ options! {
17361740
"the size at which the `large_assignments` lint starts to be emitted"),
17371741
mutable_noalias: bool = (true, parse_bool, [TRACKED],
17381742
"emit noalias metadata for mutable references (default: yes)"),
1739-
next_solver: Option<NextSolverConfig> = (None, parse_next_solver_config, [TRACKED],
1743+
next_solver: Option<NextSolverConfig> = (Some(NextSolverConfig::default()), parse_next_solver_config, [TRACKED],
17401744
"enable and configure the next generation trait solver used by rustc"),
17411745
nll_facts: bool = (false, parse_bool, [UNTRACKED],
17421746
"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/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

tests/ui/coherence/normalize-for-errors.current.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
error[E0119]: conflicting implementations of trait `MyTrait<_>` for type `(Box<(MyType,)>, _)`
1+
error[E0119]: conflicting implementations of trait `MyTrait<_>` for type `(Box<(MyType,)>, <_ as Iterator>::Item)`
22
--> $DIR/normalize-for-errors.rs:16:1
33
|
44
LL | impl<T: Copy, S: Iterator> MyTrait<S> for (T, S::Item) {}
55
| ------------------------------------------------------ first implementation here
66
LL |
77
LL | impl<S: Iterator> MyTrait<S> for (Box<<(MyType,) as Mirror>::Assoc>, S::Item) {}
8-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(Box<(MyType,)>, _)`
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(Box<(MyType,)>, <_ as Iterator>::Item)`
99
|
1010
= note: upstream crates may add a new impl of trait `std::marker::Copy` for type `std::boxed::Box<(MyType,)>` in future versions
1111

0 commit comments

Comments
 (0)