@@ -80,14 +80,28 @@ macro_rules! erase {
8080 ( $x: tt) => ( { } )
8181}
8282
83- macro_rules! anon_attr_to_bool {
84- ( anon) => ( true )
83+ macro_rules! is_anon_attr {
84+ ( anon) => ( true ) ;
85+ ( $attr: ident) => ( false ) ;
86+ }
87+
88+ macro_rules! is_input_attr {
89+ ( input) => ( true ) ;
90+ ( $attr: ident) => ( false ) ;
91+ }
92+
93+ macro_rules! contains_anon_attr {
94+ ( $( $attr: ident) ,* ) => ( { $( is_anon_attr!( $attr) | ) * false } ) ;
95+ }
96+
97+ macro_rules! contains_input_attr {
98+ ( $( $attr: ident) ,* ) => ( { $( is_input_attr!( $attr) | ) * false } ) ;
8599}
86100
87101macro_rules! define_dep_nodes {
88102 ( <$tcx: tt>
89103 $(
90- [ $( $anon : ident) * ]
104+ [ $( $attr : ident) , * ]
91105 $variant: ident $( ( $( $tuple_arg: tt) ,* ) ) *
92106 $( { $( $struct_arg_name: ident : $struct_arg_ty: ty) ,* } ) *
93107 , ) *
@@ -105,7 +119,9 @@ macro_rules! define_dep_nodes {
105119 match * self {
106120 $(
107121 DepKind :: $variant => {
108- $( return !anon_attr_to_bool!( $anon) ; ) *
122+ if contains_anon_attr!( $( $attr) ,* ) {
123+ return false ;
124+ }
109125
110126 // tuple args
111127 $( {
@@ -126,15 +142,20 @@ macro_rules! define_dep_nodes {
126142 }
127143 }
128144
129- #[ allow( unreachable_code) ]
130145 #[ inline]
131- pub fn is_anon<$tcx> ( & self ) -> bool {
146+ pub fn is_anon( & self ) -> bool {
132147 match * self {
133148 $(
134- DepKind :: $variant => {
135- $( return anon_attr_to_bool!( $anon) ; ) *
136- false
137- }
149+ DepKind :: $variant => { contains_anon_attr!( $( $attr) ,* ) }
150+ ) *
151+ }
152+ }
153+
154+ #[ inline]
155+ pub fn is_input( & self ) -> bool {
156+ match * self {
157+ $(
158+ DepKind :: $variant => { contains_input_attr!( $( $attr) ,* ) }
138159 ) *
139160 }
140161 }
@@ -378,18 +399,17 @@ define_dep_nodes!( <'tcx>
378399 // suitable wrapper, you can use `tcx.dep_graph.ignore()` to gain
379400 // access to the krate, but you must remember to add suitable
380401 // edges yourself for the individual items that you read.
381- [ ] Krate ,
402+ [ input ] Krate ,
382403
383404 // Represents the HIR node with the given node-id
384- [ ] Hir ( DefId ) ,
405+ [ input ] Hir ( DefId ) ,
385406
386407 // Represents the body of a function or method. The def-id is that of the
387408 // function/method.
388- [ ] HirBody ( DefId ) ,
409+ [ input ] HirBody ( DefId ) ,
389410
390- // Represents the metadata for a given HIR node, typically found
391- // in an extern crate.
392- [ ] MetaData ( DefId ) ,
411+ // Represents metadata from an extern crate.
412+ [ input] MetaData ( DefId ) ,
393413
394414 // Represents some artifact that we save to disk. Note that these
395415 // do not have a def-id as part of their identifier.
@@ -529,7 +549,7 @@ define_dep_nodes!( <'tcx>
529549 [ ] ExternCrate ( DefId ) ,
530550 [ ] LintLevels ,
531551 [ ] Specializes { impl1: DefId , impl2: DefId } ,
532- [ ] InScopeTraits ( DefIndex ) ,
552+ [ input ] InScopeTraits ( DefIndex ) ,
533553 [ ] ModuleExports ( DefId ) ,
534554 [ ] IsSanitizerRuntime ( CrateNum ) ,
535555 [ ] IsProfilerRuntime ( CrateNum ) ,
0 commit comments