Skip to content

ICE with impl Fn alias. #65918

@wdanilo

Description

@wdanilo

Hi,
I'm building a project and I'm using the nightly channel. I was testing it with several builds between 2019-09-20 and 2019-10-27, all with the same results – when targetting native, the compilation succeeds, when targetting WASM, we see ICE.

Unfortunately, it was hard for me to minimize the example. Fortunately, the codebase is pretty small. Here is the exact commit: enso-org/ide@9fac17b

After downloading it you can run cargo build and it should succeed. But if you run ./scripts/build.sh (which is 1-line wrapper over wasm-pack), we get:

error: internal compiler error: src/librustc_traits/normalize_erasing_regions.rs:42: could 
not fully normalize `fn(std::result::Result<&mut T, <&mut T as std::convert::TryFrom<&mut 
display::symbol::attribute::AnyAttribute<Closure_attribute_on_set_handler::<OnDirty>, 
Closure_attribute_on_resize_handler::<OnDirty>>>>::Error>) -> std::option::Option<&mut 
T> {std::result::Result::<&mut T, <&mut T as std::convert::TryFrom<&mut 
display::symbol::attribute::AnyAttribute<Closure_attribute_on_set_handler::<OnDirty>, 
Closure_attribute_on_resize_handler::<OnDirty>>>>::Error>::ok}`

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:925:9

After commenting out this line, everything should compile OK (WASM target should compile as well): https://github.com/luna/basegl/blob/9fac17b2ae69b5a63b6555529e431db1a740f11a/lib/core/src/lib.rs#L126

EDIT
The backtrace from the compiler is not very helpful:

stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   ...
   61: <unknown>

However, there is some additional info:

query stack during panic:
#0 [normalize_ty_after_erasing_regions] normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [Binder(TraitPredicate(<&'t mut T as std::convert::TryFrom<&'t mut display::symbol::attribute::AnyAttribute<Closure_attribute_on_set_handler::<OnDirty>, Closure_attribute_on_resize_handler::<OnDirty>>>>)), Binder(TraitPredicate(<&'t mut T as std::marker::Sized>)), Binder(TraitPredicate(<&'t T as std::convert::TryFrom<&'t display::symbol::attribute::AnyAttribute<Closure_attribute_on_set_handler::<OnDirty>, Closure_attribute_on_resize_handler::<OnDirty>>>>)), Binder(TraitPredicate(<&'t T as std::marker::Sized>)), Binder(TraitPredicate(<OnDirty as std::marker::Sized>)), Binder(TraitPredicate(<T as std::marker::Sized>))], reveal: All, def_id: None }, value: fn(std::result::Result<&mut T, <&mut T as std::convert::TryFrom<&mut display::symbol::attribute::AnyAttribute<Closure_attribute_on_set_handler::<OnDirty>, Closure_attribute_on_resize_handler::<OnDirty>>>>::Error>) -> std::option::Option<&mut T> {std::result::Result::<&mut T, <&mut T as std::convert::TryFrom<&mut display::symbol::attribute::AnyAttribute<Closure_attribute_on_set_handler::<OnDirty>, Closure_attribute_on_resize_handler::<OnDirty>>>>::Error>::ok} }`
#1 [optimized_mir] processing `<display::symbol::scope::Scope<OnDirty> as std::ops::index::IndexMut<display::symbol::scope::TypedIndex<usize, T>>>::index_mut`
#2 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-trait-systemArea: Trait systemC-bugCategory: This is a bug.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions