Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: error: internal compiler error[E0277]: the trait bound 'str: const Deref' is not satisfied #135210

Open
matthiaskrgr opened this issue Jan 7, 2025 · 1 comment
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. F-const_trait_impl `#![feature(const_trait_impl)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

#![feature(const_trait_impl)]
const _: fn(&String) = |s| {
    &*s as &str;
};

fn main() {}

original:

//@ check-pass

const _: fn(&String) = |s| { &*s as &str; };

fn main() {
        println!("hi");
    }

Version information

rustc 1.86.0-nightly (fb546ee09 2025-01-07)
binary: rustc
commit-hash: fb546ee09b226bc4dd4b712d35a372d923c4fa54
commit-date: 2025-01-07
host: x86_64-unknown-linux-gnu
release: 1.86.0-nightly
LLVM version: 19.1.6

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(const_trait_impl)

Program 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[E0277]: the trait bound `str: const Deref` is not satisfied
 --> /tmp/icemaker_global_tempdir.anmGc5oi45fj/rustc_testrunner_tmpdir_reporting.YXjbcW9xAirT/mvce.rs:2:5
  |
2 |     &*s as &str;
  |     ^^^
  |
note: delayed at compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:773:24
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_selection_error
         4: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_fulfillment_error
         5: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_fulfillment_errors
         6: rustc_hir_typeck::typeck_with_fallback::{closure#0}
         7: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
         8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
         9: rustc_query_impl::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
        10: rustc_hir_analysis::check::check::check_item_type
        11: rustc_hir_analysis::check::wfcheck::check_well_formed
        12: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        13: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 1]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        14: rustc_query_impl::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
        15: rustc_hir_analysis::check::wfcheck::check_mod_type_wf
        16: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        17: 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; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        18: rustc_query_impl::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
        19: rustc_hir_analysis::check_crate
        20: rustc_interface::passes::run_required_analyses
        21: rustc_interface::passes::analysis
        22: 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; 0]>>
        23: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        24: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        25: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
        26: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        27: std::sys::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<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
        28: <<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<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        29: std::sys::pal::unix::thread::Thread::new::thread_start
        30: <unknown>
        31: <unknown>
 --> /tmp/icemaker_global_tempdir.anmGc5oi45fj/rustc_testrunner_tmpdir_reporting.YXjbcW9xAirT/mvce.rs:2:5
  |
2 |     &*s as &str;
  |     ^^^

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 (fb546ee09 2025-01-07) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z crate-attr=feature(const_trait_impl) -Z dump-mir-dir=dir

query stack during panic:
end of query stack

@rustbot label +F-const_trait_impl

@matthiaskrgr matthiaskrgr added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 7, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 7, 2025
@matthiaskrgr
Copy link
Member Author

bisects to #134951 cc @compiler-errors

@compiler-errors compiler-errors self-assigned this Jan 7, 2025
@fmease fmease added F-const_trait_impl `#![feature(const_trait_impl)]` A-diagnostics Area: Messages for errors, warnings, and lints and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. F-const_trait_impl `#![feature(const_trait_impl)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants