about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-09-17 22:04:28 +0000
committerbors <bors@rust-lang.org>2022-09-17 22:04:28 +0000
commit5253b0a0a1f366fad0ebed57597fcf2703b9e893 (patch)
tree8111bda03a6a21e62ba5c5ae16ac54619f21cbd1 /src
parent98ad6a5519651af36e246c0335c964dd52c554ba (diff)
parent5ba52ca002bd1ee2d7f9fe1969c21e8faaf9edac (diff)
downloadrust-5253b0a0a1f366fad0ebed57597fcf2703b9e893.tar.gz
rust-5253b0a0a1f366fad0ebed57597fcf2703b9e893.zip
Auto merge of #101949 - matthiaskrgr:rollup-xu5cqnd, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #101093 (Initial version of 1.64 release notes)
 - #101713 (change AccessLevels representation)
 - #101821 (Bump Unicode to version 15.0.0, regenerate tables)
 - #101826 (Enforce "joined()" and "joined_with_noop()" test)
 - #101835 (Allow using vendoring when running bootstrap from outside the source root)
 - #101942 (Revert "Copy stage0 binaries into stage0-sysroot")
 - #101943 (rustdoc: remove unused CSS `.non-exhaustive { margin-bottom }`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/bootstrap.py3
-rw-r--r--src/bootstrap/builder.rs3
-rw-r--r--src/bootstrap/compile.rs37
-rw-r--r--src/librustdoc/core.rs5
-rw-r--r--src/librustdoc/html/static/css/rustdoc.css4
-rw-r--r--src/librustdoc/visit_ast.rs2
-rw-r--r--src/librustdoc/visit_lib.rs4
-rw-r--r--src/test/ui/async-await/async-fn-size-uninit-locals.rs4
-rw-r--r--src/test/ui/privacy/access_levels.rs69
-rw-r--r--src/test/ui/privacy/access_levels.stderr151
10 files changed, 116 insertions, 166 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 350d87d58a4..57128685d91 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -778,7 +778,8 @@ class RustBuild(object):
         elif color == "never":
             args.append("--color=never")
 
