mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Split DepNode::ItemSignature into non-overlapping variants.
This commit is contained in:
parent
d84693b93d
commit
2557800fd6
@ -16,7 +16,7 @@ The nodes of the graph are defined by the enum `DepNode`. They represent
|
||||
one of three things:
|
||||
|
||||
1. HIR nodes (like `Hir(DefId)`) represent the HIR input itself.
|
||||
2. Data nodes (like `ItemSignature(DefId)`) represent some computed
|
||||
2. Data nodes (like `TypeOfItem(DefId)`) represent some computed
|
||||
information about a particular item.
|
||||
3. Procedure nodes (like `CoherenceCheckTrait(DefId)`) represent some
|
||||
procedure that is executing. Usually this procedure is
|
||||
@ -289,7 +289,7 @@ to see something like:
|
||||
|
||||
Hir(foo) -> Collect(bar)
|
||||
Collect(bar) -> TypeckTables(bar)
|
||||
|
||||
|
||||
That first edge looks suspicious to you. So you set
|
||||
`RUST_FORBID_DEP_GRAPH_EDGE` to `Hir&foo -> Collect&bar`, re-run, and
|
||||
then observe the backtrace. Voila, bug fixed!
|
||||
|
@ -387,11 +387,21 @@ define_dep_nodes!(
|
||||
|
||||
// Nodes representing bits of computed IR in the tcx. Each shared
|
||||
// table in the tcx (or elsewhere) maps to one of these
|
||||
// nodes. Often we map multiple tables to the same node if there
|
||||
// is no point in distinguishing them (e.g., both the type and
|
||||
// predicates for an item wind up in `ItemSignature`).
|
||||
// nodes.
|
||||
AssociatedItems(DefId),
|
||||
ItemSignature(DefId),
|
||||
TypeOfItem(DefId),
|
||||
GenericsOfItem(DefId),
|
||||
PredicatesOfItem(DefId),
|
||||
SuperPredicatesOfItem(DefId),
|
||||
TraitDefOfItem(DefId),
|
||||
AdtDefOfItem(DefId),
|
||||
IsDefaultImpl(DefId),
|
||||
ImplTraitRef(DefId),
|
||||
ImplPolarity(DefId),
|
||||
ClosureKind(DefId),
|
||||
FnSignature(DefId),
|
||||
CoerceUnsizedInfo(DefId),
|
||||
|
||||
ItemVarianceConstraints(DefId),
|
||||
ItemVariances(DefId),
|
||||
IsConstFn(DefId),
|
||||
|
@ -796,12 +796,12 @@ macro_rules! define_provider_struct {
|
||||
// the driver creates (using several `rustc_*` crates).
|
||||
define_maps! { <'tcx>
|
||||
/// Records the type of every item.
|
||||
[] type_of: ItemSignature(DefId) -> Ty<'tcx>,
|
||||
[] type_of: TypeOfItem(DefId) -> Ty<'tcx>,
|
||||
|
||||
/// Maps from the def-id of an item (trait/struct/enum/fn) to its
|
||||
/// associated generics and predicates.
|
||||
[] generics_of: ItemSignature(DefId) -> &'tcx ty::Generics,
|
||||
[] predicates_of: ItemSignature(DefId) -> ty::GenericPredicates<'tcx>,
|
||||
[] generics_of: GenericsOfItem(DefId) -> &'tcx ty::Generics,
|
||||
[] predicates_of: PredicatesOfItem(DefId) -> ty::GenericPredicates<'tcx>,
|
||||
|
||||
/// Maps from the def-id of a trait to the list of
|
||||
/// super-predicates. This is a subset of the full list of
|
||||
@ -809,15 +809,15 @@ define_maps! { <'tcx>
|
||||
/// evaluate them even during type conversion, often before the
|
||||
/// full predicates are available (note that supertraits have
|
||||
/// additional acyclicity requirements).
|
||||
[] super_predicates_of: ItemSignature(DefId) -> ty::GenericPredicates<'tcx>,
|
||||
[] super_predicates_of: SuperPredicatesOfItem(DefId) -> ty::GenericPredicates<'tcx>,
|
||||
|
||||
/// To avoid cycles within the predicates of a single item we compute
|
||||
/// per-type-parameter predicates for resolving `T::AssocTy`.
|
||||
[] type_param_predicates: type_param_predicates((DefId, DefId))
|
||||
-> ty::GenericPredicates<'tcx>,
|
||||
|
||||
[] trait_def: ItemSignature(DefId) -> &'tcx ty::TraitDef,
|
||||
[] adt_def: ItemSignature(DefId) -> &'tcx ty::AdtDef,
|
||||
[] trait_def: TraitDefOfItem(DefId) -> &'tcx ty::TraitDef,
|
||||
[] adt_def: AdtDefOfItem(DefId) -> &'tcx ty::AdtDef,
|
||||
[] adt_destructor: AdtDestructor(DefId) -> Option<ty::Destructor>,
|
||||
[] adt_sized_constraint: SizedConstraint(DefId) -> &'tcx [Ty<'tcx>],
|
||||
[] adt_dtorck_constraint: DtorckConstraint(DefId) -> ty::DtorckConstraint<'tcx>,
|
||||
@ -829,7 +829,7 @@ define_maps! { <'tcx>
|
||||
[] is_foreign_item: IsForeignItem(DefId) -> bool,
|
||||
|
||||
/// True if this is a default impl (aka impl Foo for ..)
|
||||
[] is_default_impl: ItemSignature(DefId) -> bool,
|
||||
[] is_default_impl: IsDefaultImpl(DefId) -> bool,
|
||||
|
||||
/// Get a map with the variance of every item; use `item_variance`
|
||||
/// instead.
|
||||
@ -845,8 +845,8 @@ define_maps! { <'tcx>
|
||||
/// Maps from a trait item to the trait item "descriptor"
|
||||
[] associated_item: AssociatedItems(DefId) -> ty::AssociatedItem,
|
||||
|
||||
[] impl_trait_ref: ItemSignature(DefId) -> Option<ty::TraitRef<'tcx>>,
|
||||
[] impl_polarity: ItemSignature(DefId) -> hir::ImplPolarity,
|
||||
[] impl_trait_ref: ImplTraitRef(DefId) -> Option<ty::TraitRef<'tcx>>,
|
||||
[] impl_polarity: ImplPolarity(DefId) -> hir::ImplPolarity,
|
||||
|
||||
/// Maps a DefId of a type to a list of its inherent impls.
|
||||
/// Contains implementations of methods that are inherent to a type.
|
||||
@ -877,13 +877,13 @@ define_maps! { <'tcx>
|
||||
|
||||
/// Type of each closure. The def ID is the ID of the
|
||||
/// expression defining the closure.
|
||||
[] closure_kind: ItemSignature(DefId) -> ty::ClosureKind,
|
||||
[] closure_kind: ClosureKind(DefId) -> ty::ClosureKind,
|
||||
|
||||
/// The signature of functions and closures.
|
||||
[] fn_sig: ItemSignature(DefId) -> ty::PolyFnSig<'tcx>,
|
||||
[] fn_sig: FnSignature(DefId) -> ty::PolyFnSig<'tcx>,
|
||||
|
||||
/// Caches CoerceUnsized kinds for impls on custom types.
|
||||
[] coerce_unsized_info: ItemSignature(DefId)
|
||||
[] coerce_unsized_info: CoerceUnsizedInfo(DefId)
|
||||
-> ty::adjustment::CoerceUnsizedInfo,
|
||||
|
||||
[] typeck_item_bodies: typeck_item_bodies_dep_node(CrateNum) -> CompileResult,
|
||||
|
@ -34,54 +34,64 @@ struct WontChange {
|
||||
mod signatures {
|
||||
use WillChange;
|
||||
|
||||
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR no path
|
||||
#[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path
|
||||
#[rustc_then_this_would_need(AssociatedItems)] //~ ERROR no path
|
||||
#[rustc_then_this_would_need(TraitDefOfItem)] //~ ERROR no path
|
||||
trait Bar {
|
||||
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
|
||||
#[rustc_then_this_would_need(FnSignature)] //~ ERROR OK
|
||||
fn do_something(x: WillChange);
|
||||
}
|
||||
|
||||
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
|
||||
#[rustc_then_this_would_need(FnSignature)] //~ ERROR OK
|
||||
#[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK
|
||||
fn some_fn(x: WillChange) { }
|
||||
|
||||
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
|
||||
#[rustc_then_this_would_need(FnSignature)] //~ ERROR OK
|
||||
#[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK
|
||||
fn new_foo(x: u32, y: u32) -> WillChange {
|
||||
WillChange { x: x, y: y }
|
||||
}
|
||||
|
||||
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
|
||||
#[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK
|
||||
impl WillChange {
|
||||
#[rustc_then_this_would_need(FnSignature)] //~ ERROR OK
|
||||
#[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK
|
||||
fn new(x: u32, y: u32) -> WillChange { loop { } }
|
||||
}
|
||||
|
||||
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
|
||||
#[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK
|
||||
impl WillChange {
|
||||
#[rustc_then_this_would_need(FnSignature)] //~ ERROR OK
|
||||
#[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK
|
||||
fn method(&self, x: u32) { }
|
||||
}
|
||||
|
||||
struct WillChanges {
|
||||
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
|
||||
#[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK
|
||||
x: WillChange,
|
||||
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
|
||||
#[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK
|
||||
y: WillChange
|
||||
}
|
||||
|
||||
// The fields change, not the type itself.
|
||||
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR no path
|
||||
#[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path
|
||||
fn indirect(x: WillChanges) { }
|
||||
}
|
||||
|
||||
mod invalid_signatures {
|
||||
use WontChange;
|
||||
|
||||
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR no path
|
||||
#[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path
|
||||
trait A {
|
||||
#[rustc_then_this_would_need(FnSignature)] //~ ERROR no path
|
||||
fn do_something_else_twice(x: WontChange);
|
||||
}
|
||||
|
||||
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR no path
|
||||
#[rustc_then_this_would_need(FnSignature)] //~ ERROR no path
|
||||
#[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path
|
||||
fn b(x: WontChange) { }
|
||||
|
||||
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR no path from `WillChange`
|
||||
#[rustc_then_this_would_need(FnSignature)] //~ ERROR no path from `WillChange`
|
||||
#[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path from `WillChange`
|
||||
fn c(x: u32) { }
|
||||
}
|
||||
|
||||
|
@ -25,40 +25,42 @@ type TypeAlias = u32;
|
||||
|
||||
// The type alias directly affects the type of the field,
|
||||
// not the enclosing struct:
|
||||
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR no path
|
||||
#[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path
|
||||
struct Struct {
|
||||
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
|
||||
#[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK
|
||||
x: TypeAlias,
|
||||
y: u32
|
||||
}
|
||||
|
||||
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR no path
|
||||
#[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path
|
||||
enum Enum {
|
||||
Variant1 {
|
||||
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
|
||||
#[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK
|
||||
t: TypeAlias
|
||||
},
|
||||
Variant2(i32)
|
||||
}
|
||||
|
||||
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR no path
|
||||
#[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path
|
||||
trait Trait {
|
||||
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
|
||||
#[rustc_then_this_would_need(FnSignature)] //~ ERROR OK
|
||||
fn method(&self, _: TypeAlias);
|
||||
}
|
||||
|
||||
struct SomeType;
|
||||
|
||||
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR no path
|
||||
#[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path
|
||||
impl SomeType {
|
||||
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
|
||||
#[rustc_then_this_would_need(FnSignature)] //~ ERROR OK
|
||||
#[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK
|
||||
fn method(&self, _: TypeAlias) {}
|
||||
}
|
||||
|
||||
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
|
||||
#[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK
|
||||
type TypeAlias2 = TypeAlias;
|
||||
|
||||
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
|
||||
#[rustc_then_this_would_need(FnSignature)] //~ ERROR OK
|
||||
#[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK
|
||||
fn function(_: TypeAlias) {
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user