From c8420db21d6d64ed9ce8c7937ad7ceda0eee8d20 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 14 Oct 2019 13:13:38 +0200 Subject: [PATCH] Create new error code E0740 for visibility restrictions to ancestor module issues --- src/librustc_resolve/build_reduced_graph.rs | 6 +++--- src/librustc_resolve/error_codes.rs | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index c18bdfad22c..3564aefba73 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -256,9 +256,9 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> { if self.r.is_accessible_from(vis, parent_scope.module) { vis } else { - let msg = - "visibilities can only be restricted to ancestor modules"; - self.r.session.span_err(path.span, msg); + struct_span_err!(self.r.session, path.span, E0741, + "visibilities can only be restricted to ancestor modules") + .emit(); ty::Visibility::Public } } diff --git a/src/librustc_resolve/error_codes.rs b/src/librustc_resolve/error_codes.rs index 9515c87ce4b..b76373703d1 100644 --- a/src/librustc_resolve/error_codes.rs +++ b/src/librustc_resolve/error_codes.rs @@ -1953,4 +1953,5 @@ struct Foo> { // E0470, removed E0577, E0578, + E0740, }