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

Skip to content
Closed
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
extract error_cannot_declare_mod_here
  • Loading branch information
Centril committed Mar 16, 2020
commit 48b9526d4e8302c9768e774036aa68f01194454e
54 changes: 27 additions & 27 deletions src/librustc_parse/parser/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,41 +142,41 @@ impl<'a> Parser<'a> {
}
Err(err)
}
DirectoryOwnership::UnownedViaMod => {
let mut err =
self.struct_span_err(id_sp, "cannot declare a new module at this location");
if !id_sp.is_dummy() {
let src_path = self.sess.source_map().span_to_filename(id_sp);
if let FileName::Real(src_path) = src_path {
if let Some(stem) = src_path.file_stem() {
let mut dest_path = src_path.clone();
dest_path.set_file_name(stem);
dest_path.push("mod.rs");
err.span_note(
id_sp,
&format!(
"maybe move this module `{}` to its own \
directory via `{}`",
src_path.display(),
dest_path.display()
),
);
}
}
}
if paths.path_exists {
DirectoryOwnership::UnownedViaMod => self.error_cannot_declare_mod_here(id_sp, paths),
}
}

fn error_cannot_declare_mod_here<T>(&self, id_sp: Span, paths: ModulePath) -> PResult<'a, T> {
let mut err = self.struct_span_err(id_sp, "cannot declare a new module at this location");
if !id_sp.is_dummy() {
if let FileName::Real(src_path) = self.sess.source_map().span_to_filename(id_sp) {
if let Some(stem) = src_path.file_stem() {
let mut dest_path = src_path.clone();
dest_path.set_file_name(stem);
dest_path.push("mod.rs");
err.span_note(
id_sp,
&format!(
"... or maybe `use` the module `{}` instead \
of possibly redeclaring it",
paths.name
"maybe move this module `{}` to its own \
directory via `{}`",
src_path.display(),
dest_path.display()
),
);
}
Err(err)
}
}
if paths.path_exists {
err.span_note(
id_sp,
&format!(
"... or maybe `use` the module `{}` instead \
of possibly redeclaring it",
paths.name
),
);
}
Err(err)
}

/// Derive a submodule path from the first found `#[path = "path_string"]`.
Expand Down