diff options
| author | bors <bors@rust-lang.org> | 2019-11-08 15:52:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-11-08 15:52:14 +0000 |
| commit | 9e346646e93cc243567e27bb0f4e8716d56ad1f1 (patch) | |
| tree | 32241bdad56a558bbfa93093ba4cc65797df3498 /src/libsyntax/parse/parser/module.rs | |
| parent | 76ade3e8ac42cd7a7b7c3c5ef54818ab68e3ebdc (diff) | |
| parent | 65c77bc09ab38b3d9377168d673ed7b0a2c1e0c3 (diff) | |
| download | rust-9e346646e93cc243567e27bb0f4e8716d56ad1f1.tar.gz rust-9e346646e93cc243567e27bb0f4e8716d56ad1f1.zip | |
Auto merge of #66225 - Centril:rollup-it0t5tk, r=Centril
Rollup of 5 pull requests
Successful merges:
- #65785 (Transition future compat lints to {ERROR, DENY} - Take 2)
- #66007 (Remove "here" from "expected one of X here")
- #66043 (rename Memory::get methods to get_raw to indicate their unchecked nature)
- #66154 (miri: Rename to_{u,i}size to to_machine_{u,i}size)
- #66188 (`MethodSig` -> `FnSig` & Use it in `ItemKind::Fn`)
Failed merges:
r? @ghost
Diffstat (limited to 'src/libsyntax/parse/parser/module.rs')
| -rw-r--r-- | src/libsyntax/parse/parser/module.rs | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/src/libsyntax/parse/parser/module.rs b/src/libsyntax/parse/parser/module.rs index 72049daaed3..3e5974c2eee 100644 --- a/src/libsyntax/parse/parser/module.rs +++ b/src/libsyntax/parse/parser/module.rs @@ -23,7 +23,6 @@ pub(super) struct ModulePath { pub(super) struct ModulePathSuccess { pub path: PathBuf, pub directory_ownership: DirectoryOwnership, - warn: bool, } impl<'a> Parser<'a> { @@ -57,17 +56,10 @@ impl<'a> Parser<'a> { if self.eat(&token::Semi) { if in_cfg && self.recurse_into_file_modules { // This mod is in an external file. Let's go get it! - let ModulePathSuccess { path, directory_ownership, warn } = + let ModulePathSuccess { path, directory_ownership } = self.submod_path(id, &outer_attrs, id_span)?; - let (module, mut attrs) = + let (module, attrs) = self.eval_src_mod(path, directory_ownership, id.to_string(), id_span)?; - // Record that we fetched the mod from an external file. - if warn { - let attr = attr::mk_attr_outer( - attr::mk_word_item(Ident::with_dummy_span(sym::warn_directory_ownership))); - attr::mark_known(&attr); - attrs.push(attr); - } Ok((id, ItemKind::Mod(module), Some(attrs))) } else { let placeholder = ast::Mod { @@ -138,17 +130,16 @@ impl<'a> Parser<'a> { // `#[path]` included and contains a `mod foo;` declaration. // If you encounter this, it's your own darn fault :P Some(_) => DirectoryOwnership::Owned { relative: None }, - _ => DirectoryOwnership::UnownedViaMod(true), + _ => DirectoryOwnership::UnownedViaMod, }, path, - warn: false, }); } let relative = match self.directory.ownership { DirectoryOwnership::Owned { relative } => relative, DirectoryOwnership::UnownedViaBlock | - DirectoryOwnership::UnownedViaMod(_) => None, + DirectoryOwnership::UnownedViaMod => None, }; let paths = Parser::default_submod_path( id, relative, &self.directory.path, self.sess.source_map()); @@ -169,12 +160,7 @@ impl<'a> Parser<'a> { } Err(err) } - DirectoryOwnership::UnownedViaMod(warn) => { - if warn { - if let Ok(result) = paths.result { - return Ok(ModulePathSuccess { warn: true, ..result }); - } - } + DirectoryOwnership::UnownedViaMod => { let mut err = self.diagnostic().struct_span_err(id_sp, "cannot declare a new module at this location"); if !id_sp.is_dummy() { @@ -252,14 +238,12 @@ impl<'a> Parser<'a> { directory_ownership: DirectoryOwnership::Owned { relative: Some(id), }, - warn: false, }), (false, true) => Ok(ModulePathSuccess { path: secondary_path, directory_ownership: DirectoryOwnership::Owned { relative: None, }, - warn: false, }), (false, false) => Err(Error::FileNotFoundForModule { mod_name: mod_name.clone(), |
