From b871293cfdccbac795408a2bfc5110a54416c84d Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 1 Oct 2018 10:42:16 -0700 Subject: [PATCH 1/5] The `proc_macro_quote` feature now lives at #54722 --- src/libproc_macro/lib.rs | 4 ++-- src/libproc_macro/quote.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libproc_macro/lib.rs b/src/libproc_macro/lib.rs index 34a44bd142148..41ef72049e31f 100644 --- a/src/libproc_macro/lib.rs +++ b/src/libproc_macro/lib.rs @@ -142,7 +142,7 @@ impl fmt::Debug for TokenStream { } } -#[unstable(feature = "proc_macro_quote", issue = "38356")] +#[unstable(feature = "proc_macro_quote", issue = "54722")] pub use quote::{quote, quote_span}; /// Creates a token stream containing a single token tree. @@ -252,7 +252,7 @@ pub mod token_stream { /// To quote `$` itself, use `$$`. /// /// This is a dummy macro, the actual implementation is in `quote::quote`.` -#[unstable(feature = "proc_macro_quote", issue = "38356")] +#[unstable(feature = "proc_macro_quote", issue = "54722")] #[macro_export] macro_rules! quote { () => {} } diff --git a/src/libproc_macro/quote.rs b/src/libproc_macro/quote.rs index 7ae7b13a15217..0f454a79055a0 100644 --- a/src/libproc_macro/quote.rs +++ b/src/libproc_macro/quote.rs @@ -70,7 +70,7 @@ macro_rules! quote { /// This is the actual `quote!()` proc macro. /// /// It is manually loaded in `CStore::load_macro_untracked`. -#[unstable(feature = "proc_macro_quote", issue = "38356")] +#[unstable(feature = "proc_macro_quote", issue = "54722")] pub fn quote(stream: TokenStream) -> TokenStream { if stream.is_empty() { return quote!(::TokenStream::new()); @@ -144,7 +144,7 @@ pub fn quote(stream: TokenStream) -> TokenStream { /// Quote a `Span` into a `TokenStream`. /// This is needed to implement a custom quoter. -#[unstable(feature = "proc_macro_quote", issue = "38356")] +#[unstable(feature = "proc_macro_quote", issue = "54722")] pub fn quote_span(_: Span) -> TokenStream { quote!(::Span::def_site()) } From 3ced475360795b46c0551d55a02b7d2504bdd526 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 1 Oct 2018 10:44:19 -0700 Subject: [PATCH 2/5] The `proc_macro_raw_ident` feature is now at #54723 --- src/libproc_macro/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libproc_macro/lib.rs b/src/libproc_macro/lib.rs index 41ef72049e31f..5b3cb3562d165 100644 --- a/src/libproc_macro/lib.rs +++ b/src/libproc_macro/lib.rs @@ -881,7 +881,7 @@ impl Ident { } /// Same as `Ident::new`, but creates a raw identifier (`r#ident`). - #[unstable(feature = "proc_macro_raw_ident", issue = "38356")] + #[unstable(feature = "proc_macro_raw_ident", issue = "54723")] pub fn new_raw(string: &str, span: Span) -> Ident { if !Ident::is_valid(string) { panic!("`{:?}` is not a valid identifier", string) From 76625234924bb9dbdd9d4783c227999f7e352c73 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 1 Oct 2018 10:47:18 -0700 Subject: [PATCH 3/5] Span::def_site() is now at #54724 --- src/libproc_macro/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libproc_macro/lib.rs b/src/libproc_macro/lib.rs index 5b3cb3562d165..74a1a1a037f32 100644 --- a/src/libproc_macro/lib.rs +++ b/src/libproc_macro/lib.rs @@ -283,7 +283,7 @@ macro_rules! diagnostic_method { impl Span { /// A span that resolves at the macro definition site. - #[unstable(feature = "proc_macro_span", issue = "38356")] + #[unstable(feature = "proc_macro_def_site", issue = "54724")] pub fn def_site() -> Span { ::__internal::with_sess(|_, data| data.def_site) } From 526ca7ce793f6e4749296b406a2854ac7cbf5554 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 1 Oct 2018 10:53:03 -0700 Subject: [PATCH 4/5] All `proc_macro_span` APIs tracked at #54725 now --- src/libproc_macro/lib.rs | 48 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/libproc_macro/lib.rs b/src/libproc_macro/lib.rs index 74a1a1a037f32..1a2b16a4fed06 100644 --- a/src/libproc_macro/lib.rs +++ b/src/libproc_macro/lib.rs @@ -298,7 +298,7 @@ impl Span { } /// The original source file into which this span points. - #[unstable(feature = "proc_macro_span", issue = "38356")] + #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn source_file(&self) -> SourceFile { SourceFile { source_file: __internal::lookup_char_pos(self.0.lo()).file, @@ -307,7 +307,7 @@ impl Span { /// The `Span` for the tokens in the previous macro expansion from which /// `self` was generated from, if any. - #[unstable(feature = "proc_macro_span", issue = "38356")] + #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn parent(&self) -> Option { self.0.parent().map(Span) } @@ -315,13 +315,13 @@ impl Span { /// The span for the origin source code that `self` was generated from. If /// this `Span` wasn't generated from other macro expansions then the return /// value is the same as `*self`. - #[unstable(feature = "proc_macro_span", issue = "38356")] + #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn source(&self) -> Span { Span(self.0.source_callsite()) } /// Get the starting line/column in the source file for this span. - #[unstable(feature = "proc_macro_span", issue = "38356")] + #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn start(&self) -> LineColumn { let loc = __internal::lookup_char_pos(self.0.lo()); LineColumn { @@ -331,7 +331,7 @@ impl Span { } /// Get the ending line/column in the source file for this span. - #[unstable(feature = "proc_macro_span", issue = "38356")] + #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn end(&self) -> LineColumn { let loc = __internal::lookup_char_pos(self.0.hi()); LineColumn { @@ -343,7 +343,7 @@ impl Span { /// Create a new span encompassing `self` and `other`. /// /// Returns `None` if `self` and `other` are from different files. - #[unstable(feature = "proc_macro_span", issue = "38356")] + #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn join(&self, other: Span) -> Option { let self_loc = __internal::lookup_char_pos(self.0.lo()); let other_loc = __internal::lookup_char_pos(other.0.lo()); @@ -355,20 +355,20 @@ impl Span { /// Creates a new span with the same line/column information as `self` but /// that resolves symbols as though it were at `other`. - #[unstable(feature = "proc_macro_span", issue = "38356")] + #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn resolved_at(&self, other: Span) -> Span { Span(self.0.with_ctxt(other.0.ctxt())) } /// Creates a new span with the same name resolution behavior as `self` but /// with the line/column information of `other`. - #[unstable(feature = "proc_macro_span", issue = "38356")] + #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn located_at(&self, other: Span) -> Span { other.resolved_at(*self) } /// Compares to spans to see if they're equal. - #[unstable(feature = "proc_macro_span", issue = "38356")] + #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn eq(&self, other: &Span) -> bool { self.0 == other.0 } @@ -391,33 +391,33 @@ impl fmt::Debug for Span { } /// A line-column pair representing the start or end of a `Span`. -#[unstable(feature = "proc_macro_span", issue = "38356")] +#[unstable(feature = "proc_macro_span", issue = "54725")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub struct LineColumn { /// The 1-indexed line in the source file on which the span starts or ends (inclusive). - #[unstable(feature = "proc_macro_span", issue = "38356")] + #[unstable(feature = "proc_macro_span", issue = "54725")] pub line: usize, /// The 0-indexed column (in UTF-8 characters) in the source file on which /// the span starts or ends (inclusive). - #[unstable(feature = "proc_macro_span", issue = "38356")] + #[unstable(feature = "proc_macro_span", issue = "54725")] pub column: usize } -#[unstable(feature = "proc_macro_span", issue = "38356")] +#[unstable(feature = "proc_macro_span", issue = "54725")] impl !Send for LineColumn {} -#[unstable(feature = "proc_macro_span", issue = "38356")] +#[unstable(feature = "proc_macro_span", issue = "54725")] impl !Sync for LineColumn {} /// The source file of a given `Span`. -#[unstable(feature = "proc_macro_span", issue = "38356")] +#[unstable(feature = "proc_macro_span", issue = "54725")] #[derive(Clone)] pub struct SourceFile { source_file: Lrc, } -#[unstable(feature = "proc_macro_span", issue = "38356")] +#[unstable(feature = "proc_macro_span", issue = "54725")] impl !Send for SourceFile {} -#[unstable(feature = "proc_macro_span", issue = "38356")] +#[unstable(feature = "proc_macro_span", issue = "54725")] impl !Sync for SourceFile {} impl SourceFile { @@ -431,7 +431,7 @@ impl SourceFile { /// the command line, the path as given may not actually be valid. /// /// [`is_real`]: #method.is_real - #[unstable(feature = "proc_macro_span", issue = "38356")] + #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn path(&self) -> PathBuf { match self.source_file.name { FileName::Real(ref path) => path.clone(), @@ -441,7 +441,7 @@ impl SourceFile { /// Returns `true` if this source file is a real source file, and not generated by an external /// macro's expansion. - #[unstable(feature = "proc_macro_span", issue = "38356")] + #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn is_real(&self) -> bool { // This is a hack until intercrate spans are implemented and we can have real source files // for spans generated in external macros. @@ -451,7 +451,7 @@ impl SourceFile { } -#[unstable(feature = "proc_macro_span", issue = "38356")] +#[unstable(feature = "proc_macro_span", issue = "54725")] impl fmt::Debug for SourceFile { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("SourceFile") @@ -461,14 +461,14 @@ impl fmt::Debug for SourceFile { } } -#[unstable(feature = "proc_macro_span", issue = "38356")] +#[unstable(feature = "proc_macro_span", issue = "54725")] impl PartialEq for SourceFile { fn eq(&self, other: &Self) -> bool { Lrc::ptr_eq(&self.source_file, &other.source_file) } } -#[unstable(feature = "proc_macro_span", issue = "38356")] +#[unstable(feature = "proc_macro_span", issue = "54725")] impl Eq for SourceFile {} /// A single token or a delimited sequence of token trees (e.g. `[1, (), ..]`). @@ -679,7 +679,7 @@ impl Group { /// pub fn span_open(&self) -> Span { /// ^ /// ``` - #[unstable(feature = "proc_macro_span", issue = "38356")] + #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn span_open(&self) -> Span { Span(self.span.open) } @@ -690,7 +690,7 @@ impl Group { /// pub fn span_close(&self) -> Span { /// ^ /// ``` - #[unstable(feature = "proc_macro_span", issue = "38356")] + #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn span_close(&self) -> Span { Span(self.span.close) } From 615214480a589426caf3121d9f68a7f6946b7126 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 1 Oct 2018 10:58:21 -0700 Subject: [PATCH 5/5] Extra proc macro gates are now at #54727 --- src/libsyntax/feature_gate.rs | 10 +++++----- src/test/ui-fulldeps/proc-macro/auxiliary/multispan.rs | 2 +- .../ui-fulldeps/proc-macro/auxiliary/three-equals.rs | 2 +- src/test/ui/span/issue-36530.stderr | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index bbadfa01221b9..adbe2f9d4393f 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -441,10 +441,10 @@ declare_features! ( // Allows macro invocations on modules expressions and statements and // procedural macros to expand to non-items. - (active, proc_macro_mod, "1.27.0", Some(38356), None), - (active, proc_macro_expr, "1.27.0", Some(38356), None), - (active, proc_macro_non_items, "1.27.0", Some(38356), None), - (active, proc_macro_gen, "1.27.0", Some(38356), None), + (active, proc_macro_mod, "1.27.0", Some(54727), None), + (active, proc_macro_expr, "1.27.0", Some(54727), None), + (active, proc_macro_non_items, "1.27.0", Some(54727), None), + (active, proc_macro_gen, "1.27.0", Some(54727), None), // #[doc(alias = "...")] (active, doc_alias, "1.27.0", Some(50146), None), @@ -502,7 +502,7 @@ declare_features! ( (active, custom_test_frameworks, "1.30.0", Some(50297), None), // Non-builtin attributes in inner attribute position - (active, custom_inner_attributes, "1.30.0", Some(38356), None), + (active, custom_inner_attributes, "1.30.0", Some(54726), None), // Self struct constructor (RFC 2302) (active, self_struct_ctor, "1.30.0", Some(51994), None), diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/multispan.rs b/src/test/ui-fulldeps/proc-macro/auxiliary/multispan.rs index cecd9ef4d994d..383016f990eb6 100644 --- a/src/test/ui-fulldeps/proc-macro/auxiliary/multispan.rs +++ b/src/test/ui-fulldeps/proc-macro/auxiliary/multispan.rs @@ -11,7 +11,7 @@ // no-prefer-dynamic #![crate_type = "proc-macro"] -#![feature(proc_macro_diagnostic, proc_macro_span)] +#![feature(proc_macro_diagnostic, proc_macro_span, proc_macro_def_site)] extern crate proc_macro; diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/three-equals.rs b/src/test/ui-fulldeps/proc-macro/auxiliary/three-equals.rs index 70151278947dd..569a458f55a44 100644 --- a/src/test/ui-fulldeps/proc-macro/auxiliary/three-equals.rs +++ b/src/test/ui-fulldeps/proc-macro/auxiliary/three-equals.rs @@ -11,7 +11,7 @@ // no-prefer-dynamic #![crate_type = "proc-macro"] -#![feature(proc_macro_diagnostic, proc_macro_span)] +#![feature(proc_macro_diagnostic, proc_macro_span, proc_macro_def_site)] extern crate proc_macro; diff --git a/src/test/ui/span/issue-36530.stderr b/src/test/ui/span/issue-36530.stderr index 78d81ad049306..98361c879ff68 100644 --- a/src/test/ui/span/issue-36530.stderr +++ b/src/test/ui/span/issue-36530.stderr @@ -6,7 +6,7 @@ LL | #[foo] //~ ERROR is currently unknown to the compiler | = help: add #![feature(custom_attribute)] to the crate attributes to enable -error[E0658]: non-builtin inner attributes are unstable (see issue #38356) +error[E0658]: non-builtin inner attributes are unstable (see issue #54726) --> $DIR/issue-36530.rs:15:5 | LL | #![foo] //~ ERROR is currently unknown to the compiler