Skip to content

Commit 2f16be4

Browse files
committed
Auto merge of #65990 - Centril:rollup-v843h4a, r=Centril
Rollup of 7 pull requests Successful merges: - #65274 (Upload toolstates.json to rust-lang-ci2) - #65434 (Add long error explanation for E0577) - #65850 (Update comments re type parameter hack in object safety) - #65955 (ci: revert msys2 ca-certificates hack) - #65959 (Fix an incorrect docstring for Immediate in librustc_mir/interpret.) - #65979 (Switch CrateMetadata's source_map_import_info from RwLock to Once) - #65981 (work around aggressive syntax feature gating) Failed merges: r? @ghost
2 parents 03d537e + 83000c2 commit 2f16be4

File tree

20 files changed

+197
-151
lines changed

20 files changed

+197
-151
lines changed

src/bootstrap/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,10 @@ impl Build {
10801080
/// done. The file is updated immediately after this function completes.
10811081
pub fn save_toolstate(&self, tool: &str, state: ToolState) {
10821082
if let Some(ref path) = self.config.save_toolstates {
1083+
if let Some(parent) = path.parent() {
1084+
// Ensure the parent directory always exists
1085+
t!(std::fs::create_dir_all(parent));
1086+
}
10831087
let mut file = t!(fs::OpenOptions::new()
10841088
.create(true)
10851089
.read(true)

src/ci/azure-pipelines/auto.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ jobs:
140140
IMAGE: x86_64-gnu-aux
141141
x86_64-gnu-tools:
142142
IMAGE: x86_64-gnu-tools
143+
DEPLOY_TOOLSTATES_JSON: toolstates-linux.json
143144
x86_64-gnu-debug:
144145
IMAGE: x86_64-gnu-debug
145146
x86_64-gnu-nopt:
@@ -262,8 +263,9 @@ jobs:
262263
# MSVC tools tests
263264
x86_64-msvc-tools:
264265
MSYS_BITS: 64
265-
SCRIPT: src/ci/docker/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstates.json windows
266-
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstates.json
266+
SCRIPT: src/ci/docker/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstate/toolstates.json windows
267+
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstate/toolstates.json
268+
DEPLOY_TOOLSTATES_JSON: toolstates-windows.json
267269

268270
# 32/64-bit MinGW builds.
269271
#

src/ci/azure-pipelines/steps/run.yml

+14-30
Original file line numberDiff line numberDiff line change
@@ -183,37 +183,21 @@ steps:
183183
condition: and(succeeded(), not(variables.SKIP_JOB))
184184
displayName: Run build
185185

186-
# If we're a deploy builder, use the `aws` command to publish everything to our
187-
# bucket.
188-
- bash: |
189-
set -e
190-
source src/ci/shared.sh
191-
if [ "$AGENT_OS" = "Linux" ]; then
192-
rm -rf obj/build/dist/doc
193-
upload_dir=obj/build/dist
194-
else
195-
rm -rf build/dist/doc
196-
upload_dir=build/dist
197-
fi
198-
ls -la $upload_dir
199-
deploy_dir=rustc-builds
200-
if [ "$DEPLOY_ALT" == "1" ]; then
201-
deploy_dir=rustc-builds-alt
202-
fi
203-
retry aws s3 cp --no-progress --recursive --acl public-read ./$upload_dir s3://$DEPLOY_BUCKET/$deploy_dir/$BUILD_SOURCEVERSION
186+
- bash: src/ci/scripts/upload-artifacts.sh
204187
env:
205188
AWS_ACCESS_KEY_ID: $(UPLOAD_AWS_ACCESS_KEY_ID)
206189
AWS_SECRET_ACCESS_KEY: $(UPLOAD_AWS_SECRET_ACCESS_KEY)
207-
condition: and(succeeded(), not(variables.SKIP_JOB), or(eq(variables.DEPLOY, '1'), eq(variables.DEPLOY_ALT, '1')))
208190
displayName: Upload artifacts
209-
210-
# Upload CPU usage statistics that we've been gathering this whole time. Always
211-
# execute this step in case we want to inspect failed builds, but don't let
212-
# errors here ever fail the build since this is just informational.
213-
- bash: aws s3 cp --acl public-read cpu-usage.csv s3://$DEPLOY_BUCKET/rustc-builds/$BUILD_SOURCEVERSION/cpu-$CI_JOB_NAME.csv
214-
env:
215-
AWS_ACCESS_KEY_ID: $(UPLOAD_AWS_ACCESS_KEY_ID)
216-
AWS_SECRET_ACCESS_KEY: $(UPLOAD_AWS_SECRET_ACCESS_KEY)
217-
condition: variables['UPLOAD_AWS_SECRET_ACCESS_KEY']
218-
continueOnError: true
219-
displayName: Upload CPU usage statistics
191+
# Adding a condition on DEPLOY=1 or DEPLOY_ALT=1 is not needed as all deploy
192+
# builders *should* have the AWS credentials available. Still, explicitly
193+
# adding the condition is helpful as this way CI will not silently skip
194+
# deploying artifacts from a dist builder if the variables are misconfigured,
195+
# erroring about invalid credentials instead.
196+
condition: |
197+
and(
198+
succeeded(), not(variables.SKIP_JOB),
199+
or(
200+
variables.UPLOAD_AWS_SECRET_ACCESS_KEY,
201+
eq(variables.DEPLOY, '1'), eq(variables.DEPLOY_ALT, '1')
202+
)
203+
)

src/ci/docker/run.sh

+2
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ fi
106106
mkdir -p $HOME/.cargo
107107
mkdir -p $objdir/tmp
108108
mkdir -p $objdir/cores
109+
mkdir -p /tmp/toolstate
109110

110111
args=
111112
if [ "$SCCACHE_BUCKET" != "" ]; then
@@ -156,6 +157,7 @@ else
156157
args="$args --volume $objdir:/checkout/obj"
157158
args="$args --volume $HOME/.cargo:/cargo"
158159
args="$args --volume $HOME/rustsrc:$HOME/rustsrc"
160+
args="$args --volume /tmp/toolstate:/tmp/toolstate"
159161
args="$args --env LOCAL_USER_ID=`id -u`"
160162
fi
161163

src/ci/docker/x86_64-gnu-tools/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ ENV CHECK_LINKS 1
2626

2727
ENV RUST_CONFIGURE_ARGS \
2828
--build=x86_64-unknown-linux-gnu \
29-
--save-toolstates=/tmp/toolstates.json
30-
ENV SCRIPT /tmp/checktools.sh ../x.py /tmp/toolstates.json linux
29+
--save-toolstates=/tmp/toolstate/toolstates.json
30+
ENV SCRIPT /tmp/checktools.sh ../x.py /tmp/toolstate/toolstates.json linux

src/ci/docker/x86_64-gnu-tools/checktools.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -eu
44

55
X_PY="$1"
6-
TOOLSTATE_FILE="$(realpath $2)"
6+
TOOLSTATE_FILE="$(realpath -m $2)"
77
OS="$3"
88
COMMIT="$(git rev-parse HEAD)"
99
CHANGED_FILES="$(git diff --name-status HEAD HEAD^)"
@@ -13,6 +13,7 @@ SIX_WEEK_CYCLE="$(( ($(date +%s) / 86400 - 20) % 42 ))"
1313
# The Wednesday after this has value 0.
1414
# We track this value to prevent regressing tools in the last week of the 6-week cycle.
1515

16+
mkdir -p "$(dirname $TOOLSTATE_FILE)"
1617
touch "$TOOLSTATE_FILE"
1718

1819
# Try to test all the tools and store the build/test success in the TOOLSTATE_FILE

src/ci/scripts/install-msys2-packages.sh

-8
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@ source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
88
if isWindows; then
99
pacman -S --noconfirm --needed base-devel ca-certificates make diffutils tar
1010

11-
# FIXME(#65767): workaround msys bug, step 2
12-
arch=i686
13-
if [ "$MSYS_BITS" = "64" ]; then
14-
arch=x86_64
15-
fi
16-
pacman -U --noconfirm --noprogressbar mingw-w64-$arch-ca-certificates-20180409-1-any.pkg.tar.xz
17-
rm mingw-w64-$arch-ca-certificates-20180409-1-any.pkg.tar.xz
18-
1911
# Make sure we use the native python interpreter instead of some msys equivalent
2012
# one way or another. The msys interpreters seem to have weird path conversions
2113
# baked in which break LLVM's build system one way or another, so let's use the

src/ci/scripts/install-msys2.sh

-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/bin/bash
2-
# ignore-tidy-linelength
32
# Download and install MSYS2, needed primarily for the test suite (run-make) but
43
# also used by the MinGW toolchain for assembling things.
54
#
@@ -13,13 +12,6 @@ IFS=$'\n\t'
1312
source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
1413

1514
if isWindows; then
16-
# FIXME(#65767): workaround msys bug, step 1
17-
arch=i686
18-
if [ "$MSYS_BITS" = "64" ]; then
19-
arch=x86_64
20-
fi
21-
curl -O "${MIRRORS_BASE}/msys2-repo/mingw/$arch/mingw-w64-$arch-ca-certificates-20180409-1-any.pkg.tar.xz"
22-
2315
choco install msys2 --params="/InstallDir:${SYSTEM_WORKFOLDER}/msys2 /NoPath" -y --no-progress
2416
mkdir -p "${SYSTEM_WORKFOLDER}/msys2/home/${USERNAME}"
2517

src/ci/scripts/upload-artifacts.sh

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
# Upload all the artifacts to our S3 bucket. All the files inside ${upload_dir}
3+
# will be uploaded to the deploy bucket and eventually signed and released in
4+
# static.rust-lang.org.
5+
6+
set -euo pipefail
7+
IFS=$'\n\t'
8+
9+
source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
10+
11+
upload_dir="$(mktemp -d)"
12+
13+
# Release tarballs produced by a dist builder.
14+
if [[ "${DEPLOY-0}" -eq "1" ]] || [[ "${DEPLOY_ALT-0}" -eq "1" ]]; then
15+
dist_dir=build/dist
16+
if isLinux; then
17+
dist_dir=obj/build/dist
18+
fi
19+
rm -rf "${dist_dir}/doc"
20+
cp -r "${dist_dir}"/* "${upload_dir}"
21+
fi
22+
23+
# CPU usage statistics.
24+
cp cpu-usage.csv "${upload_dir}/cpu-${CI_JOB_NAME}.csv"
25+
26+
# Toolstate data.
27+
if [[ -n "${DEPLOY_TOOLSTATES_JSON+x}" ]]; then
28+
cp /tmp/toolstate/toolstates.json "${upload_dir}/${DEPLOY_TOOLSTATES_JSON}"
29+
fi
30+
31+
echo "Files that will be uploaded:"
32+
ls -lah "${upload_dir}"
33+
echo
34+
35+
deploy_dir="rustc-builds"
36+
if [[ "${DEPLOY_ALT-0}" -eq "1" ]]; then
37+
deploy_dir="rustc-builds-alt"
38+
fi
39+
deploy_url="s3://${DEPLOY_BUCKET}/${deploy_dir}/$(ciCommit)"
40+
41+
retry aws s3 cp --no-progress --recursive --acl public-read "${upload_dir}" "${deploy_url}"

src/ci/shared.sh

+4
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ function getCIBranch {
4646
echo "$BUILD_SOURCEBRANCHNAME"
4747
}
4848

49+
function ciCommit {
50+
echo "${BUILD_SOURCEVERSION}"
51+
}
52+
4953
function ciCommandAddPath {
5054
if [[ $# -ne 1 ]]; then
5155
echo "usage: $0 <path>"

src/libcore/lib.rs

+12
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@
133133
#[allow(unused)]
134134
use prelude::v1::*;
135135

136+
#[cfg(not(test))] // See #65860
136137
#[macro_use]
137138
mod macros;
138139

@@ -180,40 +181,51 @@ pub mod hint;
180181

181182
/* Core language traits */
182183

184+
#[cfg(not(test))] // See #65860
183185
pub mod marker;
184186
pub mod ops;
187+
#[cfg(not(test))] // See #65860
185188
pub mod cmp;
189+
#[cfg(not(test))] // See #65860
186190
pub mod clone;
191+
#[cfg(not(test))] // See #65860
187192
pub mod default;
188193
pub mod convert;
189194
pub mod borrow;
190195

191196
/* Core types and methods on primitives */
192197

193198
pub mod any;
199+
#[cfg(not(test))] // See #65860
194200
pub mod array;
195201
pub mod ascii;
196202
pub mod sync;
197203
pub mod cell;
198204
pub mod char;
199205
pub mod panic;
200206
pub mod panicking;
207+
#[cfg(not(test))] // See #65860
201208
pub mod pin;
209+
#[cfg(not(test))] // See #65860
202210
pub mod iter;
203211
pub mod option;
204212
pub mod raw;
205213
pub mod result;
206214
pub mod ffi;
207215

208216
pub mod slice;
217+
#[cfg(not(test))] // See #65860
209218
pub mod str;
219+
#[cfg(not(test))] // See #65860
210220
pub mod hash;
221+
#[cfg(not(test))] // See #65860
211222
pub mod fmt;
212223
pub mod time;
213224

214225
pub mod unicode;
215226

216227
/* Async */
228+
#[cfg(not(test))] // See #65860
217229
pub mod future;
218230
pub mod task;
219231

src/librustc/traits/object_safety.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -520,9 +520,11 @@ impl<'tcx> TyCtxt<'tcx> {
520520
/// a pointer.
521521
///
522522
/// In practice, we cannot use `dyn Trait` explicitly in the obligation because it would result
523-
/// in a new check that `Trait` is object safe, creating a cycle. So instead, we fudge a little
524-
/// by introducing a new type parameter `U` such that `Self: Unsize<U>` and `U: Trait + ?Sized`,
525-
/// and use `U` in place of `dyn Trait`. Written as a chalk-style query:
523+
/// in a new check that `Trait` is object safe, creating a cycle (until object_safe_for_dispatch
524+
/// is stabilized, see tracking issue https://github.com/rust-lang/rust/issues/43561).
525+
/// Instead, we fudge a little by introducing a new type parameter `U` such that
526+
/// `Self: Unsize<U>` and `U: Trait + ?Sized`, and use `U` in place of `dyn Trait`.
527+
/// Written as a chalk-style query:
526528
///
527529
/// forall (U: Trait + ?Sized) {
528530
/// if (Self: Unsize<U>) {
@@ -556,8 +558,8 @@ impl<'tcx> TyCtxt<'tcx> {
556558

557559
// the type `U` in the query
558560
// use a bogus type parameter to mimick a forall(U) query using u32::MAX for now.
559-
// FIXME(mikeyhew) this is a total hack, and we should replace it when real forall queries
560-
// are implemented
561+
// FIXME(mikeyhew) this is a total hack. Once object_safe_for_dispatch is stabilized, we can
562+
// replace this with `dyn Trait`
561563
let unsized_self_ty: Ty<'tcx> = self.mk_ty_param(
562564
::std::u32::MAX,
563565
Symbol::intern("RustaceansAreAwesome"),

src/librustc_data_structures/sync.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -497,13 +497,15 @@ impl<T> Once<T> {
497497
/// If the value was already initialized the closure is not called and `false` is returned,
498498
/// otherwise if the value from the closure initializes the inner value, `true` is returned
499499
#[inline]
500-
pub fn init_locking<F: FnOnce() -> T>(&self, f: F) -> bool {
501-
let mut lock = self.0.lock();
502-
if lock.is_some() {
503-
return false;
500+
pub fn init_locking<F: FnOnce() -> T>(&self, f: F) -> &T {
501+
{
502+
let mut lock = self.0.lock();
503+
if lock.is_none() {
504+
*lock = Some(f());
505+
}
504506
}
505-
*lock = Some(f());
506-
true
507+
508+
self.borrow()
507509
}
508510

509511
/// Tries to initialize the inner value by calling the closure without ensuring that no-one

src/librustc_metadata/creader.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use crate::cstore::{self, CStore, MetadataBlob};
44
use crate::locator::{self, CratePaths};
55
use crate::schema::{CrateRoot, CrateDep};
6-
use rustc_data_structures::sync::{RwLock, Lock, AtomicCell};
6+
use rustc_data_structures::sync::{Lock, Once, AtomicCell};
77

88
use rustc::hir::def_id::CrateNum;
99
use rustc_data_structures::svh::Svh;
@@ -249,7 +249,7 @@ impl<'a> CrateLoader<'a> {
249249
cnum_map,
250250
cnum,
251251
dependencies: Lock::new(dependencies),
252-
source_map_import_info: RwLock::new(vec![]),
252+
source_map_import_info: Once::new(),
253253
alloc_decoding_state: AllocDecodingState::new(interpret_alloc_index),
254254
dep_kind: Lock::new(dep_kind),
255255
source,

src/librustc_metadata/cstore.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc::middle::cstore::{CrateSource, DepKind, ExternCrate};
99
use rustc::mir::interpret::AllocDecodingState;
1010
use rustc_index::vec::IndexVec;
1111
use rustc::util::nodemap::FxHashMap;
12-
use rustc_data_structures::sync::{Lrc, RwLock, Lock, MetadataRef, AtomicCell};
12+
use rustc_data_structures::sync::{Lrc, Lock, MetadataRef, Once, AtomicCell};
1313
use syntax::ast;
1414
use syntax::edition::Edition;
1515
use syntax_expand::base::SyntaxExtension;
@@ -62,7 +62,7 @@ crate struct CrateMetadata {
6262
/// Proc macro descriptions for this crate, if it's a proc macro crate.
6363
crate raw_proc_macros: Option<&'static [ProcMacro]>,
6464
/// Source maps for code from the crate.
65-
crate source_map_import_info: RwLock<Vec<ImportedSourceFile>>,
65+
crate source_map_import_info: Once<Vec<ImportedSourceFile>>,
6666
/// Used for decoding interpret::AllocIds in a cached & thread-safe manner.
6767
crate alloc_decoding_state: AllocDecodingState,
6868
/// The `DepNodeIndex` of the `DepNode` representing this upstream crate.

0 commit comments

Comments
 (0)