-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Specialized Drop impl causes 'internal compiler error' #40132
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
Labels
A-specialization
Area: Trait impl specialization
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Comments
cc @pnkfelix |
Drop implementations cannot be specialised, and an error to that regard is (in theory) reported. The Slightly minified / cleaned up code: struct A<T> {
a: T,
}
struct DropStruct;
impl Drop for A<DropStruct> {
fn drop(&mut self) {}
}
fn main() {
// Comment the next line to get the real error
let _ = A { a: 0 };
} Backtrace:
|
Another example #[derive(Default)]
pub struct S<A>(pub A);
impl<'a, A> Drop for S<&'a A> {
fn drop(&mut self) {}
} Removing derive avoids the ICE |
arielb1
added a commit
to arielb1/rust
that referenced
this issue
Mar 1, 2017
This removes the Cell from AdtDef. Also, moving destructor validity checking to on-demand (forced during item-type checking) ensures that invalid destructors can't cause ICEs. Fixes rust-lang#38868. Fixes rust-lang#40132.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-specialization
Area: Trait impl specialization
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Possible duplicate of: #38868
Problem:
rustc crashes with 'internal compiler error' if a special file (see the 'Input' section) is compiled.
Exact error output (run via
cargo run
):How to reproduce the error:
Create a new (binary) project with
cargo new rustc_bug_1 --bin
Put the attached source inside
main.rs
Run the project with
cargo run
Witness the error ;-)
The error-causeing source:
Explanation:
I tried some crazy stuff in Rust in order to better understand the languages' semantics when i encountered the bug. I know....usually you cannot specialize the Drop impl, or so the compiler keeps telling me if i further minimize the provided source.
Used OS and rust toolchain:
Arch x64 (up2date)
Rust Toolchains:
Tested with all three.
The text was updated successfully, but these errors were encountered: