Skip to content

ICE instead of "function is expected to take 1 argument, but it takes 2 arguments" #48046

Closed
@shssoichiro

Description

@shssoichiro

Minified example (Playground)

pub struct VectorizerOptions {
    pub tokenizer: &'static (Fn(&str) -> Vec<&str>),
}

pub fn main() {
    let opts = VectorizerOptions {
        tokenizer: &str::split
    };
}

Tested working as expected on stable and beta:

error[E0593]: function is expected to take 1 argument, but it takes 2 arguments
--> src/main.rs:7:20
  |
7 |         tokenizer: &str::split
  |                    ^^^^^^^^^^^ expected function that takes 1 argument
  |
  = note: required for the cast to the object type `for<'r> std::ops::Fn(&'r str) -> std::vec::Vec<&'r str>`

error: aborting due to previous error

Nightly on 2018-02-05 and 2018-02-06 throw the following ICE:

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:335:21
note: Run with `RUST_BACKTRACE=1` for a backtrace.

error: internal compiler error: unexpected panic

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityregression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions