diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2019-11-25 12:26:32 -0800 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2019-11-25 12:38:45 -0800 |
| commit | 00fe97ad0e440d78a3dbf8df77ac5192ca6d6403 (patch) | |
| tree | 5a10245f438fe776b7728881b075d5a0bf170e55 | |
| parent | e5816a75cc9951218e6ec06f64a5f07575c36770 (diff) | |
| download | rust-00fe97ad0e440d78a3dbf8df77ac5192ca6d6403.tar.gz rust-00fe97ad0e440d78a3dbf8df77ac5192ca6d6403.zip | |
Fix capitalization when mentioning different crate versions in E0308
| -rw-r--r-- | src/librustc/infer/error_reporting/mod.rs | 15 | ||||
| -rw-r--r-- | src/test/ui/type/type-mismatch-same-crate-name.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/type/type-mismatch-same-crate-name.stderr | 12 |
3 files changed, 9 insertions, 22 deletions
diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index 0f93ef6b1a9..3ff5b2521ae 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -463,7 +463,6 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { &self, err: &mut DiagnosticBuilder<'_>, terr: &TypeError<'tcx>, - sp: Span, ) { use hir::def_id::CrateNum; use hir::map::DisambiguatedDefPathData; @@ -577,14 +576,10 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { }; if same_path().unwrap_or(false) { let crate_name = self.tcx.crate_name(did1.krate); - err.span_note( - sp, - &format!( - "Perhaps two different versions \ - of crate `{}` are being used?", - crate_name - ), - ); + err.note(&format!( + "perhaps two different versions of crate `{}` are being used?", + crate_name + )); } } }; @@ -1263,7 +1258,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { .unwrap_or_else(|| { self.tcx.hir().body_owner_def_id(hir::BodyId { hir_id: cause.body_id }) }); - self.check_and_note_conflicting_crates(diag, terr, span); + self.check_and_note_conflicting_crates(diag, terr); self.tcx.note_and_explain_type_err(diag, terr, span, body_owner_def_id); // It reads better to have the error origin as the final diff --git a/src/test/ui/type/type-mismatch-same-crate-name.rs b/src/test/ui/type/type-mismatch-same-crate-name.rs index b1f9a28e16d..eeda5460ac3 100644 --- a/src/test/ui/type/type-mismatch-same-crate-name.rs +++ b/src/test/ui/type/type-mismatch-same-crate-name.rs @@ -15,11 +15,11 @@ fn main() { extern crate crate_a1 as a; a::try_foo(foo2); //~^ ERROR mismatched types - //~| Perhaps two different versions of crate `crate_a1` + //~| perhaps two different versions of crate `crate_a1` //~| expected struct `main::a::Foo` a::try_bar(bar2); //~^ ERROR mismatched types - //~| Perhaps two different versions of crate `crate_a1` + //~| perhaps two different versions of crate `crate_a1` //~| expected trait `main::a::Bar` //~| expected struct `std::boxed::Box<(dyn main::a::Bar + 'static)>` //~| found struct `std::boxed::Box<dyn main::a::Bar>` diff --git a/src/test/ui/type/type-mismatch-same-crate-name.stderr b/src/test/ui/type/type-mismatch-same-crate-name.stderr index 91bbe9c1fbe..be5406696b7 100644 --- a/src/test/ui/type/type-mismatch-same-crate-name.stderr +++ b/src/test/ui/type/type-mismatch-same-crate-name.stderr @@ -4,11 +4,7 @@ error[E0308]: mismatched types LL | a::try_foo(foo2); | ^^^^ expected struct `main::a::Foo`, found a different struct `main::a::Foo` | -note: Perhaps two different versions of crate `crate_a1` are being used? - --> $DIR/type-mismatch-same-crate-name.rs:16:20 - | -LL | a::try_foo(foo2); - | ^^^^ + = note: perhaps two different versions of crate `crate_a1` are being used? error[E0308]: mismatched types --> $DIR/type-mismatch-same-crate-name.rs:20:20 @@ -18,11 +14,7 @@ LL | a::try_bar(bar2); | = note: expected struct `std::boxed::Box<(dyn main::a::Bar + 'static)>` found struct `std::boxed::Box<dyn main::a::Bar>` -note: Perhaps two different versions of crate `crate_a1` are being used? - --> $DIR/type-mismatch-same-crate-name.rs:20:20 - | -LL | a::try_bar(bar2); - | ^^^^ + = note: perhaps two different versions of crate `crate_a1` are being used? error: aborting due to 2 previous errors |
