about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobin Stocker <robin@nibor.org>2016-10-27 15:24:08 +1100
committerRobin Stocker <robin@nibor.org>2016-10-27 15:24:08 +1100
commitde5172ce5f41cc915829bd4ebc8409c42d936808 (patch)
treeb29401c14c8aebff24933cf12c911d465801a9cc
parentc59cb71d976ceabf00c7da0224a795fab530601e (diff)
downloadrust-de5172ce5f41cc915829bd4ebc8409c42d936808.tar.gz
rust-de5172ce5f41cc915829bd4ebc8409c42d936808.zip
Add semicolon to "Maybe a missing `extern crate foo`" message
I had it a couple of times that I was missing the "extern crate" line
after I introduced a new dependency. So I copied the text from the
message and inserted it into the beginning of my code, only to find the
compiler complaining that I was missing the semicolon. (I forgot to add
it after the text that I had pasted.)

There's a similar message which does include the semicolon, namely
"help: you can import it into scope: `use foo::Bar;`". I think the two
messages should be consistent, so this change adds it for "extern
crate".
-rw-r--r--src/librustc_resolve/lib.rs2
-rw-r--r--src/test/compile-fail/issue-12612.rs2
-rw-r--r--src/test/compile-fail/issue-1697.rs2
-rw-r--r--src/test/compile-fail/unresolved-import.rs2
4 files changed, 4 insertions, 4 deletions
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index 856eb348eae..7bb16640d61 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -1412,7 +1412,7 @@ impl<'a> Resolver<'a> {
 
                                 format!("Did you mean `{}{}`?", prefix, path_str)
                             }
-                            None => format!("Maybe a missing `extern crate {}`?", segment_name),
+                            None => format!("Maybe a missing `extern crate {};`?", segment_name),
                         }
                     } else {
                         format!("Could not find `{}` in `{}`", segment_name, module_name)
diff --git a/src/test/compile-fail/issue-12612.rs b/src/test/compile-fail/issue-12612.rs
index 20943bd0ea0..c6f76ca7887 100644
--- a/src/test/compile-fail/issue-12612.rs
+++ b/src/test/compile-fail/issue-12612.rs
@@ -16,7 +16,7 @@ use foo::bar;
 
 mod test {
     use bar::foo; //~ ERROR unresolved import `bar::foo` [E0432]
-                  //~^ Maybe a missing `extern crate bar`?
+                  //~^ Maybe a missing `extern crate bar;`?
 }
 
 fn main() {}
diff --git a/src/test/compile-fail/issue-1697.rs b/src/test/compile-fail/issue-1697.rs
index dc09af0ada6..1375200271c 100644
--- a/src/test/compile-fail/issue-1697.rs
+++ b/src/test/compile-fail/issue-1697.rs
@@ -11,6 +11,6 @@
 // Testing that we don't fail abnormally after hitting the errors
 
 use unresolved::*; //~ ERROR unresolved import `unresolved::*` [E0432]
-                   //~^ Maybe a missing `extern crate unresolved`?
+                   //~^ Maybe a missing `extern crate unresolved;`?
 
 fn main() {}
diff --git a/src/test/compile-fail/unresolved-import.rs b/src/test/compile-fail/unresolved-import.rs
index 0a9a4375697..47490af0ff3 100644
--- a/src/test/compile-fail/unresolved-import.rs
+++ b/src/test/compile-fail/unresolved-import.rs
@@ -11,7 +11,7 @@
 // ignore-tidy-linelength
 
 use foo::bar; //~ ERROR unresolved import `foo::bar` [E0432]
-              //~^ Maybe a missing `extern crate foo`?
+              //~^ Maybe a missing `extern crate foo;`?
 
 use bar::Baz as x; //~ ERROR unresolved import `bar::Baz` [E0432]
                    //~^ no `Baz` in `bar`. Did you mean to use `Bar`?