parent
a1bea1551b
commit
b997af95fc
@ -199,7 +199,9 @@ impl LitKind {
|
|||||||
let symbol = if value { kw::True } else { kw::False };
|
let symbol = if value { kw::True } else { kw::False };
|
||||||
(token::Bool, symbol, None)
|
(token::Bool, symbol, None)
|
||||||
}
|
}
|
||||||
LitKind::Err => unreachable!(),
|
// This only shows up in places like `-Zunpretty=hir` output, so we
|
||||||
|
// don't bother to produce something useful.
|
||||||
|
LitKind::Err => (token::Err, Symbol::intern("<bad-literal>"), None),
|
||||||
};
|
};
|
||||||
|
|
||||||
token::Lit::new(kind, symbol, suffix)
|
token::Lit::new(kind, symbol, suffix)
|
||||||
|
8
src/test/ui/unpretty/bad-literal.rs
Normal file
8
src/test/ui/unpretty/bad-literal.rs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// compile-flags: -Zunpretty=hir
|
||||||
|
// check-fail
|
||||||
|
|
||||||
|
// In #100948 this caused an ICE with -Zunpretty=hir.
|
||||||
|
fn main() {
|
||||||
|
1u;
|
||||||
|
//~^ ERROR invalid suffix `u` for number literal
|
||||||
|
}
|
10
src/test/ui/unpretty/bad-literal.stderr
Normal file
10
src/test/ui/unpretty/bad-literal.stderr
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
error: invalid suffix `u` for number literal
|
||||||
|
--> $DIR/bad-literal.rs:6:5
|
||||||
|
|
|
||||||
|
LL | 1u;
|
||||||
|
| ^^ invalid suffix `u`
|
||||||
|
|
|
||||||
|
= help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
11
src/test/ui/unpretty/bad-literal.stdout
Normal file
11
src/test/ui/unpretty/bad-literal.stdout
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#[prelude_import]
|
||||||
|
use ::std::prelude::rust_2015::*;
|
||||||
|
#[macro_use]
|
||||||
|
extern crate std;
|
||||||
|
// compile-flags: -Zunpretty=hir
|
||||||
|
// check-fail
|
||||||
|
|
||||||
|
// In #100948 this caused an ICE with -Zunpretty=hir.
|
||||||
|
fn main() {
|
||||||
|
<bad-literal>;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user