Skip to content

Commit 6f5b1d2

Browse files
committed
Other logics
1 parent ff3985b commit 6f5b1d2

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
@@ -2370,9 +2370,12 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> {
23702370
// We lower empty bounds like `Vec<dyn Copy>:` as
23712371
// `WellFormed(Vec<dyn Copy>)`, which will later get checked by
23722372
// regular WF checking
2373-
if let ty::ClauseKind::WellFormed(..) = pred.kind().skip_binder() {
2374-
continue;
2373+
2374+
match pred.kind().skip_binder() {
2375+
ty::ClauseKind::WellFormed(..) | ty::ClauseKind::UnstableFeature(..) => continue,
2376+
_ => {}
23752377
}
2378+
23762379
// Match the existing behavior.
23772380
if pred.is_global() && !pred.has_type_flags(TypeFlags::HAS_BINDER_VARS) {
23782381
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
@@ -53,6 +53,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
5353
| ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..))
5454
| ty::PredicateKind::ConstEquate(..)
5555
| ty::PredicateKind::Clause(ty::ClauseKind::HostEffect(..))
56+
| ty::PredicateKind::Clause(ty::ClauseKind::UnstableFeature(_))
5657
| ty::PredicateKind::Ambiguous => false,
5758
}
5859
}

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
@@ -1568,8 +1568,9 @@ impl<'tcx> LateLintPass<'tcx> for TrivialConstraints {
15681568
ClauseKind::TypeOutlives(..) |
15691569
ClauseKind::RegionOutlives(..) => "lifetime",
15701570

1571+
ClauseKind::UnstableFeature(_)
15711572
// `ConstArgHasType` is never global as `ct` is always a param
1572-
ClauseKind::ConstArgHasType(..)
1573+
| ClauseKind::ConstArgHasType(..)
15731574
// Ignore projections, as they can only be global
15741575
// if the trait bound is global
15751576
| 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;
@@ -816,6 +817,14 @@ impl<'tcx> rustc_type_ir::inherent::Features<TyCtxt<'tcx>> for &'tcx rustc_featu
816817
fn associated_const_equality(self) -> bool {
817818
self.associated_const_equality()
818819
}
820+
821+
fn impl_stability(self) -> bool {
822+
self.impl_stability()
823+
}
824+
825+
fn enabled(self, symbol: <TyCtxt<'tcx> as Interner>::Symbol) -> bool {
826+
self.enabled(symbol)
827+
}
819828
}
820829

821830
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
@@ -596,6 +596,9 @@ where
596596
ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(ct, ty)) => {
597597
self.compute_const_arg_has_type_goal(Goal { param_env, predicate: (ct, ty) })
598598
}
599+
ty::PredicateKind::Clause(ty::ClauseKind::UnstableFeature(symbol)) => {
600+
self.compute_unstable_feature_goal(param_env, symbol)
601+
}
599602
ty::PredicateKind::Subtype(predicate) => {
600603
self.compute_subtype_goal(Goal { param_env, predicate })
601604
}

0 commit comments

Comments
 (0)