@@ -165,16 +165,32 @@ pub fn eval_condition(
165165 // The unwraps below may look dangerous, but we've already asserted
166166 // that they won't fail with the loop above.
167167 match cfg. name ( ) {
168- Some ( sym:: any) => mis
169- . iter ( )
170- // We don't use any() here, because we want to evaluate all cfg condition
171- // as eval_condition can (and does) extra checks
172- . fold ( false , |res, mi| res | eval_condition ( mi, sess, features, eval) ) ,
173- Some ( sym:: all) => mis
174- . iter ( )
175- // We don't use all() here, because we want to evaluate all cfg condition
176- // as eval_condition can (and does) extra checks
177- . fold ( true , |res, mi| res & eval_condition ( mi, sess, features, eval) ) ,
168+ Some ( sym:: any) => {
169+ if mis. is_empty ( ) {
170+ dcx. emit_warn ( session_diagnostics:: UseCfgBooleanLit {
171+ span : cfg. span ,
172+ lit : false ,
173+ pred : sym:: any,
174+ } ) ;
175+ }
176+ mis. iter ( )
177+ // We don't use any() here, because we want to evaluate all cfg condition
178+ // as eval_condition can (and does) extra checks
179+ . fold ( false , |res, mi| res | eval_condition ( mi, sess, features, eval) )
180+ }
181+ Some ( sym:: all) => {
182+ if mis. is_empty ( ) {
183+ dcx. emit_warn ( session_diagnostics:: UseCfgBooleanLit {
184+ span : cfg. span ,
185+ lit : true ,
186+ pred : sym:: all,
187+ } ) ;
188+ }
189+ mis. iter ( )
190+ // We don't use all() here, because we want to evaluate all cfg condition
191+ // as eval_condition can (and does) extra checks
192+ . fold ( true , |res, mi| res & eval_condition ( mi, sess, features, eval) )
193+ }
178194 Some ( sym:: not) => {
179195 let [ mi] = mis. as_slice ( ) else {
180196 dcx. emit_err ( session_diagnostics:: ExpectedOneCfgPattern { span : cfg. span } ) ;
0 commit comments