diff --git a/src/tools/miri/cargo-miri/src/main.rs b/src/tools/miri/cargo-miri/src/main.rs index 331c4c9c2b0e7..da891ef077293 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 6006d6c89dbca..cda27beab300f 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, 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 0000000000000..de719df0f1f30 --- /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(|_| ()); +}