Skip to content

ICE with static function pointer to a generic function #13970

Description

@Kimundi

Testcase:

fn foo<T>(a: T) -> T { a }

static BLOCK_FN_INFERRED: fn(uint) -> uint = foo;

fn main() {}

The intend here is to let rustc infer the right instantiation of foo, which would be foo::<uint>.

Output (warnings trimmed):

error: internal compiler error: fictitious type ty_param(middle::ty::param_ty{idx: 0u, def_id: syntax::ast::DefId{krate: 0u32, node: 11u32}}) in sizing_type_of()
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://static.rust-lang.org/doc/master/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at '~Any', /build/rust-git/src/rust/src/libsyntax/diagnostic.rs:155

Activity

  1. Twisol commented on Jan 4, 2015

    @Twisol
    Contributor

    /cc @eddyb

  2. added a commit that references this issue on Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions