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

unboxed closure ICE with debug format qualifier #17737

Closed
jeremyletang opened this issue Oct 3, 2014 · 3 comments
Closed

unboxed closure ICE with debug format qualifier #17737

jeremyletang opened this issue Oct 3, 2014 · 3 comments
Labels
A-closures Area: Closures (`|…| { … }`) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@jeremyletang
Copy link
Contributor

Here is the code:

#![feature(unboxed_closures)]
#![feature(unboxed_closure_sugar)]

extern crate debug;

fn main() {
    let f = move |:| {};
    println!("{:?}", f)
}

and the produced error:

error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'couldn't find visit method for err', /build/rust-git/src/rust/src/libcore/option.rs:315
@jeremyletang jeremyletang changed the title unboxed closure ICE unboxed closure ICE with debug format qualifier Oct 3, 2014
@huonw huonw added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-closures Area: Closures (`|…| { … }`) labels Oct 3, 2014
@bkoropoff
Copy link
Contributor

The type visitor glue generation code does not support unboxed closures:

          ty::ty_unboxed_closure(..) => self.leaf("err"),

A quick fix would mimic the visitor glue for boxed closures. Ideally, the TyVisitor interface could be extended to handle unboxed closures separately, which would allow for visting upvars in the closure environment.

@bkoropoff
Copy link
Contributor

Working on the quick fix

bkoropoff added a commit to bkoropoff/rust that referenced this issue Oct 4, 2014
This is a quick fix that prevents an ICE by mimicing the visitor
glue for boxed closures and bare functions.  Ideally, the `TyVisitor`
interface will be improved in the future to allow representing
more information about unboxed closures such as Fn/FnMut/FnOnce
status, capture mode, and captured free variable types and offsets.

Closes issue rust-lang#17737
bkoropoff added a commit to bkoropoff/rust that referenced this issue Oct 4, 2014
bors added a commit that referenced this issue Oct 4, 2014
This is a quick fix.  In the long term, the `TyVisitor` interface should be expanded to better represent closure types.

Closes issue #17737
@aturon
Copy link
Member

aturon commented Oct 16, 2014

Closing as a dupe of #16808

@aturon aturon closed this as completed Oct 16, 2014
lnicola pushed a commit to lnicola/rust that referenced this issue Sep 25, 2024
feat(ide-completion): extra sugar auto-completion `async fn ...` in `impl trait` for `async fn in trait` that's defined in desugar form

Solves rust-lang#17719.

---

Preview

<img width="670" alt="image" src="https://github.com/user-attachments/assets/64ccef84-4062-4702-8760-89220585f422">

<img width="540" alt="image" src="https://github.com/user-attachments/assets/d22637f9-d531-43b2-a9f1-cd40a002903a">

<img width="631" alt="image" src="https://github.com/user-attachments/assets/21cd2142-bb8e-4493-9ac7-e6a9e7076904">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-closures Area: Closures (`|…| { … }`) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

4 participants