From 7927f0919f178c099f2824f691cfc79065bb419d Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 22 Sep 2022 21:01:13 +0200 Subject: [PATCH 1/2] add regression test for miri issue 2433 --- .../miri/tests/pass/issues/issue-miri-2433.rs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/tools/miri/tests/pass/issues/issue-miri-2433.rs diff --git a/src/tools/miri/tests/pass/issues/issue-miri-2433.rs b/src/tools/miri/tests/pass/issues/issue-miri-2433.rs new file mode 100644 index 00000000000..de719df0f1f --- /dev/null +++ b/src/tools/miri/tests/pass/issues/issue-miri-2433.rs @@ -0,0 +1,22 @@ +#![feature(type_alias_impl_trait)] + +trait T { type Item; } + +type Alias<'a> = impl T; + +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(|_| ()); +} From a7cdfafafb78ddddaaf5ab0c7e14cefc71d3a1db Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 22 Sep 2022 21:01:23 +0200 Subject: [PATCH 2/2] make Miri build in stage 0 --- src/tools/miri/cargo-miri/src/main.rs | 1 + src/tools/miri/src/lib.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/tools/miri/cargo-miri/src/main.rs b/src/tools/miri/cargo-miri/src/main.rs index 331c4c9c2b0..da891ef0772 100644 --- a/src/tools/miri/cargo-miri/src/main.rs +++ b/src/tools/miri/cargo-miri/src/main.rs @@ -1,3 +1,4 @@ +#![cfg_attr(bootstrap, feature(let_else))] #![allow(clippy::useless_format, clippy::derive_partial_eq_without_eq, rustc::internal)] #[macro_use] diff --git a/src/tools/miri/src/lib.rs b/src/tools/miri/src/lib.rs index 6006d6c89db..cda27beab30 100644 --- a/src/tools/miri/src/lib.rs +++ b/src/tools/miri/src/lib.rs @@ -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,