Skip to content

Commit 0ab4458

Browse files
committed
Revert "Normalize function type during validation"
This reverts commit d486bfc.
1 parent 8247223 commit 0ab4458

File tree

3 files changed

+8
-16
lines changed

3 files changed

+8
-16
lines changed

compiler/rustc_mir/src/transform/validate.rs

-2
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
364364
}
365365
}
366366
TerminatorKind::Call { func, args, destination, cleanup, .. } => {
367-
let param_env = self.param_env.with_reveal_all_normalized(self.tcx);
368367
let func_ty = func.ty(&self.body.local_decls, self.tcx);
369-
let func_ty = self.tcx.normalize_erasing_regions(param_env, func_ty);
370368
match func_ty.kind() {
371369
ty::FnPtr(..) | ty::FnDef(..) => {}
372370
_ => self.fail(

src/test/ui/issues/issue-50865-private-impl-trait/auxiliary/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// revisions: default miropt
2+
//[miropt]compile-flags: -Z mir-opt-level=2
3+
// ~^ This flag is for #77668, it used to be ICE.
4+
15
#![crate_type = "lib"]
26

37
pub fn bar<P>( // Error won't happen if "bar" is not generic
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,17 @@
1-
// Regression test for various issues related to normalization & inlining.
2-
// * #68347, #77306, #77668 - missed normalization during inlining.
3-
// * #78442 - missed normalization in validator after inlining.
4-
//
5-
// build-pass
1+
// run-pass
62
// compile-flags:-Zmir-opt-level=2
73

4+
// Previously ICEd because we did not normalize during inlining,
5+
// see https://github.com/rust-lang/rust/pull/77306 for more discussion.
6+
87
pub fn write() {
98
create()()
109
}
1110

12-
pub fn write_generic<T>(_t: T) {
13-
hide()();
14-
}
15-
1611
pub fn create() -> impl FnOnce() {
1712
|| ()
1813
}
1914

20-
pub fn hide() -> impl Fn() {
21-
write
22-
}
23-
2415
fn main() {
2516
write();
26-
write_generic(());
2717
}

0 commit comments

Comments
 (0)