Revert "Normalize function type during validation"
This reverts commit d486bfcbff107e8a6769e00c59d02b13c664b6ee.
This commit is contained in:
parent
8247223f74
commit
0ab44584aa
@ -364,9 +364,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
TerminatorKind::Call { func, args, destination, cleanup, .. } => {
|
||||
let param_env = self.param_env.with_reveal_all_normalized(self.tcx);
|
||||
let func_ty = func.ty(&self.body.local_decls, self.tcx);
|
||||
let func_ty = self.tcx.normalize_erasing_regions(param_env, func_ty);
|
||||
match func_ty.kind() {
|
||||
ty::FnPtr(..) | ty::FnDef(..) => {}
|
||||
_ => self.fail(
|
||||
|
@ -1,3 +1,7 @@
|
||||
// revisions: default miropt
|
||||
//[miropt]compile-flags: -Z mir-opt-level=2
|
||||
// ~^ This flag is for #77668, it used to be ICE.
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
pub fn bar<P>( // Error won't happen if "bar" is not generic
|
||||
|
@ -1,27 +1,17 @@
|
||||
// Regression test for various issues related to normalization & inlining.
|
||||
// * #68347, #77306, #77668 - missed normalization during inlining.
|
||||
// * #78442 - missed normalization in validator after inlining.
|
||||
//
|
||||
// build-pass
|
||||
// run-pass
|
||||
// compile-flags:-Zmir-opt-level=2
|
||||
|
||||
// Previously ICEd because we did not normalize during inlining,
|
||||
// see https://github.com/rust-lang/rust/pull/77306 for more discussion.
|
||||
|
||||
pub fn write() {
|
||||
create()()
|
||||
}
|
||||
|
||||
pub fn write_generic<T>(_t: T) {
|
||||
hide()();
|
||||
}
|
||||
|
||||
pub fn create() -> impl FnOnce() {
|
||||
|| ()
|
||||
}
|
||||
|
||||
pub fn hide() -> impl Fn() {
|
||||
write
|
||||
}
|
||||
|
||||
fn main() {
|
||||
write();
|
||||
write_generic(());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user