Skip to content

Lifetime-polymorphic anonymous function causing compiler panic #30860

Closed
@asajeffrey

Description

@asajeffrey

The program at https://play.rust-lang.org/?gist=1a60fe4cd514848f6788 generates the following:

<anon>:44:5: 44:26 error: internal compiler error: Encountered errors `[FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<[closure@<anon>:40:19: 40:65] as core::ops::Fn<(<Str as TypeWithLifetime<'_>>::Type,)>>)),depth=1),OutputTypeParameterMismatch(Binder(<[closure@<anon>:40:19: 40:65] as core::ops::Fn<(&'static str,)>>), Binder(<[closure@<anon>:40:19: 40:65] as core::ops::Fn<(<Str as TypeWithLifetime<'_>>::Type,)>>), Sorts(ExpectedFound { expected: <Str as TypeWithLifetime<'_>>::Type, found: &'static str }))), FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<[closure@<anon>:40:19: 40:65] as core::ops::FnOnce<(<Str as TypeWithLifetime<'_>>::Type,)>>)),depth=1),OutputTypeParameterMismatch(Binder(<[closure@<anon>:40:19: 40:65] as core::ops::FnOnce<(&'static str,)>>), Binder(<[closure@<anon>:40:19: 40:65] as core::ops::FnOnce<(<Str as TypeWithLifetime<'_>>::Type,)>>), Sorts(ExpectedFound { expected: <Str as TypeWithLifetime<'_>>::Type, found: &'static str })))]` fulfilling during trans
<anon>:44     consumer.accept("hi");
              ^~~~~~~~~~~~~~~~~~~~~
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', ../src/libsyntax/diagnostic.rs:176

Reported on #rust-lang irc, @aturon reckons this is new, and should be filed with a mention of @nikomatsakis.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.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