about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTaylor Cramer <cramertaylorj@gmail.com>2017-03-15 14:24:02 -0700
committerTaylor Cramer <cramertaylorj@gmail.com>2017-03-15 22:39:04 -0700
commit28626ca5b1228f283fbc7c85d88cf897c7750267 (patch)
treee54b7aacc3dc6b66fd1f9bac3f986d7830d34f04
parent0aeb9c12979e6da753701a798d04105b6b1a8c28 (diff)
downloadrust-28626ca5b1228f283fbc7c85d88cf897c7750267.tar.gz
rust-28626ca5b1228f283fbc7c85d88cf897c7750267.zip
Stabilize pub(restricted)
-rw-r--r--src/doc/unstable-book/src/SUMMARY.md1
-rw-r--r--src/doc/unstable-book/src/pub-restricted.md10
-rw-r--r--src/librustc/lib.rs2
-rw-r--r--src/librustc_incremental/lib.rs2
-rw-r--r--src/librustc_privacy/lib.rs4
-rw-r--r--src/libstd/lib.rs2
-rw-r--r--src/libsyntax/feature_gate.rs17
-rw-r--r--src/test/compile-fail-fulldeps/auxiliary/pub_and_stability.rs1
-rw-r--r--src/test/compile-fail/imports/unused.rs1
-rw-r--r--src/test/compile-fail/privacy/restricted/auxiliary/pub_restricted.rs2
-rw-r--r--src/test/compile-fail/privacy/restricted/feature-gate.rs27
-rw-r--r--src/test/compile-fail/privacy/restricted/lookup-ignores-private.rs2
-rw-r--r--src/test/compile-fail/privacy/restricted/private-in-public.rs4
-rw-r--r--src/test/compile-fail/privacy/restricted/struct-literal-field.rs1
-rw-r--r--src/test/compile-fail/privacy/restricted/test.rs1
-rw-r--r--src/test/compile-fail/privacy/restricted/tuple-struct-fields/test.rs2
-rw-r--r--src/test/compile-fail/privacy/restricted/tuple-struct-fields/test2.rs2
-rw-r--r--src/test/compile-fail/privacy/restricted/tuple-struct-fields/test3.rs2
-rw-r--r--src/test/compile-fail/privacy/restricted/ty-params.rs2
-rw-r--r--src/test/compile-fail/privacy/union-field-privacy-1.rs1
-rw-r--r--src/test/compile-fail/privacy/union-field-privacy-2.rs1
-rw-r--r--src/test/compile-fail/resolve-bad-visibility.rs2
-rw-r--r--src/test/ui/resolve/auxiliary/privacy-struct-ctor.rs2
-rw-r--r--src/test/ui/resolve/privacy-struct-ctor.rs2
-rw-r--r--src/test/ui/resolve/privacy-struct-ctor.stderr32
-rw-r--r--src/test/ui/span/pub-struct-field.rs2
-rw-r--r--src/test/ui/span/pub-struct-field.stderr14
27 files changed, 35 insertions, 106 deletions
diff --git a/src/doc/unstable-book/src/SUMMARY.md b/src/doc/unstable-book/src/SUMMARY.md
index 5fb323d6ce9..f5d6785d445 100644
--- a/src/doc/unstable-book/src/SUMMARY.md
+++ b/src/doc/unstable-book/src/SUMMARY.md
@@ -65,7 +65,6 @@
 - [plugin_registrar](plugin-registrar.md)
 - [prelude_import](prelude-import.md)
 - [proc_macro](proc-macro.md)
-- [pub_restricted](pub-restricted.md)
 - [quote](quote.md)
 - [relaxed_adts](relaxed-adts.md)
 - [repr_simd](repr-simd.md)
