mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 11:48:30 +00:00
Rollup merge of #84945 - fee1-dead:E0583-better-message, r=petrochenkov
E0583: Include secondary path in error message Fixes #84819.
This commit is contained in:
commit
b07834b986
@ -36,7 +36,7 @@ crate struct ParsedExternalMod {
|
|||||||
pub enum ModError<'a> {
|
pub enum ModError<'a> {
|
||||||
CircularInclusion(Vec<PathBuf>),
|
CircularInclusion(Vec<PathBuf>),
|
||||||
ModInBlock(Option<Ident>),
|
ModInBlock(Option<Ident>),
|
||||||
FileNotFound(Ident, PathBuf),
|
FileNotFound(Ident, PathBuf, PathBuf),
|
||||||
MultipleCandidates(Ident, PathBuf, PathBuf),
|
MultipleCandidates(Ident, PathBuf, PathBuf),
|
||||||
ParserError(DiagnosticBuilder<'a>),
|
ParserError(DiagnosticBuilder<'a>),
|
||||||
}
|
}
|
||||||
@ -219,7 +219,7 @@ pub fn default_submod_path<'a>(
|
|||||||
file_path: secondary_path,
|
file_path: secondary_path,
|
||||||
dir_ownership: DirOwnership::Owned { relative: None },
|
dir_ownership: DirOwnership::Owned { relative: None },
|
||||||
}),
|
}),
|
||||||
(false, false) => Err(ModError::FileNotFound(ident, default_path)),
|
(false, false) => Err(ModError::FileNotFound(ident, default_path, secondary_path)),
|
||||||
(true, true) => Err(ModError::MultipleCandidates(ident, default_path, secondary_path)),
|
(true, true) => Err(ModError::MultipleCandidates(ident, default_path, secondary_path)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -247,7 +247,7 @@ impl ModError<'_> {
|
|||||||
}
|
}
|
||||||
err
|
err
|
||||||
}
|
}
|
||||||
ModError::FileNotFound(ident, default_path) => {
|
ModError::FileNotFound(ident, default_path, secondary_path) => {
|
||||||
let mut err = struct_span_err!(
|
let mut err = struct_span_err!(
|
||||||
diag,
|
diag,
|
||||||
span,
|
span,
|
||||||
@ -256,9 +256,10 @@ impl ModError<'_> {
|
|||||||
ident,
|
ident,
|
||||||
);
|
);
|
||||||
err.help(&format!(
|
err.help(&format!(
|
||||||
"to create the module `{}`, create file \"{}\"",
|
"to create the module `{}`, create file \"{}\" or \"{}\"",
|
||||||
ident,
|
ident,
|
||||||
default_path.display(),
|
default_path.display(),
|
||||||
|
secondary_path.display(),
|
||||||
));
|
));
|
||||||
err
|
err
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ error[E0583]: file not found for module `module_that_doesnt_exist`
|
|||||||
LL | mod module_that_doesnt_exist;
|
LL | mod module_that_doesnt_exist;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= help: to create the module `module_that_doesnt_exist`, create file "$DIR/module_that_doesnt_exist.rs"
|
= help: to create the module `module_that_doesnt_exist`, create file "$DIR/module_that_doesnt_exist.rs" or "$DIR/module_that_doesnt_exist/mod.rs"
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ error[E0583]: file not found for module `baz`
|
|||||||
LL | pub mod baz;
|
LL | pub mod baz;
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= help: to create the module `baz`, create file "$DIR/auxiliary/foo/bar/baz.rs"
|
= help: to create the module `baz`, create file "$DIR/auxiliary/foo/bar/baz.rs" or "$DIR/auxiliary/foo/bar/baz/mod.rs"
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ error[E0583]: file not found for module `missing`
|
|||||||
LL | mod missing;
|
LL | mod missing;
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= help: to create the module `missing`, create file "$DIR/foo/missing.rs"
|
= help: to create the module `missing`, create file "$DIR/foo/missing.rs" or "$DIR/foo/missing/mod.rs"
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ error[E0583]: file not found for module `missing`
|
|||||||
LL | mod missing;
|
LL | mod missing;
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= help: to create the module `missing`, create file "$DIR/foo_inline/inline/missing.rs"
|
= help: to create the module `missing`, create file "$DIR/foo_inline/inline/missing.rs" or "$DIR/foo_inline/inline/missing/mod.rs"
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ error[E0583]: file not found for module `not_a_real_file`
|
|||||||
LL | mod not_a_real_file;
|
LL | mod not_a_real_file;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= help: to create the module `not_a_real_file`, create file "$DIR/not_a_real_file.rs"
|
= help: to create the module `not_a_real_file`, create file "$DIR/not_a_real_file.rs" or "$DIR/not_a_real_file/mod.rs"
|
||||||
|
|
||||||
error[E0433]: failed to resolve: use of undeclared crate or module `mod_file_aux`
|
error[E0433]: failed to resolve: use of undeclared crate or module `mod_file_aux`
|
||||||
--> $DIR/mod_file_not_exist.rs:7:16
|
--> $DIR/mod_file_not_exist.rs:7:16
|
||||||
|
@ -4,7 +4,7 @@ error[E0583]: file not found for module `not_a_real_file`
|
|||||||
LL | mod not_a_real_file;
|
LL | mod not_a_real_file;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= help: to create the module `not_a_real_file`, create file "$DIR/not_a_real_file.rs"
|
= help: to create the module `not_a_real_file`, create file "$DIR/not_a_real_file.rs" or "$DIR/not_a_real_file/mod.rs"
|
||||||
|
|
||||||
error[E0433]: failed to resolve: use of undeclared crate or module `mod_file_aux`
|
error[E0433]: failed to resolve: use of undeclared crate or module `mod_file_aux`
|
||||||
--> $DIR/mod_file_not_exist_windows.rs:7:16
|
--> $DIR/mod_file_not_exist_windows.rs:7:16
|
||||||
|
@ -4,7 +4,7 @@ error[E0583]: file not found for module `n`
|
|||||||
LL | unsafe mod n;
|
LL | unsafe mod n;
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= help: to create the module `n`, create file "$DIR/n.rs"
|
= help: to create the module `n`, create file "$DIR/n.rs" or "$DIR/n/mod.rs"
|
||||||
|
|
||||||
error: module cannot be declared unsafe
|
error: module cannot be declared unsafe
|
||||||
--> $DIR/unsafe-mod.rs:1:1
|
--> $DIR/unsafe-mod.rs:1:1
|
||||||
|
@ -4,7 +4,7 @@ error[E0583]: file not found for module `řųśť`
|
|||||||
LL | mod řųśť;
|
LL | mod řųśť;
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
|
|
|
|
||||||
= help: to create the module `řųśť`, create file "$DIR/řųśť.rs"
|
= help: to create the module `řųśť`, create file "$DIR/řųśť.rs" or "$DIR/řųśť/mod.rs"
|
||||||
|
|
||||||
error[E0754]: trying to load file for module `řųśť` with non-ascii identifier name
|
error[E0754]: trying to load file for module `řųśť` with non-ascii identifier name
|
||||||
--> $DIR/mod_file_nonascii_forbidden.rs:1:5
|
--> $DIR/mod_file_nonascii_forbidden.rs:1:5
|
||||||
|
Loading…
Reference in New Issue
Block a user