- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Milestone
Description
x.rs:
enum x = (); 
impl x for x { 
    fn use_x<T>() {
        struct foo {
            i: (); 
            new(i: ()) { self.i = i; }
        }   
    }   
}
x.rc:
#[crate_type = "lib"];
The code works if:
- it is not polymorphic.
- the struct is moved outside of the impl, or the impl is removed and the struct is inside the function.
- a fn mainis added and compiled as not-a-crate.
- a fn mainis added and compiled as a crate but the#[crate_type = "lib"]is removed.
It still ICEs  if the type parameter is moved up to impl x<T> for x .
Backtrace:
#1  0x00007ffff66d2087 in diagnostic::codemap_handler::meth541::fatal ()
#2  0x00007ffff66d23fb in diagnostic::codemap_handler::meth551::bug ()
#3  0x00007ffff6069b23 in metadata::encoder::encode_symbol ()
#4  0x00007ffff606cc62 in metadata::encoder::encode_info_for_fn ()
#5  0x00007ffff60728de in metadata::encoder::encode_info_for_items::anon ()
#6  0x00007ffff5cc684a in visit::visit_block6832 ()
#7  0x00007ffff5ccdc44 in visit::visit_fn7049 ()
#8  0x00007ffff5ccce7a in visit::visit_method_helper7014 ()
#9  0x00007ffff5cccca2 in visit::visit_item7001 ()
#10 0x00007ffff606f22c in metadata::encoder::encode_info_for_items::anon ()
#11 0x00007ffff60d09b0 in __morestack ()
#12 0x00007ffff5ccc474 in visit::default_visitor6990::anon ()
#13 0x00007ffff5d02949 in metadata::encoder::encode_metadata ()
#14 0x00007ffff5cfe4d1 in middle::trans::base::write_metadata ()
Possibly related to #2733.
Metadata
Metadata
Assignees
Labels
A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️