Skip to content

Compiler panic when implementing a trait for another trait with a lifetime in a lib #18943

Closed
@pmsanford

Description

@pmsanford

This code will cause a compiler panic

#![crate_type = "lib"]

trait Foo for Sized? { }

trait Bar { }

impl<'a> Foo for Bar + 'a { }

link to run: http://is.gd/MC2wAS

message:

error: internal compiler error: unexpected panic
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
task 'rustc' panicked at 'assertion failed: bounds.is_none()', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/librustc/metadata/encoder.rs:1231

This panic only occurs when building as a lib, whether by the #![crate_type = "lib"] attribute or with the --crate-type lib command line option. If you remove the crate_type attribute and add a fn main() {} it does not panic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions