-
Notifications
You must be signed in to change notification settings - Fork 13.3k
ICE: the trait bound T: ~const Deref
is not satisfied
#136273
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
Labels
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
@rustbot label +F-const_trait_impl |
Minimized: #![feature(const_trait_impl)]
#![feature(const_deref)]
pub struct Foo;
impl const std::ops::Deref for Foo {
type Target = i32;
fn deref(&self) -> &i32 {
&0
}
}
pub const fn coerce(x: &Foo) -> &i32 {
// deref coercion
x
} Error output
|
This error can currently be worked around by explicitly doing dereferences. In the original code, this would be: unsafe { Pin::new_unchecked(&mut **this.get_unchecked_mut()) } |
probably duplicate of #135210 |
workingjubilee
added a commit
to workingjubilee/rustc
that referenced
this issue
Jan 31, 2025
…=fee1-dead Use proper type when applying deref adjustment in const When applying a deref adjustment to some type `Wrap<T>` which derefs to `T`, we were checking that `T: ~const Deref`, not `Wrap<T>: ~const Deref` like we should have been. r? project-const-traits Fixes rust-lang#136273 Fixes rust-lang#135210 -- I just deleted the test since the regression test is uninteresting
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Feb 1, 2025
Rollup merge of rust-lang#136314 - compiler-errors:const-deref-adj, r=fee1-dead Use proper type when applying deref adjustment in const When applying a deref adjustment to some type `Wrap<T>` which derefs to `T`, we were checking that `T: ~const Deref`, not `Wrap<T>: ~const Deref` like we should have been. r? project-const-traits Fixes rust-lang#136273 Fixes rust-lang#135210 -- I just deleted the test since the regression test is uninteresting
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.
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.
Code
Playground link
Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: