Skip to content

Commit

Permalink
Rollup merge of rust-lang#123431 - slanterns:literal_byte_character_c…
Browse files Browse the repository at this point in the history
…_string_stabilize, r=dtolnay

Stabilize `proc_macro_byte_character` and `proc_macro_c_str_literals`

This PR stabilizes `proc_macro_byte_character` and `proc_macro_c_str_literals`:

```rust
// proc_macro::Literal

impl Literal {
    pub fn byte_character(byte: u8) -> Literal;
    pub fn c_string(string: &CStr) -> Literal
}
```

<br>

Tracking issue: rust-lang#115268, rust-lang#119750.
Implementation PR: rust-lang#112711, rust-lang#119651.

FCPs already completed in their respective tracking issues.

Closes rust-lang#115268. Closes rust-lang#119750.

r? libs-api
  • Loading branch information
matthiaskrgr committed Apr 4, 2024
2 parents f254ab0 + fbc56df commit ad300b6
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 51 deletions.
4 changes: 2 additions & 2 deletions library/proc_macro/src/lib.rs
Expand Up @@ -1360,7 +1360,7 @@ impl 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)
Expand All @@ -1374,7 +1374,7 @@ impl Literal {
}

/// C string literal.
#[unstable(feature = "proc_macro_c_str_literals", issue = "119750")]
#[stable(feature = "proc_macro_c_str_literals", since = "CURRENT_RUSTC_VERSION")]
pub fn c_string(string: &CStr) -> Literal {
let string = string.to_bytes().escape_ascii().to_string();
Literal::new(bridge::LitKind::CStr, &string, None)
Expand Down
10 changes: 0 additions & 10 deletions tests/ui/feature-gates/feature-gate-proc_macro_byte_character.rs

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions tests/ui/feature-gates/feature-gate-proc_macro_c_str_literals.rs

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions tests/ui/proc-macro/auxiliary/api/mod.rs
Expand Up @@ -5,8 +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

extern crate proc_macro;
Expand Down

0 comments on commit ad300b6

Please sign in to comment.