Rollup merge of #66278 - LukasKalbertodt:fix-proc-macro-error, r=Centril
Fix error message about exported symbols from proc-macro crates Someone forgot to update the error message after `#[proc_macro]` and `#[proc_macro_attribute]` were stabilized.
This commit is contained in:
commit
8e0265c268
4 changed files with 12 additions and 10 deletions
|
@ -92,10 +92,12 @@ pub fn inject(sess: &ParseSess,
|
||||||
impl<'a> CollectProcMacros<'a> {
|
impl<'a> CollectProcMacros<'a> {
|
||||||
fn check_not_pub_in_root(&self, vis: &ast::Visibility, sp: Span) {
|
fn check_not_pub_in_root(&self, vis: &ast::Visibility, sp: Span) {
|
||||||
if self.is_proc_macro_crate && self.in_root && vis.node.is_pub() {
|
if self.is_proc_macro_crate && self.in_root && vis.node.is_pub() {
|
||||||
self.handler.span_err(sp,
|
self.handler.span_err(
|
||||||
"`proc-macro` crate types cannot \
|
sp,
|
||||||
export any items other than functions \
|
"`proc-macro` crate types currently cannot export any items other \
|
||||||
tagged with `#[proc_macro_derive]` currently");
|
than functions tagged with `#[proc_macro]`, `#[proc_macro_derive]`, \
|
||||||
|
or `#[proc_macro_attribute]`",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently
|
error: `proc-macro` crate types currently cannot export any items other than functions tagged with `#[proc_macro]`, `#[proc_macro_derive]`, or `#[proc_macro_attribute]`
|
||||||
--> $DIR/exports.rs:7:1
|
--> $DIR/exports.rs:7:1
|
||||||
|
|
|
|
||||||
LL | pub fn a() {}
|
LL | pub fn a() {}
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently
|
error: `proc-macro` crate types currently cannot export any items other than functions tagged with `#[proc_macro]`, `#[proc_macro_derive]`, or `#[proc_macro_attribute]`
|
||||||
--> $DIR/exports.rs:8:1
|
--> $DIR/exports.rs:8:1
|
||||||
|
|
|
|
||||||
LL | pub struct B;
|
LL | pub struct B;
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently
|
error: `proc-macro` crate types currently cannot export any items other than functions tagged with `#[proc_macro]`, `#[proc_macro_derive]`, or `#[proc_macro_attribute]`
|
||||||
--> $DIR/exports.rs:9:1
|
--> $DIR/exports.rs:9:1
|
||||||
|
|
|
|
||||||
LL | pub enum C {}
|
LL | pub enum C {}
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently
|
error: `proc-macro` crate types currently cannot export any items other than functions tagged with `#[proc_macro]`, `#[proc_macro_derive]`, or `#[proc_macro_attribute]`
|
||||||
--> $DIR/exports.rs:10:1
|
--> $DIR/exports.rs:10:1
|
||||||
|
|
|
|
||||||
LL | pub mod d {}
|
LL | pub mod d {}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
||||||
pub mod a { //~ `proc-macro` crate types cannot export any items
|
pub mod a { //~ `proc-macro` crate types currently cannot export any items
|
||||||
use proc_macro::TokenStream;
|
use proc_macro::TokenStream;
|
||||||
|
|
||||||
#[proc_macro_derive(B)]
|
#[proc_macro_derive(B)]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently
|
error: `proc-macro` crate types currently cannot export any items other than functions tagged with `#[proc_macro]`, `#[proc_macro_derive]`, or `#[proc_macro_attribute]`
|
||||||
--> $DIR/pub-at-crate-root.rs:8:1
|
--> $DIR/pub-at-crate-root.rs:8:1
|
||||||
|
|
|
|
||||||
LL | / pub mod a {
|
LL | / pub mod a {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue