Closed
Description
Code
(reduced)
pub trait Foo<'a> {
type Assoc;
fn demo() -> impl Foo
where
String: Copy;
}
fn main() {}
(original)
Code
//@ check-pass
// Check that we don't hit a query cycle when:
// 1. Computing generics_of, which requires...
// 2. Calling resolve_bound_vars, which requires...
// 3. Calling associated_items, which requires...
// 4. Calling associated_type_for_impl_trait_in_trait, which requires...
// 5. Computing generics_of, which cycles.
pub trait Foo<'a> {
type Assoc;
fn demo<T>(other: T) -> impl Foo<'a, Assoc = Self::Assoc>
where
String: Copy;
}
fn main() {}
Meta
rustc --version --verbose
:
rustc 1.79.0-nightly (2f090c30d 2024-03-23)
binary: rustc
commit-hash: 2f090c30ddd6b3bbe5c81c087579a5166e7c7278
commit-date: 2024-03-23
host: x86_64-apple-darwin
release: 1.79.0-nightly
LLVM version: 18.1.2
Error output
error[E0106]: missing lifetime specifier
--> reduced_7F5E3FA30E36CB4C7B06DCD49C5E8CADCFAEDD50AB5C52D530A4BCAE97100BC9.rs:4:23
|
4 | fn demo() -> impl Foo
| ^^^ expected named lifetime parameter
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'a` lifetime
|
4 | fn demo() -> impl Foo<'a>
| ++++
error[E0277]: the trait bound `String: Copy` is not satisfied
--> reduced_7F5E3FA30E36CB4C7B06DCD49C5E8CADCFAEDD50AB5C52D530A4BCAE97100BC9.rs:6:9
|
6 | String: Copy;
| ^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
|
= help: see issue #48214
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
1 + #![feature(trivial_bounds)]
|
Backtrace
thread 'rustc' panicked at /rustc/2f090c30ddd6b3bbe5c81c087579a5166e7c7278/compiler/rustc_middle/src/hir/mod.rs:178:21:
no entry found for key
stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: core::panicking::panic_display
3: core::option::expect_failed
4: <rustc_middle::hir::provide::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_hir::hir_id::OwnerId)>>::call_once
[... omitted 1 frame ...]
5: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::VecCache<rustc_hir::hir_id::OwnerId, rustc_middle::query::erase::Erased<[u8; 8]>>>
6: <rustc_middle::ty::context::TyCtxt>::parent_hir_id
7: <rustc_middle::ty::context::TyCtxt>::disabled_nightly_features::<rustc_span::ErrorGuaranteed, [(alloc::string::String, rustc_span::symbol::Symbol); 1]>
8: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::suggestions::TypeErrCtxtExt>::note_obligation_cause_code::<rustc_span::ErrorGuaranteed, rustc_middle::ty::predicate::Predicate>
9: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::type_err_ctxt_ext::InferCtxtPrivExt>::note_obligation_cause
10: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::type_err_ctxt_ext::TypeErrCtxtExt>::report_selection_error
11: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::type_err_ctxt_ext::InferCtxtPrivExt>::report_fulfillment_error
12: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::type_err_ctxt_ext::TypeErrCtxtExt>::report_fulfillment_errors
13: <rustc_trait_selection::traits::engine::ObligationCtxt>::assumed_wf_types_and_report_errors
14: rustc_hir_analysis::check::wfcheck::enter_wf_checking_ctxt::<rustc_hir_analysis::check::wfcheck::check_associated_item::{closure#0}>
15: rustc_hir_analysis::check::wfcheck::check_well_formed
[... omitted 1 frame ...]
16: rustc_middle::query::plumbing::query_ensure_error_guaranteed::<rustc_query_system::query::caches::VecCache<rustc_hir::hir_id::OwnerId, rustc_middle::query::erase::Erased<[u8; 1]>>, ()>
17: rustc_hir_analysis::check::wfcheck::check_mod_type_wf
[... omitted 1 frame ...]
18: rustc_hir_analysis::check_crate
19: rustc_interface::passes::analysis
[... omitted 1 frame ...]
20: <rustc_interface::queries::QueryResult<&rustc_middle::ty::context::GlobalCtxt>>::enter::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}::{closure#3}>
21: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: 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: please attach the file at `/Volumes/T7/workspace/placeholder_rustexec/rustc-ice-2024-03-24T10_33_18-39701.txt` to your bug report
query stack during panic:
#0 [hir_owner_parent] getting HIR parent of `Foo::{synthetic#0}`
#1 [check_well_formed] checking that `Foo::demo` is well-formed
#2 [check_mod_type_wf] checking that types are well-formed in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0106, E0277.
For more information about an error, try `rustc --explain E0106`.
Related Issues
- The ICE location in closed issue Adjust error
yield
/await
lowering #121664 is same as the current ICE location.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsCategory: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: 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.