From e52589e3a72ed57d47956d16d90f4b15fc7408f0 Mon Sep 17 00:00:00 2001 From: kazatsuyu Date: Fri, 22 Jan 2021 22:28:45 +0900 Subject: Fix error when using "extern crate self as" --- crates/hir_def/src/nameres/tests/diagnostics.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'crates/hir_def/src/nameres/tests') diff --git a/crates/hir_def/src/nameres/tests/diagnostics.rs b/crates/hir_def/src/nameres/tests/diagnostics.rs index 58d69d3c6..679a505dc 100644 --- a/crates/hir_def/src/nameres/tests/diagnostics.rs +++ b/crates/hir_def/src/nameres/tests/diagnostics.rs @@ -61,6 +61,21 @@ fn unresolved_extern_crate() { ); } +#[test] +fn extern_crate_self_as() { + check_diagnostics( + r" + //- /lib.rs + extern crate doesnotexist; + //^^^^^^^^^^^^^^^^^^^^^^^^^^ unresolved extern crate + // 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( -- cgit v1.2.3 From 90d6740e3237e396f437619d115b8595d2242392 Mon Sep 17 00:00:00 2001 From: kazatsuyu Date: Sat, 23 Jan 2021 00:11:37 +0900 Subject: Add mark::check! and mark::hit! --- crates/hir_def/src/nameres/tests/diagnostics.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'crates/hir_def/src/nameres/tests') diff --git a/crates/hir_def/src/nameres/tests/diagnostics.rs b/crates/hir_def/src/nameres/tests/diagnostics.rs index 679a505dc..e8e72e5ef 100644 --- a/crates/hir_def/src/nameres/tests/diagnostics.rs +++ b/crates/hir_def/src/nameres/tests/diagnostics.rs @@ -63,6 +63,7 @@ fn unresolved_extern_crate() { #[test] fn extern_crate_self_as() { + mark::check!(extern_crate_self_as); check_diagnostics( r" //- /lib.rs -- cgit v1.2.3