-
-
Notifications
You must be signed in to change notification settings - Fork 15k
Stabilize proc_macro_value feature
#151973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,7 +52,7 @@ use std::{error, fmt}; | |
|
|
||
| #[unstable(feature = "proc_macro_diagnostic", issue = "54140")] | ||
| pub use diagnostic::{Diagnostic, Level, MultiSpan}; | ||
| #[unstable(feature = "proc_macro_value", issue = "136652")] | ||
| #[stable(feature = "proc_macro_value", since = "CURRENT_RUSTC_VERSION")] | ||
| pub use rustc_literal_escaper::EscapeError; | ||
| use rustc_literal_escaper::{ | ||
| MixedUnit, unescape_byte, unescape_byte_str, unescape_c_str, unescape_char, unescape_str, | ||
|
|
@@ -64,7 +64,7 @@ use crate::bridge::client::Methods as BridgeMethods; | |
| use crate::escape::{EscapeOptions, escape_bytes}; | ||
|
|
||
| /// Errors returned when trying to retrieve a literal unescaped value. | ||
| #[unstable(feature = "proc_macro_value", issue = "136652")] | ||
| #[stable(feature = "proc_macro_value", since = "CURRENT_RUSTC_VERSION")] | ||
| #[derive(Debug, PartialEq, Eq)] | ||
| pub enum ConversionErrorKind { | ||
|
Comment on lines
+67
to
69
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to make this
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For this one, not sure if it'll ever need to be updated though. |
||
| /// The literal failed to be escaped, take a look at [`EscapeError`] for more information. | ||
|
|
@@ -1454,7 +1454,7 @@ impl Literal { | |
| } | ||
|
|
||
| /// Returns the unescaped character value if the current literal is a byte character literal. | ||
| #[unstable(feature = "proc_macro_value", issue = "136652")] | ||
| #[stable(feature = "proc_macro_value", since = "CURRENT_RUSTC_VERSION")] | ||
| pub fn byte_character_value(&self) -> Result<u8, ConversionErrorKind> { | ||
| self.0.symbol.with(|symbol| match self.0.kind { | ||
| bridge::LitKind::Char => { | ||
|
Comment on lines
+1457
to
1460
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before we stabilize, do we mean to match on
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very good point, gonna fix that. |
||
|
|
@@ -1465,7 +1465,7 @@ impl Literal { | |
| } | ||
|
|
||
| /// Returns the unescaped character value if the current literal is a character literal. | ||
| #[unstable(feature = "proc_macro_value", issue = "136652")] | ||
| #[stable(feature = "proc_macro_value", since = "CURRENT_RUSTC_VERSION")] | ||
| pub fn character_value(&self) -> Result<char, ConversionErrorKind> { | ||
| self.0.symbol.with(|symbol| match self.0.kind { | ||
| bridge::LitKind::Char => { | ||
|
|
@@ -1476,7 +1476,7 @@ impl Literal { | |
| } | ||
|
|
||
| /// Returns the unescaped string value if the current literal is a string or a string literal. | ||
| #[unstable(feature = "proc_macro_value", issue = "136652")] | ||
| #[stable(feature = "proc_macro_value", since = "CURRENT_RUSTC_VERSION")] | ||
| pub fn str_value(&self) -> Result<String, ConversionErrorKind> { | ||
| self.0.symbol.with(|symbol| match self.0.kind { | ||
| bridge::LitKind::Str => { | ||
|
|
@@ -1510,7 +1510,7 @@ impl Literal { | |
|
|
||
| /// Returns the unescaped string value if the current literal is a c-string or a c-string | ||
| /// literal. | ||
| #[unstable(feature = "proc_macro_value", issue = "136652")] | ||
| #[stable(feature = "proc_macro_value", since = "CURRENT_RUSTC_VERSION")] | ||
| pub fn cstr_value(&self) -> Result<Vec<u8>, ConversionErrorKind> { | ||
| self.0.symbol.with(|symbol| match self.0.kind { | ||
| bridge::LitKind::CStr => { | ||
|
|
@@ -1549,7 +1549,7 @@ impl Literal { | |
|
|
||
| /// Returns the unescaped string value if the current literal is a byte string or a byte string | ||
| /// literal. | ||
| #[unstable(feature = "proc_macro_value", issue = "136652")] | ||
| #[stable(feature = "proc_macro_value", since = "CURRENT_RUSTC_VERSION")] | ||
| pub fn byte_str_value(&self) -> Result<Vec<u8>, ConversionErrorKind> { | ||
| self.0.symbol.with(|symbol| match self.0.kind { | ||
| bridge::LitKind::ByteStr => { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.