@@ -207,9 +207,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
207
207
Attribute :: Parsed ( AttributeKind :: ConstContinue ( attr_span) ) => {
208
208
self . check_const_continue ( hir_id, * attr_span, target)
209
209
}
210
- Attribute :: Parsed ( AttributeKind :: AllowInternalUnsafe ( attr_span) ) => {
211
- self . check_allow_internal_unsafe ( hir_id, * attr_span, span, target, attrs)
212
- }
213
210
Attribute :: Parsed ( AttributeKind :: AllowInternalUnstable ( _, first_span) ) => {
214
211
self . check_allow_internal_unstable ( hir_id, * first_span, span, target, attrs)
215
212
}
@@ -416,6 +413,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
416
413
// internal
417
414
| sym:: prelude_import
418
415
| sym:: panic_handler
416
+ | sym:: allow_internal_unsafe
419
417
| sym:: lang
420
418
| sym:: needs_allocator
421
419
| sym:: default_lib_allocator
@@ -2214,49 +2212,14 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
2214
2212
2215
2213
/// Outputs an error for `#[allow_internal_unstable]` which can only be applied to macros.
2216
2214
/// (Allows proc_macro functions)
2217
- fn check_allow_internal_unstable (
2218
- & self ,
2219
- hir_id : HirId ,
2220
- attr_span : Span ,
2221
- span : Span ,
2222
- target : Target ,
2223
- attrs : & [ Attribute ] ,
2224
- ) {
2225
- self . check_macro_only_attr (
2226
- hir_id,
2227
- attr_span,
2228
- span,
2229
- target,
2230
- attrs,
2231
- "allow_internal_unstable" ,
2232
- )
2233
- }
2234
-
2235
- /// Outputs an error for `#[allow_internal_unsafe]` which can only be applied to macros.
2236
- /// (Allows proc_macro functions)
2237
- fn check_allow_internal_unsafe (
2238
- & self ,
2239
- hir_id : HirId ,
2240
- attr_span : Span ,
2241
- span : Span ,
2242
- target : Target ,
2243
- attrs : & [ Attribute ] ,
2244
- ) {
2245
- self . check_macro_only_attr ( hir_id, attr_span, span, target, attrs, "allow_internal_unsafe" )
2246
- }
2247
-
2248
- /// Outputs an error for attributes that can only be applied to macros, such as
2249
- /// `#[allow_internal_unsafe]` and `#[allow_internal_unstable]`.
2250
- /// (Allows proc_macro functions)
2251
2215
// FIXME(jdonszelmann): if possible, move to attr parsing
2252
- fn check_macro_only_attr (
2216
+ fn check_allow_internal_unstable (
2253
2217
& self ,
2254
2218
hir_id : HirId ,
2255
2219
attr_span : Span ,
2256
2220
span : Span ,
2257
2221
target : Target ,
2258
2222
attrs : & [ Attribute ] ,
2259
- attr_name : & str ,
2260
2223
) {
2261
2224
match target {
2262
2225
Target :: Fn => {
@@ -2275,14 +2238,18 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
2275
2238
// erroneously allowed it and some crates used it accidentally, to be compatible
2276
2239
// with crates depending on them, we can't throw an error here.
2277
2240
Target :: Field | Target :: Arm => {
2278
- self . inline_attr_str_error_without_macro_def ( hir_id, attr_span, attr_name) ;
2241
+ self . inline_attr_str_error_without_macro_def (
2242
+ hir_id,
2243
+ attr_span,
2244
+ "allow_internal_unstable" ,
2245
+ ) ;
2279
2246
return ;
2280
2247
}
2281
2248
// otherwise continue out of the match
2282
2249
_ => { }
2283
2250
}
2284
2251
2285
- self . tcx . dcx ( ) . emit_err ( errors:: MacroOnlyAttribute { attr_span, span } ) ;
2252
+ self . tcx . dcx ( ) . emit_err ( errors:: AllowInternalUnstable { attr_span, span } ) ;
2286
2253
}
2287
2254
2288
2255
/// Checks if the items on the `#[debugger_visualizer]` attribute are valid.
0 commit comments