-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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: slices are not scalars
II
#116721
Comments
cc @cjgillot |
I cannot reproduce the original anymore, but #121357 does reproduce. |
I can still reproduce this with the original mvce when I use the flags that I listed. |
bisected #121357 with searched nightlies: from nightly-2023-09-01 to nightly-2023-10-01 bisected with cargo-bisect-rustc v0.6.8 cc #115612 |
The bisection here isn't useful sadly, but thank you anyways. rust/compiler/rustc_mir_transform/src/lib.rs Line 451 in bb59453
Self: Sized here). It sadly has to filter out "non-global" predicates, which Self: Sized belongs to. It has to do this because of overflows as mentioned above.@compiler-errors told me that the new trait solvers non-fatal handling of overflow will allow this to be fixed. But until then, there's nothing we can do. As for getting the code working, the solution here so to avoid these impossible bounds wherever possible. In the example here, that's easy to do, just delete it. In #121357 that's a bit more annoying, I don't really see a solution. We could try playing whack-a-mole by trying to make the MIR opts sorta-handle these cases that slip through, but I don't think that's very sustainable. Might work at least for the trivial cases like #121357 though, but I don't open PRs for that. |
another one fn cast_same_meta<T: ?Sized, U: ?Sized>(ptr: *const T) -> *const U {}
fn sized_slice<T>(ptr: *const [T]) -> *const str
where
[T]: Sized,
{
cast_same_meta(ptr)
} |
I'm afraid that this has reached stable with 1.78. I couldn't reproduce it with the minimal example in the previous comment, but a crate of mine now fails on stable, but compiled fine on 1.77.2:
full output
The code responsible for this is fairly simple: Removing that impl makes the crate compile again. Will we still just wait for the new solver, now that it's a stable-stable regression? |
I managed to minimize the example from use bytemuck::Pod; // 1.15.0
struct NPlusOneArray<T, const N: usize>([T; N], T);
impl<T: Pod, const N: usize> AsRef<[T]> for NPlusOneArray<T, N>
where
[T]: Pod,
{
fn as_ref(&self) -> &[T] {
todo!()
}
} (On Playground, ICE in release mode) |
Avoid cloning jump threading state when possible The current implementation of jump threading passes most of its time cloning its state. This PR attempts to avoid such clones by special-casing the last predecessor when recursing through a terminator. This is not optimal, but a first step while I refactor the state data structure to be sparse. The two other commits are drive-by. Fixes rust-lang#116721 r? `@oli-obk`
Avoid cloning jump threading state when possible The current implementation of jump threading passes most of its time cloning its state. This PR attempts to avoid such clones by special-casing the last predecessor when recursing through a terminator. This is not optimal, but a first step while I refactor the state data structure to be sparse. The two other commits are drive-by. Fixes rust-lang#116721 r? `@oli-obk`
Avoid cloning jump threading state when possible The current implementation of jump threading passes most of its time cloning its state. This PR attempts to avoid such clones by special-casing the last predecessor when recursing through a terminator. This is not optimal, but a first step while I refactor the state data structure to be sparse. The two other commits are drive-by. Fixes rust-lang#116721 r? `@oli-obk`
Avoid cloning jump threading state when possible The current implementation of jump threading passes most of its time cloning its state. This PR attempts to avoid such clones by special-casing the last predecessor when recursing through a terminator. This is not optimal, but a first step while I refactor the state data structure to be sparse. The two other commits are drive-by. Fixes rust-lang/rust#116721 r? `@oli-obk`
Avoid cloning jump threading state when possible The current implementation of jump threading passes most of its time cloning its state. This PR attempts to avoid such clones by special-casing the last predecessor when recursing through a terminator. This is not optimal, but a first step while I refactor the state data structure to be sparse. The two other commits are drive-by. Fixes rust-lang/rust#116721 r? `@oli-obk`
File: /tmp/icemaker/033b7887410cef9d40e915f3b66f44d747d3e0d2.rs
#116513 season two
auto-reduced (treereduce-rust):
original:
Version information
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zmir-opt-level=3 --emit=mir
Program output
The text was updated successfully, but these errors were encountered: