Skip to content

ICE when using trivial_bounds and an associated type #125394

Closed as not planned
@CraftSpider

Description

@CraftSpider

This appears to be an issue in the MissingCopyImplementations lint, possibly it assuming struct S(<Foo as Bar>::Assoc); can be normalized, when due to the bound and the lack of implementation Bar for Foo, the type is effectively struct S(<Error>);

Code

playground

Meta

rustc --version --verbose: locally

rustc 1.80.0-nightly (791adf759 2024-05-21)
binary: rustc
commit-hash: 791adf759cc065316f054961875052d5bc03e16c
commit-date: 2024-05-21
host: x86_64-pc-windows-msvc
release: 1.80.0-nightly
LLVM version: 18.1.6

Error output

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: couldn't normalize struct field `<Bar as Foo>::Assoc` when checking Copy implementation
  --> src/lib.rs:11:17
   |
11 | pub struct Baz2(<Bar as Foo>::Assoc)
   |                 ^^^^^^^^^^^^^^^^^^^
   |
note: delayed at compiler/rustc_trait_selection/src/traits/misc.rs:177:27 - disabled backtrace
  --> src/lib.rs:11:17
   |
11 | pub struct Baz2(<Bar as Foo>::Assoc)
   |                 ^^^^^^^^^^^^^^^^^^^

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: please attach the file at `/playground/rustc-ice-2024-05-22T05_01_12-24.txt` to your bug report

note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
warning: `playground` (lib) generated 3 warnings
error: could not compile `playground` (lib); 3 warnings emitted
Backtrace

note: delayed at compiler/rustc_trait_selection/src/traits/misc.rs:177:27
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxt>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: rustc_trait_selection::traits::misc::all_fields_implement_trait
         4: <rustc_lint::builtin::MissingCopyImplementations as rustc_lint::passes::LateLintPass>::check_item
         5: <rustc_lint::BuiltinCombinedModuleLateLintPass as rustc_lint::passes::LateLintPass>::check_item
         6: <rustc_lint::late::LateContextAndPass<rustc_lint::BuiltinCombinedModuleLateLintPass> as rustc_hir::intravisit::Visitor>::visit_nested_item
         7: rustc_lint::lint_mod
         8: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::lint_mod::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
         9: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalModDefId, rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        10: rustc_query_impl::query_impl::lint_mod::get_query_non_incr::__rust_end_short_backtrace
        11: rustc_lint::late::check_crate::{closure#1}
        12: rustc_lint::late::check_crate
        13: rustc_interface::passes::analysis
        14: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        16: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        17: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        18: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        19: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#2} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        20: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/791adf759cc065316f054961875052d5bc03e16c/library/alloc/src/boxed.rs:2063:9
        21: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/791adf759cc065316f054961875052d5bc03e16c/library/alloc/src/boxed.rs:2063:9
        22: std::sys::pal::unix::thread::Thread::new::thread_start
                   at /rustc/791adf759cc065316f054961875052d5bc03e16c/library/std/src/sys/pal/unix/thread.rs:108:17
        23: start_thread
        24: clone

Metadata

Metadata

Labels

C-bugCategory: This is a bug.F-trivial_bounds`#![feature(trivial_bounds)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️L-missing_copy_implementationsLint: missing_copy_implementationsS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions