Skip to content

Commit d81f6ad

Browse files
Remove the old target checking logic
1 parent b7ed7d3 commit d81f6ad

File tree

13 files changed

+148
-1309
lines changed

13 files changed

+148
-1309
lines changed

compiler/rustc_builtin_macros/messages.ftl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,6 @@ builtin_macros_only_one_argument = {$name} takes 1 argument
259259
260260
builtin_macros_proc_macro = `proc-macro` crate types currently cannot export any items other than functions tagged with `#[proc_macro]`, `#[proc_macro_derive]`, or `#[proc_macro_attribute]`
261261
262-
builtin_macros_proc_macro_attribute_only_be_used_on_bare_functions = the `#[{$path}]` attribute may only be used on bare functions
263-
264262
builtin_macros_proc_macro_attribute_only_usable_with_crate_type = the `#[{$path}]` attribute is only usable with crates of the `proc-macro` crate type
265263
266264
builtin_macros_requires_cfg_pattern =

compiler/rustc_builtin_macros/src/errors.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -905,14 +905,6 @@ pub(crate) struct TakesNoArguments<'a> {
905905
pub name: &'a str,
906906
}
907907

908-
#[derive(Diagnostic)]
909-
#[diag(builtin_macros_proc_macro_attribute_only_be_used_on_bare_functions)]
910-
pub(crate) struct AttributeOnlyBeUsedOnBareFunctions<'a> {
911-
#[primary_span]
912-
pub span: Span,
913-
pub path: &'a str,
914-
}
915-
916908
#[derive(Diagnostic)]
917909
#[diag(builtin_macros_proc_macro_attribute_only_usable_with_crate_type)]
918910
pub(crate) struct AttributeOnlyUsableWithCrateType<'a> {

compiler/rustc_builtin_macros/src/proc_macro_harness.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,7 @@ impl<'a> Visitor<'a> for CollectProcMacros<'a> {
231231
let fn_ident = if let ast::ItemKind::Fn(fn_) = &item.kind {
232232
fn_.ident
233233
} else {
234-
self.dcx
235-
.create_err(errors::AttributeOnlyBeUsedOnBareFunctions {
236-
span: attr.span,
237-
path: &pprust::path_to_string(&attr.get_normal_item().path),
238-
})
239-
.emit();
234+
// Error handled by general target checking logic
240235
return;
241236
};
242237

compiler/rustc_error_codes/src/error_codes/E0518.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
#### Note: this error code is no longer emitted by the compiler.
2+
13
An `#[inline(..)]` attribute was incorrectly placed on something other than a
24
function or method.
35

46
Example of erroneous code:
57

6-
```compile_fail,E0518
8+
```ignore (no longer emitted)
79
#[inline(always)]
810
struct Foo;
911
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
#### Note: this error code is no longer emitted by the compiler.
2+
13
This error indicates that a `#[non_exhaustive]` attribute was incorrectly placed
24
on something other than a struct or enum.
35

46
Erroneous code example:
57

6-
```compile_fail,E0701
8+
```ignore (no longer emitted)
79
#[non_exhaustive]
810
trait Foo { }
911
```

compiler/rustc_error_codes/src/error_codes/E0739.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
#### Note: this error code is no longer emitted by the compiler.
2+
13
`#[track_caller]` must be applied to a function
24

35
Erroneous code example:
46

5-
```compile_fail,E0739
7+
```ignore (no longer emitted)
68
#[track_caller]
79
struct Bar {
810
a: u8,

compiler/rustc_error_codes/src/error_codes/E0755.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
#### Note: this error code is no longer emitted by the compiler.
2+
13
The `ffi_pure` attribute was used on a non-foreign function.
24

35
Erroneous code example:
46

5-
```compile_fail,E0755
7+
```ignore (no longer emitted)
68
#![feature(ffi_pure)]
79
810
#[unsafe(ffi_pure)] // error!

compiler/rustc_error_codes/src/error_codes/E0756.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
#### Note: this error code is no longer emitted by the compiler.
2+
13
The `ffi_const` attribute was used on something other than a foreign function
24
declaration.
35

46
Erroneous code example:
57

6-
```compile_fail,E0756
8+
```ignore (no longer emitted)
79
#![feature(ffi_const)]
810
911
#[unsafe(ffi_const)] // error!

compiler/rustc_error_codes/src/error_codes/E0788.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#### Note: this error code is no longer emitted by the compiler.
2+
13
A `#[coverage(off|on)]` attribute was found in a position where it is not
24
allowed.
35

@@ -10,7 +12,7 @@ Coverage attributes can be applied to:
1012

1113
Example of erroneous code:
1214

13-
```compile_fail,E0788
15+
```ignore (no longer emitted)
1416
unsafe extern "C" {
1517
#[coverage(off)]
1618
fn foreign_fn();

compiler/rustc_hir/src/hir.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,6 +1233,13 @@ impl Attribute {
12331233
_ => None,
12341234
}
12351235
}
1236+
1237+
pub fn is_parsed_attr(&self) -> bool {
1238+
match self {
1239+
Attribute::Parsed(_) => true,
1240+
Attribute::Unparsed(_) => false,
1241+
}
1242+
}
12361243
}
12371244

12381245
impl AttributeExt for Attribute {
@@ -1303,13 +1310,8 @@ impl AttributeExt for Attribute {
13031310
match &self {
13041311
Attribute::Unparsed(u) => u.span,
13051312
// FIXME: should not be needed anymore when all attrs are parsed
1306-
Attribute::Parsed(AttributeKind::Deprecation { span, .. }) => *span,
13071313
Attribute::Parsed(AttributeKind::DocComment { span, .. }) => *span,
1308-
Attribute::Parsed(AttributeKind::MacroUse { span, .. }) => *span,
1309-
Attribute::Parsed(AttributeKind::MayDangle(span)) => *span,
1310-
Attribute::Parsed(AttributeKind::Ignore { span, .. }) => *span,
1311-
Attribute::Parsed(AttributeKind::ShouldPanic { span, .. }) => *span,
1312-
Attribute::Parsed(AttributeKind::AutomaticallyDerived(span)) => *span,
1314+
Attribute::Parsed(AttributeKind::Deprecation { span, .. }) => *span,
13131315
Attribute::Parsed(AttributeKind::AllowInternalUnsafe(span)) => *span,
13141316
a => panic!("can't get the span of an arbitrary parsed attribute: {a:?}"),
13151317
}

0 commit comments

Comments
 (0)