Rollup merge of #46804 - estebank:conflicting-impl-def-span, r=arielb1
Use def span for conflicting impls and recursive fn
This commit is contained in:
commit
3a2becbd84
@ -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(),
|
||||
|
@ -352,7 +352,7 @@ impl MissingDoc {
|
||||
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 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnconditionalRecursion {
|
||||
// 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();
|
||||
}
|
||||
|
||||
|
@ -2,17 +2,17 @@ error[E0119]: conflicting implementations of trait `Sweet`:
|
||||
--> $DIR/coherence-overlap-downstream.rs:18:1
|
||||
|
|
||||
17 | impl<T:Sugar> Sweet for T { }
|
||||
| ----------------------------- first implementation here
|
||||
| ------------------------- first implementation here
|
||||
18 | impl<T:Fruit> 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<X, T> Foo<X> for T where T: Bar<X> {}
|
||||
| ------------------------------------------ first implementation here
|
||||
| --------------------------------------- first implementation here
|
||||
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`
|
||||
|
||||
|
@ -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<T:Sugar> Sweet for T { }
|
||||
| ----------------------------- first implementation here
|
||||
| ------------------------- first implementation here
|
||||
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<_>`
|
||||
|
||||
|
@ -2,9 +2,9 @@ error[E0119]: conflicting implementations of trait `Foo` for type `i16`:
|
||||
--> $DIR/coherence-overlap-upstream.rs:22:1
|
||||
|
|
||||
21 | impl<T> 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
|
||||
|
||||
|
@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `complex_impl_support::Extern
|
||||
--> $DIR/complex-impl.rs:19:1
|
||||
|
|
||||
19 | impl<R> 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<U>, V, W>)
|
||||
|
@ -1,12 +1,8 @@
|
||||
error[E0119]: conflicting implementations of trait `std::convert::AsRef<Q>` for type `std::boxed::Box<Q>`:
|
||||
--> $DIR/conflict-with-std.rs:17:1
|
||||
|
|
||||
17 | / impl AsRef<Q> for Box<Q> { //~ ERROR conflicting implementations
|
||||
18 | | fn as_ref(&self) -> &Q {
|
||||
19 | | &**self
|
||||
20 | | }
|
||||
21 | | }
|
||||
| |_^
|
||||
17 | impl AsRef<Q> for Box<Q> { //~ ERROR conflicting implementations
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: conflicting implementation in crate `alloc`:
|
||||
- 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`:
|
||||
--> $DIR/conflict-with-std.rs:24:1
|
||||
|
|
||||
24 | / impl From<S> for S { //~ ERROR conflicting implementations
|
||||
25 | | fn from(s: S) -> S {
|
||||
26 | | s
|
||||
27 | | }
|
||||
28 | | }
|
||||
| |_^
|
||||
24 | impl From<S> for S { //~ ERROR conflicting implementations
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: conflicting implementation in crate `core`:
|
||||
- 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`:
|
||||
--> $DIR/conflict-with-std.rs:31:1
|
||||
|
|
||||
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 | | }
|
||||
| |_^
|
||||
31 | impl TryFrom<X> for X { //~ ERROR conflicting implementations
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: conflicting implementation in crate `core`:
|
||||
- impl<T, U> std::convert::TryFrom<U> for T
|
||||
|
@ -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<T> { //~ ERROR conflicting implementations of trait
|
||||
24 | | fn from(_: &'a [T]) -> LocalType<T> { LocalType(None) }
|
||||
25 | | }
|
||||
| |_^
|
||||
23 | impl<'a, T> LolFrom<&'a [T]> for LocalType<T> { //~ ERROR conflicting implementations of trait
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: conflicting implementation in crate `issue_23563_a`:
|
||||
- impl<T, U> a::LolFrom<T> for U
|
||||
|
@ -1,12 +1,8 @@
|
||||
error[E0119]: conflicting implementations of trait `std::convert::Into<_>` for type `GenX<_>`:
|
||||
--> $DIR/issue-27403.rs:15:1
|
||||
|
|
||||
15 | / impl<S> Into<S> for GenX<S> { //~ ERROR conflicting implementations
|
||||
16 | | fn into(self) -> S {
|
||||
17 | | self.inner
|
||||
18 | | }
|
||||
19 | | }
|
||||
| |_^
|
||||
15 | impl<S> Into<S> for GenX<S> { //~ ERROR conflicting implementations
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: conflicting implementation in crate `core`:
|
||||
- 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
|
||||
|
|
||||
15 | impl<Foo> Deref for Foo { } //~ ERROR must be used
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: conflicting implementation in crate `core`:
|
||||
- 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<_>`:
|
||||
--> $DIR/so-37347311.rs:21:1
|
||||
|
|
||||
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 | | }
|
||||
| |_^
|
||||
21 | impl<S: Storage> From<S::Error> for MyError<S> { //~ ERROR conflicting implementations
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: conflicting implementation in crate `core`:
|
||||
- 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
|
||||
|
|
||||
15 | impl<T: Display> MyMarker for T {}
|
||||
| ---------------------------------- first implementation here
|
||||
| ------------------------------- first implementation here
|
||||
16 | impl<T: Debug> MyMarker for T {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -1,15 +1,11 @@
|
||||
error[E0119]: conflicting implementations of trait `Foo` for type `u8`:
|
||||
--> $DIR/specialization-feature-gate-overlap.rs:23:1
|
||||
|
|
||||
19 | / impl<T> 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<T> Foo for T {
|
||||
| ----------------- first implementation here
|
||||
...
|
||||
23 | impl Foo for u8 { //~ ERROR E0119
|
||||
| ^^^^^^^^^^^^^^^ conflicting implementation for `u8`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user