Skip to content

Commit 26291ce

Browse files
committed
reword suggestion for clarity regarding file system checks
1 parent 7ff72c0 commit 26291ce

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

compiler/rustc_resolve/src/diagnostics.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2430,7 +2430,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
24302430
// FIXME: add case where non parent using undeclared module (hard?)
24312431
&& let Some(dir) = src.parent()
24322432
&& let Some(src) = src.with_extension("").file_name().and_then(|x| x.to_str())
2433-
&& [
2433+
&& let Some(m) = [
24342434
// …/x.rs
24352435
dir.join(i).with_extension("rs"),
24362436
// …/x/mod.rs
@@ -2452,14 +2452,15 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
24522452
.iter()
24532453
.flatten(),
24542454
)
2455-
.any(|x| x.exists())
2455+
.find(|x| x.exists())
24562456
{
24572457
Some((
24582458
// FIXME: add suggestion
24592459
vec![],
24602460
format!(
2461-
"you may have forgotten to declare module `{ident}`. \
2462-
use `mod {ident}` in this file to declare this module.",
2461+
"to make use of source file {}, use `mod {ident}` \
2462+
in this file to declare the module",
2463+
m.display()
24632464
),
24642465
Applicability::MaybeIncorrect,
24652466
))

0 commit comments

Comments
 (0)