Repository navigation
ICE with impl Fn alias. #65918
Description
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:9After 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 stackMetadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
hellow554 commentedon Oct 29, 2019
That code is a mess! After an hour of digging through the code and removing half of it - the code that triggers the error is:
https://github.com/luna/basegl/blob/9fac17b2ae69b5a63b6555529e431db1a740f11a/lib/core/src/display/symbol/scope.rs#L146-L153
I try to produce a MCVE out of it currently
wdanilo commentedon Oct 29, 2019
@hellow554 Yes, the code is in a very work-in-progress state, so there are a lot of places which should be refactored or even removed, sorry for that. The line that I mentioned in my original post calls the function that you have pointed to. The function alone compiles well to WASM. It does not compile when used as follow: https://github.com/luna/basegl/blob/9fac17b2ae69b5a63b6555529e431db1a740f11a/lib/core/src/lib.rs#L126
hellow554 commentedon Oct 29, 2019
Seems to be related to
#[feature(type_alias_impl_trait)]. Here's something small-ish:I may give it a shot later, but now I'm gonna head home :)
wdanilo commentedon Oct 29, 2019
@hellow554 that is amazing! I've created yet shorter version (still, there may be things to simplify here):
hellow554 commentedon Oct 29, 2019
hellow554 commentedon Oct 29, 2019
wdanilo commentedon Oct 29, 2019
@hellow554 thank you for tracking it down ❤️
56 remaining items
Normalize opaque types when converting `ParamEnv` to `Reveal::All`
Normalize opaque types when converting `ParamEnv` to `Reveal::All`