about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorggomez <guillaume1.gomez@gmail.com>2016-08-29 15:29:07 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2016-08-30 23:19:06 +0200
commite32dad3a7e3425b9707d7ae944298fa3a2fb7314 (patch)
tree7a79d18f26a31ebd4cfb95364ad678a955838409 /src
parentb9eaeb12648e1b26ef86d9efc24f0f456c5d8e2c (diff)
downloadrust-e32dad3a7e3425b9707d7ae944298fa3a2fb7314.tar.gz
rust-e32dad3a7e3425b9707d7ae944298fa3a2fb7314.zip
Add E0468 error explanation
Diffstat (limited to 'src')
-rw-r--r--src/librustc_metadata/diagnostics.rs29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/librustc_metadata/diagnostics.rs b/src/librustc_metadata/diagnostics.rs
index 5127936b2e2..42f607ccca0 100644
--- a/src/librustc_metadata/diagnostics.rs
+++ b/src/librustc_metadata/diagnostics.rs
@@ -157,6 +157,34 @@ extern crate macros_for_good;
 ```
 "##,
 
+E0468: r##"
+A non-root module attempts to import macros from another crate.
+
+Example of erroneous code:
+
+```compile_fail,E0468
+mod foo {
+    #[macro_use(helpful_macro)] // error: must be at crate root to import
+    extern crate some_crate;    //        macros from another crate
+    helpful_macro!(...)
+}
+```
+
+Only `extern crate` imports at the crate root level are allowed to import
+macros.
+
+Either move the macro import to crate root or do without the foreign macros.
+This will work:
+
+```ignore
+#[macro_use(helpful_macro)]
+extern crate some_crate;
+
+mod foo {
+    helpful_macro!(...)
+}
+```
+"##,
 }
 
 register_diagnostics! {
@@ -168,7 +196,6 @@ register_diagnostics! {
     E0462, // found staticlib `..` instead of rlib or dylib
     E0464, // multiple matching crates for `..`
     E0465, // multiple .. candidates for `..` found
-    E0468, // an `extern crate` loading macros must be at the crate root
     E0469, // imported macro not found
     E0470, // reexported macro not found
     E0519, // local crate and dependency have same (crate-name, disambiguator)