Skip to content

Commit c523672

Browse files
committedOct 30, 2023
Preserve deprecation attribute even if 'since' version is missing
1 parent b106167 commit c523672

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed
 

Diff for: ‎compiler/rustc_attr/src/builtin.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -876,10 +876,10 @@ pub fn find_deprecation(
876876
sess.emit_err(session_diagnostics::InvalidSince { span: attr.span });
877877
Some(DeprecatedSince::Err)
878878
}
879-
} else if is_rustc {
880-
sess.emit_err(session_diagnostics::MissingSince { span: attr.span });
881-
continue;
882879
} else {
880+
if is_rustc {
881+
sess.emit_err(session_diagnostics::MissingSince { span: attr.span });
882+
}
883883
None
884884
};
885885

Diff for: ‎tests/ui/stability-attribute/stability-attribute-sanity-4.rs

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ mod bogus_attribute_types_2 {
1919

2020
#[stable(feature = "a", since = "3.3.3")]
2121
#[deprecated] //~ ERROR missing 'since'
22+
//~^ ERROR missing 'note'
2223
fn f5() { }
2324

2425
#[stable(feature = "a", since = "3.3.3")]

Diff for: ‎tests/ui/stability-attribute/stability-attribute-sanity-4.stderr

+10-3
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,19 @@ error[E0542]: missing 'since'
2828
LL | #[deprecated]
2929
| ^^^^^^^^^^^^^
3030

31+
error[E0543]: missing 'note'
32+
--> $DIR/stability-attribute-sanity-4.rs:21:5
33+
|
34+
LL | #[deprecated]
35+
| ^^^^^^^^^^^^^
36+
3137
error[E0542]: missing 'since'
32-
--> $DIR/stability-attribute-sanity-4.rs:25:5
38+
--> $DIR/stability-attribute-sanity-4.rs:26:5
3339
|
3440
LL | #[deprecated = "a"]
3541
| ^^^^^^^^^^^^^^^^^^^
3642

37-
error: aborting due to 6 previous errors
43+
error: aborting due to 7 previous errors
3844

39-
For more information about this error, try `rustc --explain E0542`.
45+
Some errors have detailed explanations: E0542, E0543.
46+
For more information about an error, try `rustc --explain E0542`.

0 commit comments

Comments
 (0)