From dce99874368e3e42402b4443c5eb39495c8c162a Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Wed, 22 Jul 2020 14:01:50 +0200 Subject: Check that visibility upgrade path is hit --- crates/ra_hir_def/src/nameres/collector.rs | 7 ++++++- crates/ra_hir_def/src/nameres/tests.rs | 5 ++--- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'crates/ra_hir_def') 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<'_> { panic!("`Tr as _` imports with unrelated visibilities {:?} and {:?} (trait {:?})", old_vis, vis, tr); }); - max_vis != old_vis + if max_vis == old_vis { + false + } else { + mark::hit!(upgrade_underscore_visibility); + true + } } }; 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::*; #[test] fn underscore_pub_crate_reexport() { + mark::check!(upgrade_underscore_visibility); check( r#" //- /main.rs crate:main deps:lib @@ -629,9 +630,7 @@ use tr::Tr as _; pub use tr::Tr as _; mod tr { - pub trait Tr { - fn method(&self) {} - } + pub trait Tr {} } "#, expect![[r#" -- cgit v1.2.3