mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-24 12:54:00 +00:00
Use def span for conflicting impls and recursive fn
This commit is contained in:
parent
3cc68bac7c
commit
ea64ab7d4e
@ -341,15 +341,18 @@ pub(super) fn specialization_graph_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx
|
|||||||
}),
|
}),
|
||||||
if used_to_be_allowed { " (E0119)" } else { "" }
|
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 {
|
let mut err = if used_to_be_allowed {
|
||||||
tcx.struct_span_lint_node(
|
tcx.struct_span_lint_node(
|
||||||
lint::builtin::INCOHERENT_FUNDAMENTAL_IMPLS,
|
lint::builtin::INCOHERENT_FUNDAMENTAL_IMPLS,
|
||||||
tcx.hir.as_local_node_id(impl_def_id).unwrap(),
|
tcx.hir.as_local_node_id(impl_def_id).unwrap(),
|
||||||
tcx.span_of_impl(impl_def_id).unwrap(),
|
impl_span,
|
||||||
&msg)
|
&msg)
|
||||||
} else {
|
} else {
|
||||||
struct_span_err!(tcx.sess,
|
struct_span_err!(tcx.sess,
|
||||||
tcx.span_of_impl(impl_def_id).unwrap(),
|
impl_span,
|
||||||
E0119,
|
E0119,
|
||||||
"{}",
|
"{}",
|
||||||
msg)
|
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) {
|
match tcx.span_of_impl(overlap.with_impl) {
|
||||||
Ok(span) => {
|
Ok(span) => {
|
||||||
err.span_label(span, format!("first implementation here"));
|
err.span_label(tcx.sess.codemap().def_span(span),
|
||||||
err.span_label(tcx.span_of_impl(impl_def_id).unwrap(),
|
format!("first implementation here"));
|
||||||
|
err.span_label(impl_span,
|
||||||
format!("conflicting implementation{}",
|
format!("conflicting implementation{}",
|
||||||
overlap.self_desc
|
overlap.self_desc
|
||||||
.map_or(String::new(),
|
.map_or(String::new(),
|
||||||
|
@ -352,7 +352,7 @@ impl MissingDoc {
|
|||||||
let has_doc = attrs.iter().any(|a| a.is_value_str() && a.check_name("doc"));
|
let has_doc = attrs.iter().any(|a| a.is_value_str() && a.check_name("doc"));
|
||||||
if !has_doc {
|
if !has_doc {
|
||||||
cx.span_lint(MISSING_DOCS,
|
cx.span_lint(MISSING_DOCS,
|
||||||
sp,
|
cx.tcx.sess.codemap().def_span(sp),
|
||||||
&format!("missing documentation for {}", desc));
|
&format!("missing documentation for {}", desc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -914,15 +914,16 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnconditionalRecursion {
|
|||||||
// no break */ }`) shouldn't be linted unless it actually
|
// no break */ }`) shouldn't be linted unless it actually
|
||||||
// recurs.
|
// recurs.
|
||||||
if !reached_exit_without_self_call && !self_call_spans.is_empty() {
|
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,
|
let mut db = cx.struct_span_lint(UNCONDITIONAL_RECURSION,
|
||||||
sp,
|
sp,
|
||||||
"function cannot return without recurring");
|
"function cannot return without recurring");
|
||||||
|
db.span_label(sp, "cannot return without recurring");
|
||||||
// offer some help to the programmer.
|
// offer some help to the programmer.
|
||||||
for call in &self_call_spans {
|
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 \
|
db.help("a `loop` may express intention better if this is on purpose");
|
||||||
better if this is on purpose");
|
|
||||||
db.emit();
|
db.emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,17 +2,17 @@ error[E0119]: conflicting implementations of trait `Sweet`:
|
|||||||
--> $DIR/coherence-overlap-downstream.rs:18:1
|
--> $DIR/coherence-overlap-downstream.rs:18:1
|
||||||
|
|
|
|
||||||
17 | impl<T:Sugar> Sweet for T { }
|
17 | impl<T:Sugar> Sweet for T { }
|
||||||
| ----------------------------- first implementation here
|
| ------------------------- first implementation here
|
||||||
18 | impl<T:Fruit> Sweet for T { }
|
18 | impl<T:Fruit> Sweet for T { }
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
|
||||||
|
|
||||||
error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`:
|
error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`:
|
||||||
--> $DIR/coherence-overlap-downstream.rs:24:1
|
--> $DIR/coherence-overlap-downstream.rs:24:1
|
||||||
|
|
|
|
||||||
23 | impl<X, T> Foo<X> for T where T: Bar<X> {}
|
23 | impl<X, T> Foo<X> for T where T: Bar<X> {}
|
||||||
| ------------------------------------------ first implementation here
|
| --------------------------------------- first implementation here
|
||||||
24 | impl<X> Foo<X> for i32 {}
|
24 | impl<X> Foo<X> for i32 {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32`
|
| ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32`
|
||||||
|
|
|
|
||||||
= note: downstream crates may implement trait `Bar<_>` for type `i32`
|
= note: downstream crates may implement trait `Bar<_>` for type `i32`
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@ error[E0119]: conflicting implementations of trait `Sweet` for type `std::boxed:
|
|||||||
--> $DIR/coherence-overlap-issue-23516.rs:18:1
|
--> $DIR/coherence-overlap-issue-23516.rs:18:1
|
||||||
|
|
|
|
||||||
17 | impl<T:Sugar> Sweet for T { }
|
17 | impl<T:Sugar> Sweet for T { }
|
||||||
| ----------------------------- first implementation here
|
| ------------------------- first implementation here
|
||||||
18 | impl<U:Sugar> Sweet for Box<U> { }
|
18 | impl<U:Sugar> Sweet for Box<U> { }
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::boxed::Box<_>`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::boxed::Box<_>`
|
||||||
|
|
|
|
||||||
= note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>`
|
= note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>`
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@ error[E0119]: conflicting implementations of trait `Foo` for type `i16`:
|
|||||||
--> $DIR/coherence-overlap-upstream.rs:22:1
|
--> $DIR/coherence-overlap-upstream.rs:22:1
|
||||||
|
|
|
|
||||||
21 | impl<T> Foo for T where T: Remote {}
|
21 | impl<T> Foo for T where T: Remote {}
|
||||||
| ------------------------------------ first implementation here
|
| --------------------------------- first implementation here
|
||||||
22 | impl Foo for i16 {}
|
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
|
= note: upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` in future versions
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `complex_impl_support::Extern
|
|||||||
--> $DIR/complex-impl.rs:19:1
|
--> $DIR/complex-impl.rs:19:1
|
||||||
|
|
|
|
||||||
19 | impl<R> External for (Q, R) {} //~ ERROR must be used
|
19 | impl<R> External for (Q, R) {} //~ ERROR must be used
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: conflicting implementation in crate `complex_impl_support`:
|
= 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<U>, V, W>)
|
- impl<'a, 'b, 'c, T, U, V, W> complex_impl_support::External for (T, complex_impl_support::M<'a, 'b, 'c, std::boxed::Box<U>, V, W>)
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
error[E0119]: conflicting implementations of trait `std::convert::AsRef<Q>` for type `std::boxed::Box<Q>`:
|
error[E0119]: conflicting implementations of trait `std::convert::AsRef<Q>` for type `std::boxed::Box<Q>`:
|
||||||
--> $DIR/conflict-with-std.rs:17:1
|
--> $DIR/conflict-with-std.rs:17:1
|
||||||
|
|
|
|
||||||
17 | / impl AsRef<Q> for Box<Q> { //~ ERROR conflicting implementations
|
17 | impl AsRef<Q> for Box<Q> { //~ ERROR conflicting implementations
|
||||||
18 | | fn as_ref(&self) -> &Q {
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
19 | | &**self
|
|
||||||
20 | | }
|
|
||||||
21 | | }
|
|
||||||
| |_^
|
|
||||||
|
|
|
|
||||||
= note: conflicting implementation in crate `alloc`:
|
= note: conflicting implementation in crate `alloc`:
|
||||||
- impl<T> std::convert::AsRef<T> for std::boxed::Box<T>
|
- impl<T> std::convert::AsRef<T> for std::boxed::Box<T>
|
||||||
@ -15,12 +11,8 @@ error[E0119]: conflicting implementations of trait `std::convert::AsRef<Q>` for
|
|||||||
error[E0119]: conflicting implementations of trait `std::convert::From<S>` for type `S`:
|
error[E0119]: conflicting implementations of trait `std::convert::From<S>` for type `S`:
|
||||||
--> $DIR/conflict-with-std.rs:24:1
|
--> $DIR/conflict-with-std.rs:24:1
|
||||||
|
|
|
|
||||||
24 | / impl From<S> for S { //~ ERROR conflicting implementations
|
24 | impl From<S> for S { //~ ERROR conflicting implementations
|
||||||
25 | | fn from(s: S) -> S {
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
26 | | s
|
|
||||||
27 | | }
|
|
||||||
28 | | }
|
|
||||||
| |_^
|
|
||||||
|
|
|
|
||||||
= note: conflicting implementation in crate `core`:
|
= note: conflicting implementation in crate `core`:
|
||||||
- impl<T> std::convert::From<T> for T;
|
- impl<T> std::convert::From<T> for T;
|
||||||
@ -28,13 +20,8 @@ error[E0119]: conflicting implementations of trait `std::convert::From<S>` for t
|
|||||||
error[E0119]: conflicting implementations of trait `std::convert::TryFrom<X>` for type `X`:
|
error[E0119]: conflicting implementations of trait `std::convert::TryFrom<X>` for type `X`:
|
||||||
--> $DIR/conflict-with-std.rs:31:1
|
--> $DIR/conflict-with-std.rs:31:1
|
||||||
|
|
|
|
||||||
31 | / impl TryFrom<X> for X { //~ ERROR conflicting implementations
|
31 | impl TryFrom<X> for X { //~ ERROR conflicting implementations
|
||||||
32 | | type Error = ();
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
33 | | fn try_from(u: X) -> Result<X, ()> {
|
|
||||||
34 | | Ok(u)
|
|
||||||
35 | | }
|
|
||||||
36 | | }
|
|
||||||
| |_^
|
|
||||||
|
|
|
|
||||||
= note: conflicting implementation in crate `core`:
|
= note: conflicting implementation in crate `core`:
|
||||||
- impl<T, U> std::convert::TryFrom<U> for T
|
- impl<T, U> std::convert::TryFrom<U> for T
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
error[E0119]: conflicting implementations of trait `a::LolFrom<&[_]>` for type `LocalType<_>`:
|
error[E0119]: conflicting implementations of trait `a::LolFrom<&[_]>` for type `LocalType<_>`:
|
||||||
--> $DIR/issue-23563.rs:23:1
|
--> $DIR/issue-23563.rs:23:1
|
||||||
|
|
|
|
||||||
23 | / impl<'a, T> LolFrom<&'a [T]> for LocalType<T> { //~ ERROR conflicting implementations of trait
|
23 | impl<'a, T> LolFrom<&'a [T]> for LocalType<T> { //~ ERROR conflicting implementations of trait
|
||||||
24 | | fn from(_: &'a [T]) -> LocalType<T> { LocalType(None) }
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
25 | | }
|
|
||||||
| |_^
|
|
||||||
|
|
|
|
||||||
= note: conflicting implementation in crate `issue_23563_a`:
|
= note: conflicting implementation in crate `issue_23563_a`:
|
||||||
- impl<T, U> a::LolFrom<T> for U
|
- impl<T, U> a::LolFrom<T> for U
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
error[E0119]: conflicting implementations of trait `std::convert::Into<_>` for type `GenX<_>`:
|
error[E0119]: conflicting implementations of trait `std::convert::Into<_>` for type `GenX<_>`:
|
||||||
--> $DIR/issue-27403.rs:15:1
|
--> $DIR/issue-27403.rs:15:1
|
||||||
|
|
|
|
||||||
15 | / impl<S> Into<S> for GenX<S> { //~ ERROR conflicting implementations
|
15 | impl<S> Into<S> for GenX<S> { //~ ERROR conflicting implementations
|
||||||
16 | | fn into(self) -> S {
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
17 | | self.inner
|
|
||||||
18 | | }
|
|
||||||
19 | | }
|
|
||||||
| |_^
|
|
||||||
|
|
|
|
||||||
= note: conflicting implementation in crate `core`:
|
= note: conflicting implementation in crate `core`:
|
||||||
- impl<T, U> std::convert::Into<U> for T
|
- impl<T, U> std::convert::Into<U> for T
|
||||||
|
@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `std::ops::Deref` for type `&
|
|||||||
--> $DIR/issue-28981.rs:15:1
|
--> $DIR/issue-28981.rs:15:1
|
||||||
|
|
|
|
||||||
15 | impl<Foo> Deref for Foo { } //~ ERROR must be used
|
15 | impl<Foo> Deref for Foo { } //~ ERROR must be used
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: conflicting implementation in crate `core`:
|
= note: conflicting implementation in crate `core`:
|
||||||
- impl<'a, T> std::ops::Deref for &'a T
|
- impl<'a, T> std::ops::Deref for &'a T
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
error[E0119]: conflicting implementations of trait `std::convert::From<MyError<_>>` for type `MyError<_>`:
|
error[E0119]: conflicting implementations of trait `std::convert::From<MyError<_>>` for type `MyError<_>`:
|
||||||
--> $DIR/so-37347311.rs:21:1
|
--> $DIR/so-37347311.rs:21:1
|
||||||
|
|
|
|
||||||
21 | / impl<S: Storage> From<S::Error> for MyError<S> { //~ ERROR conflicting implementations
|
21 | impl<S: Storage> From<S::Error> for MyError<S> { //~ ERROR conflicting implementations
|
||||||
22 | | fn from(error: S::Error) -> MyError<S> {
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
23 | | MyError::StorageProblem(error)
|
|
||||||
24 | | }
|
|
||||||
25 | | }
|
|
||||||
| |_^
|
|
||||||
|
|
|
|
||||||
= note: conflicting implementation in crate `core`:
|
= note: conflicting implementation in crate `core`:
|
||||||
- impl<T> std::convert::From<T> for T;
|
- impl<T> std::convert::From<T> for T;
|
||||||
|
@ -2,9 +2,9 @@ error[E0119]: conflicting implementations of trait `MyMarker`:
|
|||||||
--> $DIR/feature-gate-overlapping_marker_traits.rs:16:1
|
--> $DIR/feature-gate-overlapping_marker_traits.rs:16:1
|
||||||
|
|
|
|
||||||
15 | impl<T: Display> MyMarker for T {}
|
15 | impl<T: Display> MyMarker for T {}
|
||||||
| ---------------------------------- first implementation here
|
| ------------------------------- first implementation here
|
||||||
16 | impl<T: Debug> MyMarker for T {}
|
16 | impl<T: Debug> MyMarker for T {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -1,16 +1,11 @@
|
|||||||
error[E0119]: conflicting implementations of trait `std::ops::Drop` for type `MyStruct`:
|
error[E0119]: conflicting implementations of trait `std::ops::Drop` for type `MyStruct`:
|
||||||
--> $DIR/issue-28568.rs:17:1
|
--> $DIR/issue-28568.rs:17:1
|
||||||
|
|
|
|
||||||
13 | / impl Drop for MyStruct {
|
13 | impl Drop for MyStruct {
|
||||||
14 | | fn drop(&mut self) { }
|
| ---------------------- first implementation here
|
||||||
15 | | }
|
...
|
||||||
| |_- first implementation here
|
17 | impl Drop for MyStruct {
|
||||||
16 |
|
| ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyStruct`
|
||||||
17 | / impl Drop for MyStruct {
|
|
||||||
18 | | //~^ ERROR conflicting implementations of trait
|
|
||||||
19 | | fn drop(&mut self) { }
|
|
||||||
20 | | }
|
|
||||||
| |_^ conflicting implementation for `MyStruct`
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -1,239 +1,156 @@
|
|||||||
error: function cannot return without recurring
|
error: function cannot return without recurring
|
||||||
--> $DIR/lint-unconditional-recursion.rs:14:1
|
--> $DIR/lint-unconditional-recursion.rs:14:1
|
||||||
|
|
|
|
||||||
14 | / fn foo() { //~ ERROR function cannot return without recurring
|
14 | fn foo() { //~ ERROR function cannot return without recurring
|
||||||
15 | | foo();
|
| ^^^^^^^^ cannot return without recurring
|
||||||
16 | | }
|
15 | foo();
|
||||||
| |_^
|
| ----- recursive call site
|
||||||
|
|
|
|
||||||
note: lint level defined here
|
note: lint level defined here
|
||||||
--> $DIR/lint-unconditional-recursion.rs:11:9
|
--> $DIR/lint-unconditional-recursion.rs:11:9
|
||||||
|
|
|
|
||||||
11 | #![deny(unconditional_recursion)]
|
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
|
= help: a `loop` may express intention better if this is on purpose
|
||||||
|
|
||||||
error: function cannot return without recurring
|
error: function cannot return without recurring
|
||||||
--> $DIR/lint-unconditional-recursion.rs:24:1
|
--> $DIR/lint-unconditional-recursion.rs:24:1
|
||||||
|
|
|
|
||||||
24 | / fn baz() { //~ ERROR function cannot return without recurring
|
24 | fn baz() { //~ ERROR function cannot return without recurring
|
||||||
25 | | if true {
|
| ^^^^^^^^ cannot return without recurring
|
||||||
26 | | baz()
|
25 | if true {
|
||||||
27 | | } else {
|
|
||||||
28 | | baz()
|
|
||||||
29 | | }
|
|
||||||
30 | | }
|
|
||||||
| |_^
|
|
||||||
|
|
|
||||||
note: recursive call site
|
|
||||||
--> $DIR/lint-unconditional-recursion.rs:26:9
|
|
||||||
|
|
|
||||||
26 | baz()
|
26 | baz()
|
||||||
| ^^^^^
|
| ----- recursive call site
|
||||||
note: recursive call site
|
27 | } else {
|
||||||
--> $DIR/lint-unconditional-recursion.rs:28:9
|
|
||||||
|
|
|
||||||
28 | baz()
|
28 | baz()
|
||||||
| ^^^^^
|
| ----- recursive call site
|
||||||
|
|
|
||||||
= help: a `loop` may express intention better if this is on purpose
|
= help: a `loop` may express intention better if this is on purpose
|
||||||
|
|
||||||
error: function cannot return without recurring
|
error: function cannot return without recurring
|
||||||
--> $DIR/lint-unconditional-recursion.rs:36:1
|
--> $DIR/lint-unconditional-recursion.rs:36:1
|
||||||
|
|
|
|
||||||
36 | / fn quz() -> bool { //~ ERROR function cannot return without recurring
|
36 | fn quz() -> bool { //~ ERROR function cannot return without recurring
|
||||||
37 | | if true {
|
| ^^^^^^^^^^^^^^^^ cannot return without recurring
|
||||||
38 | | while quz() {}
|
37 | if true {
|
||||||
39 | | true
|
|
||||||
... |
|
|
||||||
42 | | }
|
|
||||||
43 | | }
|
|
||||||
| |_^
|
|
||||||
|
|
|
||||||
note: recursive call site
|
|
||||||
--> $DIR/lint-unconditional-recursion.rs:38:15
|
|
||||||
|
|
|
||||||
38 | while quz() {}
|
38 | while quz() {}
|
||||||
| ^^^^^
|
| ----- recursive call site
|
||||||
note: recursive call site
|
...
|
||||||
--> $DIR/lint-unconditional-recursion.rs:41:16
|
|
||||||
|
|
|
||||||
41 | loop { quz(); }
|
41 | loop { quz(); }
|
||||||
| ^^^^^
|
| ----- recursive call site
|
||||||
|
|
|
||||||
= help: a `loop` may express intention better if this is on purpose
|
= help: a `loop` may express intention better if this is on purpose
|
||||||
|
|
||||||
error: function cannot return without recurring
|
error: function cannot return without recurring
|
||||||
--> $DIR/lint-unconditional-recursion.rs:47:5
|
--> $DIR/lint-unconditional-recursion.rs:47:5
|
||||||
|
|
|
|
||||||
47 | / fn bar(&self) { //~ ERROR function cannot return without recurring
|
47 | fn bar(&self) { //~ ERROR function cannot return without recurring
|
||||||
48 | | self.bar()
|
| ^^^^^^^^^^^^^ cannot return without recurring
|
||||||
49 | | }
|
|
||||||
| |_____^
|
|
||||||
|
|
|
||||||
note: recursive call site
|
|
||||||
--> $DIR/lint-unconditional-recursion.rs:48:9
|
|
||||||
|
|
|
||||||
48 | self.bar()
|
48 | self.bar()
|
||||||
| ^^^^^^^^^^
|
| ---------- recursive call site
|
||||||
|
|
|
||||||
= help: a `loop` may express intention better if this is on purpose
|
= help: a `loop` may express intention better if this is on purpose
|
||||||
|
|
||||||
error: function cannot return without recurring
|
error: function cannot return without recurring
|
||||||
--> $DIR/lint-unconditional-recursion.rs:53:5
|
--> $DIR/lint-unconditional-recursion.rs:53:5
|
||||||
|
|
|
|
||||||
53 | / fn bar(&self) { //~ ERROR function cannot return without recurring
|
53 | fn bar(&self) { //~ ERROR function cannot return without recurring
|
||||||
54 | | loop {
|
| ^^^^^^^^^^^^^ cannot return without recurring
|
||||||
55 | | self.bar()
|
54 | loop {
|
||||||
56 | | }
|
|
||||||
57 | | }
|
|
||||||
| |_____^
|
|
||||||
|
|
|
||||||
note: recursive call site
|
|
||||||
--> $DIR/lint-unconditional-recursion.rs:55:13
|
|
||||||
|
|
|
||||||
55 | self.bar()
|
55 | self.bar()
|
||||||
| ^^^^^^^^^^
|
| ---------- recursive call site
|
||||||
|
|
|
||||||
= help: a `loop` may express intention better if this is on purpose
|
= help: a `loop` may express intention better if this is on purpose
|
||||||
|
|
||||||
error: function cannot return without recurring
|
error: function cannot return without recurring
|
||||||
--> $DIR/lint-unconditional-recursion.rs:62:5
|
--> $DIR/lint-unconditional-recursion.rs:62:5
|
||||||
|
|
|
|
||||||
62 | / fn bar(&self) { //~ ERROR function cannot return without recurring
|
62 | fn bar(&self) { //~ ERROR function cannot return without recurring
|
||||||
63 | | 0.bar()
|
| ^^^^^^^^^^^^^ cannot return without recurring
|
||||||
64 | | }
|
|
||||||
| |_____^
|
|
||||||
|
|
|
||||||
note: recursive call site
|
|
||||||
--> $DIR/lint-unconditional-recursion.rs:63:9
|
|
||||||
|
|
|
||||||
63 | 0.bar()
|
63 | 0.bar()
|
||||||
| ^^^^^^^
|
| ------- recursive call site
|
||||||
|
|
|
||||||
= help: a `loop` may express intention better if this is on purpose
|
= help: a `loop` may express intention better if this is on purpose
|
||||||
|
|
||||||
error: function cannot return without recurring
|
error: function cannot return without recurring
|
||||||
--> $DIR/lint-unconditional-recursion.rs:75:5
|
--> $DIR/lint-unconditional-recursion.rs:75:5
|
||||||
|
|
|
|
||||||
75 | / fn bar(&self) { //~ ERROR function cannot return without recurring
|
75 | fn bar(&self) { //~ ERROR function cannot return without recurring
|
||||||
76 | | Foo2::bar(self)
|
| ^^^^^^^^^^^^^ cannot return without recurring
|
||||||
77 | | }
|
|
||||||
| |_____^
|
|
||||||
|
|
|
||||||
note: recursive call site
|
|
||||||
--> $DIR/lint-unconditional-recursion.rs:76:9
|
|
||||||
|
|
|
||||||
76 | Foo2::bar(self)
|
76 | Foo2::bar(self)
|
||||||
| ^^^^^^^^^^^^^^^
|
| --------------- recursive call site
|
||||||
|
|
|
||||||
= help: a `loop` may express intention better if this is on purpose
|
= help: a `loop` may express intention better if this is on purpose
|
||||||
|
|
||||||
error: function cannot return without recurring
|
error: function cannot return without recurring
|
||||||
--> $DIR/lint-unconditional-recursion.rs:81:5
|
--> $DIR/lint-unconditional-recursion.rs:81:5
|
||||||
|
|
|
|
||||||
81 | / fn bar(&self) { //~ ERROR function cannot return without recurring
|
81 | fn bar(&self) { //~ ERROR function cannot return without recurring
|
||||||
82 | | loop {
|
| ^^^^^^^^^^^^^ cannot return without recurring
|
||||||
83 | | Foo2::bar(self)
|
82 | loop {
|
||||||
84 | | }
|
|
||||||
85 | | }
|
|
||||||
| |_____^
|
|
||||||
|
|
|
||||||
note: recursive call site
|
|
||||||
--> $DIR/lint-unconditional-recursion.rs:83:13
|
|
||||||
|
|
|
||||||
83 | Foo2::bar(self)
|
83 | Foo2::bar(self)
|
||||||
| ^^^^^^^^^^^^^^^
|
| --------------- recursive call site
|
||||||
|
|
|
||||||
= help: a `loop` may express intention better if this is on purpose
|
= help: a `loop` may express intention better if this is on purpose
|
||||||
|
|
||||||
error: function cannot return without recurring
|
error: function cannot return without recurring
|
||||||
--> $DIR/lint-unconditional-recursion.rs:91:5
|
--> $DIR/lint-unconditional-recursion.rs:91:5
|
||||||
|
|
|
|
||||||
91 | / fn qux(&self) { //~ ERROR function cannot return without recurring
|
91 | fn qux(&self) { //~ ERROR function cannot return without recurring
|
||||||
92 | | self.qux();
|
| ^^^^^^^^^^^^^ cannot return without recurring
|
||||||
93 | | }
|
|
||||||
| |_____^
|
|
||||||
|
|
|
||||||
note: recursive call site
|
|
||||||
--> $DIR/lint-unconditional-recursion.rs:92:9
|
|
||||||
|
|
|
||||||
92 | self.qux();
|
92 | self.qux();
|
||||||
| ^^^^^^^^^^
|
| ---------- recursive call site
|
||||||
|
|
|
||||||
= help: a `loop` may express intention better if this is on purpose
|
= help: a `loop` may express intention better if this is on purpose
|
||||||
|
|
||||||
error: function cannot return without recurring
|
error: function cannot return without recurring
|
||||||
--> $DIR/lint-unconditional-recursion.rs:96:5
|
--> $DIR/lint-unconditional-recursion.rs:96:5
|
||||||
|
|
|
|
||||||
96 | / fn as_ref(&self) -> &Self { //~ ERROR function cannot return without recurring
|
96 | fn as_ref(&self) -> &Self { //~ ERROR function cannot return without recurring
|
||||||
97 | | Baz::as_ref(self)
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring
|
||||||
98 | | }
|
|
||||||
| |_____^
|
|
||||||
|
|
|
||||||
note: recursive call site
|
|
||||||
--> $DIR/lint-unconditional-recursion.rs:97:9
|
|
||||||
|
|
|
||||||
97 | Baz::as_ref(self)
|
97 | Baz::as_ref(self)
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ----------------- recursive call site
|
||||||
|
|
|
||||||
= help: a `loop` may express intention better if this is on purpose
|
= help: a `loop` may express intention better if this is on purpose
|
||||||
|
|
||||||
error: function cannot return without recurring
|
error: function cannot return without recurring
|
||||||
--> $DIR/lint-unconditional-recursion.rs:103:5
|
--> $DIR/lint-unconditional-recursion.rs:103:5
|
||||||
|
|
|
|
||||||
103 | / fn default() -> Baz { //~ ERROR function cannot return without recurring
|
103 | fn default() -> Baz { //~ ERROR function cannot return without recurring
|
||||||
104 | | let x = Default::default();
|
| ^^^^^^^^^^^^^^^^^^^ cannot return without recurring
|
||||||
105 | | x
|
|
||||||
106 | | }
|
|
||||||
| |_____^
|
|
||||||
|
|
|
||||||
note: recursive call site
|
|
||||||
--> $DIR/lint-unconditional-recursion.rs:104:17
|
|
||||||
|
|
|
||||||
104 | let x = Default::default();
|
104 | let x = Default::default();
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ------------------ recursive call site
|
||||||
|
|
|
||||||
= help: a `loop` may express intention better if this is on purpose
|
= help: a `loop` may express intention better if this is on purpose
|
||||||
|
|
||||||
error: function cannot return without recurring
|
error: function cannot return without recurring
|
||||||
--> $DIR/lint-unconditional-recursion.rs:112:5
|
--> $DIR/lint-unconditional-recursion.rs:112:5
|
||||||
|
|
|
|
||||||
112 | / fn deref(&self) -> &() { //~ ERROR function cannot return without recurring
|
112 | fn deref(&self) -> &() { //~ ERROR function cannot return without recurring
|
||||||
113 | | &**self
|
| ^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring
|
||||||
114 | | }
|
|
||||||
| |_____^
|
|
||||||
|
|
|
||||||
note: recursive call site
|
|
||||||
--> $DIR/lint-unconditional-recursion.rs:113:10
|
|
||||||
|
|
|
||||||
113 | &**self
|
113 | &**self
|
||||||
| ^^^^^^
|
| ------ recursive call site
|
||||||
|
|
|
||||||
= help: a `loop` may express intention better if this is on purpose
|
= help: a `loop` may express intention better if this is on purpose
|
||||||
|
|
||||||
error: function cannot return without recurring
|
error: function cannot return without recurring
|
||||||
--> $DIR/lint-unconditional-recursion.rs:119:5
|
--> $DIR/lint-unconditional-recursion.rs:119:5
|
||||||
|
|
|
|
||||||
119 | / fn index(&self, x: usize) -> &Baz { //~ ERROR function cannot return without recurring
|
119 | fn index(&self, x: usize) -> &Baz { //~ ERROR function cannot return without recurring
|
||||||
120 | | &self[x]
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring
|
||||||
121 | | }
|
|
||||||
| |_____^
|
|
||||||
|
|
|
||||||
note: recursive call site
|
|
||||||
--> $DIR/lint-unconditional-recursion.rs:120:10
|
|
||||||
|
|
|
||||||
120 | &self[x]
|
120 | &self[x]
|
||||||
| ^^^^^^^
|
| ------- recursive call site
|
||||||
|
|
|
||||||
= help: a `loop` may express intention better if this is on purpose
|
= help: a `loop` may express intention better if this is on purpose
|
||||||
|
|
||||||
error: function cannot return without recurring
|
error: function cannot return without recurring
|
||||||
--> $DIR/lint-unconditional-recursion.rs:128:5
|
--> $DIR/lint-unconditional-recursion.rs:128:5
|
||||||
|
|
|
|
||||||
128 | / fn deref(&self) -> &Baz { //~ ERROR function cannot return without recurring
|
128 | fn deref(&self) -> &Baz { //~ ERROR function cannot return without recurring
|
||||||
129 | | self.as_ref()
|
| ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring
|
||||||
130 | | }
|
|
||||||
| |_____^
|
|
||||||
|
|
|
||||||
note: recursive call site
|
|
||||||
--> $DIR/lint-unconditional-recursion.rs:129:9
|
|
||||||
|
|
|
||||||
129 | self.as_ref()
|
129 | self.as_ref()
|
||||||
| ^^^^
|
| ---- recursive call site
|
||||||
|
|
|
||||||
= help: a `loop` may express intention better if this is on purpose
|
= help: a `loop` may express intention better if this is on purpose
|
||||||
|
|
||||||
error: aborting due to 14 previous errors
|
error: aborting due to 14 previous errors
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
error[E0119]: conflicting implementations of trait `Foo` for type `u8`:
|
error[E0119]: conflicting implementations of trait `Foo` for type `u8`:
|
||||||
--> $DIR/specialization-feature-gate-overlap.rs:23:1
|
--> $DIR/specialization-feature-gate-overlap.rs:23:1
|
||||||
|
|
|
|
||||||
19 | / impl<T> Foo for T {
|
19 | impl<T> Foo for T {
|
||||||
20 | | fn foo(&self) {}
|
| ----------------- first implementation here
|
||||||
21 | | }
|
...
|
||||||
| |_- first implementation here
|
23 | impl Foo for u8 { //~ ERROR E0119
|
||||||
22 |
|
| ^^^^^^^^^^^^^^^ conflicting implementation for `u8`
|
||||||
23 | / impl Foo for u8 { //~ ERROR E0119
|
|
||||||
24 | | fn foo(&self) {}
|
|
||||||
25 | | }
|
|
||||||
| |_^ conflicting implementation for `u8`
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user