Skip to content

Commit 6ce5109

Browse files
oli-obkfee1-dead
authored andcommitted
typeck and borrowck compile
1 parent 11026ec commit 6ce5109

File tree

7 files changed

+19
-15
lines changed

7 files changed

+19
-15
lines changed

compiler/rustc_borrowck/src/diagnostics/region_name.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
642642
(
643643
GenericArgKind::Lifetime(_)
644644
| GenericArgKind::Type(_)
645+
| GenericArgKind::Constness(_)
645646
| GenericArgKind::Const(_),
646647
_,
647648
) => {

compiler/rustc_borrowck/src/type_check/constraint_conversion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
126126
.type_must_outlive(origin, t1, r2);
127127
}
128128

129-
GenericArgKind::Const(_) => {
129+
GenericArgKind::Constness(_) | GenericArgKind::Const(_) => {
130130
// Consts cannot outlive one another, so we
131131
// don't need to handle any relations here.
132132
}

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2608,7 +2608,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
26082608
(outlives_requirements.category, outlives_requirements.blame_span),
26092609
))
26102610
}
2611-
GenericArgKind::Type(_) | GenericArgKind::Const(_) => None,
2611+
GenericArgKind::Type(_)
2612+
| GenericArgKind::Const(_)
2613+
| GenericArgKind::Constness(_) => None,
26122614
}
26132615
})
26142616
.collect();

compiler/rustc_mir_transform/src/shim.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ impl<'tcx> CloneShimBuilder<'tcx> {
342342
// we must subst the self_ty because it's
343343
// otherwise going to be TySelf and we can't index
344344
// or access fields of a Place of type TySelf.
345-
let substs = tcx.mk_substs_trait(self_ty, &[]);
345+
let substs = tcx.mk_substs_trait(self_ty, &[], ty::ConstnessArg::Not);
346346
let sig = tcx.bound_fn_sig(def_id).subst(tcx, substs);
347347
let sig = tcx.erase_late_bound_regions(sig);
348348
let span = tcx.def_span(def_id);
@@ -423,7 +423,7 @@ impl<'tcx> CloneShimBuilder<'tcx> {
423423
) {
424424
let tcx = self.tcx;
425425

426-
let substs = tcx.mk_substs_trait(ty, &[]);
426+
let substs = tcx.mk_substs_trait(ty, &[], ty::ConstnessArg::Not);
427427

428428
// `func == Clone::clone(&ty) -> ty`
429429
let func_ty = tcx.mk_fn_def(self.def_id, substs);
@@ -529,7 +529,8 @@ fn build_call_shim<'tcx>(
529529

530530
// Create substitutions for the `Self` and `Args` generic parameters of the shim body.
531531
let arg_tup = tcx.mk_tup(untuple_args.iter());
532-
let sig_substs = tcx.mk_substs_trait(ty, &[ty::subst::GenericArg::from(arg_tup)]);
532+
let sig_substs =
533+
tcx.mk_substs_trait(ty, &[ty::subst::GenericArg::from(arg_tup)], ty::ConstnessArg::Not);
533534

534535
(Some(sig_substs), Some(untuple_args))
535536
} else {

compiler/rustc_privacy/src/lib.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,9 @@ where
132132

133133
fn visit_predicate(&mut self, predicate: ty::Predicate<'tcx>) -> ControlFlow<V::BreakTy> {
134134
match predicate.kind().skip_binder() {
135-
ty::PredicateKind::Trait(ty::TraitPredicate {
136-
trait_ref,
137-
constness: _,
138-
polarity: _,
139-
}) => self.visit_trait(trait_ref),
135+
ty::PredicateKind::Trait(ty::TraitPredicate { trait_ref, polarity: _ }) => {
136+
self.visit_trait(trait_ref)
137+
}
140138
ty::PredicateKind::Projection(ty::ProjectionPredicate { projection_ty, term }) => {
141139
term.visit_with(self)?;
142140
self.visit_projection_ty(projection_ty)
@@ -1167,7 +1165,7 @@ impl<'tcx> Visitor<'tcx> for TypePrivacyVisitor<'tcx> {
11671165
self.tcx.types.never,
11681166
);
11691167

1170-
for (trait_predicate, _, _) in bounds.trait_bounds {
1168+
for (trait_predicate, _) in bounds.trait_bounds {
11711169
if self.visit_trait(trait_predicate.skip_binder()).is_break() {
11721170
return;
11731171
}

compiler/rustc_typeck/src/check/compare_method.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,9 @@ fn compare_generic_param_kinds<'tcx>(
10131013
// this is exhaustive so that anyone adding new generic param kinds knows
10141014
// to make sure this error is reported for them.
10151015
(Const { .. }, Const { .. }) | (Type { .. }, Type { .. }) => false,
1016-
(Lifetime { .. }, _) | (_, Lifetime { .. }) => unreachable!(),
1016+
(Constness, _) | (_, Constness) | (Lifetime { .. }, _) | (_, Lifetime { .. }) => {
1017+
unreachable!()
1018+
}
10171019
} {
10181020
let param_impl_span = tcx.def_span(param_impl.def_id);
10191021
let param_trait_span = tcx.def_span(param_trait.def_id);
@@ -1033,7 +1035,7 @@ fn compare_generic_param_kinds<'tcx>(
10331035
format!("{} const parameter of type `{}`", prefix, tcx.type_of(param.def_id))
10341036
}
10351037
Type { .. } => format!("{} type parameter", prefix),
1036-
Lifetime { .. } => unreachable!(),
1038+
Constness | Lifetime { .. } => unreachable!(),
10371039
};
10381040

10391041
let trait_header_span = tcx.def_ident_span(tcx.parent(trait_item.def_id)).unwrap();
@@ -1376,6 +1378,7 @@ pub fn check_type_bounds<'tcx>(
13761378
})
13771379
.into()
13781380
}
1381+
GenericParamDefKind::Constness => ty::ConstnessArg::Param.into(),
13791382
});
13801383
let bound_vars = tcx.mk_bound_variable_kinds(bound_vars.into_iter());
13811384
let impl_ty_substs = tcx.intern_substs(&substs);

compiler/rustc_typeck/src/impl_wf_check/min_specialization.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,7 @@ fn trait_predicate_kind<'tcx>(
413413
trait_ref, // TODO review specialization check
414414
polarity: _,
415415
}) => Some(tcx.trait_def(trait_ref.def_id).specialization_kind),
416-
ty::PredicateKind::Trait(_)
417-
| ty::PredicateKind::RegionOutlives(_)
416+
ty::PredicateKind::RegionOutlives(_)
418417
| ty::PredicateKind::TypeOutlives(_)
419418
| ty::PredicateKind::Projection(_)
420419
| ty::PredicateKind::WellFormed(_)

0 commit comments

Comments
 (0)