Collect mod item types in parallel, just like wfcheck
This commit is contained in:
parent
8c9a75b323
commit
de3fb8d429
@ -55,7 +55,18 @@
|
||||
// Main entry point
|
||||
|
||||
fn collect_mod_item_types(tcx: TyCtxt<'_>, module_def_id: LocalModDefId) {
|
||||
tcx.hir().visit_item_likes_in_module(module_def_id, &mut CollectItemTypesVisitor { tcx });
|
||||
let items = tcx.hir_module_items(module_def_id);
|
||||
let hir = tcx.hir();
|
||||
let _ = items.par_items(|item| Ok(CollectItemTypesVisitor { tcx }.visit_item(hir.item(item))));
|
||||
let _ = items.par_trait_items(|item| {
|
||||
Ok(CollectItemTypesVisitor { tcx }.visit_trait_item(hir.trait_item(item)))
|
||||
});
|
||||
let _ = items.par_impl_items(|item| {
|
||||
Ok(CollectItemTypesVisitor { tcx }.visit_impl_item(hir.impl_item(item)))
|
||||
});
|
||||
let _ = items.par_foreign_items(|item| {
|
||||
Ok(CollectItemTypesVisitor { tcx }.visit_foreign_item(hir.foreign_item(item)))
|
||||
});
|
||||
}
|
||||
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
|
@ -15,8 +15,10 @@ impl<'a, T> Struct<T> for Trait<'a, T> {}
|
||||
|
||||
impl<'a, T> Enum<T> for Trait<'a, T> {}
|
||||
//~^ ERROR expected trait, found enum `Enum`
|
||||
//~| ERROR trait objects must include the `dyn` keyword
|
||||
|
||||
impl<'a, T> Union<T> for Trait<'a, T> {}
|
||||
//~^ ERROR expected trait, found union `Union`
|
||||
//~| ERROR trait objects must include the `dyn` keyword
|
||||
|
||||
fn main() {}
|
||||
|
@ -21,7 +21,7 @@ LL | impl<'a, T> Trait<'a, T> for Enum<T> {}
|
||||
| ~~~~~~~~~~~~ ~~~~~~~
|
||||
|
||||
error[E0404]: expected trait, found union `Union`
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:19:13
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:20:13
|
||||
|
|
||||
LL | impl<'a, T> Union<T> for Trait<'a, T> {}
|
||||
| ^^^^^^^^ not a trait
|
||||
@ -42,7 +42,29 @@ help: add `dyn` keyword before this trait
|
||||
LL | impl<'a, T> Struct<T> for dyn Trait<'a, T> {}
|
||||
| +++
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error[E0782]: trait objects must include the `dyn` keyword
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:16:25
|
||||
|
|
||||
LL | impl<'a, T> Enum<T> for Trait<'a, T> {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
help: add `dyn` keyword before this trait
|
||||
|
|
||||
LL | impl<'a, T> Enum<T> for dyn Trait<'a, T> {}
|
||||
| +++
|
||||
|
||||
error[E0782]: trait objects must include the `dyn` keyword
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:20:26
|
||||
|
|
||||
LL | impl<'a, T> Union<T> for Trait<'a, T> {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
help: add `dyn` keyword before this trait
|
||||
|
|
||||
LL | impl<'a, T> Union<T> for dyn Trait<'a, T> {}
|
||||
| +++
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0404, E0782.
|
||||
For more information about an error, try `rustc --explain E0404`.
|
||||
|
@ -14,8 +14,12 @@ impl<'a, T> Struct<T> for Trait<'a, T> {}
|
||||
|
||||
impl<'a, T> Enum<T> for Trait<'a, T> {}
|
||||
//~^ ERROR expected trait, found enum `Enum`
|
||||
//~| WARNING trait objects without an explicit `dyn` are deprecated
|
||||
//~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
|
||||
impl<'a, T> Union<T> for Trait<'a, T> {}
|
||||
//~^ ERROR expected trait, found union `Union`
|
||||
//~| WARNING trait objects without an explicit `dyn` are deprecated
|
||||
//~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
|
||||
fn main() {}
|
||||
|
@ -21,7 +21,7 @@ LL | impl<'a, T> Trait<'a, T> for Enum<T> {}
|
||||
| ~~~~~~~~~~~~ ~~~~~~~
|
||||
|
||||
error[E0404]: expected trait, found union `Union`
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait.rs:18:13
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait.rs:20:13
|
||||
|
|
||||
LL | impl<'a, T> Union<T> for Trait<'a, T> {}
|
||||
| ^^^^^^^^ not a trait
|
||||
@ -45,6 +45,32 @@ help: if this is an object-safe trait, use `dyn`
|
||||
LL | impl<'a, T> Struct<T> for dyn Trait<'a, T> {}
|
||||
| +++
|
||||
|
||||
error: aborting due to 3 previous errors; 1 warning emitted
|
||||
warning: trait objects without an explicit `dyn` are deprecated
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait.rs:15:25
|
||||
|
|
||||
LL | impl<'a, T> Enum<T> for Trait<'a, T> {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
|
||||
help: if this is an object-safe trait, use `dyn`
|
||||
|
|
||||
LL | impl<'a, T> Enum<T> for dyn Trait<'a, T> {}
|
||||
| +++
|
||||
|
||||
warning: trait objects without an explicit `dyn` are deprecated
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait.rs:20:26
|
||||
|
|
||||
LL | impl<'a, T> Union<T> for Trait<'a, T> {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
|
||||
help: if this is an object-safe trait, use `dyn`
|
||||
|
|
||||
LL | impl<'a, T> Union<T> for dyn Trait<'a, T> {}
|
||||
| +++
|
||||
|
||||
error: aborting due to 3 previous errors; 3 warnings emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0404`.
|
||||
|
Loading…
Reference in New Issue
Block a user