Skip to content

Commit 68d099a

Browse files
Create new error code E0734 for stability attributes used outside of standard library
1 parent c9edc02 commit 68d099a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/librustc/error_codes.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2247,4 +2247,5 @@ static X: u32 = 42;
22472247
E0726, // non-explicit (not `'_`) elided lifetime in unsupported position
22482248
E0727, // `async` generators are not yet supported
22492249
E0728, // `await` must be in an `async` function or block
2250+
E0734, // stability attributes may not be used outside of the standard library
22502251
}

src/librustc/middle/stability.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,12 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
199199
let name = attr.name_or_empty();
200200
if [sym::unstable, sym::stable, sym::rustc_deprecated].contains(&name) {
201201
attr::mark_used(attr);
202-
self.tcx.sess.span_err(attr.span, "stability attributes may not be used \
203-
outside of the standard library");
202+
struct_span_err!(
203+
self.tcx.sess,
204+
attr.span,
205+
E0734,
206+
"stability attributes may not be used outside of the standard library",
207+
).emit();
204208
}
205209
}
206210

0 commit comments

Comments
 (0)