diff options
| author | Jonathan Turner <jonathandturner@users.noreply.github.com> | 2016-09-28 20:21:52 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-09-28 20:21:52 -0700 |
| commit | f1ea5cc273d425033ad430c8fbc28bae1013b45a (patch) | |
| tree | 8298328989f66af7994b8c5c42ceecc420eea1f0 /src/libsyntax/ext/tt | |
| parent | 13c8e763d4d69732419fa1d23bdbf310be4b597f (diff) | |
| parent | 174f0936514d7e7224c34a78699733eea498875e (diff) | |
| download | rust-f1ea5cc273d425033ad430c8fbc28bae1013b45a.tar.gz rust-f1ea5cc273d425033ad430c8fbc28bae1013b45a.zip | |
Rollup merge of #36789 - jseyfried:non_inline_mod_in_block, r=nikomatsakis
Allow more non-inline modules in blocks
Currently, non-inline modules without a `#[path]` attribute are not allowed in blocks.
This PR allows non-inline modules that have an ancestor module with a `#[path]` attribute, provided there is not a nearer ancestor block.
For example,
```rust
fn main() {
#[path = "..."] mod foo {
mod bar; //< allowed by this PR
fn f() {
mod bar; //< still an error
}
}
}
```
Fixes #36772.
r? @nikomatsakis
Diffstat (limited to 'src/libsyntax/ext/tt')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 9f4c0b5eb80..2e0c7ddb540 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -122,7 +122,7 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt, rhs); let mut p = Parser::new(cx.parse_sess(), cx.cfg(), Box::new(trncbr)); p.directory = cx.current_expansion.module.directory.clone(); - p.restrictions = match cx.current_expansion.in_block { + p.restrictions = match cx.current_expansion.no_noninline_mod { true => Restrictions::NO_NONINLINE_MOD, false => Restrictions::empty(), }; |
