Skip to content

Commit fed5789

Browse files
committed
Remove value_from_cycle_error specialization for type_of
1 parent cdbe2b3 commit fed5789

14 files changed

+20
-151
lines changed

compiler/rustc_query_impl/src/from_cycle_error.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ use rustc_span::{ErrorGuaranteed, Span};
2121
use crate::job::report_cycle;
2222

2323
pub(crate) fn specialize_query_vtables<'tcx>(vtables: &mut QueryVTables<'tcx>) {
24-
vtables.type_of.value_from_cycle_error = |tcx, _, _, err| {
25-
let guar = err.emit();
26-
erase_val(ty::EarlyBinder::bind(Ty::new_error(tcx, guar)))
27-
};
28-
2924
vtables.fn_sig.value_from_cycle_error = |tcx, key, _, err| {
3025
let guar = err.delay_as_bug();
3126
erase_val(fn_sig(tcx, key, guar))

tests/incremental/const-generic-type-cycle.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,5 @@ trait Bar<const N: usize> {}
1313
#[cfg(cfail)]
1414
trait Bar<const N: dyn BB> {}
1515
//[cfail]~^ ERROR cycle detected when computing type of `Bar::N`
16-
//[cfail]~| ERROR cycle detected when computing type of `Bar::N`
17-
//[cfail]~| ERROR `(dyn Bar<{ 2 + 1 }> + 'static)` is forbidden as the type of a const generic parameter
1816

1917
trait BB = Bar<{ 2 + 1 }>;

tests/ui/consts/issue-103790.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ struct S<const S: (), const S: S = { S }>;
55
//~^ ERROR the name `S` is already used for a generic parameter in this item's generic parameters
66
//~| ERROR missing generics for struct `S`
77
//~| ERROR cycle detected when computing type of `S::S`
8-
//~| ERROR `()` is forbidden as the type of a const generic parameter
98

109
fn main() {}

tests/ui/consts/issue-103790.stderr

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,7 @@ LL | struct S<const S: (), const S: S = { S }>;
3636
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3737
= 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
3838

39-
error: `()` is forbidden as the type of a const generic parameter
40-
--> $DIR/issue-103790.rs:4:19
41-
|
42-
LL | struct S<const S: (), const S: S = { S }>;
43-
| ^^
44-
|
45-
= note: the only supported types are integers, `bool`, and `char`
46-
help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
47-
|
48-
LL + #![feature(adt_const_params)]
49-
|
50-
51-
error: aborting due to 4 previous errors
39+
error: aborting due to 3 previous errors
5240

5341
Some errors have detailed explanations: E0107, E0391, E0403.
5442
For more information about an error, try `rustc --explain E0107`.

tests/ui/delegation/unsupported.current.stderr

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,13 @@ note: ...which requires comparing an impl and trait method signature, inferring
2929
LL | reuse ToReuse::opaque_ret;
3030
| ^^^^^^^^^^
3131
= note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:32:5: 32:25>::opaque_ret::{anon_assoc#0}`, completing the cycle
32-
= note: cycle used when checking effective visibilities
33-
= 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
34-
35-
error[E0283]: type annotations needed
36-
--> $DIR/unsupported.rs:54:18
37-
|
38-
LL | reuse Trait::foo;
39-
| ^^^ cannot infer type
32+
note: cycle used when checking assoc item `opaque::<impl at $DIR/unsupported.rs:32:5: 32:25>::opaque_ret` is compatible with trait definition
33+
--> $DIR/unsupported.rs:33:24
4034
|
41-
= note: cannot satisfy `_: effects::Trait`
35+
LL | reuse ToReuse::opaque_ret;
36+
| ^^^^^^^^^^
37+
= 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
4238

43-
error: aborting due to 3 previous errors
39+
error: aborting due to 2 previous errors
4440

45-
Some errors have detailed explanations: E0283, E0391.
46-
For more information about an error, try `rustc --explain E0283`.
41+
For more information about this error, try `rustc --explain E0391`.

tests/ui/delegation/unsupported.next.stderr

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,9 @@ note: ...which requires comparing an impl and trait method signature, inferring
2525
LL | reuse ToReuse::opaque_ret;
2626
| ^^^^^^^^^^
2727
= note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:32:5: 32:25>::opaque_ret::{anon_assoc#0}`, completing the cycle
28-
= note: cycle used when checking effective visibilities
28+
= note: cycle used when computing implied outlives bounds for `<u16 as opaque::ToReuse>::opaque_ret::{anon_assoc#0}` (hack disabled = false)
2929
= 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
3030

31-
error[E0283]: type annotations needed
32-
--> $DIR/unsupported.rs:54:18
33-
|
34-
LL | reuse Trait::foo;
35-
| ^^^ cannot infer type
36-
|
37-
= note: cannot satisfy `_: effects::Trait`
38-
39-
error: aborting due to 3 previous errors
31+
error: aborting due to 2 previous errors
4032

41-
Some errors have detailed explanations: E0283, E0391.
42-
For more information about an error, try `rustc --explain E0283`.
33+
For more information about this error, try `rustc --explain E0391`.

tests/ui/delegation/unsupported.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ mod effects {
5252
}
5353

5454
reuse Trait::foo;
55-
//~^ ERROR type annotations needed
5655
}
5756

5857
fn main() {}

tests/ui/impl-trait/in-trait/method-compatability-via-leakage-cycle.next.stderr

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -57,66 +57,6 @@ LL | fn foo(b: bool) -> impl Sized {
5757
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5858
= 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
5959

60-
error[E0391]: cycle detected when computing type of `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo::{anon_assoc#0}`
61-
--> $DIR/method-compatability-via-leakage-cycle.rs:21:24
62-
|
63-
LL | fn foo(b: bool) -> impl Sized {
64-
| ^^^^^^^^^^
65-
|
66-
note: ...which requires comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process...
67-
--> $DIR/method-compatability-via-leakage-cycle.rs:21:5
68-
|
69-
LL | fn foo(b: bool) -> impl Sized {
70-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
71-
note: ...which requires computing type of `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo::{opaque#0}`...
72-
--> $DIR/method-compatability-via-leakage-cycle.rs:21:24
73-
|
74-
LL | fn foo(b: bool) -> impl Sized {
75-
| ^^^^^^^^^^
76-
note: ...which requires computing type of opaque `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo::{opaque#0}`...
77-
--> $DIR/method-compatability-via-leakage-cycle.rs:21:24
78-
|
79-
LL | fn foo(b: bool) -> impl Sized {
80-
| ^^^^^^^^^^
81-
note: ...which requires borrow-checking `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo`...
82-
--> $DIR/method-compatability-via-leakage-cycle.rs:21:5
83-
|
84-
LL | fn foo(b: bool) -> impl Sized {
85-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
86-
note: ...which requires promoting constants in MIR for `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo`...
87-
--> $DIR/method-compatability-via-leakage-cycle.rs:21:5
88-
|
89-
LL | fn foo(b: bool) -> impl Sized {
90-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
91-
note: ...which requires checking if `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo` contains FFI-unwind calls...
92-
--> $DIR/method-compatability-via-leakage-cycle.rs:21:5
93-
|
94-
LL | fn foo(b: bool) -> impl Sized {
95-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
96-
note: ...which requires building MIR for `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo`...
97-
--> $DIR/method-compatability-via-leakage-cycle.rs:21:5
98-
|
99-
LL | fn foo(b: bool) -> impl Sized {
100-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
101-
note: ...which requires match-checking `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo`...
102-
--> $DIR/method-compatability-via-leakage-cycle.rs:21:5
103-
|
104-
LL | fn foo(b: bool) -> impl Sized {
105-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
106-
note: ...which requires type-checking `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo`...
107-
--> $DIR/method-compatability-via-leakage-cycle.rs:21:5
108-
|
109-
LL | fn foo(b: bool) -> impl Sized {
110-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
111-
= note: ...which again requires computing type of `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo::{anon_assoc#0}`, completing the cycle
112-
note: cycle used when checking assoc item `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo` is compatible with trait definition
113-
--> $DIR/method-compatability-via-leakage-cycle.rs:21:5
114-
|
115-
LL | fn foo(b: bool) -> impl Sized {
116-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
117-
= 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
118-
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
119-
120-
error: aborting due to 2 previous errors
60+
error: aborting due to 1 previous error
12161

12262
For more information about this error, try `rustc --explain E0391`.

tests/ui/issues/issue-34373.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ trait Trait<T> {
66

77
pub struct Foo<T = Box<dyn Trait<DefaultFoo>>>;
88
//~^ ERROR cycle detected when computing type of `Foo::T`
9-
//~| ERROR type parameter `T` is never used
109
type DefaultFoo = Foo;
1110

1211
fn main() {

tests/ui/issues/issue-34373.stderr

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | pub struct Foo<T = Box<dyn Trait<DefaultFoo>>>;
55
| ^^^^^^^^^^
66
|
77
note: ...which requires expanding type alias `DefaultFoo`...
8-
--> $DIR/issue-34373.rs:10:19
8+
--> $DIR/issue-34373.rs:9:19
99
|
1010
LL | type DefaultFoo = Foo;
1111
| ^^^
@@ -17,16 +17,6 @@ LL | pub struct Foo<T = Box<dyn Trait<DefaultFoo>>>;
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-
error[E0392]: type parameter `T` is never used
21-
--> $DIR/issue-34373.rs:7:16
22-
|
23-
LL | pub struct Foo<T = Box<dyn Trait<DefaultFoo>>>;
24-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unused type parameter
25-
|
26-
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
27-
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
28-
29-
error: aborting due to 2 previous errors
20+
error: aborting due to 1 previous error
3021

31-
Some errors have detailed explanations: E0391, E0392.
32-
For more information about an error, try `rustc --explain E0391`.
22+
For more information about this error, try `rustc --explain E0391`.

0 commit comments

Comments
 (0)