summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 93d7e5b..02e9857 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -86,10 +86,10 @@
//! a different thread.
// Proc-macro2 types in rustdoc of other crates get linked to here.
-#![doc(html_root_url = "https://docs.rs/proc-macro2/1.0.81")]
+#![doc(html_root_url = "https://docs.rs/proc-macro2/1.0.85")]
#![cfg_attr(any(proc_macro_span, super_unstable), feature(proc_macro_span))]
#![cfg_attr(super_unstable, feature(proc_macro_def_site))]
-#![cfg_attr(doc_cfg, feature(doc_cfg))]
+#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(unsafe_op_in_unsafe_fn)]
#![allow(
clippy::cast_lossless,
@@ -175,7 +175,7 @@ use std::ffi::CStr;
use std::path::PathBuf;
#[cfg(span_locations)]
-#[cfg_attr(doc_cfg, doc(cfg(feature = "span-locations")))]
+#[cfg_attr(docsrs, doc(cfg(feature = "span-locations")))]
pub use crate::location::LineColumn;
/// An abstract stream of tokens, or more concretely a sequence of token trees.
@@ -252,7 +252,7 @@ impl FromStr for TokenStream {
}
#[cfg(feature = "proc-macro")]
-#[cfg_attr(doc_cfg, doc(cfg(feature = "proc-macro")))]
+#[cfg_attr(docsrs, doc(cfg(feature = "proc-macro")))]
impl From<proc_macro::TokenStream> for TokenStream {
fn from(inner: proc_macro::TokenStream) -> Self {
TokenStream::_new(inner.into())
@@ -260,7 +260,7 @@ impl From<proc_macro::TokenStream> for TokenStream {
}
#[cfg(feature = "proc-macro")]
-#[cfg_attr(doc_cfg, doc(cfg(feature = "proc-macro")))]
+#[cfg_attr(docsrs, doc(cfg(feature = "proc-macro")))]
impl From<TokenStream> for proc_macro::TokenStream {
fn from(inner: TokenStream) -> Self {
inner.inner.into()
@@ -339,7 +339,7 @@ impl Error for LexError {}
///
/// This type is semver exempt and not exposed by default.
#[cfg(all(procmacro2_semver_exempt, any(not(wrap_proc_macro), super_unstable)))]
-#[cfg_attr(doc_cfg, doc(cfg(procmacro2_semver_exempt)))]
+#[cfg_attr(docsrs, doc(cfg(procmacro2_semver_exempt)))]
#[derive(Clone, PartialEq, Eq)]
pub struct SourceFile {
inner: imp::SourceFile,
@@ -428,7 +428,7 @@ impl Span {
///
/// This method is semver exempt and not exposed by default.
#[cfg(procmacro2_semver_exempt)]
- #[cfg_attr(doc_cfg, doc(cfg(procmacro2_semver_exempt)))]
+ #[cfg_attr(docsrs, doc(cfg(procmacro2_semver_exempt)))]
pub fn def_site() -> Self {
Span::_new(imp::Span::def_site())
}
@@ -471,7 +471,7 @@ impl Span {
///
/// This method is semver exempt and not exposed by default.
#[cfg(all(procmacro2_semver_exempt, any(not(wrap_proc_macro), super_unstable)))]
- #[cfg_attr(doc_cfg, doc(cfg(procmacro2_semver_exempt)))]
+ #[cfg_attr(docsrs, doc(cfg(procmacro2_semver_exempt)))]
pub fn source_file(&self) -> SourceFile {
SourceFile::_new(self.inner.source_file())
}
@@ -486,7 +486,7 @@ impl Span {
/// procedural macro, such as main.rs or build.rs, the byte range is always
/// accurate regardless of toolchain.
#[cfg(span_locations)]
- #[cfg_attr(doc_cfg, doc(cfg(feature = "span-locations")))]
+ #[cfg_attr(docsrs, doc(cfg(feature = "span-locations")))]
pub fn byte_range(&self) -> Range<usize> {
self.inner.byte_range()
}
@@ -501,7 +501,7 @@ impl Span {
/// outside of a procedural macro, such as main.rs or build.rs, the
/// line/column are always meaningful regardless of toolchain.
#[cfg(span_locations)]
- #[cfg_attr(doc_cfg, doc(cfg(feature = "span-locations")))]
+ #[cfg_attr(docsrs, doc(cfg(feature = "span-locations")))]
pub fn start(&self) -> LineColumn {
self.inner.start()
}
@@ -516,7 +516,7 @@ impl Span {
/// outside of a procedural macro, such as main.rs or build.rs, the
/// line/column are always meaningful regardless of toolchain.
#[cfg(span_locations)]
- #[cfg_attr(doc_cfg, doc(cfg(feature = "span-locations")))]
+ #[cfg_attr(docsrs, doc(cfg(feature = "span-locations")))]
pub fn end(&self) -> LineColumn {
self.inner.end()
}
@@ -538,7 +538,7 @@ impl Span {
///
/// This method is semver exempt and not exposed by default.
#[cfg(procmacro2_semver_exempt)]
- #[cfg_attr(doc_cfg, doc(cfg(procmacro2_semver_exempt)))]
+ #[cfg_attr(docsrs, doc(cfg(procmacro2_semver_exempt)))]
pub fn eq(&self, other: &Span) -> bool {
self.inner.eq(&other.inner)
}
@@ -685,6 +685,18 @@ pub enum Delimiter {
/// operator priorities in cases like `$var * 3` where `$var` is `1 + 2`.
/// Invisible delimiters may not survive roundtrip of a token stream through
/// a string.
+ ///
+ /// <div class="warning">
+ ///
+ /// Note: rustc currently can ignore the grouping of tokens delimited by `None` in the output
+ /// of a proc_macro. Only `None`-delimited groups created by a macro_rules macro in the input
+ /// of a proc_macro macro are preserved, and only in very specific circumstances.
+ /// Any `None`-delimited groups (re)created by a proc_macro will therefore not preserve
+ /// operator priorities as indicated above. The other `Delimiter` variants should be used
+ /// instead in this context. This is a rustc bug. For details, see
+ /// [rust-lang/rust#67062](https://github.com/rust-lang/rust/issues/67062).
+ ///
+ /// </div>
None,
}