Skip to content

Commit 00fe97a

Browse files
committed
Fix capitalization when mentioning different crate versions in E0308
1 parent e5816a7 commit 00fe97a

File tree

3 files changed

+9
-22
lines changed

3 files changed

+9
-22
lines changed

src/librustc/infer/error_reporting/mod.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,6 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
463463
&self,
464464
err: &mut DiagnosticBuilder<'_>,
465465
terr: &TypeError<'tcx>,
466-
sp: Span,
467466
) {
468467
use hir::def_id::CrateNum;
469468
use hir::map::DisambiguatedDefPathData;
@@ -577,14 +576,10 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
577576
};
578577
if same_path().unwrap_or(false) {
579578
let crate_name = self.tcx.crate_name(did1.krate);
580-
err.span_note(
581-
sp,
582-
&format!(
583-
"Perhaps two different versions \
584-
of crate `{}` are being used?",
585-
crate_name
586-
),
587-
);
579+
err.note(&format!(
580+
"perhaps two different versions of crate `{}` are being used?",
581+
crate_name
582+
));
588583
}
589584
}
590585
};
@@ -1263,7 +1258,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
12631258
.unwrap_or_else(|| {
12641259
self.tcx.hir().body_owner_def_id(hir::BodyId { hir_id: cause.body_id })
12651260
});
1266-
self.check_and_note_conflicting_crates(diag, terr, span);
1261+
self.check_and_note_conflicting_crates(diag, terr);
12671262
self.tcx.note_and_explain_type_err(diag, terr, span, body_owner_def_id);
12681263

12691264
// It reads better to have the error origin as the final

src/test/ui/type/type-mismatch-same-crate-name.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ fn main() {
1515
extern crate crate_a1 as a;
1616
a::try_foo(foo2);
1717
//~^ ERROR mismatched types
18-
//~| Perhaps two different versions of crate `crate_a1`
18+
//~| perhaps two different versions of crate `crate_a1`
1919
//~| expected struct `main::a::Foo`
2020
a::try_bar(bar2);
2121
//~^ ERROR mismatched types
22-
//~| Perhaps two different versions of crate `crate_a1`
22+
//~| perhaps two different versions of crate `crate_a1`
2323
//~| expected trait `main::a::Bar`
2424
//~| expected struct `std::boxed::Box<(dyn main::a::Bar + 'static)>`
2525
//~| found struct `std::boxed::Box<dyn main::a::Bar>`

src/test/ui/type/type-mismatch-same-crate-name.stderr

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ error[E0308]: mismatched types
44
LL | a::try_foo(foo2);
55
| ^^^^ expected struct `main::a::Foo`, found a different struct `main::a::Foo`
66
|
7-
note: Perhaps two different versions of crate `crate_a1` are being used?
8-
--> $DIR/type-mismatch-same-crate-name.rs:16:20
9-
|
10-
LL | a::try_foo(foo2);
11-
| ^^^^
7+
= note: perhaps two different versions of crate `crate_a1` are being used?
128

139
error[E0308]: mismatched types
1410
--> $DIR/type-mismatch-same-crate-name.rs:20:20
@@ -18,11 +14,7 @@ LL | a::try_bar(bar2);
1814
|
1915
= note: expected struct `std::boxed::Box<(dyn main::a::Bar + 'static)>`
2016
found struct `std::boxed::Box<dyn main::a::Bar>`
21-
note: Perhaps two different versions of crate `crate_a1` are being used?
22-
--> $DIR/type-mismatch-same-crate-name.rs:20:20
23-
|
24-
LL | a::try_bar(bar2);
25-
| ^^^^
17+
= note: perhaps two different versions of crate `crate_a1` are being used?
2618

2719
error: aborting due to 2 previous errors
2820

0 commit comments

Comments
 (0)