Skip to content

ICE when using inlined function from another crate (UFCS related) #18501

Closed
@japaric

Description

@japaric

While trying to replace the "secret" functions (e.g. secret_show) used for format_args! with their UFCS versions (e.g. Show::fmt), I ran into the following ICE:

STR

// fmt.rs
struct Foo;

trait Show {
    fn fmt(&self);
}

impl Show for Foo {
    fn fmt(&self) {}
}

fn secret_show<T: Show>(_: &T) {}

fn bar<T>(f: extern "Rust" fn(&T), t: &T) {}

// ICE requirement: this has to be marked as inline
#[cfg(ice)]
#[inline]
pub fn baz() {
    bar(Show::fmt, &Foo);
}

#[cfg(not(ice))]
#[inline]
pub fn baz() {
    bar(secret_show, &Foo);
}
// main.rs
extern crate fmt;

fn main() {
    ::fmt::baz();
}

Output

$ rustc --cfg ice --crate-type=lib fmt.rs && rustc -L . main.rs
task 'rustc' panicked at 'assertion failed: did.krate != ast::LOCAL_CRATE', /var/tmp/paludis/build/dev-lang-rust-scm/work/rust-scm/src/librustc/middle/ty.rs:4476

I couldn't get a backtrace with RUST_BACKTRACE nor with gdb

Version

rustc 0.13.0-dev (82045ca36 2014-10-31 11:16:44 +0000)

cc @nick29581

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