mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 07:22:42 +00:00
Auto merge of #118937 - lcnr:rename-solver-flag, r=compiler-errors
`-Ztrait-solver=next` to `-Znext-solver` renames the feature flag to enable the new trait solver. still want some feedback before merging: https://rust-lang.zulipchat.com/#narrow/stream/364551-t-types.2Ftrait-system-refactor/topic/renaming.20the.20feature.20flag.20to.20.60-Znew-solver.60. The idea is to make it easier to add another option, e.g. to enable the solver in wfcheck or to optionally change its behavior to our new coinduction approach. r? `@compiler-errors`
This commit is contained in:
commit
2ecba0fa00
@ -315,7 +315,7 @@ fn check_opaque_type_well_formed<'tcx>(
|
||||
parent_def_id = tcx.local_parent(parent_def_id);
|
||||
}
|
||||
|
||||
// FIXME(-Ztrait-solver=next): We probably should use `DefiningAnchor::Error`
|
||||
// FIXME(-Znext-solver): We probably should use `DefiningAnchor::Error`
|
||||
// and prepopulate this `InferCtxt` with known opaque values, rather than
|
||||
// using the `Bind` anchor here. For now it's fine.
|
||||
let infcx = tcx
|
||||
|
@ -1003,16 +1003,16 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
reported_errors: Default::default(),
|
||||
};
|
||||
|
||||
// FIXME(-Ztrait-solver=next): A bit dubious that we're only registering
|
||||
// FIXME(-Znext-solver): A bit dubious that we're only registering
|
||||
// predefined opaques in the typeck root.
|
||||
if infcx.next_trait_solver() && !infcx.tcx.is_typeck_child(body.source.def_id()) {
|
||||
checker.register_predefined_opaques_in_new_solver();
|
||||
checker.register_predefined_opaques_for_next_solver();
|
||||
}
|
||||
|
||||
checker
|
||||
}
|
||||
|
||||
pub(super) fn register_predefined_opaques_in_new_solver(&mut self) {
|
||||
pub(super) fn register_predefined_opaques_for_next_solver(&mut self) {
|
||||
// OK to use the identity arguments for each opaque type key, since
|
||||
// we remap opaques from HIR typeck back to their definition params.
|
||||
let opaques: Vec<_> = self
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Copied from https://github.com/rust-lang/rust/blob/46455dc65069387f2dc46612f13fd45452ab301a/tests/ui/coroutine/gen_block_iterate.rs
|
||||
// revisions: next old
|
||||
//compile-flags: --edition 2024 -Zunstable-options
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
// run-pass
|
||||
#![feature(gen_blocks)]
|
||||
|
||||
|
@ -320,7 +320,7 @@ fn compare_method_predicate_entailment<'tcx>(
|
||||
if check_implied_wf == CheckImpliedWfMode::Check && !(impl_sig, trait_sig).references_error() {
|
||||
// Select obligations to make progress on inference before processing
|
||||
// the wf obligation below.
|
||||
// FIXME(-Ztrait-solver=next): Not needed when the hack below is removed.
|
||||
// FIXME(-Znext-solver): Not needed when the hack below is removed.
|
||||
let errors = ocx.select_where_possible();
|
||||
if !errors.is_empty() {
|
||||
let reported = infcx.err_ctxt().report_fulfillment_errors(errors);
|
||||
@ -333,7 +333,7 @@ fn compare_method_predicate_entailment<'tcx>(
|
||||
// trigger the lint. Instead, let's only consider type outlives and
|
||||
// region outlives obligations.
|
||||
//
|
||||
// FIXME(-Ztrait-solver=next): Try removing this hack again once
|
||||
// FIXME(-Znext-solver): Try removing this hack again once
|
||||
// the new solver is stable.
|
||||
let mut wf_args: smallvec::SmallVec<[_; 4]> =
|
||||
unnormalized_impl_sig.inputs_and_output.iter().map(|ty| ty.into()).collect();
|
||||
|
@ -1019,7 +1019,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
/// Returns false if the coercion creates any obligations that result in
|
||||
/// errors.
|
||||
pub fn can_coerce(&self, expr_ty: Ty<'tcx>, target: Ty<'tcx>) -> bool {
|
||||
// FIXME(-Ztrait-solver=next): We need to structurally resolve both types here.
|
||||
// FIXME(-Znext-solver): We need to structurally resolve both types here.
|
||||
let source = self.resolve_vars_with_obligations(expr_ty);
|
||||
debug!("coercion::can_with_predicates({:?} -> {:?})", source, target);
|
||||
|
||||
|
@ -83,7 +83,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
/// version (resolve_vars_if_possible), this version will
|
||||
/// also select obligations if it seems useful, in an effort
|
||||
/// to get more type information.
|
||||
// FIXME(-Ztrait-solver=next): A lot of the calls to this method should
|
||||
// FIXME(-Znext-solver): A lot of the calls to this method should
|
||||
// probably be `try_structurally_resolve_type` or `structurally_resolve_type` instead.
|
||||
#[instrument(skip(self), level = "debug", ret)]
|
||||
pub(in super::super) fn resolve_vars_with_obligations(&self, mut ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
|
@ -101,7 +101,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
||||
/// variable, then you'll get a new inference variable; if it is a
|
||||
/// universally quantified variable, you get a placeholder.
|
||||
///
|
||||
/// FIXME(-Ztrait-solver=next): This is public because it's used by the
|
||||
/// FIXME(-Znext-solver): This is public because it's used by the
|
||||
/// new trait solver which has a different canonicalization routine.
|
||||
/// We should somehow deduplicate all of this.
|
||||
pub fn instantiate_canonical_var(
|
||||
|
@ -11,7 +11,7 @@ use rustc_middle::ty::fold::{FnMutDelegate, TypeFoldable};
|
||||
use rustc_middle::ty::GenericArgKind;
|
||||
use rustc_middle::ty::{self, TyCtxt};
|
||||
|
||||
/// FIXME(-Ztrait-solver=next): This or public because it is shared with the
|
||||
/// FIXME(-Znext-solver): This or public because it is shared with the
|
||||
/// new trait solver implementation. We should deduplicate canonicalization.
|
||||
pub trait CanonicalExt<'tcx, V> {
|
||||
/// Instantiate the wrapped value, replacing each canonical value
|
||||
|
@ -135,7 +135,7 @@ pub enum FulfillmentErrorCode<'tcx> {
|
||||
CodeSubtypeError(ExpectedFound<Ty<'tcx>>, TypeError<'tcx>), // always comes from a SubtypePredicate
|
||||
CodeConstEquateError(ExpectedFound<Const<'tcx>>, TypeError<'tcx>),
|
||||
CodeAmbiguity {
|
||||
/// Overflow reported from the new solver `-Ztrait-solver=next`, which will
|
||||
/// Overflow reported from the new solver `-Znext-solver`, which will
|
||||
/// be reported as an regular error as opposed to a fatal error.
|
||||
overflow: bool,
|
||||
},
|
||||
|
@ -6,10 +6,9 @@ use rustc_session::config::{
|
||||
build_configuration, build_session_options, rustc_optgroups, BranchProtection, CFGuard, Cfg,
|
||||
DebugInfo, DumpMonoStatsFormat, ErrorOutputType, ExternEntry, ExternLocation, Externs,
|
||||
FunctionReturn, InliningThreshold, Input, InstrumentCoverage, InstrumentXRay,
|
||||
LinkSelfContained, LinkerPluginLto, LocationDetail, LtoCli, MirSpanview, OomStrategy, Options,
|
||||
OutFileName, OutputType, OutputTypes, PAuthKey, PacRet, Passes, Polonius,
|
||||
ProcMacroExecutionStrategy, Strip, SwitchWithOptPath, SymbolManglingVersion, TraitSolver,
|
||||
WasiExecModel,
|
||||
LinkSelfContained, LinkerPluginLto, LocationDetail, LtoCli, MirSpanview, NextSolverConfig,
|
||||
OomStrategy, Options, OutFileName, OutputType, OutputTypes, PAuthKey, PacRet, Passes, Polonius,
|
||||
ProcMacroExecutionStrategy, Strip, SwitchWithOptPath, SymbolManglingVersion, WasiExecModel,
|
||||
};
|
||||
use rustc_session::lint::Level;
|
||||
use rustc_session::search_paths::SearchPath;
|
||||
@ -781,6 +780,10 @@ fn test_unstable_options_tracking_hash() {
|
||||
tracked!(mir_opt_level, Some(4));
|
||||
tracked!(move_size_limit, Some(4096));
|
||||
tracked!(mutable_noalias, false);
|
||||
tracked!(
|
||||
next_solver,
|
||||
Some(NextSolverConfig { coherence: true, globally: false, dump_tree: Default::default() })
|
||||
);
|
||||
tracked!(no_generate_arange_section, true);
|
||||
tracked!(no_jump_tables, true);
|
||||
tracked!(no_link, true);
|
||||
@ -822,7 +825,6 @@ 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!(translate_remapped_path_to_local_path, false);
|
||||
tracked!(trap_unreachable, Some(false));
|
||||
tracked!(treat_err_as_bug, NonZeroUsize::new(1));
|
||||
|
@ -5,7 +5,7 @@ use rustc_data_structures::sync::Lock;
|
||||
use rustc_query_system::cache::WithDepNode;
|
||||
use rustc_query_system::dep_graph::DepNodeIndex;
|
||||
use rustc_session::Limit;
|
||||
/// The trait solver cache used by `-Ztrait-solver=next`.
|
||||
/// The trait solver cache used by `-Znext-solver`.
|
||||
///
|
||||
/// FIXME(@lcnr): link to some official documentation of how
|
||||
/// this works.
|
||||
|
@ -2240,15 +2240,11 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
}
|
||||
|
||||
pub fn next_trait_solver_globally(self) -> bool {
|
||||
self.sess.opts.unstable_opts.trait_solver == rustc_session::config::TraitSolver::Next
|
||||
self.sess.opts.unstable_opts.next_solver.map_or(false, |c| c.globally)
|
||||
}
|
||||
|
||||
pub fn next_trait_solver_in_coherence(self) -> bool {
|
||||
matches!(
|
||||
self.sess.opts.unstable_opts.trait_solver,
|
||||
rustc_session::config::TraitSolver::Next
|
||||
| rustc_session::config::TraitSolver::NextCoherence
|
||||
)
|
||||
self.sess.opts.unstable_opts.next_solver.map_or(false, |c| c.coherence)
|
||||
}
|
||||
|
||||
pub fn is_impl_trait_in_trait(self, def_id: DefId) -> bool {
|
||||
|
@ -62,7 +62,7 @@ pub enum TreatParams {
|
||||
///
|
||||
/// N.B. during deep rejection, this acts identically to `ForLookup`.
|
||||
///
|
||||
/// FIXME(-Ztrait-solver=next): Remove this variant and cleanup
|
||||
/// FIXME(-Znext-solver): Remove this variant and cleanup
|
||||
/// the code.
|
||||
NextSolverLookup,
|
||||
}
|
||||
|
@ -755,13 +755,14 @@ pub enum PrintKind {
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||
pub enum TraitSolver {
|
||||
/// Classic trait solver in `rustc_trait_selection::traits::select`
|
||||
Classic,
|
||||
/// Experimental trait solver in `rustc_trait_selection::solve`
|
||||
Next,
|
||||
/// Use the new trait solver during coherence
|
||||
NextCoherence,
|
||||
pub struct NextSolverConfig {
|
||||
/// Whether the new trait solver should be enabled in coherence.
|
||||
pub coherence: bool,
|
||||
/// Whether the new trait solver should be enabled everywhere.
|
||||
/// This is only `true` if `coherence` is also enabled.
|
||||
pub globally: bool,
|
||||
/// Whether to dump proof trees after computing a proof tree.
|
||||
pub dump_tree: DumpSolverProofTree,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||
@ -3220,10 +3221,10 @@ pub(crate) mod dep_tracking {
|
||||
use super::{
|
||||
BranchProtection, CFGuard, CFProtection, CrateType, DebugInfo, DebugInfoCompression,
|
||||
ErrorOutputType, FunctionReturn, InliningThreshold, InstrumentCoverage, InstrumentXRay,
|
||||
LinkerPluginLto, LocationDetail, LtoCli, OomStrategy, OptLevel, OutFileName, OutputType,
|
||||
OutputTypes, Polonius, RemapPathScopeComponents, ResolveDocLinks, SourceFileHashAlgorithm,
|
||||
SplitDwarfKind, SwitchWithOptPath, SymbolManglingVersion, TraitSolver, TrimmedDefPaths,
|
||||
WasiExecModel,
|
||||
LinkerPluginLto, LocationDetail, LtoCli, NextSolverConfig, OomStrategy, OptLevel,
|
||||
OutFileName, OutputType, OutputTypes, Polonius, RemapPathScopeComponents, ResolveDocLinks,
|
||||
SourceFileHashAlgorithm, SplitDwarfKind, SwitchWithOptPath, SymbolManglingVersion,
|
||||
TrimmedDefPaths, WasiExecModel,
|
||||
};
|
||||
use crate::lint;
|
||||
use crate::utils::NativeLib;
|
||||
@ -3326,7 +3327,7 @@ pub(crate) mod dep_tracking {
|
||||
BranchProtection,
|
||||
OomStrategy,
|
||||
LanguageIdentifier,
|
||||
TraitSolver,
|
||||
NextSolverConfig,
|
||||
Polonius,
|
||||
InliningThreshold,
|
||||
FunctionReturn,
|
||||
|
@ -396,8 +396,7 @@ mod desc {
|
||||
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`";
|
||||
pub const parse_unpretty: &str = "`string` or `string=string`";
|
||||
pub const parse_treat_err_as_bug: &str = "either no value or a non-negative number";
|
||||
pub const parse_trait_solver: &str =
|
||||
"one of the supported solver modes (`classic`, `next`, or `next-coherence`)";
|
||||
pub const parse_next_solver_config: &str = "a comma separated list of solver configurations: `globally` (default), `coherence`, `dump-tree`, `dump-tree-on-error";
|
||||
pub const parse_lto: &str =
|
||||
"either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, `fat`, or omitted";
|
||||
pub const parse_linker_plugin_lto: &str =
|
||||
@ -429,7 +428,6 @@ mod desc {
|
||||
"a `,` separated combination of `bti`, `b-key`, `pac-ret`, or `leaf`";
|
||||
pub const parse_proc_macro_execution_strategy: &str =
|
||||
"one of supported execution strategies (`same-thread`, or `cross-thread`)";
|
||||
pub const parse_dump_solver_proof_tree: &str = "one of: `always`, `on-request`, `on-error`";
|
||||
pub const parse_remap_path_scope: &str = "comma separated list of scopes: `macro`, `diagnostics`, `unsplit-debuginfo`, `split-debuginfo`, `split-debuginfo-path`, `object`, `all`";
|
||||
pub const parse_inlining_threshold: &str =
|
||||
"either a boolean (`yes`, `no`, `on`, `off`, etc), or a non-negative number";
|
||||
@ -1032,15 +1030,48 @@ mod parse {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn parse_trait_solver(slot: &mut TraitSolver, v: Option<&str>) -> bool {
|
||||
match v {
|
||||
Some("classic") => *slot = TraitSolver::Classic,
|
||||
Some("next") => *slot = TraitSolver::Next,
|
||||
Some("next-coherence") => *slot = TraitSolver::NextCoherence,
|
||||
// default trait solver is subject to change..
|
||||
Some("default") => *slot = TraitSolver::Classic,
|
||||
_ => return false,
|
||||
pub(crate) fn parse_next_solver_config(
|
||||
slot: &mut Option<NextSolverConfig>,
|
||||
v: Option<&str>,
|
||||
) -> bool {
|
||||
if let Some(config) = v {
|
||||
let mut coherence = false;
|
||||
let mut globally = true;
|
||||
let mut dump_tree = None;
|
||||
for c in config.split(',') {
|
||||
match c {
|
||||
"globally" => globally = true,
|
||||
"coherence" => {
|
||||
globally = false;
|
||||
coherence = true;
|
||||
}
|
||||
"dump-tree" => {
|
||||
if dump_tree.replace(DumpSolverProofTree::Always).is_some() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
"dump-tree-on-error" => {
|
||||
if dump_tree.replace(DumpSolverProofTree::OnError).is_some() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
_ => return false,
|
||||
}
|
||||
}
|
||||
|
||||
*slot = Some(NextSolverConfig {
|
||||
coherence: coherence || globally,
|
||||
globally,
|
||||
dump_tree: dump_tree.unwrap_or_default(),
|
||||
});
|
||||
} else {
|
||||
*slot = Some(NextSolverConfig {
|
||||
coherence: true,
|
||||
globally: true,
|
||||
dump_tree: Default::default(),
|
||||
});
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
@ -1305,19 +1336,6 @@ mod parse {
|
||||
true
|
||||
}
|
||||
|
||||
pub(crate) fn parse_dump_solver_proof_tree(
|
||||
slot: &mut DumpSolverProofTree,
|
||||
v: Option<&str>,
|
||||
) -> bool {
|
||||
match v {
|
||||
None | Some("always") => *slot = DumpSolverProofTree::Always,
|
||||
Some("never") => *slot = DumpSolverProofTree::Never,
|
||||
Some("on-error") => *slot = DumpSolverProofTree::OnError,
|
||||
_ => return false,
|
||||
};
|
||||
true
|
||||
}
|
||||
|
||||
pub(crate) fn parse_inlining_threshold(slot: &mut InliningThreshold, v: Option<&str>) -> bool {
|
||||
match v {
|
||||
Some("always" | "yes") => {
|
||||
@ -1591,9 +1609,6 @@ options! {
|
||||
"output statistics about monomorphization collection"),
|
||||
dump_mono_stats_format: DumpMonoStatsFormat = (DumpMonoStatsFormat::Markdown, parse_dump_mono_stats, [UNTRACKED],
|
||||
"the format to use for -Z dump-mono-stats (`markdown` (default) or `json`)"),
|
||||
dump_solver_proof_tree: DumpSolverProofTree = (DumpSolverProofTree::Never, parse_dump_solver_proof_tree, [UNTRACKED],
|
||||
"dump a proof tree for every goal evaluated by the new trait solver. If the flag is specified without any options after it
|
||||
then it defaults to `always`. If the flag is not specified at all it defaults to `on-request`."),
|
||||
dwarf_version: Option<u32> = (None, parse_opt_number, [TRACKED],
|
||||
"version of DWARF debug information to emit (default: 2 or 4, depending on platform)"),
|
||||
dylib_lto: bool = (false, parse_bool, [UNTRACKED],
|
||||
@ -1722,6 +1737,8 @@ options! {
|
||||
"the size at which the `large_assignments` lint starts to be emitted"),
|
||||
mutable_noalias: bool = (true, parse_bool, [TRACKED],
|
||||
"emit noalias metadata for mutable references (default: yes)"),
|
||||
next_solver: Option<NextSolverConfig> = (None, parse_next_solver_config, [TRACKED],
|
||||
"enable and configure the next generation trait solver used by rustc"),
|
||||
nll_facts: bool = (false, parse_bool, [UNTRACKED],
|
||||
"dump facts from NLL analysis into side files (default: no)"),
|
||||
nll_facts_dir: String = ("nll-facts".to_string(), parse_string, [UNTRACKED],
|
||||
@ -1922,8 +1939,6 @@ 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)"),
|
||||
// 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.
|
||||
|
@ -200,9 +200,10 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
|
||||
let result = f(&mut ecx);
|
||||
|
||||
let tree = ecx.inspect.finalize();
|
||||
if let (Some(tree), DumpSolverProofTree::Always) =
|
||||
(&tree, infcx.tcx.sess.opts.unstable_opts.dump_solver_proof_tree)
|
||||
{
|
||||
if let (Some(tree), DumpSolverProofTree::Always) = (
|
||||
&tree,
|
||||
infcx.tcx.sess.opts.unstable_opts.next_solver.map(|c| c.dump_tree).unwrap_or_default(),
|
||||
) {
|
||||
let mut lock = std::io::stdout().lock();
|
||||
let _ = lock.write_fmt(format_args!("{tree:?}\n"));
|
||||
let _ = lock.flush();
|
||||
@ -377,7 +378,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
|
||||
//
|
||||
// This assert was removed as it did not hold for goals constraining
|
||||
// an inference variable to a recursive alias, e.g. in
|
||||
// tests/ui/traits/new-solver/overflow/recursive-self-normalization.rs.
|
||||
// tests/ui/traits/next-solver/overflow/recursive-self-normalization.rs.
|
||||
//
|
||||
// Once we have decided on how to handle trait-system-refactor-initiative#75,
|
||||
// we should re-add an assert here.
|
||||
@ -421,7 +422,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
|
||||
self.compute_const_evaluatable_goal(Goal { param_env, predicate: ct })
|
||||
}
|
||||
ty::PredicateKind::ConstEquate(_, _) => {
|
||||
bug!("ConstEquate should not be emitted when `-Ztrait-solver=next` is active")
|
||||
bug!("ConstEquate should not be emitted when `-Znext-solver` is active")
|
||||
}
|
||||
ty::PredicateKind::NormalizesTo(predicate) => {
|
||||
self.compute_normalizes_to_goal(Goal { param_env, predicate })
|
||||
|
@ -265,7 +265,7 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
|
||||
GenerateProofTree::Never => ProofTreeBuilder::new_noop(),
|
||||
GenerateProofTree::IfEnabled => {
|
||||
let opts = &tcx.sess.opts.unstable_opts;
|
||||
match opts.dump_solver_proof_tree {
|
||||
match opts.next_solver.map(|c| c.dump_tree).unwrap_or_default() {
|
||||
DumpSolverProofTree::Always => ProofTreeBuilder::new_root(),
|
||||
// `OnError` is handled by reevaluating goals in error
|
||||
// reporting with `GenerateProofTree::Yes`.
|
||||
|
@ -1,7 +1,6 @@
|
||||
//! The next-generation trait solver, currently still WIP.
|
||||
//!
|
||||
//! As a user of rust, you can use `-Ztrait-solver=next` or `next-coherence`
|
||||
//! to enable the new trait solver always, or just within coherence, respectively.
|
||||
//! As a user of rust, you can use `-Znext-solver` to enable the new trait solver.
|
||||
//!
|
||||
//! As a developer of rustc, you shouldn't be using the new trait
|
||||
//! solver without asking the trait-system-refactor-initiative, but it can
|
||||
@ -248,7 +247,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|
||||
return None;
|
||||
}
|
||||
|
||||
// FIXME(-Ztrait-solver=next): We should instead try to find a `Certainty::Yes` response with
|
||||
// FIXME(-Znext-solver): We should instead try to find a `Certainty::Yes` response with
|
||||
// a subset of the constraints that all the other responses have.
|
||||
let one = responses[0];
|
||||
if responses[1..].iter().all(|&resp| resp == one) {
|
||||
|
@ -38,7 +38,7 @@ struct StackEntry<'tcx> {
|
||||
/// If we were to use that result when later trying to prove another cycle
|
||||
/// participant, we can end up with unstable query results.
|
||||
///
|
||||
/// See tests/ui/new-solver/coinduction/incompleteness-unstable-result.rs for
|
||||
/// See tests/ui/next-solver/coinduction/incompleteness-unstable-result.rs for
|
||||
/// an example of where this is needed.
|
||||
cycle_participants: FxHashSet<CanonicalInput<'tcx>>,
|
||||
}
|
||||
@ -237,7 +237,7 @@ impl<'tcx> SearchGraph<'tcx> {
|
||||
// in unstable results due to incompleteness.
|
||||
//
|
||||
// However, a test for this would be an even more complex version of
|
||||
// tests/ui/traits/new-solver/coinduction/incompleteness-unstable-result.rs.
|
||||
// tests/ui/traits/next-solver/coinduction/incompleteness-unstable-result.rs.
|
||||
// I did not bother to write such a test and we have no regression test
|
||||
// for this. It would be good to have such a test :)
|
||||
#[allow(rustc::potential_query_instability)]
|
||||
@ -248,7 +248,7 @@ impl<'tcx> SearchGraph<'tcx> {
|
||||
// until we reach a fixpoint. It is not enough to simply retry the
|
||||
// `root` goal of this cycle.
|
||||
//
|
||||
// See tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.rs
|
||||
// See tests/ui/traits/next-solver/cycles/fixpoint-rerun-all-cycle-heads.rs
|
||||
// for an example.
|
||||
self.stack[stack_depth].has_been_used = true;
|
||||
return if let Some(result) = self.stack[stack_depth].provisional_result {
|
||||
|
@ -445,7 +445,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
|
||||
return Err(NoSolution);
|
||||
}
|
||||
|
||||
// FIXME(-Ztrait-solver=next): Implement this when we get const working in the new solver
|
||||
// FIXME(-Znext-solver): Implement this when we get const working in the new solver
|
||||
|
||||
// `Destruct` is automatically implemented for every type in
|
||||
// non-const environments.
|
||||
|
@ -855,7 +855,7 @@ where
|
||||
}
|
||||
|
||||
fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||
// Need to lazily normalize here in with `-Ztrait-solver=next-coherence`.
|
||||
// Need to lazily normalize here in with `-Znext-solver=coherence`.
|
||||
let ty = match (self.lazily_normalize_ty)(ty) {
|
||||
Ok(ty) => ty,
|
||||
Err(err) => return ControlFlow::Break(OrphanCheckEarlyExit::NormalizationFailure(err)),
|
||||
@ -1069,7 +1069,7 @@ impl<'a, 'tcx> ProofTreeVisitor<'tcx> for AmbiguityCausesVisitor<'a, 'tcx> {
|
||||
let lazily_normalize_ty = |ty: Ty<'tcx>| {
|
||||
let mut fulfill_cx = <dyn TraitEngine<'tcx>>::new(infcx);
|
||||
if matches!(ty.kind(), ty::Alias(..)) {
|
||||
// FIXME(-Ztrait-solver=next-coherence): we currently don't
|
||||
// FIXME(-Znext-solver=coherence): we currently don't
|
||||
// normalize opaque types here, resulting in diverging behavior
|
||||
// for TAITs.
|
||||
match infcx
|
||||
|
@ -25,7 +25,6 @@ use rustc_middle::ty::ToPredicate;
|
||||
use rustc_middle::ty::TypeFoldable;
|
||||
use rustc_middle::ty::Variance;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_session::config::TraitSolver;
|
||||
|
||||
pub trait TraitEngineExt<'tcx> {
|
||||
fn new(infcx: &InferCtxt<'tcx>) -> Box<Self>;
|
||||
@ -33,18 +32,16 @@ pub trait TraitEngineExt<'tcx> {
|
||||
|
||||
impl<'tcx> TraitEngineExt<'tcx> for dyn TraitEngine<'tcx> {
|
||||
fn new(infcx: &InferCtxt<'tcx>) -> Box<Self> {
|
||||
match (infcx.tcx.sess.opts.unstable_opts.trait_solver, infcx.next_trait_solver()) {
|
||||
(TraitSolver::Classic, false) | (TraitSolver::NextCoherence, false) => {
|
||||
Box::new(FulfillmentContext::new(infcx))
|
||||
}
|
||||
(TraitSolver::Classic | TraitSolver::Next | TraitSolver::NextCoherence, true) => {
|
||||
Box::new(NextFulfillmentCtxt::new(infcx))
|
||||
}
|
||||
(TraitSolver::Next, false) => bug!(
|
||||
"incompatible combination of -Ztrait-solver flag ({:?}) and InferCtxt::next_trait_solver ({:?})",
|
||||
infcx.tcx.sess.opts.unstable_opts.trait_solver,
|
||||
infcx.next_trait_solver()
|
||||
),
|
||||
if infcx.next_trait_solver() {
|
||||
Box::new(NextFulfillmentCtxt::new(infcx))
|
||||
} else {
|
||||
let new_solver_globally =
|
||||
infcx.tcx.sess.opts.unstable_opts.next_solver.map_or(false, |c| c.globally);
|
||||
assert!(
|
||||
!new_solver_globally,
|
||||
"using old solver even though new solver is enabled globally"
|
||||
);
|
||||
Box::new(FulfillmentContext::new(infcx))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ use rustc_middle::ty::{
|
||||
self, SubtypePredicate, ToPolyTraitRef, ToPredicate, TraitRef, Ty, TyCtxt, TypeFoldable,
|
||||
TypeVisitable, TypeVisitableExt,
|
||||
};
|
||||
use rustc_session::config::{DumpSolverProofTree, TraitSolver};
|
||||
use rustc_session::config::DumpSolverProofTree;
|
||||
use rustc_session::Limit;
|
||||
use rustc_span::def_id::LOCAL_CRATE;
|
||||
use rustc_span::symbol::sym;
|
||||
@ -370,7 +370,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
) {
|
||||
let tcx = self.tcx;
|
||||
|
||||
if tcx.sess.opts.unstable_opts.dump_solver_proof_tree == DumpSolverProofTree::OnError {
|
||||
if tcx.sess.opts.unstable_opts.next_solver.map(|c| c.dump_tree).unwrap_or_default()
|
||||
== DumpSolverProofTree::OnError
|
||||
{
|
||||
dump_proof_tree(root_obligation, self.infcx);
|
||||
}
|
||||
|
||||
@ -812,23 +814,20 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
|
||||
ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(ty)) => {
|
||||
let ty = self.resolve_vars_if_possible(ty);
|
||||
match self.tcx.sess.opts.unstable_opts.trait_solver {
|
||||
TraitSolver::Classic => {
|
||||
// WF predicates cannot themselves make
|
||||
// errors. They can only block due to
|
||||
// ambiguity; otherwise, they always
|
||||
// degenerate into other obligations
|
||||
// (which may fail).
|
||||
span_bug!(span, "WF predicate not satisfied for {:?}", ty);
|
||||
}
|
||||
TraitSolver::Next | TraitSolver::NextCoherence => {
|
||||
// FIXME: we'll need a better message which takes into account
|
||||
// which bounds actually failed to hold.
|
||||
self.tcx.sess.struct_span_err(
|
||||
span,
|
||||
format!("the type `{ty}` is not well-formed"),
|
||||
)
|
||||
}
|
||||
if self.next_trait_solver() {
|
||||
// FIXME: we'll need a better message which takes into account
|
||||
// which bounds actually failed to hold.
|
||||
self.tcx.sess.struct_span_err(
|
||||
span,
|
||||
format!("the type `{ty}` is not well-formed"),
|
||||
)
|
||||
} else {
|
||||
// WF predicates cannot themselves make
|
||||
// errors. They can only block due to
|
||||
// ambiguity; otherwise, they always
|
||||
// degenerate into other obligations
|
||||
// (which may fail).
|
||||
span_bug!(span, "WF predicate not satisfied for {:?}", ty);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1562,7 +1561,9 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
|
||||
#[instrument(skip(self), level = "debug")]
|
||||
fn report_fulfillment_error(&self, error: &FulfillmentError<'tcx>) {
|
||||
if self.tcx.sess.opts.unstable_opts.dump_solver_proof_tree == DumpSolverProofTree::OnError {
|
||||
if self.tcx.sess.opts.unstable_opts.next_solver.map(|c| c.dump_tree).unwrap_or_default()
|
||||
== DumpSolverProofTree::OnError
|
||||
{
|
||||
dump_proof_tree(&error.root_obligation, self.infcx);
|
||||
}
|
||||
|
||||
@ -1668,7 +1669,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
)
|
||||
.into(),
|
||||
};
|
||||
// FIXME(-Ztrait-solver=next): For diagnostic purposes, it would be nice
|
||||
// FIXME(-Znext-solver): For diagnostic purposes, it would be nice
|
||||
// to deeply normalize this type.
|
||||
let normalized_term =
|
||||
ocx.normalize(&obligation.cause, obligation.param_env, unnormalized_term);
|
||||
|
@ -315,7 +315,7 @@ pub fn normalize_param_env_or_error<'tcx>(
|
||||
// We do not normalize types here as there is no backwards compatibility requirement
|
||||
// for us to do so.
|
||||
//
|
||||
// FIXME(-Ztrait-solver=next): remove this hack since we have deferred projection equality
|
||||
// FIXME(-Znext-solver): remove this hack since we have deferred projection equality
|
||||
predicate.fold_with(&mut ConstNormalizer(tcx))
|
||||
}),
|
||||
)
|
||||
@ -386,7 +386,7 @@ pub fn normalize_param_env_or_error<'tcx>(
|
||||
|
||||
/// Normalize a type and process all resulting obligations, returning any errors.
|
||||
///
|
||||
/// FIXME(-Ztrait-solver=next): This should be replaced by `At::deeply_normalize`
|
||||
/// FIXME(-Znext-solver): This should be replaced by `At::deeply_normalize`
|
||||
/// which has the same behavior with the new solver. Because using a separate
|
||||
/// fulfillment context worsens caching in the old solver, `At::deeply_normalize`
|
||||
/// is still lazy with the old solver as it otherwise negatively impacts perf.
|
||||
|
@ -67,7 +67,7 @@ pub trait NormalizeExt<'tcx> {
|
||||
/// same goals in both a temporary and the shared context which negatively impacts
|
||||
/// performance as these don't share caching.
|
||||
///
|
||||
/// FIXME(-Ztrait-solver=next): This has the same behavior as `traits::fully_normalize`
|
||||
/// FIXME(-Znext-solver): This has the same behavior as `traits::fully_normalize`
|
||||
/// in the new solver, but because of performance reasons, we currently reuse an
|
||||
/// existing fulfillment context in the old solver. Once we also eagerly prove goals with
|
||||
/// the old solver or have removed the old solver, remove `traits::fully_normalize` and
|
||||
|
@ -72,7 +72,7 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
|
||||
let mut fulfill_cx = crate::solve::FulfillmentCtxt::new(self);
|
||||
fulfill_cx.register_predicate_obligation(self, obligation.clone());
|
||||
// True errors
|
||||
// FIXME(-Ztrait-solver=next): Overflows are reported as ambig here, is that OK?
|
||||
// FIXME(-Znext-solver): Overflows are reported as ambig here, is that OK?
|
||||
if !fulfill_cx.select_where_possible(self).is_empty() {
|
||||
Ok(EvaluationResult::EvaluatedToErr)
|
||||
} else if !fulfill_cx.select_all_or_error(self).is_empty() {
|
||||
|
@ -26,7 +26,7 @@ impl<'tcx> super::QueryTypeOp<'tcx> for AscribeUserType<'tcx> {
|
||||
tcx.type_op_ascribe_user_type(canonicalized)
|
||||
}
|
||||
|
||||
fn perform_locally_in_new_solver(
|
||||
fn perform_locally_with_next_solver(
|
||||
ocx: &ObligationCtxt<'_, 'tcx>,
|
||||
key: ParamEnvAnd<'tcx, Self>,
|
||||
) -> Result<Self::QueryResponse, NoSolution> {
|
||||
|
@ -23,7 +23,7 @@ impl<'tcx> super::QueryTypeOp<'tcx> for Eq<'tcx> {
|
||||
tcx.type_op_eq(canonicalized)
|
||||
}
|
||||
|
||||
fn perform_locally_in_new_solver(
|
||||
fn perform_locally_with_next_solver(
|
||||
ocx: &ObligationCtxt<'_, 'tcx>,
|
||||
key: ParamEnvAnd<'tcx, Self>,
|
||||
) -> Result<Self::QueryResponse, NoSolution> {
|
||||
|
@ -50,7 +50,7 @@ impl<'tcx> super::QueryTypeOp<'tcx> for ImpliedOutlivesBounds<'tcx> {
|
||||
tcx.implied_outlives_bounds(canonicalized)
|
||||
}
|
||||
|
||||
fn perform_locally_in_new_solver(
|
||||
fn perform_locally_with_next_solver(
|
||||
ocx: &ObligationCtxt<'_, 'tcx>,
|
||||
key: ParamEnvAnd<'tcx, Self>,
|
||||
) -> Result<Self::QueryResponse, NoSolution> {
|
||||
|
@ -89,7 +89,7 @@ pub trait QueryTypeOp<'tcx>: fmt::Debug + Copy + TypeFoldable<TyCtxt<'tcx>> + 't
|
||||
/// make sure to feed it predefined opaque types and the defining anchor
|
||||
/// and that would require duplicating all of the tcx queries. Instead,
|
||||
/// just perform these ops locally.
|
||||
fn perform_locally_in_new_solver(
|
||||
fn perform_locally_with_next_solver(
|
||||
ocx: &ObligationCtxt<'_, 'tcx>,
|
||||
key: ParamEnvAnd<'tcx, Self>,
|
||||
) -> Result<Self::QueryResponse, NoSolution>;
|
||||
@ -149,7 +149,7 @@ where
|
||||
if infcx.next_trait_solver() {
|
||||
return Ok(scrape_region_constraints(
|
||||
infcx,
|
||||
|ocx| QueryTypeOp::perform_locally_in_new_solver(ocx, self),
|
||||
|ocx| QueryTypeOp::perform_locally_with_next_solver(ocx, self),
|
||||
"query type op",
|
||||
span,
|
||||
)?
|
||||
|
@ -25,11 +25,11 @@ where
|
||||
T::type_op_method(tcx, canonicalized)
|
||||
}
|
||||
|
||||
fn perform_locally_in_new_solver(
|
||||
fn perform_locally_with_next_solver(
|
||||
ocx: &ObligationCtxt<'_, 'tcx>,
|
||||
key: ParamEnvAnd<'tcx, Self>,
|
||||
) -> Result<Self::QueryResponse, NoSolution> {
|
||||
// FIXME(-Ztrait-solver=next): shouldn't be using old normalizer
|
||||
// FIXME(-Znext-solver): shouldn't be using old normalizer
|
||||
Ok(ocx.normalize(&ObligationCause::dummy(), key.param_env, key.value.value))
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ impl<'tcx> super::QueryTypeOp<'tcx> for DropckOutlives<'tcx> {
|
||||
tcx.dropck_outlives(canonicalized)
|
||||
}
|
||||
|
||||
fn perform_locally_in_new_solver(
|
||||
fn perform_locally_with_next_solver(
|
||||
ocx: &ObligationCtxt<'_, 'tcx>,
|
||||
key: ParamEnvAnd<'tcx, Self>,
|
||||
) -> Result<Self::QueryResponse, NoSolution> {
|
||||
|
@ -40,7 +40,7 @@ impl<'tcx> super::QueryTypeOp<'tcx> for ProvePredicate<'tcx> {
|
||||
tcx.type_op_prove_predicate(canonicalized)
|
||||
}
|
||||
|
||||
fn perform_locally_in_new_solver(
|
||||
fn perform_locally_with_next_solver(
|
||||
ocx: &ObligationCtxt<'_, 'tcx>,
|
||||
key: ParamEnvAnd<'tcx, Self>,
|
||||
) -> Result<Self::QueryResponse, NoSolution> {
|
||||
|
@ -20,7 +20,7 @@ impl<'tcx> super::QueryTypeOp<'tcx> for Subtype<'tcx> {
|
||||
tcx.type_op_subtype(canonicalized)
|
||||
}
|
||||
|
||||
fn perform_locally_in_new_solver(
|
||||
fn perform_locally_with_next_solver(
|
||||
ocx: &ObligationCtxt<'_, 'tcx>,
|
||||
key: ParamEnvAnd<'tcx, Self>,
|
||||
) -> Result<Self::QueryResponse, NoSolution> {
|
||||
|
@ -22,7 +22,7 @@ impl<'tcx> StructurallyNormalizeExt<'tcx> for At<'_, 'tcx> {
|
||||
assert!(!ty.is_ty_var(), "should have resolved vars before calling");
|
||||
|
||||
if self.infcx.next_trait_solver() {
|
||||
// FIXME(-Ztrait-solver=next): correctly handle
|
||||
// FIXME(-Znext-solver): correctly handle
|
||||
// overflow here.
|
||||
for _ in 0..256 {
|
||||
let ty::Alias(ty::Projection | ty::Inherent | ty::Weak, alias) = *ty.kind() else {
|
||||
|
@ -2543,10 +2543,10 @@ impl<'test> TestCx<'test> {
|
||||
rustc.args(&["-Zpolonius"]);
|
||||
}
|
||||
Some(CompareMode::NextSolver) => {
|
||||
rustc.args(&["-Ztrait-solver=next"]);
|
||||
rustc.args(&["-Znext-solver"]);
|
||||
}
|
||||
Some(CompareMode::NextSolverCoherence) => {
|
||||
rustc.args(&["-Ztrait-solver=next-coherence"]);
|
||||
rustc.args(&["-Znext-solver=coherence"]);
|
||||
}
|
||||
Some(CompareMode::SplitDwarf) if self.config.target.contains("windows") => {
|
||||
rustc.args(&["-Csplit-debuginfo=unpacked", "-Zunstable-options"]);
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Testing inference capabilities.
|
||||
// check-pass
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
#![feature(inherent_associated_types)]
|
||||
#![allow(incomplete_features)]
|
||||
|
@ -1,6 +1,6 @@
|
||||
// edition:2021
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
// check-pass
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
@ -1,7 +1,7 @@
|
||||
// revisions: current next
|
||||
//[current] known-bug: #109924
|
||||
//[next] check-pass
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
// edition:2021
|
||||
|
||||
#![feature(return_type_notation)]
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
#![feature(auto_traits)]
|
||||
#![feature(negative_impls)]
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
//[next] known-bug: trait-system-refactor-initiative#71
|
||||
//[current] check-pass
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: old next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
// Tests that we consider `T: Sugar + Fruit` to be ambiguous, even
|
||||
// though no impls are found.
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: old next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
// Tests that we consider `T: Sugar + Fruit` to be ambiguous, even
|
||||
// though no impls are found.
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: old next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
// Tests that we consider `Box<U>: !Sugar` to be ambiguous, even
|
||||
// though we see no impl of `Sugar` for `Box`. Therefore, an overlap
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: old next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
// Tests that we consider `Box<U>: !Sugar` to be ambiguous, even
|
||||
// though we see no impl of `Sugar` for `Box`. Therefore, an overlap
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: old next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
struct S;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
struct MyType;
|
||||
trait MyTrait<S> {}
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: old next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
// A regression test for #105787
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
//revisions: old next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
// A regression test for #105787
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// check-pass
|
||||
// revisions: old next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
// If we use canonical goals during trait solving we have to reevaluate
|
||||
// the root goal of a cycle until we hit a fixpoint.
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: old next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
struct Foo<const N: u8 = { 255 + 1 }>;
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
@ -3,7 +3,7 @@
|
||||
// overall context for what caused the evaluation.
|
||||
|
||||
// revisions: old next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
const ONE: usize = 1;
|
||||
const TWO: usize = 2;
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
// check-pass
|
||||
|
||||
#![feature(coroutines, coroutine_trait, coroutine_clone)]
|
||||
|
@ -1,6 +1,6 @@
|
||||
// revisions: next old
|
||||
//compile-flags: --edition 2024 -Zunstable-options
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
// check-pass
|
||||
#![feature(gen_blocks)]
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// revisions: next old
|
||||
//compile-flags: --edition 2024 -Zunstable-options
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
// run-pass
|
||||
#![feature(gen_blocks)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
// run-pass
|
||||
|
||||
#![feature(coroutines, coroutine_trait)]
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
#![feature(coroutines)]
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// run-pass
|
||||
// revisions: current next
|
||||
//[current] compile-flags: -C opt-level=0
|
||||
//[next] compile-flags: -Ztrait-solver=next -C opt-level=0
|
||||
//[next] compile-flags: -Znext-solver -C opt-level=0
|
||||
|
||||
#![feature(dyn_star)]
|
||||
#![allow(incomplete_features)]
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
#![feature(dyn_star)]
|
||||
#![allow(incomplete_features)]
|
||||
|
@ -1,7 +1,7 @@
|
||||
// revisions: current
|
||||
// incremental
|
||||
|
||||
// FIXME(-Ztrait-solver=next): THis currently results in unstable query results:
|
||||
// FIXME(-Znext-solver): THis currently results in unstable query results:
|
||||
// `normalizes-to(opaque, opaque)` changes from `Maybe(Ambiguous)` to `Maybe(Overflow)`
|
||||
// once the hidden type of the opaque is already defined to be itself.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: old next
|
||||
//[next] compile-flags: -Ztrait-solver=next-coherence
|
||||
//[next] compile-flags: -Znext-solver=coherence
|
||||
#![feature(coerce_unsized)]
|
||||
#![feature(unsize)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
fn changer<'a>(mut things: Box<dyn Iterator<Item=&'a mut u8>>) {
|
||||
for item in *things { *item = 0 }
|
||||
@ -13,7 +13,7 @@ fn changer<'a>(mut things: Box<dyn Iterator<Item=&'a mut u8>>) {
|
||||
//[next]~| ERROR the type `Option<<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item>` is not well-formed
|
||||
//[next]~| ERROR the size for values of type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be known at compilation time
|
||||
//[next]~| ERROR type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be dereferenced
|
||||
// FIXME(-Ztrait-solver=next): these error messages are horrible and have to be
|
||||
// FIXME(-Znext-solver): these error messages are horrible and have to be
|
||||
// improved before we stabilize the new solver.
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
trait A {
|
||||
type B<'b>;
|
||||
|
@ -1,6 +1,6 @@
|
||||
// run-pass
|
||||
// revisions: old next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
#![allow(coherence_leak_check)]
|
||||
|
||||
trait Trait: Sized {
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: classic next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
//[next] check-pass
|
||||
|
||||
fn ice()
|
||||
|
@ -1,7 +1,7 @@
|
||||
// ignore-tidy-linelength
|
||||
// edition:2021
|
||||
// revisions: classic next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
//[next] check-pass
|
||||
//[classic] known-bug: #112347
|
||||
//[classic] build-fail
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: old next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
//[old] check-pass
|
||||
//[next] known-bug: #109764
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: old next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
// Tests that type alias impls traits do not leak auto-traits for
|
||||
// the purposes of coherence checking
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
// check-pass
|
||||
|
||||
use std::path::Path;
|
||||
|
@ -1,6 +1,6 @@
|
||||
// revisions: current next
|
||||
// compile-flags: -Zverbose
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
// normalize-stderr-test "DefId\([^\)]+\)" -> "DefId(..)"
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
@ -1,6 +1,6 @@
|
||||
// check-pass
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
|
||||
fn main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
// check-pass
|
||||
// compile-flags: -Ztrait-solver=next
|
||||
// compile-flags: -Znext-solver
|
||||
|
||||
fn foo<'a: 'a>(x: &'a Vec<i32>) -> impl Sized {
|
||||
()
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
// edition:2021
|
||||
|
||||
mod hyper {
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
#![feature(coroutines, coroutine_trait)]
|
||||
|
||||
use std::ops::{Coroutine, CoroutineState};
|
||||
|
@ -1,6 +1,6 @@
|
||||
// build-pass
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
fn test() -> Option<impl Sized> {
|
||||
Some("")
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
//[next] check-pass
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
type A = impl Foo; //[current]~ ERROR unconstrained opaque type
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
//[next] check-pass
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// A test exploiting the bug behind #25860 except with
|
||||
// implied trait bounds which currently don't exist without `-Ztrait-solver=chalk`.
|
||||
// implied trait bounds which currently don't exist.
|
||||
use std::marker::PhantomData;
|
||||
struct Foo<'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>)
|
||||
where
|
||||
|
@ -1,6 +1,6 @@
|
||||
// check-pass
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
#![allow(non_upper_case_globals)]
|
||||
#![allow(dead_code)]
|
||||
|
@ -1,7 +1,7 @@
|
||||
// check-pass
|
||||
// pretty-expanded FIXME #23616
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
use std::slice;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// run-pass
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
use std::ops::Index;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// check-pass
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
#![feature(lazy_type_alias)]
|
||||
//~^ WARN the feature `lazy_type_alias` is incomplete
|
||||
|
@ -1,7 +1,7 @@
|
||||
// check that the `for<T> T: From<!>` impl is reserved
|
||||
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next-coherence
|
||||
//[next] compile-flags: -Znext-solver=coherence
|
||||
|
||||
#![feature(never_type)]
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// check-pass
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
use std::ops::Deref;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// check-pass
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
trait Foo {
|
||||
type Bar<'a>
|
||||
|
@ -1,6 +1,6 @@
|
||||
// run-pass
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
#![allow(unused_must_use)]
|
||||
#![feature(c_unwind)]
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Check that we can manually implement an object-unsafe trait for its trait object.
|
||||
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
// run-pass
|
||||
|
||||
#![feature(object_safe_for_dispatch)]
|
||||
|
@ -1,6 +1,6 @@
|
||||
// revisions: classic coherence next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[coherence] compile-flags: -Ztrait-solver=next-coherence
|
||||
//[next] compile-flags: -Znext-solver
|
||||
//[coherence] compile-flags: -Znext-solver=coherence
|
||||
//[classic] check-pass
|
||||
//[classic] known-bug: #105782
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// run-pass
|
||||
// revisions: classic next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
|
||||
trait Foo: Fn(i32) -> i32 + Send {}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// check-pass
|
||||
// compile-flags: -Ztrait-solver=next
|
||||
// compile-flags: -Znext-solver
|
||||
|
||||
// See https://github.com/rust-lang/trait-system-refactor-initiative/issues/1
|
||||
// a minimization of a pattern in core.
|
||||
|
@ -1,5 +1,5 @@
|
||||
// check-pass
|
||||
// compile-flags: -Ztrait-solver=next
|
||||
// compile-flags: -Znext-solver
|
||||
|
||||
// See https://github.com/rust-lang/trait-system-refactor-initiative/issues/1,
|
||||
// a minimization of a pattern in core.
|
||||
|
@ -1,5 +1,5 @@
|
||||
// revisions: old next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] compile-flags: -Znext-solver
|
||||
// run-pass
|
||||
|
||||
// A test for https://github.com/rust-lang/trait-system-refactor-initiative/issues/45.
|
@ -1,4 +1,4 @@
|
||||
// compile-flags: -Ztrait-solver=next
|
||||
// compile-flags: -Znext-solver
|
||||
|
||||
// Makes sure that alias bounds are not unsound!
|
||||
|
@ -1,5 +1,5 @@
|
||||
// check-pass
|
||||
// compile-flags: -Ztrait-solver=next
|
||||
// compile-flags: -Znext-solver
|
||||
|
||||
trait Foo {
|
||||
type Gat<'a>
|
@ -1,5 +1,5 @@
|
||||
// check-pass
|
||||
// compile-flags: -Ztrait-solver=next
|
||||
// compile-flags: -Znext-solver
|
||||
// regression test for trait-system-refactor-initiative#68
|
||||
trait Identity {
|
||||
type Assoc: ?Sized;
|
@ -1,5 +1,5 @@
|
||||
// check-pass
|
||||
// compile-flags: -Ztrait-solver=next
|
||||
// compile-flags: -Znext-solver
|
||||
|
||||
fn test<T: Iterator>(x: T::Item) -> impl Sized {
|
||||
x
|
@ -1,4 +1,4 @@
|
||||
// compile-flags: -Ztrait-solver=next
|
||||
// compile-flags: -Znext-solver
|
||||
// check-pass
|
||||
|
||||
trait Trait {
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user