Stabilize Literal::byte_character

This commit is contained in:
Slanterns 2024-04-04 05:00:49 +08:00
parent 98efd808e1
commit 61ac7812c6
No known key found for this signature in database
GPG Key ID: 1AA37EE7FAAE433A
4 changed files with 1 additions and 25 deletions

View File

@ -1360,7 +1360,7 @@ pub fn character(ch: char) -> Literal {
}
/// Byte character literal.
#[unstable(feature = "proc_macro_byte_character", issue = "115268")]
#[stable(feature = "proc_macro_byte_character", since = "CURRENT_RUSTC_VERSION")]
pub fn byte_character(byte: u8) -> Literal {
let string = [byte].escape_ascii().to_string();
Literal::new(bridge::LitKind::Byte, &string, None)

View File

@ -1,10 +0,0 @@
//@ force-host
#![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'
}

View File

@ -1,13 +0,0 @@
error[E0658]: use of unstable library feature 'proc_macro_byte_character'
--> $DIR/feature-gate-proc_macro_byte_character.rs:9: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
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0658`.

View File

@ -5,7 +5,6 @@
#![crate_type = "proc-macro"]
#![crate_name = "proc_macro_api_tests"]
#![feature(proc_macro_span)]
#![feature(proc_macro_byte_character)]
#![feature(proc_macro_c_str_literals)]
#![deny(dead_code)] // catch if a test function is never called