diff options
| author | bors <bors@rust-lang.org> | 2018-07-15 19:35:06 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-07-15 19:35:06 +0000 |
| commit | 82e5c9c8e2c4f47a8e1090ad8e6be5a16f82795e (patch) | |
| tree | 17ebf48a20a33d0dd196b291c954bf4502fbe3b6 /src/libsyntax | |
| parent | fb8bde03cf0a024c076581824ccf5ede422a613d (diff) | |
| parent | 431aefb2d4d579b152f7f26f3e70d2fdc3db4bfb (diff) | |
| download | rust-82e5c9c8e2c4f47a8e1090ad8e6be5a16f82795e.tar.gz rust-82e5c9c8e2c4f47a8e1090ad8e6be5a16f82795e.zip | |
Auto merge of #52383 - petrochenkov:pmns, r=alexcrichton
resolve: Functions introducing procedural macros reserve a slot in the macro namespace as well Similarly to https://github.com/rust-lang/rust/pull/52234, this gives us symmetry between internal and external views of a crate, but in this case it's always an error to call a procedural macro in the same crate in which it's defined. Closes https://github.com/rust-lang/rust/issues/52225
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 38ddb501085..5ec44fb5898 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -571,6 +571,8 @@ pub enum MacroKind { Attr, /// A derive attribute macro - #[derive(Foo)] Derive, + /// A view of a procedural macro from the same crate that defines it. + ProcMacroStub, } impl MacroKind { @@ -579,6 +581,7 @@ impl MacroKind { MacroKind::Bang => "macro", MacroKind::Attr => "attribute macro", MacroKind::Derive => "derive macro", + MacroKind::ProcMacroStub => "crate-local procedural macro", } } } diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 865cb3d0d45..281ebaff272 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -232,7 +232,7 @@ pub enum InvocationKind { } impl Invocation { - fn span(&self) -> Span { + pub fn span(&self) -> Span { match self.kind { InvocationKind::Bang { span, .. } => span, InvocationKind::Attr { attr: Some(ref attr), .. } => attr.span, |
