summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_middle/src/ty/flags.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:25 +0000
commit5363f350887b1e5b5dd21a86f88c8af9d7fea6da (patch)
tree35ca005eb6e0e9a1ba3bb5dbc033209ad445dc17 /compiler/rustc_middle/src/ty/flags.rs
parentAdding debian version 1.66.0+dfsg1-1. (diff)
downloadrustc-5363f350887b1e5b5dd21a86f88c8af9d7fea6da.tar.xz
rustc-5363f350887b1e5b5dd21a86f88c8af9d7fea6da.zip
Merging upstream version 1.67.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_middle/src/ty/flags.rs')
-rw-r--r--compiler/rustc_middle/src/ty/flags.rs37
1 files changed, 32 insertions, 5 deletions
diff --git a/compiler/rustc_middle/src/ty/flags.rs b/compiler/rustc_middle/src/ty/flags.rs
index 7201737be..046a2660a 100644
--- a/compiler/rustc_middle/src/ty/flags.rs
+++ b/compiler/rustc_middle/src/ty/flags.rs
@@ -6,7 +6,7 @@ use std::slice;
pub struct FlagComputation {
pub flags: TypeFlags,
- // see `Ty::outer_exclusive_binder` for details
+ /// see `Ty::outer_exclusive_binder` for details
pub outer_exclusive_binder: ty::DebruijnIndex,
}
@@ -216,14 +216,17 @@ impl FlagComputation {
fn add_predicate_atom(&mut self, atom: ty::PredicateKind<'_>) {
match atom {
- ty::PredicateKind::Trait(trait_pred) => {
+ ty::PredicateKind::Clause(ty::Clause::Trait(trait_pred)) => {
self.add_substs(trait_pred.trait_ref.substs);
}
- ty::PredicateKind::RegionOutlives(ty::OutlivesPredicate(a, b)) => {
+ ty::PredicateKind::Clause(ty::Clause::RegionOutlives(ty::OutlivesPredicate(a, b))) => {
self.add_region(a);
self.add_region(b);
}
- ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(ty, region)) => {
+ ty::PredicateKind::Clause(ty::Clause::TypeOutlives(ty::OutlivesPredicate(
+ ty,
+ region,
+ ))) => {
self.add_ty(ty);
self.add_region(region);
}
@@ -235,7 +238,10 @@ impl FlagComputation {
self.add_ty(a);
self.add_ty(b);
}
- ty::PredicateKind::Projection(ty::ProjectionPredicate { projection_ty, term }) => {
+ ty::PredicateKind::Clause(ty::Clause::Projection(ty::ProjectionPredicate {
+ projection_ty,
+ term,
+ })) => {
self.add_projection_ty(projection_ty);
match term.unpack() {
ty::TermKind::Ty(ty) => self.add_ty(ty),
@@ -259,6 +265,7 @@ impl FlagComputation {
ty::PredicateKind::TypeWellFormedFromEnv(ty) => {
self.add_ty(ty);
}
+ ty::PredicateKind::Ambiguous => {}
}
}
@@ -306,6 +313,26 @@ impl FlagComputation {
self.add_flags(TypeFlags::STILL_FURTHER_SPECIALIZABLE);
}
ty::ConstKind::Value(_) => {}
+ ty::ConstKind::Expr(e) => {
+ use ty::Expr;
+ match e {
+ Expr::Binop(_, l, r) => {
+ self.add_const(l);
+ self.add_const(r);
+ }
+ Expr::UnOp(_, v) => self.add_const(v),
+ Expr::FunctionCall(f, args) => {
+ self.add_const(f);
+ for arg in args {
+ self.add_const(arg);
+ }
+ }
+ Expr::Cast(_, c, t) => {
+ self.add_ty(t);
+ self.add_const(c);
+ }
+ }
+ }
ty::ConstKind::Error(_) => self.add_flags(TypeFlags::HAS_ERROR),
}
}