Skip to content

Commit

Permalink
Rollup merge of #123431 - slanterns:literal_byte_character_c_string_s…
Browse files Browse the repository at this point in the history
…tabilize, 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: #115268, #119750.
Implementation PR: #112711, #119651.

FCPs already completed in their respective tracking issues.

Closes #115268. Closes #119750.

r? libs-api
  • Loading branch information
matthiaskrgr authored 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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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.