-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-codegenArea: Code generationArea: Code generationI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Description
The following code does not compile :
extern
{
fn foo();
}
static a: u64 = foo as u64;
fn main()
{
println!("{:u}", a};
}
It fails with the following message :
test.rs:6:18: 6:28 error: internal compiler error: Impossible case reached: bad combination of types for cast
test.rs:6 static baz: u64 = foo as u64;
Where as the following code, that does the same type of cast but in a non-constant expression, is valid :
extern
{
fn foo();
}
fn main()
{
let a: u64 = foo as u64;
println!("{:u}", a};
}
Maybe I'm missing some point, but I don't see any good reason to disallow this type of casts at compile-time.
Metadata
Metadata
Assignees
Labels
A-codegenArea: Code generationArea: Code generationI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️