Skip to content

Commit 435abb2

Browse files
committed
Use the same collection order as check_mod_type_wf
1 parent a5094fc commit 435abb2

10 files changed

+180
-180
lines changed

compiler/rustc_hir_analysis/src/collect.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ fn collect_mod_item_types(tcx: TyCtxt<'_>, module_def_id: LocalModDefId) {
5858
let items = tcx.hir_module_items(module_def_id);
5959
let hir = tcx.hir();
6060
let _ = items.par_items(|item| Ok(CollectItemTypesVisitor { tcx }.visit_item(hir.item(item))));
61-
let _ = items.par_trait_items(|item| {
62-
Ok(CollectItemTypesVisitor { tcx }.visit_trait_item(hir.trait_item(item)))
63-
});
6461
let _ = items.par_impl_items(|item| {
6562
Ok(CollectItemTypesVisitor { tcx }.visit_impl_item(hir.impl_item(item)))
6663
});
64+
let _ = items.par_trait_items(|item| {
65+
Ok(CollectItemTypesVisitor { tcx }.visit_trait_item(hir.trait_item(item)))
66+
});
6767
let _ = items.par_foreign_items(|item| {
6868
Ok(CollectItemTypesVisitor { tcx }.visit_foreign_item(hir.foreign_item(item)))
6969
});

tests/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr

+12-12
Original file line numberDiff line numberDiff line change
@@ -62,66 +62,66 @@ LL | fn c<C>(_: <C as Vehicle>::Color) where C : Vehicle, C : Box {
6262
| ~~~~~~~~~~~~~~~~
6363

6464
error[E0221]: ambiguous associated type `Color` in bounds of `X`
65-
--> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:35:20
65+
--> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:30:20
6666
|
6767
LL | type Color;
6868
| ---------- ambiguous `Color` from `Vehicle`
6969
...
7070
LL | type Color;
7171
| ---------- ambiguous `Color` from `Box`
7272
...
73-
LL | fn e(&self, _: X::Color) where X : Box;
73+
LL | fn d(&self, _: X::Color) where X : Box { }
7474
| ^^^^^^^^ ambiguous associated type `Color`
7575
|
7676
help: use fully-qualified syntax to disambiguate
7777
|
78-
LL | fn e(&self, _: <X as Box>::Color) where X : Box;
78+
LL | fn d(&self, _: <X as Box>::Color) where X : Box { }
7979
| ~~~~~~~~~~~~
8080
help: use fully-qualified syntax to disambiguate
8181
|
82-
LL | fn e(&self, _: <X as Vehicle>::Color) where X : Box;
82+
LL | fn d(&self, _: <X as Vehicle>::Color) where X : Box { }
8383
| ~~~~~~~~~~~~~~~~
8484

8585
error[E0221]: ambiguous associated type `Color` in bounds of `X`
86-
--> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:38:20
86+
--> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:35:20
8787
|
8888
LL | type Color;
8989
| ---------- ambiguous `Color` from `Vehicle`
9090
...
9191
LL | type Color;
9292
| ---------- ambiguous `Color` from `Box`
9393
...
94-
LL | fn f(&self, _: X::Color) where X : Box { }
94+
LL | fn e(&self, _: X::Color) where X : Box;
9595
| ^^^^^^^^ ambiguous associated type `Color`
9696
|
9797
help: use fully-qualified syntax to disambiguate
9898
|
99-
LL | fn f(&self, _: <X as Box>::Color) where X : Box { }
99+
LL | fn e(&self, _: <X as Box>::Color) where X : Box;
100100
| ~~~~~~~~~~~~
101101
help: use fully-qualified syntax to disambiguate
102102
|
103-
LL | fn f(&self, _: <X as Vehicle>::Color) where X : Box { }
103+
LL | fn e(&self, _: <X as Vehicle>::Color) where X : Box;
104104
| ~~~~~~~~~~~~~~~~
105105

106106
error[E0221]: ambiguous associated type `Color` in bounds of `X`
107-
--> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:30:20
107+
--> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:38:20
108108
|
109109
LL | type Color;
110110
| ---------- ambiguous `Color` from `Vehicle`
111111
...
112112
LL | type Color;
113113
| ---------- ambiguous `Color` from `Box`
114114
...
115-
LL | fn d(&self, _: X::Color) where X : Box { }
115+
LL | fn f(&self, _: X::Color) where X : Box { }
116116
| ^^^^^^^^ ambiguous associated type `Color`
117117
|
118118
help: use fully-qualified syntax to disambiguate
119119
|
120-
LL | fn d(&self, _: <X as Box>::Color) where X : Box { }
120+
LL | fn f(&self, _: <X as Box>::Color) where X : Box { }
121121
| ~~~~~~~~~~~~
122122
help: use fully-qualified syntax to disambiguate
123123
|
124-
LL | fn d(&self, _: <X as Vehicle>::Color) where X : Box { }
124+
LL | fn f(&self, _: <X as Vehicle>::Color) where X : Box { }
125125
| ~~~~~~~~~~~~~~~~
126126

127127
error: aborting due to 6 previous errors

tests/ui/associated-types/associated-types-project-from-hrtb-in-trait-method.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
error[E0212]: cannot use the associated type of a trait with uninferred generic parameters
2-
--> $DIR/associated-types-project-from-hrtb-in-trait-method.rs:13:32
2+
--> $DIR/associated-types-project-from-hrtb-in-trait-method.rs:32:24
33
|
4-
LL | fn some_method(&self, arg: I::A);
5-
| ^^^^
4+
LL | fn mango(&self) -> X::Assoc {
5+
| ^^^^^^^^
66
|
77
help: use a fully qualified path with inferred lifetimes
88
|
9-
LL | fn some_method(&self, arg: <I as Foo<&isize>>::A);
10-
| ~~~~~~~~~~~~~~~~~~~~
9+
LL | fn mango(&self) -> <X as Banana<'_>>::Assoc {
10+
| ~~~~~~~~~~~~~~~~~~~
1111

1212
error[E0212]: cannot use the associated type of a trait with uninferred generic parameters
13-
--> $DIR/associated-types-project-from-hrtb-in-trait-method.rs:32:24
13+
--> $DIR/associated-types-project-from-hrtb-in-trait-method.rs:13:32
1414
|
15-
LL | fn mango(&self) -> X::Assoc {
16-
| ^^^^^^^^
15+
LL | fn some_method(&self, arg: I::A);
16+
| ^^^^
1717
|
1818
help: use a fully qualified path with inferred lifetimes
1919
|
20-
LL | fn mango(&self) -> <X as Banana<'_>>::Assoc {
21-
| ~~~~~~~~~~~~~~~~~~~
20+
LL | fn some_method(&self, arg: <I as Foo<&isize>>::A);
21+
| ~~~~~~~~~~~~~~~~~~~~
2222

2323
error: aborting due to 2 previous errors
2424

tests/ui/const-generics/generic_arg_infer/in-signature.stderr

+20-20
Original file line numberDiff line numberDiff line change
@@ -74,26 +74,6 @@ LL | static TY_STATIC_MIXED: Bar<_, _> = Bar::<i32, 3>(0);
7474
| not allowed in type signatures
7575
| help: replace with the correct type: `Bar<i32, 3>`
7676

77-
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
78-
--> $DIR/in-signature.rs:35:21
79-
|
80-
LL | const ARR: [u8; _];
81-
| ^ not allowed in type signatures
82-
83-
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
84-
--> $DIR/in-signature.rs:39:25
85-
|
86-
LL | const ARR: Bar<i32, _>;
87-
| ^ not allowed in type signatures
88-
89-
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
90-
--> $DIR/in-signature.rs:43:20
91-
|
92-
LL | const ARR: Bar<_, _>;
93-
| ^ ^ not allowed in type signatures
94-
| |
95-
| not allowed in type signatures
96-
9777
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types
9878
--> $DIR/in-signature.rs:51:23
9979
|
@@ -114,6 +94,26 @@ LL | type Assoc = Bar<_, _>;
11494
| |
11595
| not allowed in type signatures
11696

97+
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
98+
--> $DIR/in-signature.rs:35:21
99+
|
100+
LL | const ARR: [u8; _];
101+
| ^ not allowed in type signatures
102+
103+
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
104+
--> $DIR/in-signature.rs:39:25
105+
|
106+
LL | const ARR: Bar<i32, _>;
107+
| ^ not allowed in type signatures
108+
109+
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
110+
--> $DIR/in-signature.rs:43:20
111+
|
112+
LL | const ARR: Bar<_, _>;
113+
| ^ ^ not allowed in type signatures
114+
| |
115+
| not allowed in type signatures
116+
117117
error: aborting due to 15 previous errors
118118

119119
For more information about this error, try `rustc --explain E0121`.

tests/ui/delegation/not-supported.stderr

+18-18
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,6 @@ LL | #![feature(fn_delegation)]
77
= note: see issue #118212 <https://github.com/rust-lang/rust/issues/118212> for more information
88
= note: `#[warn(incomplete_features)]` on by default
99

10-
error: delegation with early bound generics is not supported yet
11-
--> $DIR/not-supported.rs:16:29
12-
|
13-
LL | fn bar(&self, x: T) -> T { x }
14-
| ------------------------ callee defined here
15-
...
16-
LL | reuse GenericTrait::bar;
17-
| ^^^
18-
19-
error: delegation with early bound generics is not supported yet
20-
--> $DIR/not-supported.rs:18:29
21-
|
22-
LL | fn bar1() {}
23-
| --------- callee defined here
24-
...
25-
LL | reuse GenericTrait::bar1;
26-
| ^^^^
27-
2810
error: delegation with early bound generics is not supported yet
2911
--> $DIR/not-supported.rs:29:39
3012
|
@@ -97,6 +79,24 @@ LL | fn foo(&self, x: i32) -> i32 { x }
9779
LL | reuse Trait::foo { &self.0 }
9880
| ^^^
9981

82+
error: delegation with early bound generics is not supported yet
83+
--> $DIR/not-supported.rs:16:29
84+
|
85+
LL | fn bar(&self, x: T) -> T { x }
86+
| ------------------------ callee defined here
87+
...
88+
LL | reuse GenericTrait::bar;
89+
| ^^^
90+
91+
error: delegation with early bound generics is not supported yet
92+
--> $DIR/not-supported.rs:18:29
93+
|
94+
LL | fn bar1() {}
95+
| --------- callee defined here
96+
...
97+
LL | reuse GenericTrait::bar1;
98+
| ^^^^
99+
100100
error: delegation with early bound generics is not supported yet
101101
--> $DIR/not-supported.rs:74:21
102102
|

tests/ui/generic-associated-types/elided-in-expr-position.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error[E0107]: missing generics for associated type `Trait::Assoc`
2-
--> $DIR/elided-in-expr-position.rs:9:26
2+
--> $DIR/elided-in-expr-position.rs:31:26
33
|
4-
LL | fn g(&self) -> Self::Assoc;
4+
LL | fn g(&self) -> Self::Assoc {
55
| ^^^^^ expected 1 lifetime argument
66
|
77
note: associated type defined here, with 1 lifetime parameter: `'a`
@@ -11,13 +11,13 @@ LL | type Assoc<'a> where Self: 'a;
1111
| ^^^^^ --
1212
help: add missing lifetime argument
1313
|
14-
LL | fn g(&self) -> Self::Assoc<'_>;
14+
LL | fn g(&self) -> Self::Assoc<'_> {
1515
| ++++
1616

1717
error[E0107]: missing generics for associated type `Trait::Assoc`
18-
--> $DIR/elided-in-expr-position.rs:31:26
18+
--> $DIR/elided-in-expr-position.rs:9:26
1919
|
20-
LL | fn g(&self) -> Self::Assoc {
20+
LL | fn g(&self) -> Self::Assoc;
2121
| ^^^^^ expected 1 lifetime argument
2222
|
2323
note: associated type defined here, with 1 lifetime parameter: `'a`
@@ -27,7 +27,7 @@ LL | type Assoc<'a> where Self: 'a;
2727
| ^^^^^ --
2828
help: add missing lifetime argument
2929
|
30-
LL | fn g(&self) -> Self::Assoc<'_> {
30+
LL | fn g(&self) -> Self::Assoc<'_>;
3131
| ++++
3232

3333
error: aborting due to 2 previous errors

tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: `#[target_feature(..)]` cannot be applied to safe trait method
2-
--> $DIR/trait-impl.rs:22:5
2+
--> $DIR/trait-impl.rs:13:5
33
|
44
LL | #[target_feature(enable = "sse2")]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method
@@ -8,7 +8,7 @@ LL | fn foo(&self) {}
88
| ------------- not an `unsafe` function
99

1010
error: `#[target_feature(..)]` cannot be applied to safe trait method
11-
--> $DIR/trait-impl.rs:13:5
11+
--> $DIR/trait-impl.rs:22:5
1212
|
1313
LL | #[target_feature(enable = "sse2")]
1414
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method

tests/ui/typeck/type-placeholder-fn-in-const.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
2-
--> $DIR/type-placeholder-fn-in-const.rs:4:25
2+
--> $DIR/type-placeholder-fn-in-const.rs:10:25
33
|
4-
LL | const TEST: fn() -> _;
4+
LL | const TEST: fn() -> _ = 42;
55
| ^ not allowed in type signatures
66

77
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
8-
--> $DIR/type-placeholder-fn-in-const.rs:4:25
8+
--> $DIR/type-placeholder-fn-in-const.rs:10:25
99
|
10-
LL | const TEST: fn() -> _;
10+
LL | const TEST: fn() -> _ = 42;
1111
| ^ not allowed in type signatures
1212

1313
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
14-
--> $DIR/type-placeholder-fn-in-const.rs:10:25
14+
--> $DIR/type-placeholder-fn-in-const.rs:4:25
1515
|
16-
LL | const TEST: fn() -> _ = 42;
16+
LL | const TEST: fn() -> _;
1717
| ^ not allowed in type signatures
1818

1919
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
20-
--> $DIR/type-placeholder-fn-in-const.rs:10:25
20+
--> $DIR/type-placeholder-fn-in-const.rs:4:25
2121
|
22-
LL | const TEST: fn() -> _ = 42;
22+
LL | const TEST: fn() -> _;
2323
| ^ not allowed in type signatures
2424

2525
error: aborting due to 4 previous errors

0 commit comments

Comments
 (0)