about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-03-08 05:46:08 +0000
committerbors <bors@rust-lang.org>2019-03-08 05:46:08 +0000
commit0547ceb200f0385ba437e1808b468ec81e683c64 (patch)
tree48abe82915f918cf06b7f419d38a9b663e806737 /src/test
parent88f755f8a84df1d9e6b17cf10c96ae8b93481b2e (diff)
parentf2ef283b7265a35ee4b6e250e1160ba28b33953a (diff)
downloadrust-0547ceb200f0385ba437e1808b468ec81e683c64.tar.gz
rust-0547ceb200f0385ba437e1808b468ec81e683c64.zip
Auto merge of #58013 - Zoxc:stable-hash-macro-simple, r=oli-obk
Create a derive macro for HashStable and allow proc macros in rustc

A combination of https://github.com/rust-lang/rust/pull/56864 and https://github.com/rust-lang/rust/pull/56795. There were complications with using `serde_derive` as rustc doesn't know which crate to use for the host when there is a serde_derive in the sysroot and cargo passes another on the command line built from crates.io.

r? @eddyb (for proc macro changes) @alexcrichton (for rustbuild changes) @michaelwoerister (for the macro itself)
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui-fulldeps/hash-stable-is-unstable.rs15
-rw-r--r--src/test/ui-fulldeps/hash-stable-is-unstable.stderr48
2 files changed, 63 insertions, 0 deletions
diff --git a/src/test/ui-fulldeps/hash-stable-is-unstable.rs b/src/test/ui-fulldeps/hash-stable-is-unstable.rs
new file mode 100644
index 00000000000..9f67f642df1
--- /dev/null
+++ b/src/test/ui-fulldeps/hash-stable-is-unstable.rs
@@ -0,0 +1,15 @@
+// ignore-stage1
+
+extern crate rustc_data_structures;
+//~^ use of unstable library feature 'rustc_private'
+extern crate rustc;
+//~^ use of unstable library feature 'rustc_private'
+extern crate rustc_macros;
+//~^ use of unstable library feature 'rustc_private'
+
+use rustc_macros::HashStable;
+//~^ use of unstable library feature 'rustc_private'
+
+#[derive(HashStable)]
+//~^ use of unstable library feature 'rustc_private'
+struct Test;
diff --git a/src/test/ui-fulldeps/hash-stable-is-unstable.stderr b/src/test/ui-fulldeps/hash-stable-is-unstable.stderr
new file mode 100644
index 00000000000..e7007204d38
--- /dev/null
+++ b/src/test/ui-fulldeps/hash-stable-is-unstable.stderr
@@ -0,0 +1,48 @@
+error[E0601]: `main` function not found in crate `hash_stable_is_unstable`
+   |
+   = note: consider adding a `main` function to `$DIR/hash-stable-is-unstable.rs`
+
+error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
+  --> $DIR/hash-stable-is-unstable.rs:3:1
+   |
+LL | extern crate rustc_data_structures;
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: add #![feature(rustc_private)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
+  --> $DIR/hash-stable-is-unstable.rs:5:1
+   |
+LL | extern crate rustc;
+   | ^^^^^^^^^^^^^^^^^^^
+   |
+   = help: add #![feature(rustc_private)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
+  --> $DIR/hash-stable-is-unstable.rs:7:1
+   |
+LL | extern crate rustc_macros;
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: add #![feature(rustc_private)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
+  --> $DIR/hash-stable-is-unstable.rs:10:5
+   |
+LL | use rustc_macros::HashStable;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: add #![feature(rustc_private)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
+  --> $DIR/hash-stable-is-unstable.rs:13:10
+   |
+LL | #[derive(HashStable)]
+   |          ^^^^^^^^^^
+   |
+   = help: add #![feature(rustc_private)] to the crate attributes to enable
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0601, E0658.
+For more information about an error, try `rustc --explain E0601`.