@@ -15,7 +15,7 @@ pub struct Directive {
1515 pub is_rustc_attr : bool ,
1616 /// This is never nested more than once, i.e. the directives in this
1717 /// thinvec have no filters of their own.
18- pub filters : ThinVec < ( OnUnimplementedCondition , Directive ) > ,
18+ pub filters : ThinVec < ( Filter , Directive ) > ,
1919 pub message : Option < ( Span , FormatString ) > ,
2020 pub label : Option < ( Span , FormatString ) > ,
2121 pub notes : ThinVec < FormatString > ,
@@ -52,29 +52,29 @@ impl Directive {
5252
5353 pub fn eval (
5454 & self ,
55- condition_options : Option < & ConditionOptions > ,
55+ filter_options : Option < & FilterOptions > ,
5656 args : & FormatArgs ,
5757 ) -> CustomDiagnostic {
5858 let this = & args. this ;
5959 debug ! (
60- "Directive::eval({self:?}, this={this}, options={condition_options :?}, args ={args:?})"
60+ "Directive::eval({self:?}, this={this}, options={filter_options :?}, args ={args:?})"
6161 ) ;
6262
6363 let mut ret = CustomDiagnostic :: default ( ) ;
6464
65- if let Some ( condition_options ) = condition_options {
65+ if let Some ( filter_options ) = filter_options {
6666 for ( filter, directive) in & self . filters {
67- if filter. matches_predicate ( condition_options ) {
67+ if filter. matches_predicate ( filter_options ) {
6868 debug ! ( "eval: {filter:?} succeeded" ) ;
6969 ret. update ( directive, args) ;
7070 } else {
71- debug ! ( "eval: skipping {filter:?} due to condition " ) ;
71+ debug ! ( "eval: skipping {filter:?} due to {filter_options:?} " ) ;
7272 }
7373 }
7474 } else {
7575 debug_assert ! (
7676 !self . is_rustc_attr,
77- "Directive::eval called for `rustc_on_unimplemented` without `condition_options `"
77+ "Directive::eval called for `rustc_on_unimplemented` without `filter_options `"
7878 ) ;
7979 } ;
8080 ret. update ( self , args) ;
@@ -238,12 +238,12 @@ pub enum FormatArg {
238238
239239/// Represents the `on` filter in `#[rustc_on_unimplemented]`.
240240#[ derive( Clone , Debug , StableHash , Encodable , Decodable , PrintAttribute ) ]
241- pub struct OnUnimplementedCondition {
241+ pub struct Filter {
242242 pub span : Span ,
243243 pub pred : Predicate ,
244244}
245- impl OnUnimplementedCondition {
246- pub fn matches_predicate ( self : & OnUnimplementedCondition , options : & ConditionOptions ) -> bool {
245+ impl Filter {
246+ pub fn matches_predicate ( & self , options : & FilterOptions ) -> bool {
247247 self . pred . eval ( & mut |p| match p {
248248 FlagOrNv :: Flag ( b) => options. has_flag ( * b) ,
249249 FlagOrNv :: NameValue ( NameValue { name, value } ) => {
@@ -258,7 +258,7 @@ impl OnUnimplementedCondition {
258258 }
259259}
260260
261- /// Predicate(s) in `#[rustc_on_unimplemented]`'s `on` filter. See [`OnUnimplementedCondition `].
261+ /// Predicate(s) in `#[rustc_on_unimplemented]`'s `on` filter. See [`Filter `].
262262///
263263/// It is similar to the predicate in the `cfg` attribute,
264264/// and may contain nested predicates.
@@ -392,8 +392,7 @@ pub enum LitOrArg {
392392 Arg ( Symbol ) ,
393393}
394394
395- /// Used with `OnUnimplementedCondition::matches_predicate` to evaluate the
396- /// [`OnUnimplementedCondition`].
395+ /// Used with `Filter::matches_predicate` to evaluate the [`Filter`].
397396///
398397/// For example, given a
399398/// ```rust,ignore (just an example)
@@ -419,7 +418,7 @@ pub enum LitOrArg {
419418/// it will look like this:
420419///
421420/// ```rust,ignore (just an example)
422- /// ConditionOptions {
421+ /// FilterOptions {
423422/// self_types: ["u32", "{integral}"],
424423/// from_desugaring: Some("QuestionMark"),
425424/// cause: None,
@@ -432,7 +431,7 @@ pub enum LitOrArg {
432431/// }
433432/// ```
434433#[ derive( Debug ) ]
435- pub struct ConditionOptions {
434+ pub struct FilterOptions {
436435 /// All the self types that may apply.
437436 pub self_types : Vec < String > ,
438437 // The kind of compiler desugaring.
@@ -446,7 +445,7 @@ pub struct ConditionOptions {
446445 pub generic_args : Vec < ( Symbol , String ) > ,
447446}
448447
449- impl ConditionOptions {
448+ impl FilterOptions {
450449 pub fn has_flag ( & self , name : Flag ) -> bool {
451450 match name {
452451 Flag :: CrateLocal => self . crate_local ,
0 commit comments