Skip to content

Commit c6e7c05

Browse files
committed
use gathered body_owners in par_body_owners
Signed-off-by: Miguel Guarniz <[email protected]>
1 parent e11862f commit c6e7c05

12 files changed

+192
-203
lines changed

compiler/rustc_middle/src/hir/map/mod.rs

+2-13
Original file line numberDiff line numberDiff line change
@@ -498,19 +498,8 @@ impl<'hir> Map<'hir> {
498498

499499
pub fn par_body_owners<F: Fn(LocalDefId) + Sync + Send>(self, f: F) {
500500
use rustc_data_structures::sync::{par_iter, ParallelIterator};
501-
#[cfg(parallel_compiler)]
502-
use rustc_rayon::iter::IndexedParallelIterator;
503-
504-
par_iter(&self.krate().owners.raw).enumerate().for_each(|(owner, owner_info)| {
505-
let owner = LocalDefId::new(owner);
506-
if let MaybeOwner::Owner(owner_info) = owner_info {
507-
par_iter(owner_info.nodes.bodies.range(..)).for_each(|(local_id, _)| {
508-
let hir_id = HirId { owner, local_id: *local_id };
509-
let body_id = BodyId { hir_id };
510-
f(self.body_owner_def_id(body_id))
511-
})
512-
}
513-
});
501+
502+
par_iter(&self.tcx.hir_crate_items(()).body_owners[..]).for_each(|&def_id| f(def_id));
514503
}
515504

516505
pub fn ty_param_owner(self, def_id: LocalDefId) -> LocalDefId {

src/test/ui/asm/type-check-1.stderr

+27-27
Original file line numberDiff line numberDiff line change
@@ -33,33 +33,6 @@ LL | asm!("{}", sym x);
3333
|
3434
= help: `sym` operands must refer to either a function or a static
3535

36-
error[E0308]: mismatched types
37-
--> $DIR/type-check-1.rs:58:26
38-
|
39-
LL | asm!("{}", const 0f32);
40-
| ^^^^ expected integer, found `f32`
41-
42-
error[E0308]: mismatched types
43-
--> $DIR/type-check-1.rs:60:26
44-
|
45-
LL | asm!("{}", const 0 as *mut u8);
46-
| ^^^^^^^^^^^^ expected integer, found *-ptr
47-
|
48-
= note: expected type `{integer}`
49-
found raw pointer `*mut u8`
50-
51-
error[E0308]: mismatched types
52-
--> $DIR/type-check-1.rs:62:26
53-
|
54-
LL | asm!("{}", const &0);
55-
| ^^ expected integer, found `&{integer}`
56-
|
57-
help: consider removing the borrow
58-
|
59-
LL - asm!("{}", const &0);
60-
LL + asm!("{}", const 0);
61-
|
62-
6336
error: invalid asm output
6437
--> $DIR/type-check-1.rs:15:29
6538
|
@@ -123,6 +96,33 @@ LL | asm!("{}", inout(reg) v[..]);
12396
|
12497
= note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly
12598

99+
error[E0308]: mismatched types
100+
--> $DIR/type-check-1.rs:58:26
101+
|
102+
LL | asm!("{}", const 0f32);
103+
| ^^^^ expected integer, found `f32`
104+
105+
error[E0308]: mismatched types
106+
--> $DIR/type-check-1.rs:60:26
107+
|
108+
LL | asm!("{}", const 0 as *mut u8);
109+
| ^^^^^^^^^^^^ expected integer, found *-ptr
110+
|
111+
= note: expected type `{integer}`
112+
found raw pointer `*mut u8`
113+
114+
error[E0308]: mismatched types
115+
--> $DIR/type-check-1.rs:62:26
116+
|
117+
LL | asm!("{}", const &0);
118+
| ^^ expected integer, found `&{integer}`
119+
|
120+
help: consider removing the borrow
121+
|
122+
LL - asm!("{}", const &0);
123+
LL + asm!("{}", const 0);
124+
|
125+
126126
error[E0308]: mismatched types
127127
--> $DIR/type-check-1.rs:76:25
128128
|

src/test/ui/const-generics/const-arg-in-const-arg.full.stderr

+24-24
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,6 @@ note: the late bound lifetime parameter is introduced here
2222
LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
2323
| ^^
2424

25-
error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
26-
--> $DIR/const-arg-in-const-arg.rs:30:23
27-
|
28-
LL | let _ = [0; faz::<'a>(&())];
29-
| ^^
30-
|
31-
note: the late bound lifetime parameter is introduced here
32-
--> $DIR/const-arg-in-const-arg.rs:8:14
33-
|
34-
LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
35-
| ^^
36-
37-
error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
38-
--> $DIR/const-arg-in-const-arg.rs:33:23
39-
|
40-
LL | let _ = [0; faz::<'b>(&())];
41-
| ^^
42-
|
43-
note: the late bound lifetime parameter is introduced here
44-
--> $DIR/const-arg-in-const-arg.rs:8:14
45-
|
46-
LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
47-
| ^^
48-
4925
error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
5026
--> $DIR/const-arg-in-const-arg.rs:41:24
5127
|
@@ -118,6 +94,30 @@ LL | let _ = [0; bar::<N>()];
11894
|
11995
= help: try adding a `where` bound using this expression: `where [(); bar::<N>()]:`
12096

97+
error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
98+
--> $DIR/const-arg-in-const-arg.rs:30:23
99+
|
100+
LL | let _ = [0; faz::<'a>(&())];
101+
| ^^
102+
|
103+
note: the late bound lifetime parameter is introduced here
104+
--> $DIR/const-arg-in-const-arg.rs:8:14
105+
|
106+
LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
107+
| ^^
108+
109+
error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
110+
--> $DIR/const-arg-in-const-arg.rs:33:23
111+
|
112+
LL | let _ = [0; faz::<'b>(&())];
113+
| ^^
114+
|
115+
note: the late bound lifetime parameter is introduced here
116+
--> $DIR/const-arg-in-const-arg.rs:8:14
117+
|
118+
LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
119+
| ^^
120+
121121
error: unconstrained generic constant
122122
--> $DIR/const-arg-in-const-arg.rs:47:19
123123
|

src/test/ui/const-generics/const-arg-in-const-arg.min.stderr

+30-30
Original file line numberDiff line numberDiff line change
@@ -241,21 +241,21 @@ LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
241241
| ^^
242242

243243
error[E0747]: unresolved item provided when a constant was expected
244-
--> $DIR/const-arg-in-const-arg.rs:27:23
244+
--> $DIR/const-arg-in-const-arg.rs:38:24
245245
|
246-
LL | let _ = [0; bar::<N>()];
247-
| ^
246+
LL | let _: Foo<{ bar::<N>() }>;
247+
| ^
248248
|
249249
help: if this generic argument was intended as a const parameter, surround it with braces
250250
|
251-
LL | let _ = [0; bar::<{ N }>()];
252-
| + +
251+
LL | let _: Foo<{ bar::<{ N }>() }>;
252+
| + +
253253

254254
error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
255-
--> $DIR/const-arg-in-const-arg.rs:30:23
255+
--> $DIR/const-arg-in-const-arg.rs:41:24
256256
|
257-
LL | let _ = [0; faz::<'a>(&())];
258-
| ^^
257+
LL | let _: Foo<{ faz::<'a>(&()) }>;
258+
| ^^
259259
|
260260
note: the late bound lifetime parameter is introduced here
261261
--> $DIR/const-arg-in-const-arg.rs:8:14
@@ -264,33 +264,41 @@ LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
264264
| ^^
265265

266266
error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
267-
--> $DIR/const-arg-in-const-arg.rs:33:23
267+
--> $DIR/const-arg-in-const-arg.rs:44:24
268268
|
269-
LL | let _ = [0; faz::<'b>(&())];
270-
| ^^
269+
LL | let _: Foo<{ faz::<'b>(&()) }>;
270+
| ^^
271271
|
272272
note: the late bound lifetime parameter is introduced here
273273
--> $DIR/const-arg-in-const-arg.rs:8:14
274274
|
275275
LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
276276
| ^^
277277

278+
error: constant expression depends on a generic parameter
279+
--> $DIR/const-arg-in-const-arg.rs:25:17
280+
|
281+
LL | let _ = [0; foo::<T>()];
282+
| ^^^^^^^^^^
283+
|
284+
= note: this may fail depending on what value the parameter takes
285+
278286
error[E0747]: unresolved item provided when a constant was expected
279-
--> $DIR/const-arg-in-const-arg.rs:38:24
287+
--> $DIR/const-arg-in-const-arg.rs:27:23
280288
|
281-
LL | let _: Foo<{ bar::<N>() }>;
282-
| ^
289+
LL | let _ = [0; bar::<N>()];
290+
| ^
283291
|
284292
help: if this generic argument was intended as a const parameter, surround it with braces
285293
|
286-
LL | let _: Foo<{ bar::<{ N }>() }>;
287-
| + +
294+
LL | let _ = [0; bar::<{ N }>()];
295+
| + +
288296

289297
error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
290-
--> $DIR/const-arg-in-const-arg.rs:41:24
298+
--> $DIR/const-arg-in-const-arg.rs:30:23
291299
|
292-
LL | let _: Foo<{ faz::<'a>(&()) }>;
293-
| ^^
300+
LL | let _ = [0; faz::<'a>(&())];
301+
| ^^
294302
|
295303
note: the late bound lifetime parameter is introduced here
296304
--> $DIR/const-arg-in-const-arg.rs:8:14
@@ -299,25 +307,17 @@ LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
299307
| ^^
300308

301309
error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
302-
--> $DIR/const-arg-in-const-arg.rs:44:24
310+
--> $DIR/const-arg-in-const-arg.rs:33:23
303311
|
304-
LL | let _: Foo<{ faz::<'b>(&()) }>;
305-
| ^^
312+
LL | let _ = [0; faz::<'b>(&())];
313+
| ^^
306314
|
307315
note: the late bound lifetime parameter is introduced here
308316
--> $DIR/const-arg-in-const-arg.rs:8:14
309317
|
310318
LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
311319
| ^^
312320

313-
error: constant expression depends on a generic parameter
314-
--> $DIR/const-arg-in-const-arg.rs:25:17
315-
|
316-
LL | let _ = [0; foo::<T>()];
317-
| ^^^^^^^^^^
318-
|
319-
= note: this may fail depending on what value the parameter takes
320-
321321
error[E0747]: unresolved item provided when a constant was expected
322322
--> $DIR/const-arg-in-const-arg.rs:49:27
323323
|

src/test/ui/issues/issue-47486.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/issue-47486.rs:2:10
3+
|
4+
LL | () < std::mem::size_of::<_>();
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `usize`
6+
17
error[E0282]: type annotations needed
28
--> $DIR/issue-47486.rs:3:11
39
|
@@ -9,12 +15,6 @@ help: consider specifying the generic argument
915
LL | [0u8; std::mem::size_of::<_>()];
1016
| ~~~~~
1117

12-
error[E0308]: mismatched types
13-
--> $DIR/issue-47486.rs:2:10
14-
|
15-
LL | () < std::mem::size_of::<_>();
16-
| ^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `usize`
17-
1818
error: aborting due to 2 previous errors
1919

2020
Some errors have detailed explanations: E0282, E0308.

src/test/ui/moves/use_of_moved_value_copy_suggestions.stderr

+14-14
Original file line numberDiff line numberDiff line change
@@ -143,36 +143,36 @@ LL | fn duplicate_custom_4<T: A + Copy + Trait>(t: S<T>) -> (S<T>, S<T>)
143143
| ++++++++++++++
144144

145145
error[E0382]: use of moved value: `t`
146-
--> $DIR/use_of_moved_value_copy_suggestions.rs:83:9
146+
--> $DIR/use_of_moved_value_copy_suggestions.rs:75:9
147147
|
148-
LL | fn existing_colon_in_where<T>(t: T)
149-
| - move occurs because `t` has type `T`, which does not implement the `Copy` trait
150-
...
148+
LL | fn existing_colon<T:>(t: T) {
149+
| - move occurs because `t` has type `T`, which does not implement the `Copy` trait
150+
LL |
151151
LL | [t, t];
152152
| - ^ value used here after move
153153
| |
154154
| value moved here
155155
|
156-
help: consider further restricting type parameter `T`
156+
help: consider restricting type parameter `T`
157157
|
158-
LL | T:, T: Copy
159-
| ~~~~~~~~~
158+
LL | fn existing_colon<T: Copy>(t: T) {
159+
| ++++
160160

161161
error[E0382]: use of moved value: `t`
162-
--> $DIR/use_of_moved_value_copy_suggestions.rs:75:9
162+
--> $DIR/use_of_moved_value_copy_suggestions.rs:83:9
163163
|
164-
LL | fn existing_colon<T:>(t: T) {
165-
| - move occurs because `t` has type `T`, which does not implement the `Copy` trait
166-
LL |
164+
LL | fn existing_colon_in_where<T>(t: T)
165+
| - move occurs because `t` has type `T`, which does not implement the `Copy` trait
166+
...
167167
LL | [t, t];
168168
| - ^ value used here after move
169169
| |
170170
| value moved here
171171
|
172-
help: consider restricting type parameter `T`
172+
help: consider further restricting type parameter `T`
173173
|
174-
LL | fn existing_colon<T: Copy>(t: T) {
175-
| ++++
174+
LL | T:, T: Copy
175+
| ~~~~~~~~~
176176

177177
error: aborting due to 11 previous errors
178178

src/test/ui/proc-macro/attribute-with-error.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
error[E0308]: mismatched types
2-
--> $DIR/attribute-with-error.rs:25:22
3-
|
4-
LL | let a: i32 = "foo";
5-
| --- ^^^^^ expected `i32`, found `&str`
6-
| |
7-
| expected due to this
8-
91
error[E0308]: mismatched types
102
--> $DIR/attribute-with-error.rs:10:18
113
|
@@ -22,6 +14,14 @@ LL | let b: i32 = "f'oo";
2214
| |
2315
| expected due to this
2416

17+
error[E0308]: mismatched types
18+
--> $DIR/attribute-with-error.rs:25:22
19+
|
20+
LL | let a: i32 = "foo";
21+
| --- ^^^^^ expected `i32`, found `&str`
22+
| |
23+
| expected due to this
24+
2525
error[E0308]: mismatched types
2626
--> $DIR/attribute-with-error.rs:35:22
2727
|

src/test/ui/repeat-expr/repeat_count.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ error[E0308]: mismatched types
3030
LL | let e = [0; "foo"];
3131
| ^^^^^ expected `usize`, found `&str`
3232

33+
error[E0308]: mismatched types
34+
--> $DIR/repeat_count.rs:31:17
35+
|
36+
LL | let g = [0; G { g: () }];
37+
| ^^^^^^^^^^^ expected `usize`, found struct `G`
38+
3339
error[E0308]: mismatched types
3440
--> $DIR/repeat_count.rs:19:17
3541
|
@@ -57,12 +63,6 @@ help: change the type of the numeric literal from `u8` to `usize`
5763
LL | let f = [0; 4usize];
5864
| ~~~~~
5965

60-
error[E0308]: mismatched types
61-
--> $DIR/repeat_count.rs:31:17
62-
|
63-
LL | let g = [0; G { g: () }];
64-
| ^^^^^^^^^^^ expected `usize`, found struct `G`
65-
6666
error: aborting due to 9 previous errors
6767

6868
Some errors have detailed explanations: E0308, E0435.

0 commit comments

Comments
 (0)