Skip to content

Commit

Permalink
Rollup merge of #110531 - lcnr:type-system-stuff, r=aliemjay
Browse files Browse the repository at this point in the history
small type system cleanup
  • Loading branch information
matthiaskrgr authored Apr 19, 2023
2 parents 9a13f4f + 16d061e commit 75de33c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 24 deletions.
8 changes: 4 additions & 4 deletions compiler/rustc_middle/src/ty/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ impl FlagComputation {

&ty::Alias(ty::Projection, data) => {
self.add_flags(TypeFlags::HAS_TY_PROJECTION);
self.add_projection_ty(data);
self.add_alias_ty(data);
}

&ty::Alias(ty::Opaque, ty::AliasTy { substs, .. }) => {
Expand Down Expand Up @@ -267,7 +267,7 @@ impl FlagComputation {
projection_ty,
term,
})) => {
self.add_projection_ty(projection_ty);
self.add_alias_ty(projection_ty);
self.add_term(term);
}
ty::PredicateKind::WellFormed(arg) => {
Expand Down Expand Up @@ -372,8 +372,8 @@ impl FlagComputation {
}
}

fn add_projection_ty(&mut self, projection_ty: ty::AliasTy<'_>) {
self.add_substs(projection_ty.substs);
fn add_alias_ty(&mut self, alias_ty: ty::AliasTy<'_>) {
self.add_substs(alias_ty.substs);
}

fn add_substs(&mut self, substs: &[GenericArg<'_>]) {
Expand Down
31 changes: 11 additions & 20 deletions compiler/rustc_trait_selection/src/traits/wf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,29 +170,20 @@ pub fn predicate_obligations<'tcx>(
ty::PredicateKind::WellFormed(arg) => {
wf.compute(arg);
}
ty::PredicateKind::ObjectSafe(_) => {}
ty::PredicateKind::ClosureKind(..) => {}
ty::PredicateKind::Subtype(ty::SubtypePredicate { a, b, a_is_expected: _ }) => {
wf.compute(a.into());
wf.compute(b.into());
}
ty::PredicateKind::Coerce(ty::CoercePredicate { a, b }) => {
wf.compute(a.into());
wf.compute(b.into());
}

ty::PredicateKind::ConstEvaluatable(ct) => {
wf.compute(ct.into());
}
ty::PredicateKind::ConstEquate(c1, c2) => {
wf.compute(c1.into());
wf.compute(c2.into());
}
ty::PredicateKind::Ambiguous => {}
ty::PredicateKind::TypeWellFormedFromEnv(..) => {
bug!("TypeWellFormedFromEnv is only used for Chalk")
}
ty::PredicateKind::AliasRelate(..) => {
bug!("We should only wf check where clauses and `AliasRelate` is not a `Clause`")

ty::PredicateKind::ObjectSafe(_)
| ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::Subtype(..)
| ty::PredicateKind::Coerce(..)
| ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::Ambiguous
| ty::PredicateKind::AliasRelate(..)
| ty::PredicateKind::TypeWellFormedFromEnv(..) => {
bug!("We should only wf check where clauses, unexpected predicate: {predicate:?}")
}
}

Expand Down

0 comments on commit 75de33c

Please sign in to comment.