-        run(args, env=env, verbose=self.verbose)
+        # Run this from the source directory so cargo finds .cargo/config
+        run(args, env=env, verbose=self.verbose, cwd=self.rust_root)
 
     def build_triple(self):
         """Build triple as in LLVM
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index b654db6dbe9..36f990b72ff 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -1325,6 +1325,9 @@ impl<'a> Builder<'a> {
     ) -> Cargo {
         let mut cargo = Command::new(&self.initial_cargo);
         let out_dir = self.stage_out(compiler, mode);
+        // Run cargo from the source root so it can find .cargo/config.
+        // This matters when using vendoring and the working directory is outside the repository.
+        cargo.current_dir(&self.src);
 
         // Codegen backends are not yet tracked by -Zbinary-dep-depinfo,
         // so we need to explicitly clear out if they've been updated.
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index f7ab6bf93fb..c13e83f6c86 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -436,43 +436,6 @@ impl Step for StdLink {
         let libdir = builder.sysroot_libdir(target_compiler, target);
         let hostdir = builder.sysroot_libdir(target_compiler, compiler.host);
         add_to_sysroot(builder, &libdir, &hostdir, &libstd_stamp(builder, compiler, target));
-
-        if compiler.stage == 0 {
-            // special handling for stage0, to make `rustup toolchain link` and `x dist --stage 0`
-            // work for stage0-sysroot
-
-            // copy bin files from stage0/bin to stage0-sysroot/bin
-            let sysroot = builder.out.join(&compiler.host.triple).join("stage0-sysroot");
-
-            let host = compiler.host.triple;
-            let stage0_bin_dir = builder.out.join(&host).join("stage0/bin");
-            let sysroot_bin_dir = sysroot.join("bin");
-            t!(fs::create_dir_all(&sysroot_bin_dir));
-            builder.cp_r(&stage0_bin_dir, &sysroot_bin_dir);
-
-            // copy all *.so files from stage0/lib to stage0-sysroot/lib
-            let stage0_lib_dir = builder.out.join(&host).join("stage0/lib");
-            if let Ok(files) = fs::read_dir(&stage0_lib_dir) {
-                for file in files {
-                    let file = t!(file);
-                    let path = file.path();
-                    if path.is_file() && is_dylib(&file.file_name().into_string().unwrap()) {
-                        builder.copy(&path, &sysroot.join("lib").join(path.file_name().unwrap()));
-                    }
-                }
-            }
-
-            // copy codegen-backends from stage0
-            let sysroot_codegen_backends = builder.sysroot_codegen_backends(compiler);
-            t!(fs::create_dir_all(&sysroot_codegen_backends));
-            let stage0_codegen_backends = builder
-                .out
-                .join(&host)
-                .join("stage0/lib/rustlib")
-                .join(&host)
-                .join("codegen-backends");
-            builder.cp_r(&stage0_codegen_backends, &sysroot_codegen_backends);
-        }
     }
 }
 
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index c48b25aea4a..76562d26a55 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -10,7 +10,6 @@ use rustc_hir::intravisit::{self, Visitor};
 use rustc_hir::{HirId, Path, TraitCandidate};
 use rustc_interface::interface;
 use rustc_middle::hir::nested_filter;
-use rustc_middle::middle::privacy::AccessLevels;
 use rustc_middle::ty::{ParamEnv, Ty, TyCtxt};
 use rustc_resolve as resolve;
 use rustc_session::config::{self, CrateType, ErrorOutputType};
@@ -364,9 +363,7 @@ pub(crate) fn run_global_ctxt(
         .copied()
         .filter(|&trait_def_id| tcx.trait_is_auto(trait_def_id))
         .collect();
-    let access_levels = AccessLevels {
-        map: tcx.privacy_access_levels(()).map.iter().map(|(k, v)| (k.to_def_id(), *v)).collect(),
-    };
+    let access_levels = tcx.privacy_access_levels(()).map_id(Into::into);
 
     let mut ctxt = DocContext {
         tcx,
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index 84ed056d0e1..1e2ff9a95dd 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -1562,10 +1562,6 @@ ul.all-items > li {
 	list-style: none;
 }
 
-.non-exhaustive {
-	margin-bottom: 1em;
-}
-
 details.dir-entry {
 	padding-left: 4px;
 }
diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs
index c27ac0ac40e..e6cef4a326a 100644
--- a/src/librustdoc/visit_ast.rs
+++ b/src/librustdoc/visit_ast.rs
@@ -230,7 +230,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
                     } else {
                         // All items need to be handled here in case someone wishes to link
                         // to them with intra-doc links
-                        self.cx.cache.access_levels.map.insert(did, AccessLevel::Public);
+                        self.cx.cache.access_levels.set_access_level(did, AccessLevel::Public);
                     }
                 }
             }
diff --git a/src/librustdoc/visit_lib.rs b/src/librustdoc/visit_lib.rs
index f01ec38665c..8221e0998d7 100644
--- a/src/librustdoc/visit_lib.rs
+++ b/src/librustdoc/visit_lib.rs
@@ -38,10 +38,10 @@ impl<'a, 'tcx> LibEmbargoVisitor<'a, 'tcx> {
     fn update(&mut self, did: DefId, level: Option<AccessLevel>) -> Option<AccessLevel> {
         let is_hidden = self.tcx.is_doc_hidden(did);
 
-        let old_level = self.access_levels.map.get(&did).cloned();
+        let old_level = self.access_levels.get_access_level(did);
         // Accessibility levels can only grow
         if level > old_level && !is_hidden {
-            self.access_levels.map.insert(did, level.unwrap());
+            self.access_levels.set_access_level(did, level.unwrap());
             level
         } else {
             old_level
diff --git a/src/test/ui/async-await/async-fn-size-uninit-locals.rs b/src/test/ui/async-await/async-fn-size-uninit-locals.rs
index 31a086ba975..28b3280fed5 100644
--- a/src/test/ui/async-await/async-fn-size-uninit-locals.rs
+++ b/src/test/ui/async-await/async-fn-size-uninit-locals.rs
@@ -67,9 +67,7 @@ async fn joined() {
     let c = Big::new();
 
     fut().await;
-    noop();
     joiner = Joiner { a: Some(a), b: Some(b), c: Some(c) };
-    noop();
 }
 
 async fn joined_with_noop() {
@@ -97,7 +95,7 @@ async fn join_retval() -> Joiner {
 fn main() {
     assert_eq!(2, std::mem::size_of_val(&single()));
     assert_eq!(3, std::mem::size_of_val(&single_with_noop()));
-    assert_eq!(3078, std::mem::size_of_val(&joined()));
+    assert_eq!(3074, std::mem::size_of_val(&joined()));
     assert_eq!(3078, std::mem::size_of_val(&joined_with_noop()));
     assert_eq!(3074, std::mem::size_of_val(&join_retval()));
 }
diff --git a/src/test/ui/privacy/access_levels.rs b/src/test/ui/privacy/access_levels.rs
index d51d2b57267..aa718ab9254 100644
--- a/src/test/ui/privacy/access_levels.rs
+++ b/src/test/ui/privacy/access_levels.rs
@@ -1,49 +1,62 @@
 #![feature(rustc_attrs)]
 
-#[rustc_access_level] mod outer { //~ ERROR None
-    #[rustc_access_level] pub mod inner { //~ ERROR Some(Exported)
-        #[rustc_access_level]
-        extern "C" { //~ ERROR Some(Exported)
-            #[rustc_access_level] static a: u8; //~ ERROR None
-            #[rustc_access_level] pub fn b(); //~ ERROR Some(Exported)
-        }
-        #[rustc_access_level]
-        pub trait Trait { //~ ERROR Some(Exported)
-            #[rustc_access_level] const A: i32; //~ ERROR Some(Exported)
-            #[rustc_access_level] type B; //~ ERROR Some(Exported)
+#[rustc_effective_visibility]
+mod outer { //~ ERROR Public: pub(self), Exported: pub(self), Reachable: pub(self), ReachableFromImplTrait: pub(self)
+    #[rustc_effective_visibility]
+    pub mod inner1 { //~ ERROR Public: pub(self), Exported: pub, Reachable: pub, ReachableFromImplTrait: pub
+
+        #[rustc_effective_visibility]
+        extern "C" {} //~ ERROR Public: pub(self), Exported: pub, Reachable: pub, ReachableFromImplTrait: pub
+
+        #[rustc_effective_visibility]
+        pub trait PubTrait { //~ ERROR Public: pub(self), Exported: pub, Reachable: pub, ReachableFromImplTrait: pub
+            #[rustc_effective_visibility]
+            const A: i32; //~ ERROR Public: pub(self), Exported: pub, Reachable: pub, ReachableFromImplTrait: pub
+            #[rustc_effective_visibility]
+            type B; //~ ERROR Public: pub(self), Exported: pub, Reachable: pub, ReachableFromImplTrait: pub
         }
 
-        #[rustc_access_level]
-        pub struct Struct { //~ ERROR Some(Exported)
-            #[rustc_access_level] a: u8, //~ ERROR None
-            #[rustc_access_level] pub b: u8, //~ ERROR Some(Exported)
-        }
+        #[rustc_effective_visibility]
+        struct PrivStruct; //~ ERROR Public: pub(self), Exported: pub(self), Reachable: pub(self), ReachableFromImplTrait: pub(self)
 
-        #[rustc_access_level]
-        pub union Union { //~ ERROR Some(Exported)
-            #[rustc_access_level] a: u8, //~ ERROR None
-            #[rustc_access_level] pub b: u8, //~ ERROR Some(Exported)
+        #[rustc_effective_visibility]
+        pub union PubUnion { //~ ERROR Public: pub(self), Exported: pub, Reachable: pub, ReachableFromImplTrait: pub
+            #[rustc_effective_visibility]
+            a: u8, //~ ERROR Public: pub(self), Exported: pub(self), Reachable: pub(self), ReachableFromImplTrait: pub(self)
+            #[rustc_effective_visibility]
+            pub b: u8, //~ ERROR Public: pub(self), Exported: pub, Reachable: pub, ReachableFromImplTrait: pub
         }
 
-        #[rustc_access_level]
-        pub enum Enum { //~ ERROR Some(Exported)
-            #[rustc_access_level] A( //~ ERROR Some(Exported)
-                #[rustc_access_level] Struct, //~ ERROR Some(Exported)
-                #[rustc_access_level] Union,  //~ ERROR Some(Exported)
+        #[rustc_effective_visibility]
+        pub enum Enum { //~ ERROR Public: pub(self), Exported: pub, Reachable: pub, ReachableFromImplTrait: pub
+            #[rustc_effective_visibility]
+            A( //~ ERROR Public: pub(self), Exported: pub, Reachable: pub, ReachableFromImplTrait: pub
+                #[rustc_effective_visibility]
+                PubUnion,  //~ ERROR Public: pub(self), Exported: pub, Reachable: pub, ReachableFromImplTrait: pub
             ),
         }
     }
 
-    #[rustc_access_level] macro_rules! none_macro { //~ ERROR None
+    #[rustc_effective_visibility]
+    macro_rules! none_macro { //~ Public: pub(self), Exported: pub(self), Reachable: pub(self), ReachableFromImplTrait: pub(self)
         () => {};
     }
 
     #[macro_export]
-    #[rustc_access_level] macro_rules! public_macro { //~ ERROR Some(Public)
+    #[rustc_effective_visibility]
+    macro_rules! public_macro { //~ Public: pub, Exported: pub, Reachable: pub, ReachableFromImplTrait: pub
         () => {};
     }
+
+    #[rustc_effective_visibility]
+    pub struct ReachableStruct { //~ ERROR Public: pub(self), Exported: pub(self), Reachable: pub, ReachableFromImplTrait: pub
+        #[rustc_effective_visibility]
+        pub a: u8, //~ ERROR Public: pub(self), Exported: pub(self), Reachable: pub, ReachableFromImplTrait: pub
+    }
 }
 
-pub use outer::inner;
+pub use outer::inner1;
+
+pub fn foo() -> outer::ReachableStruct { outer::ReachableStruct {a: 0} }
 
 fn main() {}
diff --git a/src/test/ui/privacy/access_levels.stderr b/src/test/ui/privacy/access_levels.stderr
index f326293c384..2ed6c330a2f 100644
--- a/src/test/ui/privacy/access_levels.stderr
+++ b/src/test/ui/privacy/access_levels.stderr
@@ -1,125 +1,104 @@
-error: None
-  --> $DIR/access_levels.rs:3:23
+error: Public: pub(self), Exported: pub(self), Reachable: pub(self), ReachableFromImplTrait: pub(self)
+  --> $DIR/access_levels.rs:4:1
    |
-LL | #[rustc_access_level] mod outer {
-   |                       ^^^^^^^^^
+LL | mod outer {
+   | ^^^^^^^^^
 
-error: Some(Exported)
-  --> $DIR/access_levels.rs:4:27
+error: Public: pub(self), Exported: pub, Reachable: pub, ReachableFromImplTrait: pub
+  --> $DIR/access_levels.rs:6:5
    |
-LL |     #[rustc_access_level] pub mod inner {
-   |                           ^^^^^^^^^^^^^
+LL |     pub mod inner1 {
+   |     ^^^^^^^^^^^^^^
 
-error: Some(Exported)
-  --> $DIR/access_levels.rs:6:9
+error: Public: pub(self), Exported: pub, Reachable: pub, ReachableFromImplTrait: pub
+  --> $DIR/access_levels.rs:9:9
    |
-LL | /         extern "C" {
-LL | |             #[rustc_access_level] static a: u8;
-LL | |             #[rustc_access_level] pub fn b();
-LL | |         }
-   | |_________^
+LL |         extern "C" {}
+   |         ^^^^^^^^^^^^^
 
-error: Some(Exported)
-  --> $DIR/access_levels.rs:11:9
+error: Public: pub(self), Exported: pub, Reachable: pub, ReachableFromImplTrait: pub
+  --> $DIR/access_levels.rs:12:9
    |
-LL |         pub trait Trait {
-   |         ^^^^^^^^^^^^^^^
+LL |         pub trait PubTrait {
+   |         ^^^^^^^^^^^^^^^^^^
 
-error: Some(Exported)
-  --> $DIR/access_levels.rs:17:9
+error: Public: pub(self), Exported: pub(self), Reachable: pub(self), ReachableFromImplTrait: pub(self)
+  --> $DIR/access_levels.rs:20:9
    |
-LL |         pub struct Struct {
+LL |         struct PrivStruct;
    |         ^^^^^^^^^^^^^^^^^
 
-error: None
-  --> $DIR/access_levels.rs:18:35
-   |
-LL |             #[rustc_access_level] a: u8,
-   |                                   ^^^^^
-
-error: Some(Exported)
-  --> $DIR/access_levels.rs:19:35
-   |
-LL |             #[rustc_access_level] pub b: u8,
-   |                                   ^^^^^^^^^
-
-error: Some(Exported)
+error: Public: pub(self), Exported: pub, Reachable: pub, ReachableFromImplTrait: pub
   --> $DIR/access_levels.rs:23:9
    |
-LL |         pub union Union {
-   |         ^^^^^^^^^^^^^^^
+LL |         pub union PubUnion {
+   |         ^^^^^^^^^^^^^^^^^^
 
-error: None
-  --> $DIR/access_levels.rs:24:35
+error: Public: pub(self), Exported: pub(self), Reachable: pub(self), ReachableFromImplTrait: pub(self)
+  --> $DIR/access_levels.rs:25:13
    |
-LL |             #[rustc_access_level] a: u8,
-   |                                   ^^^^^
+LL |             a: u8,
+   |             ^^^^^
 
-error: Some(Exported)
-  --> $DIR/access_levels.rs:25:35
+error: Public: pub(self), Exported: pub, Reachable: pub, ReachableFromImplTrait: pub
+  --> $DIR/access_levels.rs:27:13
    |
-LL |             #[rustc_access_level] pub b: u8,
-   |                                   ^^^^^^^^^
+LL |             pub b: u8,
+   |             ^^^^^^^^^
 
-error: Some(Exported)
-  --> $DIR/access_levels.rs:29:9
+error: Public: pub(self), Exported: pub, Reachable: pub, ReachableFromImplTrait: pub
+  --> $DIR/access_levels.rs:31:9
    |
 LL |         pub enum Enum {
    |         ^^^^^^^^^^^^^
 
-error: Some(Exported)
-  --> $DIR/access_levels.rs:30:35
-   |
-LL |             #[rustc_access_level] A(
-   |                                   ^
-
-error: Some(Exported)
-  --> $DIR/access_levels.rs:31:39
+error: Public: pub(self), Exported: pub, Reachable: pub, ReachableFromImplTrait: pub
+  --> $DIR/access_levels.rs:33:13
    |
-LL |                 #[rustc_access_level] Struct,
-   |                                       ^^^^^^
+LL |             A(
+   |             ^
 
-error: Some(Exported)
-  --> $DIR/access_levels.rs:32:39
+error: Public: pub(self), Exported: pub, Reachable: pub, ReachableFromImplTrait: pub
+  --> $DIR/access_levels.rs:35:17
    |
-LL |                 #[rustc_access_level] Union,
-   |                                       ^^^^^
+LL |                 PubUnion,
+   |                 ^^^^^^^^
 
-error: None
-  --> $DIR/access_levels.rs:37:27
+error: Public: pub(self), Exported: pub(self), Reachable: pub(self), ReachableFromImplTrait: pub(self)
+  --> $DIR/access_levels.rs:41:5
    |
-LL |     #[rustc_access_level] macro_rules! none_macro {
-   |                           ^^^^^^^^^^^^^^^^^^^^^^^
+LL |     macro_rules! none_macro {
+   |     ^^^^^^^^^^^^^^^^^^^^^^^
 
-error: Some(Public)
-  --> $DIR/access_levels.rs:42:27
+error: Public: pub, Exported: pub, Reachable: pub, ReachableFromImplTrait: pub
+  --> $DIR/access_levels.rs:47:5
    |
-LL |     #[rustc_access_level] macro_rules! public_macro {
-   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |     macro_rules! public_macro {
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: Some(Exported)
-  --> $DIR/access_levels.rs:12:35
+error: Public: pub(self), Exported: pub(self), Reachable: pub, ReachableFromImplTrait: pub
+  --> $DIR/access_levels.rs:52:5
    |
-LL |             #[rustc_access_level] const A: i32;
-   |                                   ^^^^^^^^^^^^
+LL |     pub struct ReachableStruct {
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: Some(Exported)
-  --> $DIR/access_levels.rs:13:35
+error: Public: pub(self), Exported: pub(self), Reachable: pub, ReachableFromImplTrait: pub
+  --> $DIR/access_levels.rs:54:9
    |
-LL |             #[rustc_access_level] type B;
-   |                                   ^^^^^^
+LL |         pub a: u8,
+   |         ^^^^^^^^^
 
-error: None
-  --> $DIR/access_levels.rs:7:35
+error: Public: pub(self), Exported: pub, Reachable: pub, ReachableFromImplTrait: pub
+  --> $DIR/access_levels.rs:14:13
    |
-LL |             #[rustc_access_level] static a: u8;
-   |                                   ^^^^^^^^^^^^
+LL |             const A: i32;
+   |             ^^^^^^^^^^^^
 
-error: Some(Exported)
-  --> $DIR/access_levels.rs:8:35
+error: Public: pub(self), Exported: pub, Reachable: pub, ReachableFromImplTrait: pub
+  --> $DIR/access_levels.rs:16:13
    |
-LL |             #[rustc_access_level] pub fn b();
-   |                                   ^^^^^^^^^^
+LL |             type B;
+   |             ^^^^^^
 
-error: aborting due to 20 previous errors
+error: aborting due to 17 previous errors