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: encountered type variable #131758

Open
matthiaskrgr opened this issue Oct 15, 2024 · 1 comment
Open

ICE: encountered type variable #131758

matthiaskrgr opened this issue Oct 15, 2024 · 1 comment
Labels
A-closures Area: Closures (`|…| { … }`) C-bug Category: This is a bug. F-unboxed_closures `#![feature(unboxed_closures)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

#![feature(unboxed_closures)]
trait Foo {}

impl<T: Fn<(i32,)>> Foo for T {}

fn baz<T: Foo>(_: T) {}

fn main() {
    baz(|x| ());
}

original:

trait Foo {}

impl<T: Fn<(i32,)>> Foo for T {}

fn baz<T: Foo>(_: T) {}

fn main() {
    baz(|_| ());
    //~^ ERROR implementation of `FnOnce` is not general enough
    //~| ERROR implementation of `Fn` is not general enough
    baz(|x| ());
    //~^ ERROR implementation of `FnOnce` is not general enough
    //~| ERROR implementation of `Fn` is not general enough
}

Version information

rustc 1.84.0-nightly (a0c2aba29 2024-10-15)
binary: rustc
commit-hash: a0c2aba29aa9ea50a7c45c3391dd446f856bef7b
commit-date: 2024-10-15
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.1

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(unboxed_closures)

Program output

warning: unused variable: `x`
 --> /tmp/icemaker_global_tempdir.qRMnYYI19Q4z/rustc_testrunner_tmpdir_reporting.nQT3i3c5eog1/mvce.rs:8:10
  |
8 |     baz(|x| ());
  |          ^ help: if this is intentional, prefix it with an underscore: `_x`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: 1 warning emitted

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: encountered type variable
 --> /tmp/icemaker_global_tempdir.qRMnYYI19Q4z/rustc_testrunner_tmpdir_reporting.nQT3i3c5eog1/mvce.rs:8:10
  |
8 |     baz(|x| ());
  |          ^
  |
note: delayed at compiler/rustc_hir_typeck/src/expr_use_visitor.rs:174:20 - disabled backtrace
 --> /tmp/icemaker_global_tempdir.qRMnYYI19Q4z/rustc_testrunner_tmpdir_reporting.nQT3i3c5eog1/mvce.rs:8:10
  |
8 |     baz(|x| ());
  |          ^

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: rustc 1.84.0-nightly (a0c2aba29 2024-10-15) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z crate-attr=feature(unboxed_closures) -Z dump-mir-dir=dir

query stack during panic:
end of query stack

@rustbot label +F-unboxed_closures

@matthiaskrgr matthiaskrgr 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 Oct 15, 2024
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. F-unboxed_closures `#![feature(unboxed_closures)]` labels Oct 15, 2024
@matthiaskrgr
Copy link
Member Author

bisects to #124902

@fmease fmease added A-closures Area: Closures (`|…| { … }`) and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Oct 16, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Oct 20, 2024
bvanjoi added a commit to bvanjoi/rust that referenced this issue Oct 27, 2024
bvanjoi added a commit to bvanjoi/rust that referenced this issue Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-closures Area: Closures (`|…| { … }`) C-bug Category: This is a bug. F-unboxed_closures `#![feature(unboxed_closures)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants