-
-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Enable -Znext-solver on nightly by default
#160619
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -3228,6 +3228,9 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) -> | |||||||
| builder.do_if_verbose(|| println!("doc tests for: {}", markdown.display())); | ||||||||
| let mut cmd = builder.rustdoc_cmd(compiler); | ||||||||
| builder.add_rust_test_threads(&mut cmd); | ||||||||
| // FIXME(#160895): While the new solver is enabled by default on nightly, | ||||||||
| // we don't want to use it in our tests for now. | ||||||||
| cmd.arg("-Znext-solver=coherence"); | ||||||||
| // allow for unstable options such as new editions | ||||||||
| cmd.arg("-Z"); | ||||||||
| cmd.arg("unstable-options"); | ||||||||
|
|
@@ -3300,7 +3303,7 @@ impl CommandLineStep for CrateLibrustc { | |||||||
| /// | ||||||||
| /// Returns whether the test succeeded. | ||||||||
| fn run_cargo_test<'a>( | ||||||||
| cargo: builder::Cargo, | ||||||||
| mut cargo: builder::Cargo, | ||||||||
| libtest_args: &[&str], | ||||||||
| crates: &[String], | ||||||||
| description: impl Into<Option<&'a str>>, | ||||||||
|
|
@@ -3314,6 +3317,10 @@ fn run_cargo_test<'a>( | |||||||
| _ => compiler.stage + 1, | ||||||||
| }; | ||||||||
|
|
||||||||
| // FIXME(#160895): While the new solver is enabled by default on nightly, | ||||||||
| // we don't want to use it in our tests for now. | ||||||||
| cargo.rustdocflag("-Znext-solver=coherence"); | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we only set
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
seems safer to do that?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we do run ordinary tests with this helper as well, so this feels necessary
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright, used an LLM to help me debug this. So afaict this function This means by setting We need to use the old solver to compile doc comments for stuff like //! ```compile_fail,E0072
//! # enum List<T> {
//! Cons(T, List<T>),
//! # }
//! ```
The old and new solver may not agree on the error code after all! As there are no "expect compile fail" tests in the crate source itself (as that would cause compiling the crate to fail, preventing all other tests), compiling normal tests using the new solver is totally fine. These are only runtime tests and whether the program has been compiled using the old or new solver would only matter if they encounter an edge-case where the old and new solver result in different runtime behavior/or the code isn't accepted by one of the two. That is far less of an issue
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, actually, rustdoc regresses due to a regression with the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||
|
|
||||||||
| let mut cargo = prepare_cargo_test(cargo, libtest_args, crates, target, builder); | ||||||||
| let _time = helpers::timeit(builder); | ||||||||
|
|
||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,17 @@ | ||
| //@ run-pass | ||
| //@ compile-flags: -Znext-solver=globally | ||
|
|
||
| #![feature(min_generic_const_args)] | ||
| #![feature(generic_const_args)] | ||
| #![feature(generic_const_exprs)] | ||
| //~^ ERROR `-Znext-solver=globally` and `generic_const_exprs` are incompatible | ||
| //~^ WARN: `feature(generic_const_exprs)` is not supported with the next-generation trait solver | ||
| //@ normalize-stderr: "(--> ).*/tests/ui/const-generics/generic_const_exprs" -> "$1$$DIR" | ||
|
|
||
| use std::mem::size_of; | ||
|
|
||
| union AsBytes<T> { | ||
| as_bytes: [u8; const { size_of::<T>() }], | ||
| //~^ WARN: union `AsBytes` is never used | ||
| as_bytes: [u8; { size_of::<T>() }], | ||
| } | ||
|
|
||
| fn main() {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,21 @@ | ||
| error: `-Znext-solver=globally` and `generic_const_exprs` are incompatible, using them at the same time is not allowed | ||
| --> $DIR/next-solver-gce-incompatible-issue-158428.rs:5:12 | ||
| warning: `feature(generic_const_exprs)` is not supported with the next-generation trait solver | ||
| --> $DIR/next-solver-gce-incompatible-issue-158428.rs:6:12 | ||
| | | ||
| LL | #![feature(generic_const_exprs)] | ||
| | ^^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| = help: remove one of these features | ||
| = note: `-Znext-solver=globally` is currently enabled by default for testing | ||
| = note: reverted the setting to `-Znext-solver=coherence` for this crate | ||
| = note: the currently stable trait solver will be used for this crate | ||
| = note: see issues #160895 <https://github.com/rust-lang/rust/issues/160895> for more information | ||
|
|
||
| error: aborting due to 1 previous error | ||
| warning: union `AsBytes` is never used | ||
| --> $DIR/next-solver-gce-incompatible-issue-158428.rs:12:7 | ||
| | | ||
| LL | union AsBytes<T> { | ||
| | ^^^^^^^ | ||
| | | ||
| = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default | ||
|
|
||
| warning: 2 warnings emitted | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,42 @@ | ||
| error: `-Znext-solver=globally` and `generic_const_exprs` are incompatible, using them at the same time is not allowed | ||
| --> $DIR/unsatisfied-const-trait-bound.rs:6:30 | ||
| warning: `feature(generic_const_exprs)` is not supported with the next-generation trait solver | ||
| --> $DIR/unsatisfied-const-trait-bound.rs:5:30 | ||
| | | ||
| LL | #![feature(const_trait_impl, generic_const_exprs)] | ||
| | ^^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| = help: remove one of these features | ||
| = note: `-Znext-solver=globally` is currently enabled by default for testing | ||
| = note: reverted the setting to `-Znext-solver=coherence` for this crate | ||
| = note: the currently stable trait solver will be used for this crate | ||
| = note: see issues #160895 <https://github.com/rust-lang/rust/issues/160895> for more information | ||
|
|
||
| error: aborting due to 1 previous error | ||
| error[E0277]: the trait bound `T: const Trait` is not satisfied | ||
| --> $DIR/unsatisfied-const-trait-bound.rs:31:37 | ||
| | | ||
| LL | fn accept0<T: Trait>(_: Container<{ T::make() }>) {} | ||
| | ^ | ||
|
|
||
| error[E0277]: the trait bound `T: const Trait` is not satisfied | ||
| --> $DIR/unsatisfied-const-trait-bound.rs:36:51 | ||
| | | ||
| LL | const fn accept1<T: [const] Trait>(_: Container<{ T::make() }>) {} | ||
| | ^ | ||
|
|
||
| error[E0277]: the trait bound `Ty: const Trait` is not satisfied | ||
| --> $DIR/unsatisfied-const-trait-bound.rs:23:15 | ||
| | | ||
| LL | require::<Ty>(); | ||
| | ^^ | ||
| | | ||
| note: required by a bound in `require` | ||
| --> $DIR/unsatisfied-const-trait-bound.rs:8:15 | ||
| | | ||
| LL | fn require<T: const Trait>() {} | ||
| | ^^^^^^^^^^^ required by this bound in `require` | ||
| help: make the `impl` of trait `Trait` `const` | ||
| | | ||
| LL | const impl Trait for Ty { | ||
| | +++++ | ||
|
|
||
| error: aborting due to 3 previous errors; 1 warning emitted | ||
|
|
||
| For more information about this error, try `rustc --explain E0277`. |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not part of this PR, but we allow
coherence: bool = trueeven withoutderive(Default)that's surprising to me 🤔View changes since the review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was also surprised :) If you read the RFC, it can be used when constructing values of the struct manually (you can skip fields with a default value).