@@ -192,6 +192,8 @@ pub enum ResolverError {
192
192
UnexpectedItemInPattern { location : Location , item : & ' static str } ,
193
193
#[ error( "Trait `{trait_name}` doesn't have a method named `{method_name}`" ) ]
194
194
NoSuchMethodInTrait { trait_name : String , method_name : String , location : Location } ,
195
+ #[ error( "The `std::warn::warn` function cannot be called at runtime" ) ]
196
+ WarnUsedAtRuntime { location : Location } ,
195
197
}
196
198
197
199
impl ResolverError {
@@ -255,9 +257,8 @@ impl ResolverError {
255
257
| ResolverError :: TypeUnsupportedInMatch { location, .. }
256
258
| ResolverError :: UnexpectedItemInPattern { location, .. }
257
259
| ResolverError :: NoSuchMethodInTrait { location, .. }
258
- | ResolverError :: VariableAlreadyDefinedInPattern { new_location : location, .. } => {
259
- * location
260
- }
260
+ | ResolverError :: VariableAlreadyDefinedInPattern { new_location : location, .. }
261
+ | ResolverError :: WarnUsedAtRuntime { location } => * location,
261
262
ResolverError :: UnusedVariable { ident }
262
263
| ResolverError :: UnusedItem { ident, .. }
263
264
| ResolverError :: DuplicateField { field : ident }
@@ -801,6 +802,13 @@ impl<'a> From<&'a ResolverError> for Diagnostic {
801
802
* location,
802
803
)
803
804
} ,
805
+ ResolverError :: WarnUsedAtRuntime { location } => {
806
+ Diagnostic :: simple_error (
807
+ "The `std::warn::warn` function cannot be called at runtime" . to_string ( ) ,
808
+ "This function can only be called in comptime code" . to_string ( ) ,
809
+ * location,
810
+ )
811
+ } ,
804
812
}
805
813
}
806
814
}
0 commit comments