-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
ICE when passing unsized trait object closure to function #93622
Comments
The following code also gives the same error but at a different location in the code:
|
The issue here is moving an unsized fn param into a box by capture. Minimized: #![feature(unsized_fn_params)]
pub fn f(k: dyn std::fmt::Display) {
let k2 = Box::new(move || { let x = k.to_string(); });
} |
A similar ICE: #![feature(unsized_fn_params)]
pub fn f(k: dyn std::fmt::Display) {
let k2 = move || {
k.to_string();
};
} Backtrace
|
To be fair, My guess would be a lot of the behaviors that make the latter an incomplete compiler feature also apply to |
Playing around with
unsized_fn_params
, @jhjourdan and I encountered an ICE caused bymove
closures. Removing the markedmove
allows the code to compile successfully.Playground
Code
Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: