From ea64ab7d4eea9b5ba89b21eeed4ad897ff6a2ded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 17 Dec 2017 23:46:55 -0800 Subject: [PATCH] Use def span for conflicting impls and recursive fn --- src/librustc/traits/specialize/mod.rs | 12 +- src/librustc_lint/builtin.rs | 9 +- .../ui/coherence-overlap-downstream.stderr | 8 +- .../ui/coherence-overlap-issue-23516.stderr | 4 +- src/test/ui/coherence-overlap-upstream.stderr | 4 +- src/test/ui/e0119/complex-impl.stderr | 2 +- src/test/ui/e0119/conflict-with-std.stderr | 25 +-- src/test/ui/e0119/issue-23563.stderr | 6 +- src/test/ui/e0119/issue-27403.stderr | 8 +- src/test/ui/e0119/issue-28981.stderr | 2 +- src/test/ui/e0119/so-37347311.stderr | 8 +- ...ture-gate-overlapping_marker_traits.stderr | 4 +- src/test/ui/issue-28568.stderr | 15 +- .../ui/lint-unconditional-recursion.stderr | 211 ++++++------------ ...specialization-feature-gate-overlap.stderr | 14 +- 15 files changed, 111 insertions(+), 221 deletions(-) diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs index 6a96d01d5f9..afe29cc0e7b 100644 --- a/src/librustc/traits/specialize/mod.rs +++ b/src/librustc/traits/specialize/mod.rs @@ -341,15 +341,18 @@ pub(super) fn specialization_graph_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx }), if used_to_be_allowed { " (E0119)" } else { "" } ); + let impl_span = tcx.sess.codemap().def_span( + tcx.span_of_impl(impl_def_id).unwrap() + ); let mut err = if used_to_be_allowed { tcx.struct_span_lint_node( lint::builtin::INCOHERENT_FUNDAMENTAL_IMPLS, tcx.hir.as_local_node_id(impl_def_id).unwrap(), - tcx.span_of_impl(impl_def_id).unwrap(), + impl_span, &msg) } else { struct_span_err!(tcx.sess, - tcx.span_of_impl(impl_def_id).unwrap(), + impl_span, E0119, "{}", msg) @@ -357,8 +360,9 @@ pub(super) fn specialization_graph_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx match tcx.span_of_impl(overlap.with_impl) { Ok(span) => { - err.span_label(span, format!("first implementation here")); - err.span_label(tcx.span_of_impl(impl_def_id).unwrap(), + err.span_label(tcx.sess.codemap().def_span(span), + format!("first implementation here")); + err.span_label(impl_span, format!("conflicting implementation{}", overlap.self_desc .map_or(String::new(), diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 07874a8cc69..5417634144b 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -352,7 +352,7 @@ fn check_missing_docs_attrs(&self, let has_doc = attrs.iter().any(|a| a.is_value_str() && a.check_name("doc")); if !has_doc { cx.span_lint(MISSING_DOCS, - sp, + cx.tcx.sess.codemap().def_span(sp), &format!("missing documentation for {}", desc)); } } @@ -914,15 +914,16 @@ fn check_fn(&mut self, // no break */ }`) shouldn't be linted unless it actually // recurs. if !reached_exit_without_self_call && !self_call_spans.is_empty() { + let sp = cx.tcx.sess.codemap().def_span(sp); let mut db = cx.struct_span_lint(UNCONDITIONAL_RECURSION, sp, "function cannot return without recurring"); + db.span_label(sp, "cannot return without recurring"); // offer some help to the programmer. for call in &self_call_spans { - db.span_note(*call, "recursive call site"); + db.span_label(*call, "recursive call site"); } - db.help("a `loop` may express intention \ - better if this is on purpose"); + db.help("a `loop` may express intention better if this is on purpose"); db.emit(); } diff --git a/src/test/ui/coherence-overlap-downstream.stderr b/src/test/ui/coherence-overlap-downstream.stderr index 8a3ef97fd55..c94ffd60d26 100644 --- a/src/test/ui/coherence-overlap-downstream.stderr +++ b/src/test/ui/coherence-overlap-downstream.stderr @@ -2,17 +2,17 @@ error[E0119]: conflicting implementations of trait `Sweet`: --> $DIR/coherence-overlap-downstream.rs:18:1 | 17 | impl Sweet for T { } - | ----------------------------- first implementation here + | ------------------------- first implementation here 18 | impl Sweet for T { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`: --> $DIR/coherence-overlap-downstream.rs:24:1 | 23 | impl Foo for T where T: Bar {} - | ------------------------------------------ first implementation here + | --------------------------------------- first implementation here 24 | impl Foo for i32 {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` + | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` | = note: downstream crates may implement trait `Bar<_>` for type `i32` diff --git a/src/test/ui/coherence-overlap-issue-23516.stderr b/src/test/ui/coherence-overlap-issue-23516.stderr index 8e107e06a9e..c27e1ad7620 100644 --- a/src/test/ui/coherence-overlap-issue-23516.stderr +++ b/src/test/ui/coherence-overlap-issue-23516.stderr @@ -2,9 +2,9 @@ error[E0119]: conflicting implementations of trait `Sweet` for type `std::boxed: --> $DIR/coherence-overlap-issue-23516.rs:18:1 | 17 | impl Sweet for T { } - | ----------------------------- first implementation here + | ------------------------- first implementation here 18 | impl Sweet for Box { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::boxed::Box<_>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::boxed::Box<_>` | = note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>` diff --git a/src/test/ui/coherence-overlap-upstream.stderr b/src/test/ui/coherence-overlap-upstream.stderr index 48961572b72..9b5b67fe9c7 100644 --- a/src/test/ui/coherence-overlap-upstream.stderr +++ b/src/test/ui/coherence-overlap-upstream.stderr @@ -2,9 +2,9 @@ error[E0119]: conflicting implementations of trait `Foo` for type `i16`: --> $DIR/coherence-overlap-upstream.rs:22:1 | 21 | impl Foo for T where T: Remote {} - | ------------------------------------ first implementation here + | --------------------------------- first implementation here 22 | impl Foo for i16 {} - | ^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i16` + | ^^^^^^^^^^^^^^^^ conflicting implementation for `i16` | = note: upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` in future versions diff --git a/src/test/ui/e0119/complex-impl.stderr b/src/test/ui/e0119/complex-impl.stderr index e4f8020145c..926dac3f9b1 100644 --- a/src/test/ui/e0119/complex-impl.stderr +++ b/src/test/ui/e0119/complex-impl.stderr @@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `complex_impl_support::Extern --> $DIR/complex-impl.rs:19:1 | 19 | impl External for (Q, R) {} //~ ERROR must be used - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `complex_impl_support`: - impl<'a, 'b, 'c, T, U, V, W> complex_impl_support::External for (T, complex_impl_support::M<'a, 'b, 'c, std::boxed::Box, V, W>) diff --git a/src/test/ui/e0119/conflict-with-std.stderr b/src/test/ui/e0119/conflict-with-std.stderr index 21f2dd05b4d..4c1f9405fb9 100644 --- a/src/test/ui/e0119/conflict-with-std.stderr +++ b/src/test/ui/e0119/conflict-with-std.stderr @@ -1,12 +1,8 @@ error[E0119]: conflicting implementations of trait `std::convert::AsRef` for type `std::boxed::Box`: --> $DIR/conflict-with-std.rs:17:1 | -17 | / impl AsRef for Box { //~ ERROR conflicting implementations -18 | | fn as_ref(&self) -> &Q { -19 | | &**self -20 | | } -21 | | } - | |_^ +17 | impl AsRef for Box { //~ ERROR conflicting implementations + | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `alloc`: - impl std::convert::AsRef for std::boxed::Box @@ -15,12 +11,8 @@ error[E0119]: conflicting implementations of trait `std::convert::AsRef` for error[E0119]: conflicting implementations of trait `std::convert::From` for type `S`: --> $DIR/conflict-with-std.rs:24:1 | -24 | / impl From for S { //~ ERROR conflicting implementations -25 | | fn from(s: S) -> S { -26 | | s -27 | | } -28 | | } - | |_^ +24 | impl From for S { //~ ERROR conflicting implementations + | ^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `core`: - impl std::convert::From for T; @@ -28,13 +20,8 @@ error[E0119]: conflicting implementations of trait `std::convert::From` for t error[E0119]: conflicting implementations of trait `std::convert::TryFrom` for type `X`: --> $DIR/conflict-with-std.rs:31:1 | -31 | / impl TryFrom for X { //~ ERROR conflicting implementations -32 | | type Error = (); -33 | | fn try_from(u: X) -> Result { -34 | | Ok(u) -35 | | } -36 | | } - | |_^ +31 | impl TryFrom for X { //~ ERROR conflicting implementations + | ^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `core`: - impl std::convert::TryFrom for T diff --git a/src/test/ui/e0119/issue-23563.stderr b/src/test/ui/e0119/issue-23563.stderr index 9dddf193063..8bbae56d843 100644 --- a/src/test/ui/e0119/issue-23563.stderr +++ b/src/test/ui/e0119/issue-23563.stderr @@ -1,10 +1,8 @@ error[E0119]: conflicting implementations of trait `a::LolFrom<&[_]>` for type `LocalType<_>`: --> $DIR/issue-23563.rs:23:1 | -23 | / impl<'a, T> LolFrom<&'a [T]> for LocalType { //~ ERROR conflicting implementations of trait -24 | | fn from(_: &'a [T]) -> LocalType { LocalType(None) } -25 | | } - | |_^ +23 | impl<'a, T> LolFrom<&'a [T]> for LocalType { //~ ERROR conflicting implementations of trait + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `issue_23563_a`: - impl a::LolFrom for U diff --git a/src/test/ui/e0119/issue-27403.stderr b/src/test/ui/e0119/issue-27403.stderr index 68d7235f6aa..4417ea9099f 100644 --- a/src/test/ui/e0119/issue-27403.stderr +++ b/src/test/ui/e0119/issue-27403.stderr @@ -1,12 +1,8 @@ error[E0119]: conflicting implementations of trait `std::convert::Into<_>` for type `GenX<_>`: --> $DIR/issue-27403.rs:15:1 | -15 | / impl Into for GenX { //~ ERROR conflicting implementations -16 | | fn into(self) -> S { -17 | | self.inner -18 | | } -19 | | } - | |_^ +15 | impl Into for GenX { //~ ERROR conflicting implementations + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `core`: - impl std::convert::Into for T diff --git a/src/test/ui/e0119/issue-28981.stderr b/src/test/ui/e0119/issue-28981.stderr index aac9f7ae964..3ea1c9adc9b 100644 --- a/src/test/ui/e0119/issue-28981.stderr +++ b/src/test/ui/e0119/issue-28981.stderr @@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `std::ops::Deref` for type `& --> $DIR/issue-28981.rs:15:1 | 15 | impl Deref for Foo { } //~ ERROR must be used - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `core`: - impl<'a, T> std::ops::Deref for &'a T diff --git a/src/test/ui/e0119/so-37347311.stderr b/src/test/ui/e0119/so-37347311.stderr index 351c0e1bbb6..84fb049df35 100644 --- a/src/test/ui/e0119/so-37347311.stderr +++ b/src/test/ui/e0119/so-37347311.stderr @@ -1,12 +1,8 @@ error[E0119]: conflicting implementations of trait `std::convert::From>` for type `MyError<_>`: --> $DIR/so-37347311.rs:21:1 | -21 | / impl From for MyError { //~ ERROR conflicting implementations -22 | | fn from(error: S::Error) -> MyError { -23 | | MyError::StorageProblem(error) -24 | | } -25 | | } - | |_^ +21 | impl From for MyError { //~ ERROR conflicting implementations + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `core`: - impl std::convert::From for T; diff --git a/src/test/ui/feature-gate-overlapping_marker_traits.stderr b/src/test/ui/feature-gate-overlapping_marker_traits.stderr index 9028b14fcd7..c1725a62ada 100644 --- a/src/test/ui/feature-gate-overlapping_marker_traits.stderr +++ b/src/test/ui/feature-gate-overlapping_marker_traits.stderr @@ -2,9 +2,9 @@ error[E0119]: conflicting implementations of trait `MyMarker`: --> $DIR/feature-gate-overlapping_marker_traits.rs:16:1 | 15 | impl MyMarker for T {} - | ---------------------------------- first implementation here + | ------------------------------- first implementation here 16 | impl MyMarker for T {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation error: aborting due to previous error diff --git a/src/test/ui/issue-28568.stderr b/src/test/ui/issue-28568.stderr index 2b4025ac122..61717ee60ff 100644 --- a/src/test/ui/issue-28568.stderr +++ b/src/test/ui/issue-28568.stderr @@ -1,16 +1,11 @@ error[E0119]: conflicting implementations of trait `std::ops::Drop` for type `MyStruct`: --> $DIR/issue-28568.rs:17:1 | -13 | / impl Drop for MyStruct { -14 | | fn drop(&mut self) { } -15 | | } - | |_- first implementation here -16 | -17 | / impl Drop for MyStruct { -18 | | //~^ ERROR conflicting implementations of trait -19 | | fn drop(&mut self) { } -20 | | } - | |_^ conflicting implementation for `MyStruct` +13 | impl Drop for MyStruct { + | ---------------------- first implementation here +... +17 | impl Drop for MyStruct { + | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyStruct` error: aborting due to previous error diff --git a/src/test/ui/lint-unconditional-recursion.stderr b/src/test/ui/lint-unconditional-recursion.stderr index 40eaab1437f..f6f97654b57 100644 --- a/src/test/ui/lint-unconditional-recursion.stderr +++ b/src/test/ui/lint-unconditional-recursion.stderr @@ -1,239 +1,156 @@ error: function cannot return without recurring --> $DIR/lint-unconditional-recursion.rs:14:1 | -14 | / fn foo() { //~ ERROR function cannot return without recurring -15 | | foo(); -16 | | } - | |_^ +14 | fn foo() { //~ ERROR function cannot return without recurring + | ^^^^^^^^ cannot return without recurring +15 | foo(); + | ----- recursive call site | note: lint level defined here --> $DIR/lint-unconditional-recursion.rs:11:9 | 11 | #![deny(unconditional_recursion)] | ^^^^^^^^^^^^^^^^^^^^^^^ -note: recursive call site - --> $DIR/lint-unconditional-recursion.rs:15:5 - | -15 | foo(); - | ^^^^^ = help: a `loop` may express intention better if this is on purpose error: function cannot return without recurring --> $DIR/lint-unconditional-recursion.rs:24:1 | -24 | / fn baz() { //~ ERROR function cannot return without recurring -25 | | if true { -26 | | baz() -27 | | } else { -28 | | baz() -29 | | } -30 | | } - | |_^ - | -note: recursive call site - --> $DIR/lint-unconditional-recursion.rs:26:9 - | +24 | fn baz() { //~ ERROR function cannot return without recurring + | ^^^^^^^^ cannot return without recurring +25 | if true { 26 | baz() - | ^^^^^ -note: recursive call site - --> $DIR/lint-unconditional-recursion.rs:28:9 - | + | ----- recursive call site +27 | } else { 28 | baz() - | ^^^^^ + | ----- recursive call site + | = help: a `loop` may express intention better if this is on purpose error: function cannot return without recurring --> $DIR/lint-unconditional-recursion.rs:36:1 | -36 | / fn quz() -> bool { //~ ERROR function cannot return without recurring -37 | | if true { -38 | | while quz() {} -39 | | true -... | -42 | | } -43 | | } - | |_^ - | -note: recursive call site - --> $DIR/lint-unconditional-recursion.rs:38:15 - | +36 | fn quz() -> bool { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^^^^ cannot return without recurring +37 | if true { 38 | while quz() {} - | ^^^^^ -note: recursive call site - --> $DIR/lint-unconditional-recursion.rs:41:16 - | + | ----- recursive call site +... 41 | loop { quz(); } - | ^^^^^ + | ----- recursive call site + | = help: a `loop` may express intention better if this is on purpose error: function cannot return without recurring --> $DIR/lint-unconditional-recursion.rs:47:5 | -47 | / fn bar(&self) { //~ ERROR function cannot return without recurring -48 | | self.bar() -49 | | } - | |_____^ - | -note: recursive call site - --> $DIR/lint-unconditional-recursion.rs:48:9 - | +47 | fn bar(&self) { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^ cannot return without recurring 48 | self.bar() - | ^^^^^^^^^^ + | ---------- recursive call site + | = help: a `loop` may express intention better if this is on purpose error: function cannot return without recurring --> $DIR/lint-unconditional-recursion.rs:53:5 | -53 | / fn bar(&self) { //~ ERROR function cannot return without recurring -54 | | loop { -55 | | self.bar() -56 | | } -57 | | } - | |_____^ - | -note: recursive call site - --> $DIR/lint-unconditional-recursion.rs:55:13 - | +53 | fn bar(&self) { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^ cannot return without recurring +54 | loop { 55 | self.bar() - | ^^^^^^^^^^ + | ---------- recursive call site + | = help: a `loop` may express intention better if this is on purpose error: function cannot return without recurring --> $DIR/lint-unconditional-recursion.rs:62:5 | -62 | / fn bar(&self) { //~ ERROR function cannot return without recurring -63 | | 0.bar() -64 | | } - | |_____^ - | -note: recursive call site - --> $DIR/lint-unconditional-recursion.rs:63:9 - | +62 | fn bar(&self) { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^ cannot return without recurring 63 | 0.bar() - | ^^^^^^^ + | ------- recursive call site + | = help: a `loop` may express intention better if this is on purpose error: function cannot return without recurring --> $DIR/lint-unconditional-recursion.rs:75:5 | -75 | / fn bar(&self) { //~ ERROR function cannot return without recurring -76 | | Foo2::bar(self) -77 | | } - | |_____^ - | -note: recursive call site - --> $DIR/lint-unconditional-recursion.rs:76:9 - | +75 | fn bar(&self) { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^ cannot return without recurring 76 | Foo2::bar(self) - | ^^^^^^^^^^^^^^^ + | --------------- recursive call site + | = help: a `loop` may express intention better if this is on purpose error: function cannot return without recurring --> $DIR/lint-unconditional-recursion.rs:81:5 | -81 | / fn bar(&self) { //~ ERROR function cannot return without recurring -82 | | loop { -83 | | Foo2::bar(self) -84 | | } -85 | | } - | |_____^ - | -note: recursive call site - --> $DIR/lint-unconditional-recursion.rs:83:13 - | +81 | fn bar(&self) { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^ cannot return without recurring +82 | loop { 83 | Foo2::bar(self) - | ^^^^^^^^^^^^^^^ + | --------------- recursive call site + | = help: a `loop` may express intention better if this is on purpose error: function cannot return without recurring --> $DIR/lint-unconditional-recursion.rs:91:5 | -91 | / fn qux(&self) { //~ ERROR function cannot return without recurring -92 | | self.qux(); -93 | | } - | |_____^ - | -note: recursive call site - --> $DIR/lint-unconditional-recursion.rs:92:9 - | +91 | fn qux(&self) { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^ cannot return without recurring 92 | self.qux(); - | ^^^^^^^^^^ + | ---------- recursive call site + | = help: a `loop` may express intention better if this is on purpose error: function cannot return without recurring --> $DIR/lint-unconditional-recursion.rs:96:5 | -96 | / fn as_ref(&self) -> &Self { //~ ERROR function cannot return without recurring -97 | | Baz::as_ref(self) -98 | | } - | |_____^ - | -note: recursive call site - --> $DIR/lint-unconditional-recursion.rs:97:9 - | +96 | fn as_ref(&self) -> &Self { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring 97 | Baz::as_ref(self) - | ^^^^^^^^^^^^^^^^^ + | ----------------- recursive call site + | = help: a `loop` may express intention better if this is on purpose error: function cannot return without recurring --> $DIR/lint-unconditional-recursion.rs:103:5 | -103 | / fn default() -> Baz { //~ ERROR function cannot return without recurring -104 | | let x = Default::default(); -105 | | x -106 | | } - | |_____^ - | -note: recursive call site - --> $DIR/lint-unconditional-recursion.rs:104:17 - | +103 | fn default() -> Baz { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^^^^^^^ cannot return without recurring 104 | let x = Default::default(); - | ^^^^^^^^^^^^^^^^^^ + | ------------------ recursive call site + | = help: a `loop` may express intention better if this is on purpose error: function cannot return without recurring --> $DIR/lint-unconditional-recursion.rs:112:5 | -112 | / fn deref(&self) -> &() { //~ ERROR function cannot return without recurring -113 | | &**self -114 | | } - | |_____^ - | -note: recursive call site - --> $DIR/lint-unconditional-recursion.rs:113:10 - | +112 | fn deref(&self) -> &() { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring 113 | &**self - | ^^^^^^ + | ------ recursive call site + | = help: a `loop` may express intention better if this is on purpose error: function cannot return without recurring --> $DIR/lint-unconditional-recursion.rs:119:5 | -119 | / fn index(&self, x: usize) -> &Baz { //~ ERROR function cannot return without recurring -120 | | &self[x] -121 | | } - | |_____^ - | -note: recursive call site - --> $DIR/lint-unconditional-recursion.rs:120:10 - | +119 | fn index(&self, x: usize) -> &Baz { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring 120 | &self[x] - | ^^^^^^^ + | ------- recursive call site + | = help: a `loop` may express intention better if this is on purpose error: function cannot return without recurring --> $DIR/lint-unconditional-recursion.rs:128:5 | -128 | / fn deref(&self) -> &Baz { //~ ERROR function cannot return without recurring -129 | | self.as_ref() -130 | | } - | |_____^ - | -note: recursive call site - --> $DIR/lint-unconditional-recursion.rs:129:9 - | +128 | fn deref(&self) -> &Baz { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring 129 | self.as_ref() - | ^^^^ + | ---- recursive call site + | = help: a `loop` may express intention better if this is on purpose error: aborting due to 14 previous errors diff --git a/src/test/ui/specialization-feature-gate-overlap.stderr b/src/test/ui/specialization-feature-gate-overlap.stderr index 7fe2891c908..6ff261c696d 100644 --- a/src/test/ui/specialization-feature-gate-overlap.stderr +++ b/src/test/ui/specialization-feature-gate-overlap.stderr @@ -1,15 +1,11 @@ error[E0119]: conflicting implementations of trait `Foo` for type `u8`: --> $DIR/specialization-feature-gate-overlap.rs:23:1 | -19 | / impl Foo for T { -20 | | fn foo(&self) {} -21 | | } - | |_- first implementation here -22 | -23 | / impl Foo for u8 { //~ ERROR E0119 -24 | | fn foo(&self) {} -25 | | } - | |_^ conflicting implementation for `u8` +19 | impl Foo for T { + | ----------------- first implementation here +... +23 | impl Foo for u8 { //~ ERROR E0119 + | ^^^^^^^^^^^^^^^ conflicting implementation for `u8` error: aborting due to previous error