Skip to content

fix MIR validation around impl Trait #75399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/librustc_mir/transform/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ pub fn equal_up_to_regions(
}

// Instantiate and run relation.
let mut relator: LifetimeIgnoreRelation<'tcx> = LifetimeIgnoreRelation { tcx: tcx, param_env };
let param_env = param_env.with_reveal_all_normalized(tcx);
let mut relator: LifetimeIgnoreRelation<'tcx> = LifetimeIgnoreRelation { tcx, param_env };
relator.relate(src, dest).is_ok()
}

Expand Down
9 changes: 9 additions & 0 deletions src/test/ui/mir/validation_impl_trait_lifetime.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// check-pass
//! This used to fail MIR validation due to the types on both sides of an assignment not being equal.
fn iter_slice<'a, T>(xs: &'a [T]) -> impl Iterator<Item = &'a T> {
xs.iter()
}

fn main() {
iter_slice::<()> as fn(_) -> _;
}