diff --git a/src/doc/unstable-book/src/pub-restricted.md b/src/doc/unstable-book/src/pub-restricted.md
deleted file mode 100644
index 730461813cb..00000000000
--- a/src/doc/unstable-book/src/pub-restricted.md
+++ /dev/null
@@ -1,10 +0,0 @@
-# `pub_restricted`
-
-The tracking issue for this feature is: [#32409]
-
-[#32409]: https://github.com/rust-lang/rust/issues/32409
-
-------------------------
-
-
-
diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs
index c4fccdcb9eb..a007c9d2c43 100644
--- a/src/librustc/lib.rs
+++ b/src/librustc/lib.rs
@@ -34,7 +34,7 @@
 #![feature(libc)]
 #![feature(loop_break_value)]
 #![feature(nonzero)]
-#![feature(pub_restricted)]
+#![cfg_attr(stage0, feature(pub_restricted))]
 #![feature(quote)]
 #![feature(rustc_diagnostic_macros)]
 #![feature(rustc_private)]
diff --git a/src/librustc_incremental/lib.rs b/src/librustc_incremental/lib.rs
index 906c4b7256f..0a8719c1253 100644
--- a/src/librustc_incremental/lib.rs
+++ b/src/librustc_incremental/lib.rs
@@ -25,7 +25,7 @@
 #![feature(core_intrinsics)]
 #![feature(conservative_impl_trait)]
 #![cfg_attr(stage0,feature(field_init_shorthand))]
-#![feature(pub_restricted)]
+#![cfg_attr(stage0, feature(pub_restricted))]
 
 extern crate graphviz;
 #[macro_use] extern crate rustc;
diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs
index 72347f1616e..074e2b873ec 100644
--- a/src/librustc_privacy/lib.rs
+++ b/src/librustc_privacy/lib.rs
@@ -951,7 +951,7 @@ impl<'a, 'tcx: 'a> TypeVisitor<'tcx> for SearchInterfaceForPrivateItemsVisitor<'
                     self.min_visibility = vis;
                 }
                 if !vis.is_at_least(self.required_visibility, self.tcx) {
-                    if self.tcx.sess.features.borrow().pub_restricted || self.has_old_errors {
+                    if self.has_old_errors {
                         let mut err = struct_span_err!(self.tcx.sess, self.span, E0446,
                             "private type `{}` in public interface", ty);
                         err.span_label(self.span, &format!("can't leak private type"));
@@ -986,7 +986,7 @@ impl<'a, 'tcx: 'a> TypeVisitor<'tcx> for SearchInterfaceForPrivateItemsVisitor<'
                 self.min_visibility = vis;
             }
             if !vis.is_at_least(self.required_visibility, self.tcx) {
-                if self.tcx.sess.features.borrow().pub_restricted || self.has_old_errors {
+                if self.has_old_errors {
                     struct_span_err!(self.tcx.sess, self.span, E0445,
                                      "private trait `{}` in public interface", trait_ref)
                         .span_label(self.span, &format!(
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index 7fa5ad25560..aa49ecfd333 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -283,7 +283,6 @@
 #![feature(placement_in_syntax)]
 #![feature(placement_new_protocol)]
 #![feature(prelude_import)]
-#![feature(pub_restricted)]
 #![feature(rand)]
 #![feature(raw)]
 #![feature(repr_simd)]
@@ -309,6 +308,7 @@
 #![feature(vec_push_all)]
 #![feature(zero_one)]
 #![cfg_attr(test, feature(update_panic_count))]
+#![cfg_attr(stage0, feature(pub_restricted))]
 
 // Explicitly import the prelude. The compiler uses this same unstable attribute
 // to import the prelude implicitly when building crates that depend on std.
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 15913d56d16..5eb9366fb2f 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -260,9 +260,6 @@ declare_features! (
     // impl specialization (RFC 1210)
     (active, specialization, "1.7.0", Some(31844)),
 
-    // pub(restricted) visibilities (RFC 1422)
-    (active, pub_restricted, "1.9.0", Some(32409)),
-
     // Allow Drop types in statics/const functions (RFC 1440)
     (active, drop_types_in_const, "1.9.0", Some(33156)),
 
@@ -406,6 +403,9 @@ declare_features! (
     (accepted, field_init_shorthand, "1.17.0", Some(37340)),
     // Allows the definition recursive static items.
     (accepted, static_recursion, "1.17.0", Some(29719)),
+    // pub(restricted) visibilities (RFC 1422)
+    (accepted, pub_restricted, "1.17.0", Some(32409)),
+
 );
 // If you change this, please modify src/doc/unstable-book as well. You must
 // move that documentation into the relevant place in the other docs, and
@@ -1410,17 +1410,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
         visit::walk_impl_item(self, ii);
     }
 
-    fn visit_vis(&mut self, vis: &'a ast::Visibility) {
-        let span = match *vis {
-            ast::Visibility::Crate(span) => span,
-            ast::Visibility::Restricted { ref path, .. } => path.span,
-            _ => return,
-        };
-        gate_feature_post!(&self, pub_restricted, span, "`pub(restricted)` syntax is experimental");
-
-        visit::walk_vis(self, vis)
-    }
-
     fn visit_generics(&mut self, g: &'a ast::Generics) {
         for t in &g.ty_params {
             if !t.attrs.is_empty() {
diff --git a/src/test/compile-fail-fulldeps/auxiliary/pub_and_stability.rs b/src/test/compile-fail-fulldeps/auxiliary/pub_and_stability.rs
index 6f458da9b52..dfbe35dfd56 100644
--- a/src/test/compile-fail-fulldeps/auxiliary/pub_and_stability.rs
+++ b/src/test/compile-fail-fulldeps/auxiliary/pub_and_stability.rs
@@ -35,7 +35,6 @@
 // non-pub fields, marked with SILLY below)
 
 #![feature(staged_api)]
-#![feature(pub_restricted)]
 
 #![stable(feature = "unit_test", since = "0.0.0")]
 
diff --git a/src/test/compile-fail/imports/unused.rs b/src/test/compile-fail/imports/unused.rs
index 05ecc781af3..1eb756fe9e4 100644
--- a/src/test/compile-fail/imports/unused.rs
+++ b/src/test/compile-fail/imports/unused.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(pub_restricted)]
 #![deny(unused)]
 
 mod foo {
diff --git a/src/test/compile-fail/privacy/restricted/auxiliary/pub_restricted.rs b/src/test/compile-fail/privacy/restricted/auxiliary/pub_restricted.rs
index b1c88ce6ce5..82d14ddb502 100644
--- a/src/test/compile-fail/privacy/restricted/auxiliary/pub_restricted.rs
+++ b/src/test/compile-fail/privacy/restricted/auxiliary/pub_restricted.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(pub_restricted)]
-
 pub(crate) struct Crate;
 #[derive(Default)]
 pub struct Universe {
diff --git a/src/test/compile-fail/privacy/restricted/feature-gate.rs b/src/test/compile-fail/privacy/restricted/feature-gate.rs
deleted file mode 100644
index e81e1e30d17..00000000000
--- a/src/test/compile-fail/privacy/restricted/feature-gate.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// gate-test-pub_restricted
-
-pub(crate) //~ ERROR experimental
-mod foo {}
-
-pub(self) //~ ERROR experimental
-mod bar {}
-
-struct S {
-    pub(self) x: i32, //~ ERROR experimental
-}
-impl S {
-    pub(self) fn f() {} //~ ERROR experimental
-}
-extern {
-    pub(self) fn f(); //~ ERROR experimental
-}
diff --git a/src/test/compile-fail/privacy/restricted/lookup-ignores-private.rs b/src/test/compile-fail/privacy/restricted/lookup-ignores-private.rs
index 2d4b5545544..abd71b9c90b 100644
--- a/src/test/compile-fail/privacy/restricted/lookup-ignores-private.rs
+++ b/src/test/compile-fail/privacy/restricted/lookup-ignores-private.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs, pub_restricted)]
+#![feature(rustc_attrs)]
 #![allow(warnings)]
 
 mod foo {
diff --git a/src/test/compile-fail/privacy/restricted/private-in-public.rs b/src/test/compile-fail/privacy/restricted/private-in-public.rs
index 84328ca387d..2f063628803 100644
--- a/src/test/compile-fail/privacy/restricted/private-in-public.rs
+++ b/src/test/compile-fail/privacy/restricted/private-in-public.rs
@@ -8,7 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(pub_restricted)]
+#![deny(warnings)]
+#![allow(unused)]
 
 mod foo {
     struct Priv;
@@ -16,6 +17,7 @@ mod foo {
         use foo::Priv;
         pub(super) fn f(_: Priv) {}
         pub(crate) fn g(_: Priv) {} //~ ERROR E0446
+        //~^ this was previously accepted
     }
 }
 
diff --git a/src/test/compile-fail/privacy/restricted/struct-literal-field.rs b/src/test/compile-fail/privacy/restricted/struct-literal-field.rs
index 53786d45c73..68458fe3f04 100644
--- a/src/test/compile-fail/privacy/restricted/struct-literal-field.rs
+++ b/src/test/compile-fail/privacy/restricted/struct-literal-field.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(pub_restricted)]
 #![deny(private_in_public)]
 #![allow(warnings)]
 
diff --git a/src/test/compile-fail/privacy/restricted/test.rs b/src/test/compile-fail/privacy/restricted/test.rs
index d55ee8221cd..12697d51042 100644
--- a/src/test/compile-fail/privacy/restricted/test.rs
+++ b/src/test/compile-fail/privacy/restricted/test.rs
@@ -10,7 +10,6 @@
 
 // aux-build:pub_restricted.rs
 
-#![feature(pub_restricted)]
 #![deny(private_in_public)]
 #![allow(warnings)]
 extern crate pub_restricted;
diff --git a/src/test/compile-fail/privacy/restricted/tuple-struct-fields/test.rs b/src/test/compile-fail/privacy/restricted/tuple-struct-fields/test.rs
index f3dcf405a68..bb212b3114d 100644
--- a/src/test/compile-fail/privacy/restricted/tuple-struct-fields/test.rs
+++ b/src/test/compile-fail/privacy/restricted/tuple-struct-fields/test.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(pub_restricted)]
-
 mod foo {
     type T = ();
     struct S1(pub(foo) (), pub(T), pub(crate) (), pub(((), T)));
diff --git a/src/test/compile-fail/privacy/restricted/tuple-struct-fields/test2.rs b/src/test/compile-fail/privacy/restricted/tuple-struct-fields/test2.rs
index 3bf8ca30a6c..2c6e71d7c55 100644
--- a/src/test/compile-fail/privacy/restricted/tuple-struct-fields/test2.rs
+++ b/src/test/compile-fail/privacy/restricted/tuple-struct-fields/test2.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(pub_restricted)]
-
 macro_rules! define_struct {
     ($t:ty) => {
         struct S1(pub $t);
diff --git a/src/test/compile-fail/privacy/restricted/tuple-struct-fields/test3.rs b/src/test/compile-fail/privacy/restricted/tuple-struct-fields/test3.rs
index febe224fb84..e15eeae8159 100644
--- a/src/test/compile-fail/privacy/restricted/tuple-struct-fields/test3.rs
+++ b/src/test/compile-fail/privacy/restricted/tuple-struct-fields/test3.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(pub_restricted)]
-
 macro_rules! define_struct {
     ($t:ty) => {
         struct S1(pub($t));
diff --git a/src/test/compile-fail/privacy/restricted/ty-params.rs b/src/test/compile-fail/privacy/restricted/ty-params.rs
index cd0edc8fe7c..c83a4e56852 100644
--- a/src/test/compile-fail/privacy/restricted/ty-params.rs
+++ b/src/test/compile-fail/privacy/restricted/ty-params.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(pub_restricted)]
-
 macro_rules! m {
     ($p: path) => (pub(in $p) struct Z;)
 }
diff --git a/src/test/compile-fail/privacy/union-field-privacy-1.rs b/src/test/compile-fail/privacy/union-field-privacy-1.rs
index 4924fabafb0..bddcd391b20 100644
--- a/src/test/compile-fail/privacy/union-field-privacy-1.rs
+++ b/src/test/compile-fail/privacy/union-field-privacy-1.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(pub_restricted)]
 #![feature(untagged_unions)]
 
 mod m {
diff --git a/src/test/compile-fail/privacy/union-field-privacy-2.rs b/src/test/compile-fail/privacy/union-field-privacy-2.rs
index 7151538f412..e26b5e99ec1 100644
--- a/src/test/compile-fail/privacy/union-field-privacy-2.rs
+++ b/src/test/compile-fail/privacy/union-field-privacy-2.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(pub_restricted)]
 #![feature(untagged_unions)]
 
 mod m {
diff --git a/src/test/compile-fail/resolve-bad-visibility.rs b/src/test/compile-fail/resolve-bad-visibility.rs
index 20878a91ede..420a45a2147 100644
--- a/src/test/compile-fail/resolve-bad-visibility.rs
+++ b/src/test/compile-fail/resolve-bad-visibility.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(pub_restricted)]
-
 enum E {}
 trait Tr {}
 
diff --git a/src/test/ui/resolve/auxiliary/privacy-struct-ctor.rs b/src/test/ui/resolve/auxiliary/privacy-struct-ctor.rs
index 383224b2f92..704b20c6e71 100644
--- a/src/test/ui/resolve/auxiliary/privacy-struct-ctor.rs
+++ b/src/test/ui/resolve/auxiliary/privacy-struct-ctor.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(pub_restricted)]
-
 pub mod m {
     pub struct S(u8);
 
diff --git a/src/test/ui/resolve/privacy-struct-ctor.rs b/src/test/ui/resolve/privacy-struct-ctor.rs
index 68bd74719f5..87e7b4f42a1 100644
--- a/src/test/ui/resolve/privacy-struct-ctor.rs
+++ b/src/test/ui/resolve/privacy-struct-ctor.rs
@@ -10,8 +10,6 @@
 
 // aux-build:privacy-struct-ctor.rs
 
-#![feature(pub_restricted)]
-
 extern crate privacy_struct_ctor as xcrate;
 
 mod m {
diff --git a/src/test/ui/resolve/privacy-struct-ctor.stderr b/src/test/ui/resolve/privacy-struct-ctor.stderr
index 30fdbb02cc7..25afb6147e4 100644
--- a/src/test/ui/resolve/privacy-struct-ctor.stderr
+++ b/src/test/ui/resolve/privacy-struct-ctor.stderr
@@ -1,7 +1,7 @@
 error[E0423]: expected value, found struct `Z`
-  --> $DIR/privacy-struct-ctor.rs:28:9
+  --> $DIR/privacy-struct-ctor.rs:26:9
    |
-28 |         Z;
+26 |         Z;
    |         ^
    |         |
    |         did you mean `Z { /* fields */ }`?
@@ -11,9 +11,9 @@ error[E0423]: expected value, found struct `Z`
              `use m::n::Z;`
 
 error[E0423]: expected value, found struct `S`
-  --> $DIR/privacy-struct-ctor.rs:38:5
+  --> $DIR/privacy-struct-ctor.rs:36:5
    |
-38 |     S;
+36 |     S;
    |     ^
    |     |
    |     did you mean `S { /* fields */ }`?
@@ -23,9 +23,9 @@ error[E0423]: expected value, found struct `S`
              `use m::S;`
 
 error[E0423]: expected value, found struct `xcrate::S`
-  --> $DIR/privacy-struct-ctor.rs:44:5
+  --> $DIR/privacy-struct-ctor.rs:42:5
    |
-44 |     xcrate::S;
+42 |     xcrate::S;
    |     ^^^^^^^^^
    |     |
    |     did you mean `xcrate::S { /* fields */ }`?
@@ -35,33 +35,33 @@ error[E0423]: expected value, found struct `xcrate::S`
              `use m::S;`
 
 error: tuple struct `Z` is private
-  --> $DIR/privacy-struct-ctor.rs:27:9
+  --> $DIR/privacy-struct-ctor.rs:25:9
    |
-27 |         n::Z; //~ ERROR tuple struct `Z` is private
+25 |         n::Z; //~ ERROR tuple struct `Z` is private
    |         ^^^^
 
 error: tuple struct `S` is private
-  --> $DIR/privacy-struct-ctor.rs:37:5
+  --> $DIR/privacy-struct-ctor.rs:35:5
    |
-37 |     m::S; //~ ERROR tuple struct `S` is private
+35 |     m::S; //~ ERROR tuple struct `S` is private
    |     ^^^^
 
 error: tuple struct `Z` is private
-  --> $DIR/privacy-struct-ctor.rs:41:5
+  --> $DIR/privacy-struct-ctor.rs:39:5
    |
-41 |     m::n::Z; //~ ERROR tuple struct `Z` is private
+39 |     m::n::Z; //~ ERROR tuple struct `Z` is private
    |     ^^^^^^^
 
 error: tuple struct `S` is private
-  --> $DIR/privacy-struct-ctor.rs:43:5
+  --> $DIR/privacy-struct-ctor.rs:41:5
    |
-43 |     xcrate::m::S; //~ ERROR tuple struct `S` is private
+41 |     xcrate::m::S; //~ ERROR tuple struct `S` is private
    |     ^^^^^^^^^^^^
 
 error: tuple struct `Z` is private
-  --> $DIR/privacy-struct-ctor.rs:47:5
+  --> $DIR/privacy-struct-ctor.rs:45:5
    |
-47 |     xcrate::m::n::Z; //~ ERROR tuple struct `Z` is private
+45 |     xcrate::m::n::Z; //~ ERROR tuple struct `Z` is private
    |     ^^^^^^^^^^^^^^^
 
 error: aborting due to 8 previous errors
diff --git a/src/test/ui/span/pub-struct-field.rs b/src/test/ui/span/pub-struct-field.rs
index 9f8f871200c..54cb0b59c75 100644
--- a/src/test/ui/span/pub-struct-field.rs
+++ b/src/test/ui/span/pub-struct-field.rs
@@ -11,8 +11,6 @@
 // Regression test for issue #26083 and #35435
 // Test that span for public struct fields start at `pub`
 
-#![feature(pub_restricted)]
-
 struct Foo {
     bar: u8,
     pub bar: u8,
diff --git a/src/test/ui/span/pub-struct-field.stderr b/src/test/ui/span/pub-struct-field.stderr
index 2c002c34736..c66361c8546 100644
--- a/src/test/ui/span/pub-struct-field.stderr
+++ b/src/test/ui/span/pub-struct-field.stderr
@@ -1,18 +1,18 @@
 error[E0124]: field `bar` is already declared
-  --> $DIR/pub-struct-field.rs:18:5
+  --> $DIR/pub-struct-field.rs:16:5
    |
-17 |     bar: u8,
+15 |     bar: u8,
    |     ------- `bar` first declared here
-18 |     pub bar: u8,
+16 |     pub bar: u8,
    |     ^^^^^^^^^^^ field already declared
 
 error[E0124]: field `bar` is already declared
-  --> $DIR/pub-struct-field.rs:19:5
+  --> $DIR/pub-struct-field.rs:17:5
    |
-17 |     bar: u8,
+15 |     bar: u8,
    |     ------- `bar` first declared here
-18 |     pub bar: u8,
-19 |     pub(crate) bar: u8,
+16 |     pub bar: u8,
+17 |     pub(crate) bar: u8,
    |     ^^^^^^^^^^^^^^^^^^ field already declared
 
 error: aborting due to 2 previous errors