diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index fcf0b7022a7a7..5b2c1061c0dab 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -1978,6 +1978,11 @@ pub impl Resolver { import_directive.module_path, *import_directive.subclass)); self.session.span_err(import_directive.span, msg); + + // Suggest to the user to declare library linkage. + let msg2 = fmt!("possible fix: declare external link with `extern mod %s;`", + *self.session.str_of(import_directive.module_path[0])); + self.session.span_note(import_directive.span, msg2); } Indeterminate => { // Bail out. We'll come around next time. diff --git a/src/test/compile-fail/import-unresolved.rs b/src/test/compile-fail/import-unresolved.rs new file mode 100644 index 0000000000000..e91c9ffc62490 --- /dev/null +++ b/src/test/compile-fail/import-unresolved.rs @@ -0,0 +1,15 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// error-pattern: unresolved +use std::*; +//-^ NOTE possible fix: declare external link with `extern mod std;` + +fn main(args: ~[str]) { debug!("unresolved"); }