Consider the following code.
#![feature(mut_restriction)]
mod inner {
pub(crate) struct Wrapper(#[expect(dead_code)] pub(crate) mut(self) u8);
}
fn param_is_fn(_: fn(u8) -> inner::Wrapper) {}
fn param_impl_fn(_: impl Fn(u8) -> inner::Wrapper) {}
fn param_impl_fn_once(_: impl FnOnce(u8) -> inner::Wrapper) {}
fn param_impl_fn_mut(_: impl FnMut(u8) -> inner::Wrapper) {}
fn main() {
let _ = inner::Wrapper;
param_is_fn(inner::Wrapper);
param_impl_fn(inner::Wrapper);
param_impl_fn_once(inner::Wrapper);
param_impl_fn_mut(inner::Wrapper);
}
Every line in main should result in a compiler error because it is not permitted to construct Wrapper directly outside of inner. I believe the simplest way to approach this is to exclude any situation where the auto-generated constructor/function is an expression.
cc @CoCo-Japan-pan @Urgau
Consider the following code.
Every line in
mainshould result in a compiler error because it is not permitted to constructWrapperdirectly outside ofinner. I believe the simplest way to approach this is to exclude any situation where the auto-generated constructor/function is an expression.cc @CoCo-Japan-pan @Urgau