forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#112711 - Emilgardis:lit_byte_char, r=dtolnay
implement Literal::byte_character without this, the only way to create a `LitKind::Byte` is by doing `"b'a'".parse::<Literal>()`, this solves that by enabling `Literal::byte_character(b'a')` cc rust-lang#71358 I think this could be done as a FCP, but I've made it as a unstable feature for now until that's decided. The tracking issue is currently wrong.
- Loading branch information
Showing
5 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
tests/ui/feature-gates/feature-gate-proc_macro_byte_character.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#![crate_type = "proc-macro"] | ||
|
||
extern crate proc_macro; | ||
|
||
use proc_macro::Literal; | ||
|
||
fn test() { | ||
Literal::byte_character(b'a'); //~ ERROR use of unstable library feature 'proc_macro_byte_character' | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/ui/feature-gates/feature-gate-proc_macro_byte_character.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0658]: use of unstable library feature 'proc_macro_byte_character' | ||
--> $DIR/feature-gate-proc_macro_byte_character.rs:8:5 | ||
| | ||
LL | Literal::byte_character(b'a'); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #115268 <https://github.com/rust-lang/rust/issues/115268> for more information | ||
= help: add `#![feature(proc_macro_byte_character)]` to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters