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: for lifetime and trait issue. #133635

Closed
mstankus opened this issue Nov 29, 2024 · 2 comments
Closed

ICE: for lifetime and trait issue. #133635

mstankus opened this issue Nov 29, 2024 · 2 comments
Labels
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.

Comments

@mstankus
Copy link

Code

pub trait Monomial<ITER : for<'a> Iterator<Item=&'a u8>> {
  fn value(&self) -> ITER;
}

struct U8arrayMonomial {
  data : Vec<u8>
}

impl<ITER : for <'a> Iterator<Item=&'a u8>> Monomial<ITER> for U8arrayMonomial {
  fn value(&self) -> ITER {
    self.data.iter()
  }
}

Meta

rustc --version --verbose:

rustc 1.82.0 (f6e511eec 2024-10-15)
binary: rustc
commit-hash: f6e511eec7342f59a25f7c0534f1dbea00d01b14
commit-date: 2024-10-15
host: x86_64-pc-windows-msvc
release: 1.82.0
LLVM version: 19.1.1

Error output

   Compiling rewrite_rule v0.1.0 (C:\cygwin64\home\mstan\Repositories\github.com\mstankus\Rust\rewrite_rule)
error[E0582]: binding for associated type `Item` references lifetime `'a`, which does not appear in the trait input types
 --> src\lib.rs:1:44
  |
