Skip to content

Commit fbe66a6

Browse files
Address nits
Co-authored-by: Oli Scherer <[email protected]>
1 parent 7196973 commit fbe66a6

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

compiler/rustc_hir_analysis/src/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ fn bounds_from_generic_predicates<'tcx>(
352352
// insert the associated types where they correspond, but for now let's be "lazy" and
353353
// propose this instead of the following valid resugaring:
354354
// `T: Trait, Trait::Assoc = K` → `T: Trait<Assoc = K>`
355-
where_clauses.push(format!("{} = {}", tcx.def_path_str(p.projection_ty.def_id), p.term,));
355+
where_clauses.push(format!("{} = {}", tcx.def_path_str(p.projection_ty.def_id), p.term));
356356
}
357357
let where_clauses = if where_clauses.is_empty() {
358358
String::new()

compiler/rustc_middle/src/ty/fast_reject.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ pub fn simplify_type<'tcx>(
126126
TreatParams::AsPlaceholder => Some(PlaceholderSimplifiedType),
127127
TreatParams::AsInfer => None,
128128
},
129-
ty::Alias(ty::Opaque, ..) | ty::Alias(ty::Projection, _) => match treat_params {
129+
ty::Alias(..) => match treat_params {
130130
// When treating `ty::Param` as a placeholder, projections also
131131
// don't unify with anything else as long as they are fully normalized.
132132
//
@@ -225,10 +225,7 @@ impl DeepRejectCtxt {
225225
match impl_ty.kind() {
226226
// Start by checking whether the type in the impl may unify with
227227
// pretty much everything. Just return `true` in that case.
228-
ty::Param(_)
229-
| ty::Alias(ty::Projection, _)
230-
| ty::Error(_)
231-
| ty::Alias(ty::Opaque, ..) => return true,
228+
ty::Param(_) | ty::Error(_) | ty::Alias(..) => return true,
232229
// These types only unify with inference variables or their own
233230
// variant.
234231
ty::Bool
@@ -326,8 +323,6 @@ impl DeepRejectCtxt {
326323
_ => false,
327324
},
328325

329-
ty::Alias(ty::Opaque, ..) => true,
330-
331326
// Impls cannot contain these types as these cannot be named directly.
332327
ty::FnDef(..) | ty::Closure(..) | ty::Generator(..) => false,
333328

@@ -347,7 +342,7 @@ impl DeepRejectCtxt {
347342
// projections can unify with other stuff.
348343
//
349344
// Looking forward to lazy normalization this is the safer strategy anyways.
350-
ty::Alias(ty::Projection, _) => true,
345+
ty::Alias(..) => true,
351346

352347
ty::Error(_) => true,
353348

compiler/rustc_trait_selection/src/traits/project.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,12 +1377,7 @@ fn assemble_candidates_from_trait_def<'cx, 'tcx>(
13771377
// Check whether the self-type is itself a projection.
13781378
// If so, extract what we know from the trait and try to come up with a good answer.
13791379
let bounds = match *obligation.predicate.self_ty().kind() {
1380-
ty::Alias(ty::Projection, ref data) => {
1381-
tcx.bound_item_bounds(data.def_id).subst(tcx, data.substs)
1382-
}
1383-
ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs }) => {
1384-
tcx.bound_item_bounds(def_id).subst(tcx, substs)
1385-
}
1380+
ty::Alias(_, ref data) => tcx.bound_item_bounds(data.def_id).subst(tcx, data.substs),
13861381
ty::Infer(ty::TyVar(_)) => {
13871382
// If the self-type is an inference variable, then it MAY wind up
13881383
// being a projected type, so induce an ambiguity.

0 commit comments

Comments
 (0)