You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before killing unsafe_destructor, we need to address the issue that type-parametric implementations of Drop cannot add new bounds ("new" as in bounds that were not already present on the type definition itself).
Here is an example:
use std::fmt;pubstructS<T>{t:T}impl<T: fmt::Show>DropforS<T>{fndrop(&mutself){println!("dropping S {{ t: {:?} }}", self.t);}}structNoShow;fnmain(){let s1 = S{t:1u8};let s2 = S{t:2u16};let s3 =S{t:NoShow};}
(On master, the above errors because it requires unsafe_destructor).
In the version of the compiler implemented on PR #21022, you get the following ICE:
% ./x86_64-apple-darwin/stage2/bin/rustc /tmp/dtor_ex2.rs
/tmp/dtor_ex2.rs:14:9: 14:11 warning: unused variable: `s1`, #[warn(unused_variables)] on by default
/tmp/dtor_ex2.rs:14 let s1 = S { t: 1u8 };
^~
/tmp/dtor_ex2.rs:15:9: 15:11 warning: unused variable: `s2`, #[warn(unused_variables)] on by default
/tmp/dtor_ex2.rs:15 let s2 = S { t: 2u16 };
^~
/tmp/dtor_ex2.rs:16:9: 16:11 warning: unused variable: `s3`, #[warn(unused_variables)] on by default
/tmp/dtor_ex2.rs:16 let s3 =S { t: NoShow };
^~
/tmp/dtor_ex2.rs:1:1: 1:1 error: internal compiler error: Encountered error `Unimplemented` selecting `Binder(TraitRef(NoShow, core::fmt::Show))` during trans
/tmp/dtor_ex2.rs:1 use std::fmt;
^
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', /Users/fklock/Dev/Mozilla/rust-drop-lts/src/libsyntax/diagnostic.rs:123
The text was updated successfully, but these errors were encountered:
pnkfelix
added
the
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
label
Jan 15, 2015
Spawned off of #21022, #21972.
Before killing
unsafe_destructor
, we need to address the issue that type-parametric implementations ofDrop
cannot add new bounds ("new" as in bounds that were not already present on the type definition itself).Here is an example:
(On master, the above errors because it requires
unsafe_destructor
).In the version of the compiler implemented on PR #21022, you get the following ICE:
The text was updated successfully, but these errors were encountered: