Skip to content

Commit db07404

Browse files
committed
Don't trigger never type lint in a delegation test
1 parent 6503543 commit db07404

File tree

2 files changed

+17
-52
lines changed

2 files changed

+17
-52
lines changed

tests/ui/delegation/unsupported.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,11 @@ mod opaque {
1010
mod to_reuse {
1111
use super::Trait;
1212

13-
pub fn opaque_ret() -> impl Trait { unimplemented!() }
14-
//~^ warn: this function depends on never type fallback being `()`
15-
//~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
13+
pub fn opaque_ret() -> impl Trait { () }
1614
}
1715

1816
trait ToReuse {
19-
fn opaque_ret() -> impl Trait { unimplemented!() }
20-
//~^ warn: this function depends on never type fallback being `()`
21-
//~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
17+
fn opaque_ret() -> impl Trait { () }
2218
}
2319

2420
// FIXME: Inherited `impl Trait`s create query cycles when used inside trait impls.
+15-46
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,43 @@
1-
error[E0391]: cycle detected when computing type of `opaque::<impl at $DIR/unsupported.rs:25:5: 25:24>::{synthetic#0}`
2-
--> $DIR/unsupported.rs:26:25
1+
error[E0391]: cycle detected when computing type of `opaque::<impl at $DIR/unsupported.rs:21:5: 21:24>::{synthetic#0}`
2+
--> $DIR/unsupported.rs:22:25
33
|
44
LL | reuse to_reuse::opaque_ret;
55
| ^^^^^^^^^^
66
|
77
note: ...which requires comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process...
8-
--> $DIR/unsupported.rs:26:25
8+
--> $DIR/unsupported.rs:22:25
99
|
1010
LL | reuse to_reuse::opaque_ret;
1111
| ^^^^^^^^^^
12-
= note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:25:5: 25:24>::{synthetic#0}`, completing the cycle
13-
note: cycle used when checking that `opaque::<impl at $DIR/unsupported.rs:25:5: 25:24>` is well-formed
14-
--> $DIR/unsupported.rs:25:5
12+
= note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:21:5: 21:24>::{synthetic#0}`, completing the cycle
13+
note: cycle used when checking that `opaque::<impl at $DIR/unsupported.rs:21:5: 21:24>` is well-formed
14+
--> $DIR/unsupported.rs:21:5
1515
|
1616
LL | impl ToReuse for u8 {
1717
| ^^^^^^^^^^^^^^^^^^^
1818
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
1919

20-
warning: this function depends on never type fallback being `()`
21-
--> $DIR/unsupported.rs:13:9
22-
|
23-
LL | pub fn opaque_ret() -> impl Trait { unimplemented!() }
24-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
25-
|
26-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
27-
= note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748>
28-
= help: specify the types explicitly
29-
note: in edition 2024, the requirement `!: opaque::Trait` will fail
30-
--> $DIR/unsupported.rs:13:32
31-
|
32-
LL | pub fn opaque_ret() -> impl Trait { unimplemented!() }
33-
| ^^^^^^^^^^
34-
= note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default
35-
36-
warning: this function depends on never type fallback being `()`
37-
--> $DIR/unsupported.rs:19:9
38-
|
39-
LL | fn opaque_ret() -> impl Trait { unimplemented!() }
40-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
41-
|
42-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
43-
= note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748>
44-
= help: specify the types explicitly
45-
note: in edition 2024, the requirement `!: opaque::Trait` will fail
46-
--> $DIR/unsupported.rs:19:28
47-
|
48-
LL | fn opaque_ret() -> impl Trait { unimplemented!() }
49-
| ^^^^^^^^^^
50-
51-
error[E0391]: cycle detected when computing type of `opaque::<impl at $DIR/unsupported.rs:28:5: 28:25>::{synthetic#0}`
52-
--> $DIR/unsupported.rs:29:24
20+
error[E0391]: cycle detected when computing type of `opaque::<impl at $DIR/unsupported.rs:24:5: 24:25>::{synthetic#0}`
21+
--> $DIR/unsupported.rs:25:24
5322
|
5423
LL | reuse ToReuse::opaque_ret;
5524
| ^^^^^^^^^^
5625
|
5726
note: ...which requires comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process...
58-
--> $DIR/unsupported.rs:29:24
27+
--> $DIR/unsupported.rs:25:24
5928
|
6029
LL | reuse ToReuse::opaque_ret;
6130
| ^^^^^^^^^^
62-
= note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:28:5: 28:25>::{synthetic#0}`, completing the cycle
63-
note: cycle used when checking that `opaque::<impl at $DIR/unsupported.rs:28:5: 28:25>` is well-formed
64-
--> $DIR/unsupported.rs:28:5
31+
= note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:24:5: 24:25>::{synthetic#0}`, completing the cycle
32+
note: cycle used when checking that `opaque::<impl at $DIR/unsupported.rs:24:5: 24:25>` is well-formed
33+
--> $DIR/unsupported.rs:24:5
6534
|
6635
LL | impl ToReuse for u16 {
6736
| ^^^^^^^^^^^^^^^^^^^^
6837
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
6938

7039
error: recursive delegation is not supported yet
71-
--> $DIR/unsupported.rs:42:22
40+
--> $DIR/unsupported.rs:38:22
7241
|
7342
LL | pub reuse to_reuse2::foo;
7443
| --- callee defined here
@@ -77,14 +46,14 @@ LL | reuse to_reuse1::foo;
7746
| ^^^
7847

7948
error[E0283]: type annotations needed
80-
--> $DIR/unsupported.rs:52:18
49+
--> $DIR/unsupported.rs:48:18
8150
|
8251
LL | reuse Trait::foo;
8352
| ^^^ cannot infer type
8453
|
8554
= note: cannot satisfy `_: effects::Trait`
8655

87-
error: aborting due to 4 previous errors; 2 warnings emitted
56+
error: aborting due to 4 previous errors
8857

8958
Some errors have detailed explanations: E0283, E0391.
9059
For more information about an error, try `rustc --explain E0283`.

0 commit comments

Comments
 (0)