From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/resolve/resolve-bad-visibility.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/test/ui/resolve/resolve-bad-visibility.rs (limited to 'src/test/ui/resolve/resolve-bad-visibility.rs') diff --git a/src/test/ui/resolve/resolve-bad-visibility.rs b/src/test/ui/resolve/resolve-bad-visibility.rs new file mode 100644 index 000000000..7d48bb97b --- /dev/null +++ b/src/test/ui/resolve/resolve-bad-visibility.rs @@ -0,0 +1,15 @@ +enum E {} +trait Tr {} + +pub(in E) struct S; //~ ERROR expected module, found enum `E` +pub(in Tr) struct Z; //~ ERROR expected module, found trait `Tr` +pub(in std::vec) struct F; //~ ERROR visibilities can only be restricted to ancestor modules +pub(in nonexistent) struct G; //~ ERROR failed to resolve +pub(in too_soon) struct H; //~ ERROR failed to resolve + +// Visibilities are resolved eagerly without waiting for modules becoming fully populated. +// Visibilities can only use ancestor modules legally which are always available in time, +// so the worst thing that can happen due to eager resolution is a suboptimal error message. +mod too_soon {} + +fn main () {} -- cgit v1.2.3