Skip to content

Commit

Permalink
Rollup merge of rust-lang#102148 - RalfJung:miri-test, r=oli-obk
Browse files Browse the repository at this point in the history
add regression test for miri issue 2433

Adding this here because the test needs to be run with debug assertions enabled to be sure so I had to run it in the rustc workspace.

Cc rust-lang/miri#2433
r? `@oli-obk`
  • Loading branch information
matthiaskrgr committed Sep 23, 2022
2 parents 7301951 + a7cdfaf commit 592695a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/tools/miri/cargo-miri/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![cfg_attr(bootstrap, feature(let_else))]
#![allow(clippy::useless_format, clippy::derive_partial_eq_without_eq, rustc::internal)]

#[macro_use]
Expand Down
1 change: 1 addition & 0 deletions src/tools/miri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#![feature(is_some_with)]
#![feature(nonzero_ops)]
#![feature(local_key_cell_methods)]
#![cfg_attr(bootstrap, feature(let_else))]
// Configure clippy and other lints
#![allow(
clippy::collapsible_else_if,
Expand Down
22 changes: 22 additions & 0 deletions src/tools/miri/tests/pass/issues/issue-miri-2433.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#![feature(type_alias_impl_trait)]

trait T { type Item; }

type Alias<'a> = impl T<Item = &'a ()>;

struct S;
impl<'a> T for &'a S {
type Item = &'a ();
}

fn filter_positive<'a>() -> Alias<'a> {
&S
}

fn with_positive(fun: impl Fn(Alias<'_>)) {
fun(filter_positive());
}

fn main() {
with_positive(|_| ());
}

0 comments on commit 592695a

Please sign in to comment.