Skip to content

Commit

Permalink
update use of feature flags
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Dec 14, 2023
1 parent 5d97ada commit 11d16c4
Show file tree
Hide file tree
Showing 218 changed files with 227 additions and 228 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/region_infer/opaque_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/type_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ 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();
Expand Down
Original file line number Diff line number Diff line change
@@ -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)]

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/coercion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/infer/canonical/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/infer/canonical/substitute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/traits/solve/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/fast_reject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,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 })
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_trait_selection/src/solve/mod.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/solve/trait_goals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_trait_selection/src/traits/coherence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1669,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);
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_trait_selection/src/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}),
)
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/traits/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ where
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))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/associated-inherent-types/inference.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/auto-traits/issue-23080-2.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// revisions: current next
//[next] compile-flags: -Ztrait-solver=next
//[next] compile-flags: -Znext-solver

#![feature(auto_traits)]
#![feature(negative_impls)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/closures/infer-signature-from-impl.rs
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/coherence/coherence-overlap-downstream.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/coherence/coherence-overlap-issue-23516.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/coherence/inter-crate-ambiguity-causes-notes.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// revisions: old next
//[next] compile-flags: -Ztrait-solver=next
//[next] compile-flags: -Znext-solver

struct S;

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/coherence/normalize-for-errors.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// revisions: current next
//[next] compile-flags: -Ztrait-solver=next
//[next] compile-flags: -Znext-solver

struct MyType;
trait MyTrait<S> {}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/coherence/occurs-check/associated-type.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// revisions: old next
//[next] compile-flags: -Ztrait-solver=next
//[next] compile-flags: -Znext-solver

// A regression test for #105787

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/coherence/occurs-check/opaques.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//revisions: old next
//[next] compile-flags: -Ztrait-solver=next
//[next] compile-flags: -Znext-solver

// A regression test for #105787

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/coinduction/canonicalization-rerun.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/consts/const-len-underflow-separate-spans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/coroutine/clone-rpit.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/coroutine/gen_block_is_iter.rs
Original file line number Diff line number Diff line change
@@ -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)]

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/coroutine/gen_block_iterate.rs
Original file line number Diff line number Diff line change
@@ -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)]

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/coroutine/non-static-is-unpin.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// revisions: current next
//[next] compile-flags: -Ztrait-solver=next
//[next] compile-flags: -Znext-solver
// run-pass

#![feature(coroutines, coroutine_trait)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/coroutine/static-not-unpin.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// revisions: current next
//[next] compile-flags: -Ztrait-solver=next
//[next] compile-flags: -Znext-solver

#![feature(coroutines)]

Expand Down
Loading

0 comments on commit 11d16c4

Please sign in to comment.