From a1eeaddf3f7aad9e82196d338613593e4e000762 Mon Sep 17 00:00:00 2001 From: Nathan Corbyn Date: Mon, 8 Jun 2020 11:57:56 +0100 Subject: [PATCH 1/2] Resolve E0584 conflict --- src/librustc_error_codes/error_codes.rs | 1 + src/librustc_error_codes/error_codes/E0761.md | 25 +++++++++++++++++++ src/librustc_expand/module.rs | 2 +- src/test/ui/mod/mod_file_disambig.stderr | 4 +-- 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 src/librustc_error_codes/error_codes/E0761.md diff --git a/src/librustc_error_codes/error_codes.rs b/src/librustc_error_codes/error_codes.rs index 7abe75a375a0b..a5b896ab19a5b 100644 --- a/src/librustc_error_codes/error_codes.rs +++ b/src/librustc_error_codes/error_codes.rs @@ -438,6 +438,7 @@ E0752: include_str!("./error_codes/E0752.md"), E0753: include_str!("./error_codes/E0753.md"), E0754: include_str!("./error_codes/E0754.md"), E0760: include_str!("./error_codes/E0760.md"), +E0761: include_str!("./error_codes/E0761.md"), ; // E0006, // merged with E0005 // E0008, // cannot bind by-move into a pattern guard diff --git a/src/librustc_error_codes/error_codes/E0761.md b/src/librustc_error_codes/error_codes/E0761.md new file mode 100644 index 0000000000000..e22ebcdc43190 --- /dev/null +++ b/src/librustc_error_codes/error_codes/E0761.md @@ -0,0 +1,25 @@ +Multiple candidate files were found for an out-of-line module. + +Erroneous code example: + +```rust +// file: ambiguous_module/mod.rs + +fn foo() {} +``` + +```rust +// file: ambiguous_module.rs + +fn foo() {} +``` + +```ignore (compile_fail not working here; see Issue #43707) +mod ambiguous_module; // error: file for module `ambiguous_module` + // found at both ambiguous_module.rs and + // ambiguous_module.rs/mod.rs + +fn main() {} +``` + +Please remove this ambiguity by deleting/renaming one of the candidate files. diff --git a/src/librustc_expand/module.rs b/src/librustc_expand/module.rs index 82215c7297ed6..535c1dbad04a9 100644 --- a/src/librustc_expand/module.rs +++ b/src/librustc_expand/module.rs @@ -291,7 +291,7 @@ pub fn default_submod_path<'a>( let mut err = struct_span_err!( sess.span_diagnostic, span, - E0584, + E0761, "file for module `{}` found at both {} and {}", mod_name, default_path_str, diff --git a/src/test/ui/mod/mod_file_disambig.stderr b/src/test/ui/mod/mod_file_disambig.stderr index 490633a3fb0ab..2cb99b7514277 100644 --- a/src/test/ui/mod/mod_file_disambig.stderr +++ b/src/test/ui/mod/mod_file_disambig.stderr @@ -1,4 +1,4 @@ -error[E0584]: file for module `mod_file_disambig_aux` found at both mod_file_disambig_aux.rs and mod_file_disambig_aux/mod.rs +error[E0761]: file for module `mod_file_disambig_aux` found at both mod_file_disambig_aux.rs and mod_file_disambig_aux/mod.rs --> $DIR/mod_file_disambig.rs:1:1 | LL | mod mod_file_disambig_aux; @@ -14,5 +14,5 @@ LL | assert_eq!(mod_file_aux::bar(), 10); error: aborting due to 2 previous errors -Some errors have detailed explanations: E0433, E0584. +Some errors have detailed explanations: E0433, E0761. For more information about an error, try `rustc --explain E0433`. From 039da0b83242e76ce84424e34f2aa38844bcf0bf Mon Sep 17 00:00:00 2001 From: Nathan Corbyn Date: Tue, 9 Jun 2020 11:14:41 +0100 Subject: [PATCH 2/2] Update comments --- src/librustc_error_codes/error_codes/E0583.md | 2 +- src/librustc_error_codes/error_codes/E0761.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc_error_codes/error_codes/E0583.md b/src/librustc_error_codes/error_codes/E0583.md index 2dcbbf8855669..701900bb0cd4b 100644 --- a/src/librustc_error_codes/error_codes/E0583.md +++ b/src/librustc_error_codes/error_codes/E0583.md @@ -2,7 +2,7 @@ A file wasn't found for an out-of-line module. Erroneous code example: -```ignore (compile_fail not working here; see Issue #43707) +```compile_fail,E0583 mod file_that_doesnt_exist; // error: file not found for module fn main() {} diff --git a/src/librustc_error_codes/error_codes/E0761.md b/src/librustc_error_codes/error_codes/E0761.md index e22ebcdc43190..c01574e413cfa 100644 --- a/src/librustc_error_codes/error_codes/E0761.md +++ b/src/librustc_error_codes/error_codes/E0761.md @@ -14,7 +14,7 @@ fn foo() {} fn foo() {} ``` -```ignore (compile_fail not working here; see Issue #43707) +```ignore (multiple source files required for compile_fail) mod ambiguous_module; // error: file for module `ambiguous_module` // found at both ambiguous_module.rs and // ambiguous_module.rs/mod.rs