Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
cbf5f7d
Use TypeRelating for instantiating query responses
matthewjasper Feb 29, 2020
f2cbe30
submod_path_from_attr: simplify & document
Centril Mar 7, 2020
9b3364f
extract error_cannot_declare_mod_here
Centril Mar 7, 2020
6cb04d9
extract error_decl_mod_in_block
Centril Mar 7, 2020
024af0b
simplify submod_path
Centril Mar 7, 2020
9855b34
submod_path: use id.span
Centril Mar 7, 2020
3eb86cf
extract parse_mod
Centril Mar 7, 2020
cbcb550
extract error_on_circular_module
Centril Mar 7, 2020
996449b
detach submod_path from Parser
Centril Mar 8, 2020
81b3500
decouple push_directory from Parser
Centril Mar 8, 2020
f284eb3
decouple eval_src_mod from Parser
Centril Mar 8, 2020
aff35c4
expand: use push_directory
Centril Mar 8, 2020
75ad1b8
de-fatalize outline module parsing
Centril Mar 8, 2020
e0d001e
extract parse_external_module
Centril Mar 8, 2020
df3792c
extract error_on_circular_module
Centril Mar 8, 2020
a9fd977
outline modules: parse -> expand.
Centril Mar 8, 2020
e994922
parse: module parsing -> item.rs
Centril Mar 8, 2020
65d072d
move Directory -> parser::module
Centril Mar 8, 2020
1b527ae
{rustc_parse::parser -> rustc_expand}::module
Centril Mar 8, 2020
adc3451
{rustc_parse -> rustc_expand}::config
Centril Mar 8, 2020
d171e59
add test for stripped nested outline module
Centril Mar 8, 2020
ad0b078
parser/expand: minor cleanup
Centril Mar 9, 2020
3ba89e8
Remove quotes around unknown fn placeholder in backtrace
dtolnay Feb 13, 2020
db75b6a
Add quotes around filename in Backtrace debug
dtolnay Feb 13, 2020
1f1ca87
Change disabled and unsupported backtraces to print using placeholder…
dtolnay Feb 13, 2020
a9cc010
Make it possible to instantiate hardcoded Backtrace from test
dtolnay Feb 13, 2020
33600e4
Add test of Debug representation of Backtrace
dtolnay Feb 13, 2020
a2364dc
Write backtrace fmt test using relative paths
dtolnay Mar 9, 2020
8fba7fb
Use smaller discriminants for generators
jonas-schievink Mar 9, 2020
b16d659
Add a test for generator discriminants
jonas-schievink Mar 9, 2020
906bb8d
fix #62456
contrun Mar 9, 2020
0a0c850
fix test failure due to earlier emitted error
contrun Mar 10, 2020
7df5868
tweak outline module parsing spans
Centril Mar 9, 2020
42ab820
use pretty-compare-only in a test
Centril Mar 10, 2020
9596dc2
parse_labeled_expr: simplify
Centril Mar 5, 2020
c303c44
use error_block_no_opening_brace more
Centril Mar 5, 2020
883e90d
simplify parse_inner_attributes
Centril Mar 5, 2020
8ee220c
more reuse in block parsing & improve diagnostics.
Centril Mar 5, 2020
055733f
parse: recover on `&'lt $expr` / `'lt $expr`.
Centril Mar 5, 2020
379f318
parse: simplify parse_fn_body
Centril Mar 5, 2020
be86b2d
parse: recover on `fn foo() = expr;`
Centril Mar 5, 2020
addbc5b
unify/improve/simplify attribute parsing
Centril Mar 5, 2020
fe848b4
parse_block_tail: reduce visibility
Centril Mar 5, 2020
e72df7e
parse_labeled_expr: add a suggestion on missing colon.
Centril Mar 6, 2020
83be689
parser/attr: adjust indentation.
Centril Mar 7, 2020
65b7ba5
parser: add note for `'label expr`.
Centril Mar 7, 2020
c01b3e6
block-no-opening-brace: add another statement
Centril Mar 7, 2020
09997e7
error_block_no_opening_brace: handle closures better
Centril Mar 7, 2020
25cd01b
issue 68890: add more minimal repro
Centril Mar 7, 2020
c0b073b
simplify & improve parse_ty_tuple_or_parens
Centril Mar 7, 2020
d1822b3
use check_path more
Centril Mar 7, 2020
ba3ae46
trait-object-lifetime-parens: improve recovery.
Centril Mar 7, 2020
458383d
parse_if_expr: recover on attributes
Centril Mar 7, 2020
b6df42a
Rollup merge of #69122 - dtolnay:backtrace, r=cramertj
Centril Mar 10, 2020
5bacc26
Rollup merge of #69591 - matthewjasper:query-response-relate, r=nikom…
Centril Mar 10, 2020
66cac64
Rollup merge of #69760 - Centril:parse-expr-improve, r=estebank
Centril Mar 10, 2020
c64771e
Rollup merge of #69837 - jonas-schievink:gen-discr-opt, r=tmandry
Centril Mar 10, 2020
7dbdd72
Rollup merge of #69838 - Centril:expand-module, r=petrochenkov,eddyb
Centril Mar 10, 2020
5d10555
Rollup merge of #69859 - contrun:fix-62456, r=matthewjasper
Centril Mar 10, 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 8, 2020
commit 9855b34f9a2bb83ecdebcc4784f3323614c8f9b0
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