aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/nameres
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2020-07-22 13:01:50 +0100
committerJonas Schievink <[email protected]>2020-07-22 13:01:50 +0100
commitdce99874368e3e42402b4443c5eb39495c8c162a (patch)
tree0863642bd1e419ea14b7caf2eb7b500a5d8236cb /crates/ra_hir_def/src/nameres
parentc07eaf868dab86d061ae80c098798a767b910e91 (diff)
Check that visibility upgrade path is hit
Diffstat (limited to 'crates/ra_hir_def/src/nameres')
-rw-r--r--crates/ra_hir_def/src/nameres/collector.rs7
-rw-r--r--crates/ra_hir_def/src/nameres/tests.rs5
2 files changed, 8 insertions, 4 deletions
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs
index 8913111f1..a030cab47 100644
--- a/crates/ra_hir_def/src/nameres/collector.rs
+++ b/crates/ra_hir_def/src/nameres/collector.rs
@@ -625,7 +625,12 @@ impl DefCollector<'_> {
625 panic!("`Tr as _` imports with unrelated visibilities {:?} and {:?} (trait {:?})", old_vis, vis, tr); 625 panic!("`Tr as _` imports with unrelated visibilities {:?} and {:?} (trait {:?})", old_vis, vis, tr);
626 }); 626 });
627 627
628 max_vis != old_vis 628 if max_vis == old_vis {
629 false
630 } else {
631 mark::hit!(upgrade_underscore_visibility);
632 true
633 }
629 } 634 }
630 }; 635 };
631 636
diff --git a/crates/ra_hir_def/src/nameres/tests.rs b/crates/ra_hir_def/src/nameres/tests.rs
index 502b1fb69..839b1de57 100644
--- a/crates/ra_hir_def/src/nameres/tests.rs
+++ b/crates/ra_hir_def/src/nameres/tests.rs
@@ -619,6 +619,7 @@ use crate::reex::*;
619 619
620#[test] 620#[test]
621fn underscore_pub_crate_reexport() { 621fn underscore_pub_crate_reexport() {
622 mark::check!(upgrade_underscore_visibility);
622 check( 623 check(
623 r#" 624 r#"
624//- /main.rs crate:main deps:lib 625//- /main.rs crate:main deps:lib
@@ -629,9 +630,7 @@ use tr::Tr as _;
629pub use tr::Tr as _; 630pub use tr::Tr as _;
630 631
631mod tr { 632mod tr {
632 pub trait Tr { 633 pub trait Tr {}
633 fn method(&self) {}
634 }
635} 634}
636 "#, 635 "#,
637 expect![[r#" 636 expect![[r#"