9247: internal: refactor unresolved extern crate diagnostic r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2021-06-13 13:06:27 +00:00 committed by GitHub
commit e6fa9b016f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 60 additions and 54 deletions

View file

@ -25,35 +25,6 @@ fn unresolved_import() {
);
}
#[test]
fn unresolved_extern_crate() {
check_diagnostics(
r"
//- /main.rs crate:main deps:core
extern crate core;
extern crate doesnotexist;
//^^^^^^^^^^^^^^^^^^^^^^^^^^ UnresolvedExternCrate
//- /lib.rs crate:core
",
);
}
#[test]
fn extern_crate_self_as() {
cov_mark::check!(extern_crate_self_as);
check_diagnostics(
r"
//- /lib.rs
extern crate doesnotexist;
//^^^^^^^^^^^^^^^^^^^^^^^^^^ UnresolvedExternCrate
// Should not error.
extern crate self as foo;
struct Foo;
use foo::Foo as Bar;
",
);
}
#[test]
fn dedup_unresolved_import_from_unresolved_crate() {
check_diagnostics(