diff options
| author | bors <bors@rust-lang.org> | 2016-09-28 21:55:15 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-09-28 21:55:15 -0700 |
| commit | 91f34c0c70746f5c938d25d02a8a66b41240b2f0 (patch) | |
| tree | 5181cf125d06fbb10f8a3d2271003dce4a9f8b62 /src/libsyntax/parse | |
| parent | eee2d04d877fe909309c39b6bdf711dc586d0a1e (diff) | |
| parent | f12f9504b33b3e98952bc2bbca41fe0b81fac6fe (diff) | |
| download | rust-91f34c0c70746f5c938d25d02a8a66b41240b2f0.tar.gz rust-91f34c0c70746f5c938d25d02a8a66b41240b2f0.zip | |
Auto merge of #36818 - jonathandturner:rollup, r=jonathandturner
Rollup of 12 pull requests - Successful merges: #35286, #35892, #36460, #36704, #36741, #36760, #36787, #36789, #36794, #36803, #36811, #36813 - Failed merges:
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index d5ed1d157e4..5476166932d 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -5274,23 +5274,27 @@ impl<'a> Parser<'a> { } } else { let directory = self.directory.clone(); - self.push_directory(id, &outer_attrs); + let restrictions = self.push_directory(id, &outer_attrs); self.expect(&token::OpenDelim(token::Brace))?; let mod_inner_lo = self.span.lo; let attrs = self.parse_inner_attributes()?; - let m = self.parse_mod_items(&token::CloseDelim(token::Brace), mod_inner_lo)?; + let m = self.with_res(restrictions, |this| { + this.parse_mod_items(&token::CloseDelim(token::Brace), mod_inner_lo) + })?; self.directory = directory; Ok((id, ItemKind::Mod(m), Some(attrs))) } } - fn push_directory(&mut self, id: Ident, attrs: &[Attribute]) { - let default_path = self.id_to_interned_str(id); - let file_path = match ::attr::first_attr_value_str_by_name(attrs, "path") { - Some(d) => d, - None => default_path, - }; - self.directory.push(&*file_path) + fn push_directory(&mut self, id: Ident, attrs: &[Attribute]) -> Restrictions { + if let Some(path) = ::attr::first_attr_value_str_by_name(attrs, "path") { + self.directory.push(&*path); + self.restrictions - Restrictions::NO_NONINLINE_MOD + } else { + let default_path = self.id_to_interned_str(id); + self.directory.push(&*default_path); + self.restrictions + } } pub fn submod_path_from_attr(attrs: &[ast::Attribute], dir_path: &Path) -> Option<PathBuf> { |
