Skip to content

Binary float literals sometimes "work" #7878

Closed
@huonw

Description

@huonw
fn main() {
    let x = 0bf;
    let x = 0b101f;
}
bin-float.rs:2:8: 2:9 warning: unused variable: `x` [-W unused-variable (default)]
bin-float.rs:2     let x = 0bf;
                       ^
bin-float.rs:3:8: 3:9 warning: unused variable: `x` [-W unused-variable (default)]
bin-float.rs:3     let x = 0b101f;
                       ^
rustc: /home/huon/rust/src/llvm/lib/Support/APFloat.cpp:2491: llvm::APFloat::opStatus llvm::APFloat::convertFromString(llvm::StringRef, llvm::APFloat::roundingMode): Assertion `!str.empty() && "Invalid string length"' failed.

(The assertion is from the 0bf.)

Also:

compiler instead. Type :help for help.
rusti> 0bf
<anon>:15:0: 15:1 error: unresolved name `f`.
<anon>:15 f;
          ^

Either they should be fully supported, or not at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-parserArea: The lexing & parsing of Rust source code to an AST

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions