From de5172ce5f41cc915829bd4ebc8409c42d936808 Mon Sep 17 00:00:00 2001 From: Robin Stocker Date: Thu, 27 Oct 2016 15:24:08 +1100 Subject: [PATCH] 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". --- src/librustc_resolve/lib.rs | 2 +- src/test/compile-fail/issue-12612.rs | 2 +- src/test/compile-fail/issue-1697.rs | 2 +- src/test/compile-fail/unresolved-import.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 856eb348eaeec..7bb16640d61f9 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 20943bd0ea077..c6f76ca78874b 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 dc09af0ada66f..1375200271c55 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 0a9a437569730..47490af0ff35e 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`?