8000 Rollup of 8 pull requests by Centril · Pull Request #70067 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Rollup of 8 pull requests #70067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 44 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
d6a17b5
Move tidy check to mingw-check
JohnTitor Mar 4, 2020
726d518
bootstrap: Use hash to determine if sanitizers needs to be rebuilt
tmiasko Mar 5, 2020
d49306d
implement zeroed and uninitialized with MaybeUninit
RalfJung Mar 11, 2020
c7eb0f2
fix expand-to-unstable test
RalfJung Mar 11, 2020
f4eb6ed
Ensure HAS_FREE_LOCAL_NAMES is set for ReFree
matthewjasper Mar 11, 2020
996a51b
init-large-type test needs optimizations
RalfJung Mar 16, 2020
a2160e6
make mem::{zeroed,uninitialized} inline(always)
RalfJung Mar 16, 2020
ec86270
Make macro metavars respect (non-)hygiene
matthewjasper Mar 11, 2020
a4125a6
submod_path_from_attr: simplify & document
Centril Mar 7, 2020
48b9526
extract error_cannot_declare_mod_here
Centril Mar 7, 2020
bbd2129
extract error_decl_mod_in_block
Centril Mar 7, 2020
7042554
simplify submod_path
Centril Mar 7, 2020
586c9b5
submod_path: use id.span
Centril Mar 7, 2020
d06031c
extract parse_mod
Centril Mar 7, 2020
a2a32c7
extract error_on_circular_module
Centril Mar 7, 2020
4d05f90
detach submod_path from Parser
Centril Mar 8, 2020
c824f5d
decouple push_directory from Parser
Centril Mar 8, 2020
4a70313
decouple eval_src_mod from Parser
Centril Mar 8, 2020
033f8a2
expand: use push_directory
Centril Mar 8, 2020
60a00b0
de-fatalize outline module parsing
Centril Mar 8, 2020
16d444a
extract parse_external_module
Centril Mar 8, 2020
a1f9953
extract error_on_circular_module
Centril Mar 8, 2020
97fa2bd
outline modules: parse -> expand.
Centril Mar 8, 2020
fb540a9
parse: module parsing -> item.rs
Centril Mar 8, 2020
e2cd4d0
move Directory -> parser::module
Centril Mar 8, 2020
e830157
{rustc_parse::parser -> rustc_expand}::module
Centril Mar 8, 2020
c16f0d3
{rustc_parse -> rustc_expand}::config
Centril Mar 8, 2020
2454395
add test for stripped nested outline module
Centril Mar 8, 2020
ed9d81e
parser/expand: minor cleanup
Centril Mar 9, 2020
9741bb6
tweak outline module parsing spans
Centril Mar 9, 2020
48b8ecc
use pretty-compare-only in a test
Centril Mar 10, 2020
998b33e
fix pre-expansion linting infra
Centril Mar 15, 2020
5cc4e94
fix rebase fallout
Centril Mar 15, 2020
442e5ff
Small fixes in documentation
JOE1994 Mar 17, 2020
194de27
Update books
ehuss Mar 17, 2020
8b0698b
--bless windows test
Centril Mar 17, 2020
34afc76
Rollup merge of #68746 - matthewjasper:metahygiene, r=petrochenkov
Centril Mar 17, 2020
3e8c948
Rollup merge of #69688 - JohnTitor:move-tidy, r=Mark-Simulacrum
Centril Mar 17, 2020
fbf9590
Rollup merge of #69735 - tmiasko:bootstrap-sanitizers-hash, r=Mark-Si…
Centril Mar 17, 2020
9712711
Rollup merge of #69838 - Centril:expand-module, r=petrochenkov
Centril Mar 17, 2020
ffec535
Rollup merge of #69922 - RalfJung:less-intrinsic, r=oli-obk
Centril Mar 17, 2020
9808a21
Rollup merge of #69956 - matthewjasper:fix-region-flags, r=nikomatsakis
Centril Mar 17, 2020
34b6d0e
Rollup merge of #70061 - JOE1994:patch-2, r=Dylan-DPC
Centril Mar 17, 2020
2a06433
Rollup merge of #70064 - ehuss:update-books, r=ehuss
Centril Mar 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
submod_path: use id.span
  • Loading branch information
Centril committed Mar 16, 2020
commit 586c9b574e05cc6c2340aca98b39a8a951781b28
12 changes: 5 additions & 7 deletions src/librustc_parse/parser/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,13 @@ impl<'a> Parser<'a> {
pub(super) fn parse_item_mod(&mut self, attrs: &mut Vec<Attribute>) -> PResult<'a, ItemInfo> {
let in_cfg = crate::config::process_configure_mod(self.sess, self.cfg_mods, attrs);

let id_span = self.token.span;
let id = self.parse_ident()?;
let (module, mut inner_attrs) = 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 } =
self.submod_path(id, &attrs, id_span)?;
self.eval_src_mod(path, directory_ownership, id.to_string(), id_span)?
self.submod_path(id, &attrs)?;
self.eval_src_mod(path, directory_ownership, id.to_string(), id.span)?
} else {
(ast::Mod { inner: DUMMY_SP, items: Vec::new(), inline: false }, Vec::new())
}
Expand Down Expand Up @@ -99,7 +98,6 @@ impl<'a> Parser<'a> {
&mut self,
id: ast::Ident,
outer_attrs: &[Attribute],
id_sp: Span,
) -> PResult<'a, ModulePathSuccess> {
if let Some(path) = Parser::submod_path_from_attr(outer_attrs, &self.directory.path) {
let directory_ownership = match path.file_name().and_then(|s| s.to_str()) {
Expand All @@ -125,10 +123,10 @@ impl<'a> Parser<'a> {

match self.directory.ownership {
DirectoryOwnership::Owned { .. } => {
paths.result.map_err(|err| self.span_fatal_err(id_sp, err))
paths.result.map_err(|err| self.span_fatal_err(id.span, err))
}
DirectoryOwnership::UnownedViaBlock => self.error_decl_mod_in_block(id_sp, paths),
DirectoryOwnership::UnownedViaMod => self.error_cannot_declare_mod_here(id_sp, paths),
DirectoryOwnership::UnownedViaBlock => self.error_decl_mod_in_block(id.span, paths),
DirectoryOwnership::UnownedViaMod => self.error_cannot_declare_mod_here(id.span, paths),
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/test/ui/directory_ownership/macro-expanded-mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// Test that macro-expanded non-inline modules behave correctly

macro_rules! mod_decl {
($i:ident) => { mod $i; } //~ ERROR Cannot declare a non-inline module inside a block
($i:ident) => {
mod $i;
};
}

mod macro_expanded_mod_helper {
mod_decl!(foo); // This should search in the folder `macro_expanded_mod_helper`
}

fn main() {
mod_decl!(foo);
mod_decl!(foo); //~ ERROR Cannot declare a non-inline module inside a block
}
9 changes: 2 additions & 7 deletions src/test/ui/directory_ownership/macro-expanded-mod.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
error: Cannot declare a non-inline module inside a block unless it has a path attribute
--> $DIR/macro-expanded-mod.rs:4:25
--> $DIR/macro-expanded-mod.rs:14:15
|
LL | ($i:ident) => { mod $i; }
| ^^
...
LL | mod_decl!(foo);
| --------------- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
| ^^^

error: aborting due to previous error

0