Skip to content

Commit 95479d4

Browse files
authored
Rollup merge of #73122 - doctorn:issue-73116, r=varkor
Resolve E0584 conflict Adds a new error code (`E0761`) to indicate ambiguity in module file names and an accompanying expanded description to resolve a conflict over `E0584`. Resolves #73116
2 parents cbfdff7 + 039da0b commit 95479d4

File tree

5 files changed

+30
-4
lines changed

5 files changed

+30
-4
lines changed

src/librustc_error_codes/error_codes.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ E0753: include_str!("./error_codes/E0753.md"),
439439
E0754: include_str!("./error_codes/E0754.md"),
440440
E0758: include_str!("./error_codes/E0758.md"),
441441
E0760: include_str!("./error_codes/E0760.md"),
442+
E0761: include_str!("./error_codes/E0761.md"),
442443
;
443444
// E0006, // merged with E0005
444445
// E0008, // cannot bind by-move into a pattern guard

src/librustc_error_codes/error_codes/E0583.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ A file wasn't found for an out-of-line module.
22

33
Erroneous code example:
44

5-
```ignore (compile_fail not working here; see Issue #43707)
5+
```compile_fail,E0583
66
mod file_that_doesnt_exist; // error: file not found for module
77
88
fn main() {}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Multiple candidate files were found for an out-of-line module.
2+
3+
Erroneous code example:
4+
5+
```rust
6+
// file: ambiguous_module/mod.rs
7+
8+
fn foo() {}
9+
```
10+
11+
```rust
12+
// file: ambiguous_module.rs
13+
14+
fn foo() {}
15+
```
16+
17+
```ignore (multiple source files required for compile_fail)
18+
mod ambiguous_module; // error: file for module `ambiguous_module`
19+
// found at both ambiguous_module.rs and
20+
// ambiguous_module.rs/mod.rs
21+
22+
fn main() {}
23+
```
24+
25+
Please remove this ambiguity by deleting/renaming one of the candidate files.

src/librustc_expand/module.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ pub fn default_submod_path<'a>(
291291
let mut err = struct_span_err!(
292292
sess.span_diagnostic,
293293
span,
294-
E0584,
294+
E0761,
295295
"file for module `{}` found at both {} and {}",
296296
mod_name,
297297
default_path_str,

src/test/ui/mod/mod_file_disambig.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0584]: file for module `mod_file_disambig_aux` found at both mod_file_disambig_aux.rs and mod_file_disambig_aux/mod.rs
1+
error[E0761]: file for module `mod_file_disambig_aux` found at both mod_file_disambig_aux.rs and mod_file_disambig_aux/mod.rs
22
--> $DIR/mod_file_disambig.rs:1:1
33
|
44
LL | mod mod_file_disambig_aux;
@@ -14,5 +14,5 @@ LL | assert_eq!(mod_file_aux::bar(), 10);
1414

1515
error: aborting due to 2 previous errors
1616

17-
Some errors have detailed explanations: E0433, E0584.
17+
Some errors have detailed explanations: E0433, E0761.
1818
For more information about an error, try `rustc --explain E0433`.

0 commit comments

Comments
 (0)