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 (1.0.0-beta): "no type for node ... in fcx" with function-local static Fn #24446

Closed
whipsch opened this issue Apr 15, 2015 · 2 comments · Fixed by #24978
Closed

ICE (1.0.0-beta): "no type for node ... in fcx" with function-local static Fn #24446

whipsch opened this issue Apr 15, 2015 · 2 comments · Fixed by #24978
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@whipsch
Copy link
Contributor

whipsch commented Apr 15, 2015

Abbreviated backtrace:

error: internal compiler error: no type for node 14: expr 0 (id=14) in fcx 0x43ed4e0
thread 'rustc' panicked at 'Box<Any>', C:/bot/slave/beta-dist-rustc-win-64/build/src/libsyntax\diagnostic.rs:190

stack backtrace:
   7:          0x1684ea2 - check::FnCtxt<'a, 'tcx>.ty..ClosureTyper<'tcx>::closure_upvars::hd9de0cb59cfad129xJn
   8:          0x16bb064 - check::regionck::Rcx<'a, 'tcx>.Visitor<'v>::visit_local::hf1f7eef7520e38941Ed
   9:          0x16bc301 - check::FnCtxt<'a, 'tcx>.mc..Typer<'tcx>::node_ty::h4717180cfe88525eQEn
  10:          0x1714e16 - check::FnCtxt<'a, 'tcx>.mc..Typer<'tcx>::is_method_call::ha5a9873524740db0vHn
  11:          0x171233f - check::FnCtxt<'a, 'tcx>.mc..Typer<'tcx>::is_method_call::ha5a9873524740db0vHn
  12:          0x170c90e - check::upvar::AdjustBorrowKind<'a, 'tcx>.Visitor<'v>::visit_fn::h83a9049482b77a0e5Lk
  13:          0x170b644 - check::upvar::SeedBorrowKind<'a, 'tcx>.Visitor<'v>::visit_fn::h96b2ebc2922ab678Yjk
  14:          0x170ada6 - check::upvar::SeedBorrowKind<'a, 'tcx>.Visitor<'v>::visit_fn::h96b2ebc2922ab678Yjk
  15:          0x17487b1 - check::CheckItemTypesVisitor<'a, 'tcx>.Visitor<'tcx>::visit_ty::hf5a010d1c8a756d3RNn
  16:          0x17426d2 - check::CheckItemTypesVisitor<'a, 'tcx>.Visitor<'tcx>::visit_item::hcf32b798d03f5730vNn

Reproduce: (playpen)

fn main() {
    static foo: Fn() -> u32 = || -> u32 {
        0
    };
}

The error message provided when doing the above with a let binding instead may be useful:

kaboom.rs:2:28: 4:6 error: mismatched types:
(expected trait core::ops::Fn, found closure) [E0308]

kaboom.rs:2:9: 2:12 error: the trait `core::marker::Sized` is not implemented for the type `core::ops::Fn() -> u32` [E0277]
kaboom.rs:2:9: 2:12 note: `core::ops::Fn() -> u32` does not have a constant size known at compile-time
kaboom.rs:2     let foo: Fn() -> u32 = || -> u32 {
                    ^~~

Looks to be related to PR #20897, however the change there has a rather catch-all appearance to it, so there is likely more to this particular ICE.

@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Apr 16, 2015
@bytwise
Copy link
Contributor

bytwise commented Apr 20, 2015

On rustc 1.0.0-nightly (1284be404 2015-04-18) (built 2015-04-17) the ICE is fixed.
The code now results in

main.rs:2:31: 4:6 error: mismatched types:
 expected `core::ops::Fn() -> u32`,
    found `[closure main.rs:2:31: 4:6]`
(expected trait core::ops::Fn,
    found closure) [E0308]
main.rs:2     static foo: Fn() -> u32 = || -> u32 {
main.rs:3         0
main.rs:4     };
error: aborting due to previous error

@jdm jdm added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Apr 20, 2015
@untitaker
Copy link
Contributor

I also can't reproduce this with rustc 1.1.0-nightly (f9e53c7f2 2015-04-24) (built 2015-04-25).

jooert added a commit to jooert/rust that referenced this issue Apr 30, 2015
jooert added a commit to jooert/rust that referenced this issue Apr 30, 2015
bors added a commit that referenced this issue Apr 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants