run wfcheck in parralel again, add test for 74950
This commit is contained in:
parent
70dfe3fa74
commit
6ad01e9932
@ -729,8 +729,8 @@ impl ItemLikeVisitor<'tcx> for CheckItemTypesVisitor<'tcx> {
|
||||
}
|
||||
|
||||
pub fn check_wf_new(tcx: TyCtxt<'_>) {
|
||||
let mut visit = wfcheck::CheckTypeWellFormedVisitor::new(tcx);
|
||||
tcx.hir().krate().visit_all_item_likes(&mut visit.as_deep_visitor());
|
||||
let visit = wfcheck::CheckTypeWellFormedVisitor::new(tcx);
|
||||
tcx.hir().krate().par_visit_all_item_likes(&visit);
|
||||
}
|
||||
|
||||
fn check_mod_item_types(tcx: TyCtxt<'_>, module_def_id: LocalDefId) {
|
||||
|
@ -8,6 +8,7 @@ use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::intravisit as hir_visit;
|
||||
use rustc_hir::intravisit::Visitor;
|
||||
use rustc_hir::itemlikevisit::ParItemLikeVisitor;
|
||||
use rustc_hir::lang_items;
|
||||
use rustc_hir::ItemKind;
|
||||
use rustc_middle::hir::map as hir_map;
|
||||
@ -1373,6 +1374,7 @@ fn check_false_global_bounds(fcx: &FnCtxt<'_, '_>, span: Span, id: hir::HirId) {
|
||||
fcx.select_all_obligations_or_error();
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct CheckTypeWellFormedVisitor<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
}
|
||||
@ -1383,6 +1385,20 @@ impl CheckTypeWellFormedVisitor<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
impl ParItemLikeVisitor<'tcx> for CheckTypeWellFormedVisitor<'tcx> {
|
||||
fn visit_item(&self, i: &'tcx hir::Item<'tcx>) {
|
||||
Visitor::visit_item(&mut self.clone(), i);
|
||||
}
|
||||
|
||||
fn visit_trait_item(&self, trait_item: &'tcx hir::TraitItem<'tcx>) {
|
||||
Visitor::visit_trait_item(&mut self.clone(), trait_item);
|
||||
}
|
||||
|
||||
fn visit_impl_item(&self, impl_item: &'tcx hir::ImplItem<'tcx>) {
|
||||
Visitor::visit_impl_item(&mut self.clone(), impl_item);
|
||||
}
|
||||
}
|
||||
|
||||
impl Visitor<'tcx> for CheckTypeWellFormedVisitor<'tcx> {
|
||||
type Map = hir_map::Map<'tcx>;
|
||||
|
||||
@ -1413,8 +1429,7 @@ impl Visitor<'tcx> for CheckTypeWellFormedVisitor<'tcx> {
|
||||
|
||||
fn visit_generic_param(&mut self, p: &'tcx hir::GenericParam<'tcx>) {
|
||||
check_param_wf(self.tcx, p);
|
||||
// No need to walk further here, there is nothing interesting
|
||||
// inside of generic params we don't already check in `check_param_wf`.
|
||||
hir_visit::walk_generic_param(self, p);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,15 +6,6 @@ LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
|
||||
|
|
||||
= note: for more information, see issue #74052 <https://github.com/rust-lang/rust/issues/74052>
|
||||
|
||||
error: using `&'static str` as const generic parameters is forbidden
|
||||
--> $DIR/issue-56445.rs:9:25
|
||||
|
|
||||
LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: the only supported types are integers, `bool` and `char`
|
||||
= note: more complex types are supported with `#[feature(const_generics)]`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0771`.
|
||||
|
@ -8,6 +8,5 @@ use std::marker::PhantomData;
|
||||
|
||||
struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
|
||||
//~^ ERROR: use of non-static lifetime `'a` in const generic
|
||||
//[min]~| ERROR: using `&'static str` as const
|
||||
|
||||
impl Bug<'_, ""> {}
|
||||
|
47
src/test/ui/const-generics/issues/issue-74950.min.stderr
Normal file
47
src/test/ui/const-generics/issues/issue-74950.min.stderr
Normal file
@ -0,0 +1,47 @@
|
||||
error: using `Inner` as const generic parameters is forbidden
|
||||
--> $DIR/issue-74950.rs:18:23
|
||||
|
|
||||
LL | struct Outer<const I: Inner>;
|
||||
| ^^^^^
|
||||
|
|
||||
= note: the only supported types are integers, `bool` and `char`
|
||||
= note: more complex types are supported with `#[feature(const_generics)]`
|
||||
|
||||
error: using `Inner` as const generic parameters is forbidden
|
||||
--> $DIR/issue-74950.rs:18:23
|
||||
|
|
||||
LL | struct Outer<const I: Inner>;
|
||||
| ^^^^^
|
||||
|
|
||||
= note: the only supported types are integers, `bool` and `char`
|
||||
= note: more complex types are supported with `#[feature(const_generics)]`
|
||||
|
||||
error: using `Inner` as const generic parameters is forbidden
|
||||
--> $DIR/issue-74950.rs:18:23
|
||||
|
|
||||
LL | struct Outer<const I: Inner>;
|
||||
| ^^^^^
|
||||
|
|
||||
= note: the only supported types are integers, `bool` and `char`
|
||||
= note: more complex types are supported with `#[feature(const_generics)]`
|
||||
|
||||
error: using `Inner` as const generic parameters is forbidden
|
||||
--> $DIR/issue-74950.rs:18:23
|
||||
|
|
||||
LL | struct Outer<const I: Inner>;
|
||||
| ^^^^^
|
||||
|
|
||||
= note: the only supported types are integers, `bool` and `char`
|
||||
= note: more complex types are supported with `#[feature(const_generics)]`
|
||||
|
||||
error: using `Inner` as const generic parameters is forbidden
|
||||
--> $DIR/issue-74950.rs:18:23
|
||||
|
|
||||
LL | struct Outer<const I: Inner>;
|
||||
| ^^^^^
|
||||
|
|
||||
= note: the only supported types are integers, `bool` and `char`
|
||||
= note: more complex types are supported with `#[feature(const_generics)]`
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
25
src/test/ui/const-generics/issues/issue-74950.rs
Normal file
25
src/test/ui/const-generics/issues/issue-74950.rs
Normal file
@ -0,0 +1,25 @@
|
||||
// [full] build-pass
|
||||
// revisions: full min
|
||||
#![cfg_attr(full, feature(const_generics))]
|
||||
#![cfg_attr(full, allow(incomplete_features))]
|
||||
#![cfg_attr(min, feature(min_const_generics))]
|
||||
|
||||
|
||||
#[derive(PartialEq, Eq)]
|
||||
struct Inner;
|
||||
|
||||
// Note: We emit the error 5 times if we don't deduplicate:
|
||||
// - struct definition
|
||||
// - impl PartialEq
|
||||
// - impl Eq
|
||||
// - impl StructuralPartialEq
|
||||
// - impl StructuralEq
|
||||
#[derive(PartialEq, Eq)]
|
||||
struct Outer<const I: Inner>;
|
||||
//[min]~^ using `Inner` as const generic parameters is forbidden
|
||||
//[min]~| using `Inner` as const generic parameters is forbidden
|
||||
//[min]~| using `Inner` as const generic parameters is forbidden
|
||||
//[min]~| using `Inner` as const generic parameters is forbidden
|
||||
//[min]~| using `Inner` as const generic parameters is forbidden
|
||||
|
||||
fn main() {}
|
Loading…
x
Reference in New Issue
Block a user