]> git.lizzy.rs Git - rust.git/commitdiff
Create new error code E0740 for visibility restrictions to ancestor module issues
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Mon, 14 Oct 2019 11:13:38 +0000 (13:13 +0200)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Tue, 29 Oct 2019 12:56:19 +0000 (13:56 +0100)
src/librustc_resolve/build_reduced_graph.rs
src/librustc_resolve/error_codes.rs

index c18bdfad22cf074f190fed46038a9f126f93a026..3564aefba73ae9c8b3ad090d9a23f1d26bba872e 100644 (file)
@@ -256,9 +256,9 @@ fn resolve_visibility(&mut self, vis: &ast::Visibility) -> ty::Visibility {
                                 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
                                 }
                             }
index 9515c87ce4bb5194b813b738a97e1d56ee8bce38..b76373703d1eaf815a1c322bbbb3eef71c6a0f1b 100644 (file)
@@ -1953,4 +1953,5 @@ struct Foo<X = Box<Self>> {
 //  E0470, removed
     E0577,
     E0578,
+    E0740,
 }