-
Notifications
You must be signed in to change notification settings - Fork 13.3k
ICE in librustc::traits::select::confirm_param_candidate #68295
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
It would be nice if you could post the backtrace next time :)
|
Something small-ish: pub struct Matrix<R, C, S> {
_phantoms: std::marker::PhantomData<(R, C, S)>,
}
impl<R, C, S> Matrix<R, C, S> {
pub fn into_owned(self) -> Matrix<R, C, Owned<R, C, ()>>
where
(): Allocator<R, C>,
{
unimplemented!()
}
}
impl<D, S> Matrix<D, D, S> {
pub fn hermitian_part(&self) -> Matrix<D, D, Owned<D, D, ()>>
where
(): Allocator<D, D>,
{
unimplemented!()
}
}
pub trait Allocator<R, C> {
type Buffer;
}
pub trait Trait<R, C, A> {
type Power;
}
impl<R, C, A: Allocator<R, C>> Trait<R, C, A> for () {
type Power = A::Buffer;
}
pub type Owned<R, C, G> = <G as Trait<R, C, ()>>::Power;
pub fn crash<R, C>(input: Matrix<R, C, ()>) -> Matrix<R, C, u32>
where
(): Allocator<R, C>,
{
input.into_owned()
} |
This is an issue with how Unfortunately, this doesn't take into account relationships between type variables. This leads to the following scenario:
In the minimized example, we end up caching I think we either need to either:
This may have soundness implications, especially when it comes to regions. I don't think we're guaranteed to always ICE on a cache entry that's actually inapplicable. |
Can't freshening try to resolve every variable it's replacing, on the fly? |
I got another ICE with the same codebase, after tweaking it to pass trait resolution. Commit that reproduces the ICE is at aweinstock314/nalgebra@649507d . Should I file this as a separate issue, or treat it as related for now? Backtrace is as follows:
|
@aweinstock314 a new issue would be great |
Issue #68090 gives an error message with very similar strings ("broken MIR in DefId"/"NoSolution") and their minimized example looks like it was minimized from a type that's also used by nalgebra, so I'll try to figure out whether the second ICE is a duplicate of that before filing an issue/adding to that thread. |
triage: P-high, removing nomination |
cc @rust-lang/wg-traits |
I'm familiar with this bug, I can try to dig in and make a recommendation for a fix. |
No longer ICEs since #86506 |
add some more testcases resolves rust-lang#52893 resolves rust-lang#68295 resolves rust-lang#87750 resolves rust-lang#88071 All these issues have been fixed according to glacier. Just adding a test so it can be closed. Can anybody tell me why the github keywords do not work? 🤔 Please edit this post if you can fix it.
add some more testcases resolves rust-lang#52893 resolves rust-lang#68295 resolves rust-lang#87750 resolves rust-lang#88071 All these issues have been fixed according to glacier. Just adding a test so it can be closed. Can anybody tell me why the github keywords do not work? 🤔 Please edit this post if you can fix it.
Error message:
error: internal compiler error: src/librustc/traits/select.rs:2922: Where clause `Binder(<base::default_allocator::DefaultAllocator as base::allocator::Allocator<N, R, C>>)` was applicable to `Obligation(predicate=Binder(TraitPredicate(<base::default_allocator::DefaultAllocator as base::allocator::Allocator<_, _, _>>)), depth=1)` but now is not
Commit that reproduces the issue: aweinstock314/nalgebra@5106e2d
I get the same error (except for the exact line number) on 1.38, 1.40, beta, and a couple of nightlies.
The other issues reachable via the query
is:issue is:open ICE "but now is not"
(#62742 and #55765) are both about the"was matchable against"
bug!
invocation atrust/src/librustc/traits/select.rs
Line 3464 in 4884061
bug!
invocation is atrust/src/librustc/traits/select.rs
Line 2781 in 4884061
I haven't yet tried to minimize this: The commit beforehand (1 line difference) on the same nalgebra branch is a compile-fail due to a trait method not being found, and I'm still trying to figure out if that one's a bug in my code.
The text was updated successfully, but these errors were encountered: