1
Fork 0

Auto merge of #92805 - BoxyUwU:revert-lazy-anon-const-substs, r=lcnr

partially revertish `lazily "compute" anon const default substs`

reverts #87280 except for some of the changes around `ty::Unevaluated` having a visitor and a generic for promoted
why revert: <https://github.com/rust-lang/rust/pull/92805#issuecomment-1010736049>

r? `@lcnr`
This commit is contained in:
bors 2022-01-16 11:19:21 +00:00
commit 7be8693984
123 changed files with 405 additions and 886 deletions

View file

@ -244,10 +244,10 @@ fn mir_build(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -> Body<'_
// The exception is `body.user_type_annotations`, which is used unmodified
// by borrow checking.
debug_assert!(
!(body.local_decls.has_free_regions(tcx)
|| body.basic_blocks().has_free_regions(tcx)
|| body.var_debug_info.has_free_regions(tcx)
|| body.yield_ty().has_free_regions(tcx)),
!(body.local_decls.has_free_regions()
|| body.basic_blocks().has_free_regions()
|| body.var_debug_info.has_free_regions()
|| body.yield_ty().has_free_regions()),
"Unexpected free regions in MIR: {:?}",
body,
);
@ -760,7 +760,6 @@ fn construct_error<'a, 'tcx>(
cfg.terminate(START_BLOCK, source_info, TerminatorKind::Unreachable);
let mut body = Body::new(
tcx,
MirSource::item(def.did.to_def_id()),
cfg.basic_blocks,
source_scopes,
@ -849,7 +848,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
}
Body::new(
self.tcx,
MirSource::item(self.def_id),
self.cfg.basic_blocks,
self.source_scopes,

View file

@ -238,7 +238,7 @@ impl<'a, 'tcx> ConstToPat<'a, 'tcx> {
// code at the moment, because types like `for <'a> fn(&'a ())` do
// not *yet* implement `PartialEq`. So for now we leave this here.
has_impl
|| ty.walk(self.tcx()).any(|t| match t.unpack() {
|| ty.walk().any(|t| match t.unpack() {
ty::subst::GenericArgKind::Lifetime(_) => false,
ty::subst::GenericArgKind::Type(t) => t.is_fn_ptr(),
ty::subst::GenericArgKind::Const(_) => false,