-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 when compiling some specific set of traits defined for nalgebra's matrix #84399
Comments
Bisected:
|
@farmaazon Thanks for the report and putting together the reproduction! @hameerabbasi I think there may have been a mistake with bisecting. nalgebra 0.26 requires nightly-2021-01-09 at a minimum due to the use of the
Changing to nalgebra 0.25 I was able to reproduce the ICE in 1.47. nalgebra 0.25 does not build on earlier versions. I think if you want to bisect further, someone will need to create a smaller reproduction that does not involve any dependencies. |
@ehuss Nalgebra 0.21.1 compiles on both old nightly ( |
Thanks for the pointers and sorry for the unnecessary ping. I've updated my bisection in #84399 (comment) based on the reproducer in #84399 (comment). |
Reduced: use std::marker::PhantomData;
pub trait Allocator<R> {
type Buffer;
}
pub struct DefaultAllocator;
impl <R> Allocator<R> for DefaultAllocator {
type Buffer = ();
}
pub type Owned<R> = <DefaultAllocator as Allocator<R>>::Buffer;
pub type MatrixMN<R> = Matrix<R, Owned<R>>;
pub type Matrix4<N> = Matrix<N, ()>;
pub struct Matrix<R, S> {
pub data: S,
_phantoms: PhantomData<R>,
}
pub fn set_object_transform(matrix: &Matrix4<()>) {
matrix.js_buffer_view();
}
pub trait Storable {
type Cell;
fn slice_to_items(_buffer: &()) -> &[Self::Cell] {
unimplemented!()
}
}
pub type Cell<T> = <T as Storable>::Cell;
impl<R> Storable for MatrixMN<R>
where
DefaultAllocator: Allocator<R>,
{
type Cell = ();
}
pub trait JsBufferView {
fn js_buffer_view(&self) -> usize {
unimplemented!()
}
}
impl<R> JsBufferView for [MatrixMN<R>]
where
DefaultAllocator: Allocator<R>,
MatrixMN<R>: Storable,
[Cell<MatrixMN<R>>]: JsBufferView,
{
fn js_buffer_view(&self) -> usize {
<MatrixMN<R> as Storable>::slice_to_items(&()).js_buffer_view()
}
}
impl JsBufferView for [()] {}
impl<R> JsBufferView for MatrixMN<R> where DefaultAllocator: Allocator<R> {} Regression in nightly-2020-04-10 found 6 bors merge commits in the specified range |
Assigning priority as discussed as part of the Prioritization Working Group procedure and removing @rustbot label -I-prioritize +P-medium |
@apiraino thanks for the update. I've noticed that the assigned label is |
This is caused by the way that In rust/compiler/rustc_middle/src/ty/mod.rs Lines 1205 to 1217 in cb81dc5
When we're querying the selection candidate cache, we call rust/compiler/rustc_trait_selection/src/traits/select/mod.rs Lines 1077 to 1080 in cb81dc5
A 'freshened' predicate will have inference variables replaced with The behavior of |
@Aaron1011 thanks for the overview, follow-up question for my full understanding: you are pointing to where the problem in rustc is, correct? Are there any implications about fixes/workarounds the issue reporter can apply to their code? @wdanilo we generally assign a |
Issue: rust-lang/rust#84399
great @Aaron1011 thanks for the additional details and for working on a patch! Updating priority accordingly |
Fixed by #84472 |
Code
available at https://github.com/farmaazon/rustc-ice-case
Meta
rustc --version --verbose
:also reproduced on
HOWEVER it does not reproduce on
Error output
Backtrace
The text was updated successfully, but these errors were encountered: