Closed
Description
Code
./src/test/ui/impl-trait/in-trait/nested-rpitit.rs
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::fmt::Display;
use std::ops::Deref;
trait Foo {
fn bar(self) -> impl Deref<Target = impl Display + ?Sized>;
}
struct A;
impl Foo for A {
fn bar(self) -> &'static str {
"Hello, world"
}
}
fn main() {
&A.bar();
}
Meta
rustc --version --verbose
:
rustc 1.66.0-nightly (57f097ea2 2022-10-01)
binary: rustc
commit-hash: 57f097ea25f2c05f424fc9b9dc50dbd6d399845c
commit-date: 2022-10-01
host: x86_64-unknown-linux-gnu
release: 1.66.0-nightly
LLVM version: 15.0.2
Error output
rustc ./src/test/ui/impl-trait/in-trait/nested-rpitit.rs --emit=mir
Backtrace
error: internal compiler error: compiler/rustc_middle/src/hir/map/mod.rs:832:18: expected item, found trait method bar in Foo::bar (hir_id=HirId { owner: OwnerId { def_id: DefId(0:10 ~ nested_rpitit[fe13]::Foo::bar) }, local_id: 0 })
thread 'rustc' panicked at 'Box<dyn Any>', /rustc/57f097ea25f2c05f424fc9b9dc50dbd6d399845c/compiler/rustc_errors/src/lib.rs:1502:9
stack backtrace:
0: 0x7efe81c38380 - std::backtrace_rs::backtrace::libunwind::trace::h80b67585f93dcdfa
at /rustc/57f097ea25f2c05f424fc9b9dc50dbd6d399845c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
1: 0x7efe81c38380 - std::backtrace_rs::backtrace::trace_unsynchronized::h1727d1d942e500b9
at /rustc/57f097ea25f2c05f424fc9b9dc50dbd6d399845c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7efe81c38380 - std::sys_common::backtrace::_print_fmt::h1d58d8daeea91706
at /rustc/57f097ea25f2c05f424fc9b9dc50dbd6d399845c/library/std/src/sys_common/backtrace.rs:66:5
3: 0x7efe81c38380 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h813c9b7ed78580ba
at /rustc/57f097ea25f2c05f424fc9b9dc50dbd6d399845c/library/std/src/sys_common/backtrace.rs:45:22
4: 0x7efe81c9314e - core::fmt::write::h3eecc0c99e4c5326
at /rustc/57f097ea25f2c05f424fc9b9dc50dbd6d399845c/library/core/src/fmt/mod.rs:1209:17
5: 0x7efe81c28f05 - std::io::Write::write_fmt::h169b89be5a4eb2e3
at /rustc/57f097ea25f2c05f424fc9b9dc50dbd6d399845c/library/std/src/io/mod.rs:1679:15
6: 0x7efe81c3b123 - std::sys_common::backtrace::_print::h8470ccc2c46bc222
at /rustc/57f097ea25f2c05f424fc9b9dc50dbd6d399845c/library/std/src/sys_common/backtrace.rs:48:5
7: 0x7efe81c3b123 - std::sys_common::backtrace::print::h59bfcbb529aad43f
at /rustc/57f097ea25f2c05f424fc9b9dc50dbd6d399845c/library/std/src/sys_common/backtrace.rs:35:9
8: 0x7efe81c3b123 - std::panicking::default_hook::{{closure}}::h19081fa8b049df20
at /rustc/57f097ea25f2c05f424fc9b9dc50dbd6d399845c/library/std/src/panicking.rs:267:22
9: 0x7efe81c3adfa - std::panicking::default_hook::h8f0eea70584d6151
at /rustc/57f097ea25f2c05f424fc9b9dc50dbd6d399845c/library/std/src/panicking.rs:286:9
10: 0x7efe844a7c21 - <rustc_driver[5f28de9a0492c992]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[2f8af133219d6c11]::ops::function::FnOnce<(&core[2f8af133219d6c11]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
11: 0x7efe81c3b95b - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hb9a306ebd1946910
at /rustc/57f097ea25f2c05f424fc9b9dc50dbd6d399845c/library/alloc/src/boxed.rs:1952:9
12: 0x7efe81c3b95b - std::panicking::rust_panic_with_hook::h6b2b2d988170cf5c
at /rustc/57f097ea25f2c05f424fc9b9dc50dbd6d399845c/library/std/src/panicking.rs:673:13
13: 0x7efe85472031 - std[281da818632cbbdf]::panicking::begin_panic::<rustc_errors[1020869c0a53ac34]::ExplicitBug>::{closure#0}
14: 0x7efe8546f916 - std[281da818632cbbdf]::sys_common::backtrace::__rust_end_short_backtrace::<std[281da818632cbbdf]::panicking::begin_panic<rustc_errors[1020869c0a53ac34]::ExplicitBug>::{closure#0}, !>
15: 0x7efe854cea86 - std[281da818632cbbdf]::panicking::begin_panic::<rustc_errors[1020869c0a53ac34]::ExplicitBug>
16: 0x7efe8546ca26 - std[281da818632cbbdf]::panic::panic_any::<rustc_errors[1020869c0a53ac34]::ExplicitBug>
17: 0x7efe8546945f - <rustc_errors[1020869c0a53ac34]::HandlerInner>::bug::<&alloc[ab68081038e0c5ba]::string::String>
18: 0x7efe85468e70 - <rustc_errors[1020869c0a53ac34]::Handler>::bug::<&alloc[ab68081038e0c5ba]::string::String>
19: 0x7efe85510c5d - rustc_middle[8a82caabfb0f2329]::ty::context::tls::with_context_opt::<rustc_middle[8a82caabfb0f2329]::ty::context::tls::with_opt<rustc_middle[8a82caabfb0f2329]::util::bug::opt_span_bug_fmt<rustc_span[efd8b0f1895919e0]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
20: 0x7efe85511b36 - rustc_middle[8a82caabfb0f2329]::util::bug::opt_span_bug_fmt::<rustc_span[efd8b0f1895919e0]::span_encoding::Span>
21: 0x7efe82ede813 - rustc_middle[8a82caabfb0f2329]::util::bug::bug_fmt
22: 0x7efe8392000d - <rustc_middle[8a82caabfb0f2329]::hir::map::Map>::expect_item
23: 0x7efe8433e503 - rustc_ty_utils[77e3777a26d786a3]::assoc::associated_item
24: 0x7efe83cef15e - rustc_query_system[e458c87a166b4189]::query::plumbing::get_query::<rustc_query_impl[f6287e509623bd0a]::queries::associated_item, rustc_query_impl[f6287e509623bd0a]::plumbing::QueryCtxt>
25: 0x7efe85559b48 - <rustc_middle[8a82caabfb0f2329]::ty::print::pretty::FmtPrinter as rustc_middle[8a82caabfb0f2329]::ty::print::pretty::PrettyPrinter>::pretty_print_opaque_impl_type
26: 0x7efe8555ac7e - <rustc_middle[8a82caabfb0f2329]::ty::print::pretty::FmtPrinter as rustc_middle[8a82caabfb0f2329]::ty::print::pretty::PrettyPrinter>::pretty_fn_sig
27: 0x7efe8552e09d - <rustc_middle[8a82caabfb0f2329]::ty::sty::FnSig as rustc_middle[8a82caabfb0f2329]::ty::print::Print<rustc_middle[8a82caabfb0f2329]::ty::print::pretty::FmtPrinter>>::print
28: 0x7efe85562057 - <rustc_middle[8a82caabfb0f2329]::ty::print::pretty::FmtPrinter as rustc_middle[8a82caabfb0f2329]::ty::print::pretty::PrettyPrinter>::in_binder::<rustc_middle[8a82caabfb0f2329]::ty::sty::FnSig>
29: 0x7efe8404a978 - <rustc_middle[8a82caabfb0f2329]::ty::print::pretty::FmtPrinter as rustc_middle[8a82caabfb0f2329]::ty::print::pretty::PrettyPrinter>::pretty_print_type
30: 0x7efe82e04d3b - <rustc_middle[8a82caabfb0f2329]::ty::Ty as core[2f8af133219d6c11]::fmt::Display>::fmt
31: 0x7efe81c9314e - core::fmt::write::h3eecc0c99e4c5326
at /rustc/57f097ea25f2c05f424fc9b9dc50dbd6d399845c/library/core/src/fmt/mod.rs:1209:17
32: 0x7efe81c852ff - core::fmt::Write::write_fmt::hbc58543f8ab67731
at /rustc/57f097ea25f2c05f424fc9b9dc50dbd6d399845c/library/core/src/fmt/mod.rs:192:9
33: 0x7efe81c852ff - alloc::fmt::format::format_inner::h6efe0f178dfca440
at /rustc/57f097ea25f2c05f424fc9b9dc50dbd6d399845c/library/alloc/src/fmt.rs:612:9
34: 0x7efe854aa2f1 - <rustc_middle[8a82caabfb0f2329]::mir::pretty::ExtraComments as rustc_middle[8a82caabfb0f2329]::mir::visit::Visitor>::visit_constant
35: 0x7efe854b2eda - <rustc_middle[8a82caabfb0f2329]::mir::pretty::ExtraComments as rustc_middle[8a82caabfb0f2329]::mir::visit::Visitor>::visit_terminator
36: 0x7efe854a89a9 - rustc_middle[8a82caabfb0f2329]::mir::pretty::write_mir_pretty::{closure#0}
37: 0x7efe854a70c0 - rustc_middle[8a82caabfb0f2329]::mir::pretty::write_mir_pretty
38: 0x7efe84891f40 - rustc_mir_transform[59cb29f3acb1db3]::dump_mir::emit_mir
39: 0x7efe831a4ad8 - <rustc_interface[a2e36ac52ab23c81]::passes::QueryContext>::enter::<<rustc_interface[a2e36ac52ab23c81]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[2f8af133219d6c11]::result::Result<alloc[ab68081038e0c5ba]::boxed::Box<dyn core[2f8af133219d6c11]::any::Any>, rustc_errors[1020869c0a53ac34]::ErrorGuaranteed>>
40: 0x7efe83198e03 - <rustc_interface[a2e36ac52ab23c81]::queries::Queries>::ongoing_codegen
41: 0x7efe8319708a - rustc_interface[a2e36ac52ab23c81]::interface::create_compiler_and_run::<core[2f8af133219d6c11]::result::Result<(), rustc_errors[1020869c0a53ac34]::ErrorGuaranteed>, rustc_driver[5f28de9a0492c992]::run_compiler::{closure#1}>
42: 0x7efe83195982 - <scoped_tls[430d84ded6e482c8]::ScopedKey<rustc_span[efd8b0f1895919e0]::SessionGlobals>>::set::<rustc_interface[a2e36ac52ab23c81]::interface::run_compiler<core[2f8af133219d6c11]::result::Result<(), rustc_errors[1020869c0a53ac34]::ErrorGuaranteed>, rustc_driver[5f28de9a0492c992]::run_compiler::{closure#1}>::{closure#0}, core[2f8af133219d6c11]::result::Result<(), rustc_errors[1020869c0a53ac34]::ErrorGuaranteed>>
43: 0x7efe8319566f - std[281da818632cbbdf]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[a2e36ac52ab23c81]::util::run_in_thread_pool_with_globals<rustc_interface[a2e36ac52ab23c81]::interface::run_compiler<core[2f8af133219d6c11]::result::Result<(), rustc_errors[1020869c0a53ac34]::ErrorGuaranteed>, rustc_driver[5f28de9a0492c992]::run_compiler::{closure#1}>::{closure#0}, core[2f8af133219d6c11]::result::Result<(), rustc_errors[1020869c0a53ac34]::ErrorGuaranteed>>::{closure#0}, core[2f8af133219d6c11]::result::Result<(), rustc_errors[1020869c0a53ac34]::ErrorGuaranteed>>
44: 0x7efe84309550 - <<std[281da818632cbbdf]::thread::Builder>::spawn_unchecked_<rustc_interface[a2e36ac52ab23c81]::util::run_in_thread_pool_with_globals<rustc_interface[a2e36ac52ab23c81]::interface::run_compiler<core[2f8af133219d6c11]::result::Result<(), rustc_errors[1020869c0a53ac34]::ErrorGuaranteed>, rustc_driver[5f28de9a0492c992]::run_compiler::{closure#1}>::{closure#0}, core[2f8af133219d6c11]::result::Result<(), rustc_errors[1020869c0a53ac34]::ErrorGuaranteed>>::{closure#0}, core[2f8af133219d6c11]::result::Result<(), rustc_errors[1020869c0a53ac34]::ErrorGuaranteed>>::{closure#1} as core[2f8af133219d6c11]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
45: 0x7efe81c45433 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h26c13cce480449d5
at /rustc/57f097ea25f2c05f424fc9b9dc50dbd6d399845c/library/alloc/src/boxed.rs:1938:9
46: 0x7efe81c45433 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1d016e890f9a0fa4
at /rustc/57f097ea25f2c05f424fc9b9dc50dbd6d399845c/library/alloc/src/boxed.rs:1938:9
47: 0x7efe81c45433 - std::sys::unix::thread::Thread::new::thread_start::ha5f4632b746acf38
at /rustc/57f097ea25f2c05f424fc9b9dc50dbd6d399845c/library/std/src/sys/unix/thread.rs:108:17
48: 0x7efe8199d78d - <unknown>
49: 0x7efe81a1e8e4 - clone
50: 0x0 - <unknown>
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.66.0-nightly (57f097ea2 2022-10-01) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [associated_item] computing associated item data for `Foo::bar::{opaque#1}`
end of query stack
error: aborting due to previous error