1 | pub trait Monomial<ITER : for<'a> Iterator<Item=&'a u8>> {
  |                                            ^^^^^^^^^^^

error[E0582]: binding for associated type `Item` references lifetime `'a`, which does not appear in the trait input types
 --> src\lib.rs:9:31
  |
9 | impl<ITER : for <'a> Iterator<Item=&'a u8>> Monomial<ITER> for U8arrayMonomial {
  |                               ^^^^^^^^^^^

thread 'rustc' panicked at compiler\rustc_trait_selection\src\error_reporting\infer\region.rs:634:21:
internal error: entered unreachable code: control flow ensures we have a `BindingObligation` or `WhereClauseInExpr` here...
stack backtrace:
   0:     0x7ffa93af0f51 - std::backtrace_rs::backtrace::dbghelp64::trace
                               at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
   1:     0x7ffa93af0f51 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ffa93af0f51 - std::sys::backtrace::_print_fmt
                               at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/std\src\sys\backtrace.rs:66
   3:     0x7ffa93af0f51 - std::sys::backtrace::impl$0::print::impl$0::fmt
                               at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/std\src\sys\backtrace.rs:39
   4:     0x7ffa93b22629 - core::fmt::rt::Argument::fmt
                               at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/core\src\fmt\rt.rs:177
   5:     0x7ffa93b22629 - core::fmt::write
                               at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/core\src\fmt\mod.rs:1178
   6:     0x7ffa93ae7117 - std::io::Write::write_fmt<std::sys::pal::windows::stdio::Stderr>
                               at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/std\src\io\mod.rs:1823
   7:     0x7ffa93af4069 - std::panicking::default_hook::closure$1
                               at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/std\src\panicking.rs:266
   8:     0x7ffa93af3bec - std::panicking::default_hook
                               at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/std\src\panicking.rs:293
   9:     0x7ffa95045e40 - memchr
  10:     0x7ffa93af4a7b - alloc::boxed::impl$50::call
                               at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/alloc\src\boxed.rs:2245
  11:     0x7ffa93af4a7b - std::panicking::rust_panic_with_hook
                               at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/std\src\panicking.rs:805
  12:     0x7ffa93af484f - std::panicking::begin_panic_handler::closure$0
                               at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/std\src\panicking.rs:664
  13:     0x7ffa93af1a0f - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/std\src\sys\backtrace.rs:170
  14:     0x7ffa93af4496 - std::panicking::begin_panic_handler
                               at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/std\src\panicking.rs:662
  15:     0x7ffa968b47d4 - core::panicking::panic_fmt
                               at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/core\src\panicking.rs:74
  16:     0x7ffa95fc0c75 - <rustc_trait_selection[b31f3d1679822cf9]::error_reporting::TypeErrCtxt>::suggest_copy_trait_method_bounds
  17:     0x7ffa95fbbc2f - <rustc_trait_selection[b31f3d1679822cf9]::error_reporting::TypeErrCtxt>::report_region_errors
  18:     0x7ffa93df4ed4 - rustc_hir_analysis[a3e25647ecbace42]::check::wfcheck::check_well_formed
  19:     0x7ffa94684b3b - rustc_query_impl[1cbfc9fc16052fcf]::plumbing::query_key_hash_verify_all
  20:     0x7ffa945bb3ad - rustc_ty_utils[67287b256ac86568]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  21:     0x7ffa946950c1 - rustc_query_impl[1cbfc9fc16052fcf]::plumbing::query_key_hash_verify_all
  22:     0x7ffa93e004df - rustc_hir_analysis[a3e25647ecbace42]::check::wfcheck::check_mod_type_wf
  23:     0x7ffa936df39b - rustc_ty_utils[67287b256ac86568]::ty::adt_sized_constraint
  24:     0x7ffa9366d7a1 - rustc_ty_utils[67287b256ac86568]::ty::adt_sized_constraint
  25:     0x7ffa936f4a8e - rustc_query_impl[1cbfc9fc16052fcf]::query_system
  26:     0x7ffa93e352de - rustc_hir_analysis[a3e25647ecbace42]::check_crate
  27:     0x7ffa93b62d51 - rustc_interface[ab63cb8dd572d7f1]::passes::resolver_for_lowering_raw
  28:     0x7ffa90bf8000 - rustc_interface[ab63cb8dd572d7f1]::passes::analysis
  29:     0x7ffa936e15cb - rustc_ty_utils[67287b256ac86568]::ty::adt_sized_constraint
  30:     0x7ffa93651b4c - rustc_ty_utils[67287b256ac86568]::ty::adt_sized_constraint
  31:     0x7ffa936ea263 - rustc_query_impl[1cbfc9fc16052fcf]::query_system
  32:     0x7ffa90bb6e21 - _rust_alloc_error_handler
  33:     0x7ffa90bb2a16 - _rust_alloc_error_handler
  34:     0x7ffa90bbc5db - _rust_alloc_error_handler
  35:     0x7ffa93b0640d - alloc::boxed::impl$48::call_once
                               at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/alloc\src\boxed.rs:2231
  36:     0x7ffa93b0640d - alloc::boxed::impl$48::call_once
                               at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/alloc\src\boxed.rs:2231
  37:     0x7ffa93b0640d - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/std\src\sys\pal\windows\thread.rs:55
  38:     0x7ffb6635259d - BaseThreadInitThunk
  39:     0x7ffb6720af38 - RtlUserThreadStart

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: rustc 1.82.0 (f6e511eec 2024-10-15) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

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

query stack during panic:
#0 [check_well_formed] checking that `<impl at src\lib.rs:9:1: 9:79>` is well-formed
#1 [check_mod_type_wf] checking that types are well-formed in top-level module
end of query stack
For more information about this error, try `rustc --explain E0582`.
error: could not compile `rewrite_rule` (lib) due to 2 previous errors
Backtrace

   Compiling rewrite_rule v0.1.0 (C:\cygwin64\home\mstan\Repositories\github.com\mstankus\Rust\rewrite_rule)
error[E0582]: binding for associated type `Item` references lifetime `'a`, which does not appear in the trait input types
 --> src\lib.rs:1:44
  |
1 | pub trait Monomial<ITER : for<'a> Iterator<Item=&'a u8>> {
  |                                            ^^^^^^^^^^^

error[E0582]: binding for associated type `Item` references lifetime `'a`, which does not appear in the trait input types
 --> src\lib.rs:9:31
  |
9 | impl<ITER : for <'a> Iterator<Item=&'a u8>> Monomial<ITER> for U8arrayMonomial {
  |                               ^^^^^^^^^^^

thread 'rustc' panicked at compiler\rustc_trait_selection\src\error_reporting\infer\region.rs:634:21:
internal error: entered unreachable code: control flow ensures we have a `BindingObligation` or `WhereClauseInExpr` here...
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/std\src\panicking.rs:662
   1: core::panicking::panic_fmt
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/core\src\panicking.rs:74
   2: <rustc_trait_selection::error_reporting::TypeErrCtxt>::suggest_copy_trait_method_bounds
   3: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_region_errors
   4: rustc_hir_analysis::check::wfcheck::check_well_formed
   5: rustc_query_impl::plumbing::query_key_hash_verify_all
   6: rustc_ty_utils::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
   7: rustc_query_impl::plumbing::query_key_hash_verify_all
   8: rustc_hir_analysis::check::wfcheck::check_mod_type_wf
   9: rustc_ty_utils::ty::adt_sized_constraint
  10: rustc_ty_utils::ty::adt_sized_constraint
  11: rustc_query_impl::query_system
  12: rustc_hir_analysis::check_crate
  13: rustc_interface::passes::resolver_for_lowering_raw
  14: rustc_interface::passes::analysis
  15: rustc_ty_utils::ty::adt_sized_constraint
  16: rustc_ty_utils::ty::adt_sized_constraint
  17: rustc_query_impl::query_system
  18: _rust_alloc_error_handler
  19: _rust_alloc_error_handler
  20: _rust_alloc_error_handler
  21: alloc::boxed::impl$48::call_once
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/alloc\src\boxed.rs:2231
  22: alloc::boxed::impl$48::call_once
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/alloc\src\boxed.rs:2231
  23: std::sys::pal::windows::thread::impl$0::new::thread_start
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/std\src\sys\pal\windows\thread.rs:55
  24: BaseThreadInitThunk
  25: RtlUserThreadStart
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: rustc 1.82.0 (f6e511eec 2024-10-15) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

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

query stack during panic:
#0 [check_well_formed] checking that `<impl at src\lib.rs:9:1: 9:79>` is well-formed
#1 [check_mod_type_wf] checking that types are well-formed in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
For more information about this error, try `rustc --explain E0582`.
error: could not compile `rewrite_rule` (lib) due to 2 previous errors

@mstankus mstankus 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 Nov 29, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 29, 2024
@cyrgani
Copy link
Contributor

cyrgani commented Nov 29, 2024

Already fixed in 1.83, probably the same as #130012.

@lqd
Copy link
Member

lqd commented Nov 29, 2024

Closing as a duplicate then. Thanks for opening an issue!

@lqd lqd closed this as completed Nov 29, 2024
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 30, 2024
@fmease fmease closed this as not planned Won't fix, can't repro, duplicate, stale Nov 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

No branches or pull requests

6 participants