-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Panic on Option::unwrap inside rustc_typeck::check::compare_method::compare_const_impl #41549
Labels
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Comments
Ruin0x11
changed the title
Panic on Option::unwrap inside rustc_typeck::check::compare_method::compare_const_impl
Panic on Option::unwrap inside rustc_typeck::check::compare_method::compare_const_impl
Apr 26, 2017
Also, the state of the code I was working on was such that I was implementing a trait with provided methods, but accidentally implementing over the provided methods and not providing all the required methods. |
Ok, the error was due to having the incorrect type on an associated constant: // In library
pub trait ManagedChunk: Serialize + Deserialize {
const SECTOR_SIZE: usize = 4096;
const REGION_WIDTH: i32 = 16;
}
// ...
// In binary project
impl ManagedChunk for SerialChunk {
const SECTOR_SIZE: u32 = 4096;
const REGION_WIDTH: u32 = 16;
} Fixing that makes the compiler panic go away. But this example errors correctly on playground (nightly/debug): #![feature(associated_consts)]
trait MyTrait: Clone {
const MY_CONST: usize = 4096;
const MY_OTHER_CONST: i32 = 16;
}
#[derive(Clone)]
struct Dude {
}
impl MyTrait for Dude {
const MY_CONST: u32 = 4096;
const MY_OTHER_CONST: u32 = 16;
}
fn main() {
println!("{}", Dude::MY_CONST);
println!("{}", Dude::MY_OTHER_CONST);
} Output:
|
sfackler
added
the
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
label
Apr 26, 2017
arielb1
added a commit
to arielb1/rust
that referenced
this issue
Apr 27, 2017
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this issue
Apr 27, 2017
don't ICE on cross-crate associated const type mismatch Fixes rust-lang#41549. r? @eddyb
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this issue
Apr 28, 2017
don't ICE on cross-crate associated const type mismatch Fixes rust-lang#41549. r? @eddyb
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this issue
Apr 28, 2017
don't ICE on cross-crate associated const type mismatch Fixes rust-lang#41549. r? @eddyb
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this issue
Apr 28, 2017
don't ICE on cross-crate associated const type mismatch Fixes rust-lang#41549. r? @eddyb
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this issue
Apr 28, 2017
don't ICE on cross-crate associated const type mismatch Fixes rust-lang#41549. r? @eddyb
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I got an ICE after adding
#![feature(associated_consts)]
to a project and migrating to nightly. Would appreciate help.This might be the call to
unwrap
that panics.The text was updated successfully, but these errors were encountered: