Open carloabelli opened 2 years ago
This is due to an (almost, but not currently detected) trivially falsifiable bound. Cow<'_, str>
does not satisfy Archive
for any lifetime, but we don't raise a type error because there's a where Cow<'a, str>: Archive
in the macro expansion. We don't see that this is satisfied for no lifetimes until we erase the region during MIR lowering.
Then since the type is global once we remove the early-bound lifetime, I think we throw away the param-env (i.e. we call ParamEnv::without_caller_bounds
), and this type fails to normalize since we no longer have the Cow<ReErased, str>: Archive
in our param-env.
Code
Meta
rustc --version --verbose
:Error output
Backtrace
``` error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:179:90: Failed to normalize as rkyv::Archive>::Resolver, maybe try to call `try_normalize_erasing_regions` instead
thread 'rustc' panicked at 'Box', compiler/rustc_errors/src/lib.rs:1169:9
stack backtrace:
0: 0x623f31a96b9c - std::backtrace_rs::backtrace::libunwind::trace::h91c465e73bf6c785
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x623f31a96b9c - std::backtrace_rs::backtrace::trace_unsynchronized::hae9da36f5d58b5f3
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x623f31a96b9c - std::sys_common::backtrace::_print_fmt::h7f499fa126a7effb
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/sys_common/backtrace.rs:67:5
3: 0x623f31a96b9c - ::fmt::h3e2b509ce2ce6007
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/sys_common/backtrace.rs:46:22
4: 0x623f31af7a2c - core::fmt::write::h753c7571fa063ecb
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/fmt/mod.rs:1168:17
5: 0x623f31a85ea3 - std::io::Write::write_fmt::h2815c0519c99ba09
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/io/mod.rs:1660:15
6: 0x623f31a9aca2 - std::sys_common::backtrace::_print::h64941a6fc8b0ed9b
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/sys_common/backtrace.rs:49:5
7: 0x623f31a9aca2 - std::sys_common::backtrace::print::hcf25e43e1a9b0766
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/sys_common/backtrace.rs:36:9
8: 0x623f31a9aca2 - std::panicking::default_hook::{{closure}}::h78d3e6cf97fc623d
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/panicking.rs:211:50
9: 0x623f31a9a885 - std::panicking::default_hook::hda898f8d3ad1a5ae
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/panicking.rs:228:9
10: 0x623f3231a761 - rustc_driver[68791c760b496cb9]::DEFAULT_HOOK::{closure#0}::{closure#0}
11: 0x623f235f0a53 - as core::ops::function::Fn>::call::h22d6801061b803af
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/alloc/src/boxed.rs:1868:9
12: 0x623f235ee89d - proc_macro::bridge::client::::enter::{{closure}}::{{closure}}::h7644afeedd980844
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/proc_macro/src/bridge/client.rs:320:21
13: 0x623f31a9b455 - std::panicking::rust_panic_with_hook::h1a5ea2d6c23051aa
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/panicking.rs:610:17
14: 0x623f3354319b - std[c2a6a440a415d498]::panicking::begin_panic::::{closure#0}
15: 0x623f33543116 - std[c2a6a440a415d498]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !>
16: 0x623f33546f7f - std[c2a6a440a415d498]::panicking::begin_panic::
17: 0x623f33551d0d - std[c2a6a440a415d498]::panic::panic_any::
18: 0x623f33550f97 - ::bug
19: 0x623f335509a0 - ::bug
20: 0x623f333d0579 - rustc_middle[918e6c9f11b9cfc2]::ty::context::tls::with_opt::::{closure#0}, ()>
21: 0x623f333d09e0 - rustc_middle[918e6c9f11b9cfc2]::util::bug::opt_span_bug_fmt::
22: 0x623f333d0956 - rustc_middle[918e6c9f11b9cfc2]::util::bug::bug_fmt
23: 0x623f340fcde6 - ::fold_ty
24: 0x623f3376d4b6 - >, >::move_paths_for_fields::{closure#0}> as core[4b8c045e35bf0313]::iter::traits::iterator::Iterator>::fold::<(), core[4b8c045e35bf0313]::iter::traits::iterator::Iterator::for_each::call<(rustc_middle[918e6c9f11b9cfc2]::mir::Place, core[4b8c045e35bf0313]::option::Option), )> as alloc[4d2bf5a5aefb7035]::vec::spec_extend::SpecExtend<(rustc_middle[918e6c9f11b9cfc2]::mir::Place, core[4b8c045e35bf0313]::option::Option), core[4b8c045e35bf0313]::iter::adapters::map::Map>, >::move_paths_for_fields::{closure#0}>>>::spec_extend::{closure#0}>::{closure#0}>
25: 0x623f3377b8ff - >::elaborate_drop
26: 0x623f33755678 - ::run_pass
27: 0x623f337a47ff - rustc_mir_transform[6b60019107120a72]::pass_manager::run_passes
28: 0x623f33788cd7 - rustc_mir_transform[6b60019107120a72]::run_post_borrowck_cleanup_passes
29: 0x623f33787de9 - rustc_mir_transform[6b60019107120a72]::mir_drops_elaborated_and_const_checked
30: 0x623f33c86d4c - rustc_query_system[f23fa726dd903306]::query::plumbing::try_execute_query::, &rustc_data_structures[496dc1ea3fa24648]::steal::Steal>>
31: 0x623f33cec007 - ::mir_drops_elaborated_and_const_checked
32: 0x623f34336fe0 - rustc_mir_transform[6b60019107120a72]::optimized_mir
33: 0x623f33c9e477 - rustc_query_system[f23fa726dd903306]::query::plumbing::try_execute_query::>
34: 0x623f33cec2d3 - ::optimized_mir
35: 0x623f33d2f167 - ::encode_crate_root
36: 0x623f346f0891 - rustc_metadata[e45939a80f641886]::rmeta::encoder::encode_metadata_impl
37: 0x623f34706051 - rustc_data_structures[496dc1ea3fa24648]::sync::join::
38: 0x623f346f0076 - rustc_metadata[e45939a80f641886]::rmeta::encoder::encode_metadata
39: 0x623f3418df19 - ::ongoing_codegen
40: 0x623f34168974 - ::enter::, rustc_errors[a7f9c61e2940d55a]::ErrorReported>>
41: 0x623f3414b97c - rustc_span[eb9d2b35b06e162f]::with_source_map::, rustc_interface[f4c999472ca453d]::interface::create_compiler_and_run, rustc_driver[68791c760b496cb9]::run_compiler::{closure#1}>::{closure#1}>
42: 0x623f34167cfe - rustc_interface[f4c999472ca453d]::interface::create_compiler_and_run::, rustc_driver[68791c760b496cb9]::run_compiler::{closure#1}>
43: 0x623f3414cedb - >::set::, rustc_driver[68791c760b496cb9]::run_compiler::{closure#1}>::{closure#0}, core[4b8c045e35bf0313]::result::Result<(), rustc_errors[a7f9c61e2940d55a]::ErrorReported>>::{closure#0}::{closure#0}, core[4b8c045e35bf0313]::result::Result<(), rustc_errors[a7f9c61e2940d55a]::ErrorReported>>
44: 0x623f3414ccd5 - std[c2a6a440a415d498]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver[68791c760b496cb9]::run_compiler::{closure#1}>::{closure#0}, core[4b8c045e35bf0313]::result::Result<(), rustc_errors[a7f9c61e2940d55a]::ErrorReported>>::{closure#0}, core[4b8c045e35bf0313]::result::Result<(), rustc_errors[a7f9c61e2940d55a]::ErrorReported>>
45: 0x623f34178499 - <::spawn_unchecked, rustc_driver[68791c760b496cb9]::run_compiler::{closure#1}>::{closure#0}, core[4b8c045e35bf0313]::result::Result<(), rustc_errors[a7f9c61e2940d55a]::ErrorReported>>::{closure#0}, core[4b8c045e35bf0313]::result::Result<(), rustc_errors[a7f9c61e2940d55a]::ErrorReported>>::{closure#1} as core[4b8c045e35bf0313]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
46: 0x623f31aa7073 - as core::ops::function::FnOnce>::call_once::h49b6c7c5155a2296
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/alloc/src/boxed.rs:1854:9
47: 0x623f31aa7073 - as core::ops::function::FnOnce>::call_once::ha8b5234bfeb15105
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/alloc/src/boxed.rs:1854:9
48: 0x623f31aa7073 - std::sys::unix::thread::Thread::new::thread_start::h6f207dd842d64859
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/sys/unix/thread.rs:108:17
49: 0x623f318835c2 - start_thread
50: 0x623f31908584 - __clone
51: 0x0 -
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.59.0 (9d1b2106e 2022-02-23) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `_::::resolve`
#1 [optimized_mir] optimizing MIR for `_::::resolve`
end of query stack
error: could not compile `minimal`
```