Skip to content

Commit f1072ac

Browse files
committed
Other logics
1 parent 2242063 commit f1072ac

File tree

26 files changed

+60
-4
lines changed

26 files changed

+60
-4
lines changed

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2368,9 +2368,12 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> {
23682368
// We lower empty bounds like `Vec<dyn Copy>:` as
23692369
// `WellFormed(Vec<dyn Copy>)`, which will later get checked by
23702370
// regular WF checking
2371-
if let ty::ClauseKind::WellFormed(..) = pred.kind().skip_binder() {
2372-
continue;
2371+
2372+
match pred.kind().skip_binder() {
2373+
ty::ClauseKind::WellFormed(..) | ty::ClauseKind::UnstableFeature(..) => continue,
2374+
_ => {}
23732375
}
2376+
23742377
// Match the existing behavior.
23752378
if pred.is_global() && !pred.has_type_flags(TypeFlags::HAS_BINDER_VARS) {
23762379
let pred = self.normalize(span, None, pred);

compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ fn trait_specialization_kind<'tcx>(
499499
| ty::ClauseKind::ConstArgHasType(..)
500500
| ty::ClauseKind::WellFormed(_)
501501
| ty::ClauseKind::ConstEvaluatable(..)
502+
| ty::ClauseKind::UnstableFeature(_)
502503
| ty::ClauseKind::HostEffect(..) => None,
503504
}
504505
}

compiler/rustc_hir_analysis/src/outlives/explicit.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ impl<'tcx> ExplicitPredicatesMap<'tcx> {
5454
| ty::ClauseKind::ConstArgHasType(_, _)
5555
| ty::ClauseKind::WellFormed(_)
5656
| ty::ClauseKind::ConstEvaluatable(_)
57+
| ty::ClauseKind::UnstableFeature(_)
5758
| ty::ClauseKind::HostEffect(..) => {}
5859
}
5960
}

compiler/rustc_hir_typeck/src/fn_ctxt/inspect_obligations.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
5454
| ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..))
5555
| ty::PredicateKind::ConstEquate(..)
5656
| ty::PredicateKind::Clause(ty::ClauseKind::HostEffect(..))
57+
| ty::PredicateKind::Clause(ty::ClauseKind::UnstableFeature(_))
5758
| ty::PredicateKind::Ambiguous => false,
5859
}
5960
}

compiler/rustc_hir_typeck/src/method/probe.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
926926
| ty::ClauseKind::ConstArgHasType(_, _)
927927
| ty::ClauseKind::WellFormed(_)
928928
| ty::ClauseKind::ConstEvaluatable(_)
929+
| ty::ClauseKind::UnstableFeature(_)
929930
| ty::ClauseKind::HostEffect(..) => None,
930931
}
931932
});

compiler/rustc_lint/src/builtin.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1569,8 +1569,9 @@ impl<'tcx> LateLintPass<'tcx> for TrivialConstraints {
15691569
ClauseKind::TypeOutlives(..) |
15701570
ClauseKind::RegionOutlives(..) => "lifetime",
15711571

1572+
ClauseKind::UnstableFeature(_)
15721573
// `ConstArgHasType` is never global as `ct` is always a param
1573-
ClauseKind::ConstArgHasType(..)
1574+
| ClauseKind::ConstArgHasType(..)
15741575
// Ignore projections, as they can only be global
15751576
// if the trait bound is global
15761577
| ClauseKind::Projection(..)

compiler/rustc_middle/src/ty/context.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
132132
type FnInputTys = &'tcx [Ty<'tcx>];
133133
type ParamTy = ParamTy;
134134
type BoundTy = ty::BoundTy;
135+
type Symbol = Symbol;
135136

136137
type PlaceholderTy = ty::PlaceholderType;
137138
type ErrorGuaranteed = ErrorGuaranteed;
@@ -827,6 +828,14 @@ impl<'tcx> rustc_type_ir::inherent::Features<TyCtxt<'tcx>> for &'tcx rustc_featu
827828
fn associated_const_equality(self) -> bool {
828829
self.associated_const_equality()
829830
}
831+
832+
fn impl_stability(self) -> bool {
833+
self.impl_stability()
834+
}
835+
836+
fn enabled(self, symbol: <TyCtxt<'tcx> as Interner>::Symbol) -> bool {
837+
self.enabled(symbol)
838+
}
830839
}
831840

832841
impl<'tcx> rustc_type_ir::inherent::Span<TyCtxt<'tcx>> for Span {

compiler/rustc_middle/src/ty/predicate.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ impl<'tcx> Predicate<'tcx> {
131131
| PredicateKind::Clause(ClauseKind::TypeOutlives(_))
132132
| PredicateKind::Clause(ClauseKind::Projection(_))
133133
| PredicateKind::Clause(ClauseKind::ConstArgHasType(..))
134+
| PredicateKind::Clause(ClauseKind::UnstableFeature(_))
134135
| PredicateKind::DynCompatible(_)
135136
| PredicateKind::Subtype(_)
136137
| PredicateKind::Coerce(_)
@@ -649,6 +650,7 @@ impl<'tcx> Predicate<'tcx> {
649650
PredicateKind::Clause(ClauseKind::Projection(..))
650651
| PredicateKind::Clause(ClauseKind::HostEffect(..))
651652
| PredicateKind::Clause(ClauseKind::ConstArgHasType(..))
653+
| PredicateKind::Clause(ClauseKind::UnstableFeature(_))
652654
| PredicateKind::NormalizesTo(..)
653655
| PredicateKind::AliasRelate(..)
654656
| PredicateKind::Subtype(..)
@@ -670,6 +672,7 @@ impl<'tcx> Predicate<'tcx> {
670672
PredicateKind::Clause(ClauseKind::Trait(..))
671673
| PredicateKind::Clause(ClauseKind::HostEffect(..))
672674
| PredicateKind::Clause(ClauseKind::ConstArgHasType(..))
675+
| PredicateKind::Clause(ClauseKind::UnstableFeature(_))
673676
| PredicateKind::NormalizesTo(..)
674677
| PredicateKind::AliasRelate(..)
675678
| PredicateKind::Subtype(..)

compiler/rustc_middle/src/ty/print/pretty.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3250,6 +3250,7 @@ define_print! {
32503250
ty::ClauseKind::ConstEvaluatable(ct) => {
32513251
p!("the constant `", print(ct), "` can be evaluated")
32523252
}
3253+
ty::ClauseKind::UnstableFeature(symbol) => p!("unstable feature: ", write("`{}`", symbol)),
32533254
}
32543255
}
32553256

compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,9 @@ where
607607
ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(ct, ty)) => {
608608
self.compute_const_arg_has_type_goal(Goal { param_env, predicate: (ct, ty) })
609609
}
610+
ty::PredicateKind::Clause(ty::ClauseKind::UnstableFeature(symbol)) => {
611+
self.compute_unstable_feature_goal(param_env, symbol)
612+
}
610613
ty::PredicateKind::Subtype(predicate) => {
611614
self.compute_subtype_goal(Goal { param_env, predicate })
612615
}

0 commit comments

Comments
 (0)