aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/test_data/parser/fuzz-failures/0000.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-10-07 10:32:47 +0100
committerGitHub <[email protected]>2020-10-07 10:32:47 +0100
commitfaddea935332de3156a5462baa07136bf2e98bf9 (patch)
tree2bf4b95ff97c0cd9ed8a69ed63808fffffd521f2 /crates/syntax/test_data/parser/fuzz-failures/0000.rs
parenta184c83535230af39fad3e238b7422b4972d597e (diff)
parent27798ee575a975a1806ced86aca8aea407897851 (diff)
Merge #6158
6158: Fix for negative literals in macros r=matklad a=cutsoy _This pull request fixes #6028._ When writing `-42.0f32` in Rust, it is usually parsed as two different tokens (a minus operator and a float literal). But a procedural macro can also generate new tokens, including negative [float literals](https://doc.rust-lang.org/stable/proc_macro/struct.Literal.html#method.f32_suffixed): ```rust #[proc_macro] fn example_verbose(input: TokenStream) -> TokenStream { let literal = Literal::f32_suffixed(-42.0); quote! { #literal } } ``` or even shorter ```rust #[proc_macro] fn example(input: TokenStream) -> TokenStream { let literal = -42.0f32; quote! { #literal } } ``` Unfortunately, these currently cause RA to crash: ``` thread '<unnamed>' panicked at 'Fail to convert given literal Literal { text: "-42.0f32", id: TokenId( 4294967295, ), }', crates/mbe/src/subtree_source.rs:161:28 ``` This pull request contains both a fix 8cf9362 and a unit test 27798ee. In addition, I installed the patched server with `cargo xtask install --server` and verified in VSCode that it no longer crashes when a procedural macro returns a negative number literal. Co-authored-by: Tim <[email protected]>
Diffstat (limited to 'crates/syntax/test_data/parser/fuzz-failures/0000.rs')
0 files changed, 0 insertions, 0 deletions