Rollup merge of #64763 - GuillaumeGomez:long-err-explanation-E0734, r=estebank

Add E0734 and its long explanation

Part of https://github.com/rust-lang/rust/issues/61137
This commit is contained in:
Mazdak Farrokhzad 2019-09-28 22:12:02 +02:00 committed by GitHub
commit 01075d8f6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 59 additions and 32 deletions

View File

@ -2217,6 +2217,23 @@ Examples of erroneous code:
static X: u32 = 42;
```
"##,
E0734: r##"
A stability attribute has been used outside of the standard library.
Erroneous code examples:
```compile_fail,E0734
#[rustc_deprecated(since = "b", reason = "text")] // invalid
#[stable(feature = "a", since = "b")] // invalid
#[unstable(feature = "b", issue = "0")] // invalid
fn foo(){}
```
These attributes are meant to only be used by the standard library and are
rejected in your own crates.
"##,
;
// E0006, // merged with E0005
// E0101, // replaced with E0282

View File

@ -199,8 +199,12 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
let name = attr.name_or_empty();
if [sym::unstable, sym::stable, sym::rustc_deprecated].contains(&name) {
attr::mark_used(attr);
self.tcx.sess.span_err(attr.span, "stability attributes may not be used \
outside of the standard library");
struct_span_err!(
self.tcx.sess,
attr.span,
E0734,
"stability attributes may not be used outside of the standard library",
).emit();
}
}

View File

@ -1,40 +1,40 @@
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-rustc_deprecated.rs:7:1
|
LL | #![rustc_deprecated()]
| ^^^^^^^^^^^^^^^^^^^^^^
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-rustc_deprecated.rs:10:1
|
LL | #[rustc_deprecated()]
| ^^^^^^^^^^^^^^^^^^^^^
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-rustc_deprecated.rs:13:17
|
LL | mod inner { #![rustc_deprecated()] }
| ^^^^^^^^^^^^^^^^^^^^^^
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-rustc_deprecated.rs:16:5
|
LL | #[rustc_deprecated()] fn f() { }
| ^^^^^^^^^^^^^^^^^^^^^
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-rustc_deprecated.rs:19:5
|
LL | #[rustc_deprecated()] struct S;
| ^^^^^^^^^^^^^^^^^^^^^
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-rustc_deprecated.rs:22:5
|
LL | #[rustc_deprecated()] type T = S;
| ^^^^^^^^^^^^^^^^^^^^^
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-rustc_deprecated.rs:25:5
|
LL | #[rustc_deprecated()] impl S { }
@ -42,3 +42,4 @@ LL | #[rustc_deprecated()] impl S { }
error: aborting due to 7 previous errors
For more information about this error, try `rustc --explain E0734`.

View File

@ -1,40 +1,40 @@
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-stable.rs:7:1
|
LL | #![stable()]
| ^^^^^^^^^^^^
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-stable.rs:10:1
|
LL | #[stable()]
| ^^^^^^^^^^^
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-stable.rs:13:17
|
LL | mod inner { #![stable()] }
| ^^^^^^^^^^^^
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-stable.rs:16:5
|
LL | #[stable()] fn f() { }
| ^^^^^^^^^^^
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-stable.rs:19:5
|
LL | #[stable()] struct S;
| ^^^^^^^^^^^
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-stable.rs:22:5
|
LL | #[stable()] type T = S;
| ^^^^^^^^^^^
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-stable.rs:25:5
|
LL | #[stable()] impl S { }
@ -42,3 +42,4 @@ LL | #[stable()] impl S { }
error: aborting due to 7 previous errors
For more information about this error, try `rustc --explain E0734`.

View File

@ -1,40 +1,40 @@
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-unstable.rs:7:1
|
LL | #![unstable()]
| ^^^^^^^^^^^^^^
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-unstable.rs:10:1
|
LL | #[unstable()]
| ^^^^^^^^^^^^^
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-unstable.rs:13:17
|
LL | mod inner { #![unstable()] }
| ^^^^^^^^^^^^^^
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-unstable.rs:16:5
|
LL | #[unstable()] fn f() { }
| ^^^^^^^^^^^^^
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-unstable.rs:19:5
|
LL | #[unstable()] struct S;
| ^^^^^^^^^^^^^
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-unstable.rs:22:5
|
LL | #[unstable()] type T = S;
| ^^^^^^^^^^^^^
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-unstable.rs:25:5
|
LL | #[unstable()] impl S { }
@ -42,3 +42,4 @@ LL | #[unstable()] impl S { }
error: aborting due to 7 previous errors
For more information about this error, try `rustc --explain E0734`.

View File

@ -1,10 +1,10 @@
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/feature-gate-staged_api.rs:1:1
|
LL | #![stable(feature = "a", since = "b")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/feature-gate-staged_api.rs:8:1
|
LL | #[stable(feature = "a", since = "b")]
@ -12,3 +12,4 @@ LL | #[stable(feature = "a", since = "b")]
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0734`.

View File

@ -1,16 +1,16 @@
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/stability-attribute-non-staged-force-unstable.rs:3:1
|
LL | #[unstable()]
| ^^^^^^^^^^^^^
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/stability-attribute-non-staged-force-unstable.rs:4:1
|
LL | #[stable()]
| ^^^^^^^^^^^
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/stability-attribute-non-staged-force-unstable.rs:5:1
|
LL | #[rustc_deprecated()]
@ -18,3 +18,4 @@ LL | #[rustc_deprecated()]
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0734`.

View File

@ -1,16 +1,16 @@
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/stability-attribute-non-staged.rs:1:1
|
LL | #[unstable()]
| ^^^^^^^^^^^^^
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/stability-attribute-non-staged.rs:2:1
|
LL | #[stable()]
| ^^^^^^^^^^^
error: stability attributes may not be used outside of the standard library
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/stability-attribute-non-staged.rs:3:1
|
LL | #[rustc_deprecated()]
@ -18,3 +18,4 @@ LL | #[rustc_deprecated()]
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0734`.

View File

@ -384,7 +384,7 @@ fn map_lib_features(base_src_path: &Path,
let file = entry.path();
let filename = file.file_name().unwrap().to_string_lossy();
if !filename.ends_with(".rs") || filename == "features.rs" ||
filename == "diagnostic_list.rs" {
filename == "diagnostic_list.rs" || filename == "error_codes.rs" {
return;
}