Skip to content

Compiler Plugins example in Rust Book does not compile #23166

@rprichard

Description

@rprichard

Compiling the current version of roman_numerals.rs produces:

$ rustc roman_numerals.rs 
roman_numerals.rs:37:24: 37:49 error: mismatched types:
 expected `&collections::string::String`,
    found `&str`
(expected struct `collections::string::String`,
    found str) [E0308]
roman_numerals.rs:37                 text = text.slice_from(rn.len());
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~
roman_numerals.rs:46:38: 46:43 error: mismatched types:
 expected `usize`,
    found `u32`
(expected usize,
    found u32) [E0308]
roman_numerals.rs:46     MacEager::expr(cx.expr_usize(sp, total))
                                                          ^~~~~
error: aborting due to 2 previous errors

I'll submit a PR with a fix once I've run make check on it...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions