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 with the image crate #100246

Closed
sanbox-irl opened this issue Aug 7, 2022 · 2 comments · Fixed by #100261
Closed

ICE with the image crate #100246

sanbox-irl opened this issue Aug 7, 2022 · 2 comments · Fixed by #100261
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

@sanbox-irl
Copy link

Code

fn load_get<A>() -> Result<&'static A, ()> {
    unimplemented!()
}

fn main() -> Result<(), ()> {
    let image: image::ImageBuffer<image::Rgba<u8>, Vec<u8>> = load_get()?;
    Ok(())
}

Meta

rustc --version --verbose:

❯ rustc --version --verbose
rustc 1.62.1 (e092d0b6b 2022-07-16)
binary: rustc
commit-hash: e092d0b6b43f2de967af0887873151bb1c0b18d3
commit-date: 2022-07-16
host: aarch64-apple-darwin
release: 1.62.1
LLVM version: 14.0.5

Error output

error[E0275]: overflow evaluating the requirement `&num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<num_rational::Ratio<_>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: num_traits::pow::Pow<&u128>`
 --> src/main.rs:6:63
  |
6 |     let image: image::ImageBuffer<image::Rgba<u8>, Vec<u8>> = load_get()?;
  |                                                               ^^^^^^^^^^^
  |
  = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`tester`)

and then if I increase the recursion limit enough...

process didn't exit successfully: `rustc --crate-name tester --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C metadata=e9955c5db8fba40f -C extra-filename=-e9955c5db8fba40f --out-dir /Users/jjspira/Documents/Rust/tester/target/debug/deps -C incremental=/Users/jjspira/Documents/Rust/tester/target/debug/incremental -L dependency=/Users/jjspira/Documents/Rust/tester/target/debug/deps --extern image=/Users/jjspira/Documents/Rust/tester/target/debug/deps/libimage-1ae40fb2a0984fba.rlib` (signal: 10, SIGBUS: access to undefined memory)

adding a backtrace gives nothing new, however, compiling on nightly gives the following:

❯ cargo +nightly run
   Compiling tester v0.1.0 (/Users/jjspira/Documents/Rust/tester)

thread 'rustc' has overflowed its stack
fatal runtime error: stack overflow
error: could not compile `tester`

Caused by:
  process didn't exit successfully: `rustc --crate-name tester --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C metadata=e5c31fefbe1f1d2f -C extra-filename=-e5c31fefbe1f1d2f --out-dir /Users/jjspira/Documents/Rust/tester/target/debug/deps -C incremental=/Users/jjspira/Documents/Rust/tester/target/debug/incremental -L dependency=/Users/jjspira/Documents/Rust/tester/target/debug/deps --extern image=/Users/jjspira/Documents/Rust/tester/target/debug/deps/libimage-0281d5d432728bf8.rlib` (signal: 6, SIGABRT: process abort signal)

I strongly suspect this is related to #89275, but that issue is now old and should have been solved. Perhaps a regression?

@sanbox-irl sanbox-irl 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 Aug 7, 2022
@compiler-errors
Copy link
Member

@sanbox-irl can you provide the Cargo.toml you compiled that code snippet with? The provided code doesn't seem complete.

@est31
Copy link
Member

est31 commented Aug 8, 2022

@compiler-errors I can reproduce it with image = "0.24" in the [dependencies] section of a Cargo.toml, but this is not an ICE.

luqmana added a commit to luqmana/rust that referenced this issue Aug 8, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Aug 9, 2022
Set tainted errors bit before emitting coerce suggestions.

Fixes rust-lang#100246.

rust-lang#89576 basically got 99% of the way there but the match typechecking code (which calls `coerce_inner`) also needed a similar fix.
@bors bors closed this as completed in 2be32e8 Aug 10, 2022
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

Successfully merging a pull request may close this issue.

3 participants