-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
FullfillmentError ICE with const fn and existential type #53092
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Much more minimized repro: #![feature(impl_trait_in_bindings)]
#![feature(min_type_alias_impl_trait)]
#![feature(type_alias_impl_trait)]
#![allow(dead_code)]
type Bug<T, U> = impl Fn(T) -> U + Copy;
const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) };
fn make_bug<T, U: From<T>>() -> Bug<T, U> {
|x| x.into()
}
fn main() {
CONST_BUG(0);
} This is only a |
If we limit this to |
This ICEs with just min_type_alias_impl_trait: #![feature(min_type_alias_impl_trait)]
#![allow(dead_code)]
type Bug<T, U> = impl Fn(T) -> U + Copy;
const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) };
fn make_bug<T, U: From<T>>() -> Bug<T, U> {
|x| x.into()
}
fn main() {
CONST_BUG(0);
} |
This That closure has a constraint that This constraint is only noticed in RevealAll mode in codegen, which then ICEs because it expected typeck to already figure all of this out properly. There are two ways to proceed here: 1. report an error instead of ICEing in
|
Since we already check function items correctly, we should probably just do the same for closures |
Again something that is highly unlikely to ever be found in real code, but nonetheless ICE's:
MCVE: #53092 (comment)
Playground: https://play.rust-lang.org/?gist=47ee8d54d29329821783e315423aa352&version=nightly&mode=release&edition=2015
Backtrace:
Changing
to
also ICE's but with a different message:
Removing the
Copy
from the existential type, gives the same ICE as #53087The text was updated successfully, but these errors were encountered: