Open
Description
auto-reduced (treereduce-rust):
use std::rc::Rc;
struct Foo<T: ?Sized>(T);
impl Foo<[u8]> {
fn len(self: &&MyNonNull<A>) -> usize {}
}
fn main() {
let rc = Rc::new() as Rc<Foo<[u8]>>;
assert_eq!(3, rc.len());
}
original:
//@ run-pass
use std::rc::Rc;
struct Foo<T: ?Sized>(T);
impl Foo<[u8]> {
fn len(self: &&MyNonNull<A>) -> usize {
self.0.len()
}
}
fn main() {
let rc = Rc::new(Foo([1u8,2,3])) as Rc<Foo<[u8]>>;
assert_eq!(3, rc.len());
}
Version information
rustc 1.86.0-nightly (c234b839d 2025-01-22)
binary: rustc
commit-hash: c234b839d1681a7aa3abb1bda6f6f350714eacfe
commit-date: 2025-01-22
host: x86_64-unknown-linux-gnu
release: 1.86.0-nightly
LLVM version: 19.1.7
Possibly related line of code:
rust/compiler/rustc_middle/src/ty/mod.rs
Lines 1578 to 1590 in c234b83
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error[E0412]: cannot find type `MyNonNull` in this scope
--> /tmp/icemaker_global_tempdir.eHo4LBDDvdmk/rustc_testrunner_tmpdir_reporting.6wJApM6bryHu/mvce.rs:6:20
|
6 | fn len(self: &&MyNonNull<A>) -> usize {}
| ^^^^^^^^^ not found in this scope
error[E0412]: cannot find type `A` in this scope
--> /tmp/icemaker_global_tempdir.eHo4LBDDvdmk/rustc_testrunner_tmpdir_reporting.6wJApM6bryHu/mvce.rs:6:30
|
6 | fn len(self: &&MyNonNull<A>) -> usize {}
| ^ not found in this scope
|
help: you might be missing a type parameter
|
5 | impl<A> Foo<[u8]> {
| +++
error[E0308]: mismatched types
--> /tmp/icemaker_global_tempdir.eHo4LBDDvdmk/rustc_testrunner_tmpdir_reporting.6wJApM6bryHu/mvce.rs:6:37
|
6 | fn len(self: &&MyNonNull<A>) -> usize {}
| --- ^^^^^ expected `usize`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
error[E0061]: this function takes 1 argument but 0 arguments were supplied
--> /tmp/icemaker_global_tempdir.eHo4LBDDvdmk/rustc_testrunner_tmpdir_reporting.6wJApM6bryHu/mvce.rs:10:14
|
10 | let rc = Rc::new() as Rc<Foo<[u8]>>;
| ^^^^^^^-- argument #1 is missing
|
note: associated function defined here
--> /home/matthias/.rustup/toolchains/master/lib/rustlib/src/rust/library/alloc/src/rc.rs:410:12
|
410 | pub fn new(value: T) -> Rc<T> {
| ^^^
help: provide the argument
|
10 | let rc = Rc::new(/* value */) as Rc<Foo<[u8]>>;
| ~~~~~~~~~~~~~
error: internal compiler error: compiler/rustc_middle/src/ty/mod.rs:1584:13: item_name: no name for DefPath { data: [DisambiguatedDefPathData { data: Impl, disambiguator: 0 }], krate: crate0 }
thread 'rustc' panicked at compiler/rustc_middle/src/ty/mod.rs:1584:13:
Box<dyn Any>
stack backtrace:
0: 0x7634adaf7cba - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h71e03dee79b82d06
1: 0x7634ae212de6 - core::fmt::write::h6960a366d70bc3fd
2: 0x7634af158e11 - std::io::Write::write_fmt::hc000aee1e5248cb2
3: 0x7634adaf7b12 - std::sys::backtrace::BacktraceLock::print::h8f4aa0f83ab25bbe
4: 0x7634adaf9f92 - std::panicking::default_hook::{{closure}}::h6b011d6c9d596681
5: 0x7634adaf9e1a - std::panicking::default_hook::hf20faf194d2c76c9
6: 0x7634acc562cb - std[d07d606e05172b8f]::panicking::update_hook::<alloc[ce64880b90703bb2]::boxed::Box<rustc_driver_impl[fadb44195348e5f3]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x7634adafaad3 - std::panicking::rust_panic_with_hook::hb107d567106f7f52
8: 0x7634acc910f1 - std[d07d606e05172b8f]::panicking::begin_panic::<rustc_errors[3f2036b9e1b7a052]::ExplicitBug>::{closure#0}
9: 0x7634acc85ff6 - std[d07d606e05172b8f]::sys::backtrace::__rust_end_short_backtrace::<std[d07d606e05172b8f]::panicking::begin_panic<rustc_errors[3f2036b9e1b7a052]::ExplicitBug>::{closure#0}, !>
10: 0x7634acc85fdd - std[d07d606e05172b8f]::panicking::begin_panic::<rustc_errors[3f2036b9e1b7a052]::ExplicitBug>
11: 0x7634acc9b021 - <rustc_errors[3f2036b9e1b7a052]::diagnostic::BugAbort as rustc_errors[3f2036b9e1b7a052]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
12: 0x7634ad27d343 - rustc_middle[4ceab1e61766c314]::util::bug::opt_span_bug_fmt::<rustc_span[3b1278fa1989d084]::span_encoding::Span>::{closure#0}
13: 0x7634ad262b3a - rustc_middle[4ceab1e61766c314]::ty::context::tls::with_opt::<rustc_middle[4ceab1e61766c314]::util::bug::opt_span_bug_fmt<rustc_span[3b1278fa1989d084]::span_encoding::Span>::{closure#0}, !>::{closure#0}
14: 0x7634ad2629cb - rustc_middle[4ceab1e61766c314]::ty::context::tls::with_context_opt::<rustc_middle[4ceab1e61766c314]::ty::context::tls::with_opt<rustc_middle[4ceab1e61766c314]::util::bug::opt_span_bug_fmt<rustc_span[3b1278fa1989d084]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
15: 0x7634ab3b3ad0 - rustc_middle[4ceab1e61766c314]::util::bug::bug_fmt
16: 0x7634af422043 - <rustc_middle[4ceab1e61766c314]::ty::context::TyCtxt>::item_name
17: 0x7634acfbccd4 - <rustc_hir_typeck[cc23a872e1f45a74]::fn_ctxt::FnCtxt>::detect_and_explain_multiple_crate_versions
18: 0x7634acfb8e05 - <rustc_hir_typeck[cc23a872e1f45a74]::fn_ctxt::FnCtxt>::suggest_traits_to_import
19: 0x7634acfa2b23 - <rustc_hir_typeck[cc23a872e1f45a74]::fn_ctxt::FnCtxt>::report_no_match_method_error
20: 0x7634acfd58e7 - <rustc_hir_typeck[cc23a872e1f45a74]::fn_ctxt::FnCtxt>::report_method_error
21: 0x7634aef2bbaa - <rustc_hir_typeck[cc23a872e1f45a74]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
22: 0x7634aef1d59b - <rustc_hir_typeck[cc23a872e1f45a74]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
23: 0x7634aef21f89 - <rustc_hir_typeck[cc23a872e1f45a74]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
24: 0x7634aef10119 - <rustc_hir_typeck[cc23a872e1f45a74]::fn_ctxt::FnCtxt>::check_expr_match::{closure#0}
25: 0x7634aef1e19d - <rustc_hir_typeck[cc23a872e1f45a74]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
26: 0x7634aef153cf - <rustc_hir_typeck[cc23a872e1f45a74]::fn_ctxt::FnCtxt>::check_expr_block
27: 0x7634aef1ccb3 - <rustc_hir_typeck[cc23a872e1f45a74]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
28: 0x7634ae8a3e80 - rustc_hir_typeck[cc23a872e1f45a74]::check::check_fn
29: 0x7634ae8adb7d - rustc_hir_typeck[cc23a872e1f45a74]::typeck_with_inspect::{closure#0}
30: 0x7634ae8abb8c - rustc_query_impl[23d350cebea3d85f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[23d350cebea3d85f]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[4ceab1e61766c314]::query::erase::Erased<[u8; 8usize]>>
31: 0x7634ae5dcf0e - rustc_query_system[29f962824b226ddd]::query::plumbing::try_execute_query::<rustc_query_impl[23d350cebea3d85f]::DynamicConfig<rustc_data_structures[9d5d27112098fe07]::vec_cache::VecCache<rustc_span[3b1278fa1989d084]::def_id::LocalDefId, rustc_middle[4ceab1e61766c314]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[29f962824b226ddd]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[23d350cebea3d85f]::plumbing::QueryCtxt, false>
32: 0x7634ae5db411 - rustc_query_impl[23d350cebea3d85f]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
33: 0x7634ae5db0cb - <rustc_middle[4ceab1e61766c314]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[f4ba3cad1ffd0a10]::check_crate::{closure#4}>::{closure#0}
34: 0x7634ae5d917f - rustc_hir_analysis[f4ba3cad1ffd0a10]::check_crate
35: 0x7634ae5d5662 - rustc_interface[8c9fe9b679497e1b]::passes::run_required_analyses
36: 0x7634af15461e - rustc_interface[8c9fe9b679497e1b]::passes::analysis
37: 0x7634af1545ef - rustc_query_impl[23d350cebea3d85f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[23d350cebea3d85f]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[4ceab1e61766c314]::query::erase::Erased<[u8; 0usize]>>
38: 0x7634af1d2595 - rustc_query_system[29f962824b226ddd]::query::plumbing::try_execute_query::<rustc_query_impl[23d350cebea3d85f]::DynamicConfig<rustc_query_system[29f962824b226ddd]::query::caches::SingleCache<rustc_middle[4ceab1e61766c314]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[23d350cebea3d85f]::plumbing::QueryCtxt, false>
39: 0x7634af1d22ce - rustc_query_impl[23d350cebea3d85f]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
40: 0x7634af2250a9 - rustc_interface[8c9fe9b679497e1b]::passes::create_and_enter_global_ctxt::<core[afcf10abfa1dac94]::option::Option<rustc_interface[8c9fe9b679497e1b]::queries::Linker>, rustc_driver_impl[fadb44195348e5f3]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
41: 0x7634af218310 - rustc_interface[8c9fe9b679497e1b]::interface::run_compiler::<(), rustc_driver_impl[fadb44195348e5f3]::run_compiler::{closure#0}>::{closure#1}
42: 0x7634af05dc36 - std[d07d606e05172b8f]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[8c9fe9b679497e1b]::util::run_in_thread_with_globals<rustc_interface[8c9fe9b679497e1b]::util::run_in_thread_pool_with_globals<rustc_interface[8c9fe9b679497e1b]::interface::run_compiler<(), rustc_driver_impl[fadb44195348e5f3]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
43: 0x7634af05d919 - <<std[d07d606e05172b8f]::thread::Builder>::spawn_unchecked_<rustc_interface[8c9fe9b679497e1b]::util::run_in_thread_with_globals<rustc_interface[8c9fe9b679497e1b]::util::run_in_thread_pool_with_globals<rustc_interface[8c9fe9b679497e1b]::interface::run_compiler<(), rustc_driver_impl[fadb44195348e5f3]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[afcf10abfa1dac94]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
44: 0x7634af05d0ab - std::sys::pal::unix::thread::Thread::new::thread_start::h3c2634d9a7e37e9a
45: 0x7634a94a339d - <unknown>
46: 0x7634a952849c - <unknown>
47: 0x0 - <unknown>
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: please make sure that you have updated to the latest nightly
note: rustc 1.86.0-nightly (c234b839d 2025-01-22) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [typeck] type-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0061, E0308, E0412.
For more information about an error, try `rustc --explain E0061`.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Suggestions generated by the compiler applied by `cargo fix`Category: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: This bug is tracked inside the repo by a `known-bug` test.Status: A bisection has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueRelevant to the compiler team, which will review and decide on the PR/issue.