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

Skip to content

Rollup of 8 pull requests #69730

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 24 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
515446c
Make error message clearer about creating new module
kornelski Feb 27, 2020
96b3261
Apply rustfmt :(
kornelski Mar 1, 2020
7b6f5ed
`delay_span_bug` when codegen cannot select obligation
estebank Mar 1, 2020
c745b4a
Add explanation for E0380
GuillaumeGomez Mar 4, 2020
6db7e34
use integer assoc consts instead of methods
RalfJung Mar 4, 2020
f0c3cf2
cover some more nearby cases
RalfJung Mar 4, 2020
8ea676e
Update books
ehuss Mar 2, 2020
0e1cd59
Toolstate: remove redundant beta-week check.
ehuss Mar 4, 2020
a6d8c9c
more toolstate comments
RalfJung Mar 4, 2020
a41f1f1
Further clarifications and comments on toolstate operation.
ehuss Mar 4, 2020
729d49d
Update macros.rs: fix documentation typo.
fables-tales Mar 4, 2020
07168f9
Don't use .ok() before unwrapping via .expect() on a Result.
matthiaskrgr Mar 4, 2020
569676b
Use .map() to modify data inside Options instead of using .and_then(|…
matthiaskrgr Mar 4, 2020
38f5db7
Use .as_deref() instead of .as_ref().map(Deref::deref) (clippy::optio…
matthiaskrgr Mar 4, 2020
d8d2004
8000 Don't use "if let" bindings to only check a value and not actually bi…
matthiaskrgr Mar 4, 2020
80ed505
Use single-char patter on {ends,starts}_with and remove clone on copy…
matthiaskrgr Mar 4, 2020
bb126e1
Rollup merge of #69520 - kornelski:e69492, r=cramertj
JohnTitor Mar 5, 2020
273c5b2
Rollup merge of #69614 - estebank:ice-age, r=davidtwco
JohnTitor Mar 5, 2020
6178e2b
Rollup merge of #69641 - ehuss:update-books, r=ehuss
JohnTitor Mar 5, 2020
8a4419a
Rollup merge of #69697 - GuillaumeGomez:explanation-e0380, r=Dylan-DPC
JohnTitor Mar 5, 2020
6000a57
Rollup merge of #69698 - RalfJung:int_assoc, r=davidtwco
JohnTitor Mar 5, 2020
ab496fe
Rollup merge of #69705 - ehuss:toolstate-remove-redundant-beta, r=Mar…
JohnTitor Mar 5, 2020
61b68f1
Rollup merge of #69711 - penelopezone:patch-1, r=steveklabnik
JohnTitor Mar 5, 2020
3219fdd
Rollup merge of #69713 - matthiaskrgr:more_cleanup, r=cramertj
JohnTitor Mar 5, 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
26 changes: 7 additions & 19 deletions src/librustc_parse/parser/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use rustc_span::{MultiSpan, Span, SpanSnippetError, DUMMY_SP};

use log::{debug, trace};
use std::mem;
use std::path::PathBuf;

const TURBOFISH: &'static str = "use `::<...>` instead of `<...>` to specify type arguments";

Expand All @@ -40,29 +41,15 @@ pub(super) fn dummy_arg(ident: Ident) -> Param {
}

pub enum Error {
FileNotFoundForModule {
8000 mod_name: String,
default_path: String,
secondary_path: String,
dir_path: String,
},
DuplicatePaths {
mod_name: String,
default_path: String,
secondary_path: String,
},
FileNotFoundForModule { mod_name: String, default_path: PathBuf },
DuplicatePaths { mod_name: String, default_path: String, secondary_path: String },
UselessDocComment,
}

impl Error {
fn span_err(self, sp: impl Into<MultiSpan>, handler: &Handler) -> DiagnosticBuilder<'_> {
match self {
Error::FileNotFoundForModule {
ref mod_name,
ref default_path,
ref secondary_path,
ref dir_path,
} => {
Error::FileNotFoundForModule { ref mod_name, ref default_path } => {
let mut err = struct_span_err!(
handler,
sp,
Expand All @@ -71,8 +58,9 @@ impl Error {
mod_name,
);
err.help(&format!(
"name the file either {} or {} inside the directory \"{}\"",
default_path, secondary_path, dir_path,
"to create the module `{}`, create file \"{}\"",
mod_name,
default_path.display(),
));
err
}
Expand Down
9 changes: 3 additions & 6 deletions src/librustc_parse/parser/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,9 @@ impl<'a> Parser<'a> {
path: secondary_path,
directory_ownership: DirectoryOwnership::Owned { relative: None },
}),
(false, false) => Err(Error::FileNotFoundForModule {
mod_name: mod_name.clone(),
default_path: default_path_str,
secondary_path: secondary_path_str,
dir_path: dir_path.display().to_string(),
}),
(false, false) => {
Err(Error::FileNotFoundForModule { mod_name: mod_name.clone(), default_path })
}
(true, true) => Err(Error::DuplicatePaths {
mod_name: mod_name.clone(),
default_path: default_path_str,
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/error-codes/E0583.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0583]: file not found for module `module_that_doesnt_exist`
LL | mod module_that_doesnt_exist;
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: name the file either module_that_doesnt_exist.rs or module_that_doesnt_exist/mod.rs inside the directory "$DIR"
= help: to create the module `module_that_doesnt_exist`, create file "$DIR/module_that_doesnt_exist.rs"

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0583]: file not found for module `baz`
LL | pub mod baz;
| ^^^
|
= help: name the file either bar/baz.rs or bar/baz/mod.rs inside the directory "$DIR/auxiliary/foo"
= help: to create the module `baz`, create file "$DIR/auxiliary/foo/bar/baz.rs"

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0583]: file not found for module `missing`
LL | mod missing;
| ^^^^^^^
|
= help: name the file either foo/missing.rs or foo/missing/mod.rs inside the directory "$DIR"
= help: to create the module `missing`, create file "$DIR/foo/missing.rs"

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0583]: file not found for module `missing`
LL | mod missing;
| ^^^^^^^
|
= help: name the file either missing.rs or missing/mod.rs inside the directory "$DIR/foo_inline/inline"
= help: to create the module `missing`, create file "$DIR/foo_inline/inline/missing.rs"

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/mod_file_not_exist.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ignore-windows

mod not_a_real_file; //~ ERROR file not found for module `not_a_real_file`
//~^ HELP name the file either not_a_real_file.rs or not_a_real_file/mod.rs inside the directory
//~^ HELP to create the module `not_a_real_file`, create file "

fn main() {
assert_eq!(mod_file_aux::bar(), 10);
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/mod_file_not_exist.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0583]: file not found for module `not_a_real_file`
LL | mod not_a_real_file;
| ^^^^^^^^^^^^^^^
|
= help: name the file either not_a_real_file.rs or not_a_real_file/mod.rs inside the directory "$DIR"
= help: to create the module `not_a_real_file`, create file "$DIR/not_a_real_file.rs"

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/mod_file_not_exist_windows.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0583]: file not found for module `not_a_real_file`
LL | mod not_a_real_file;
| ^^^^^^^^^^^^^^^
|
= help: name the file either not_a_real_file.rs or not_a_real_file/mod.rs inside the directory "$DIR"
= help: to create the module `not_a_real_file`, create file "$DIR/not_a_real_file.rs"

error: aborting due to previous error

Expand Down
0