-
Notifications
You must be signed in to change notification settings - Fork 13.3k
cannot relate bound region #107359
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
Comments
|
@rustbot label +I-ICE +C-bug +E-needs-mcve |
On stable it gives this compile error instead of crashing:
|
Ran into this issue myself, and finally managed to get a minimal repo: struct H<'a, T> {
_marker: std::marker::PhantomData<&'a T>,
}
pub fn breaks<'a, F>(_: F)
where F: core::ops::Fn(H<u8>) + 'a {} For some reason, calling this with a func that takes a mutable reference to the argument causes an ICE. For example: let func = |should_not_be_mutable: &mut H<u8>| { };
breaks(func); // Oops! ICE! N.B: Breaks in |
I found this could also happen on a closure that's inferred to take a value type but is expected to take a reference. On stable (rustc 1.68.0-beta.5 (003b6f2 2023-02-15)) this fails with
I can try to minimize this if it would help beyond Velvet's example. |
I also hit this while working on the compiler where I annotate closure argument types to get some more precise error messages because I needed help, the ICE was quite unhelpful :D |
The MCVE seems fixed on beta/nightly. |
I guess the fix isn't in the bootstrap compiler yet (2023-01-25). |
@rustbot label +S-bug-has-mcve |
This is fixed with sufficient tests, I believe. Closing in favor of #109361 which has an MCVE and to track a possible stable backport. |
The text was updated successfully, but these errors were encountered: