Skip to content

Commit 2f16be4

Browse files
committedOct 31, 2019
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.

‎src/librustc_metadata/decoder.rs

+63-82
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::schema::*;
55
use crate::table::{FixedSizeEncoding, PerDefTable};
66

77
use rustc_index::vec::IndexVec;
8-
use rustc_data_structures::sync::{Lrc, ReadGuard};
8+
use rustc_data_structures::sync::Lrc;
99
use rustc::hir::map::{DefKey, DefPath, DefPathData, DefPathHash};
1010
use rustc::hir;
1111
use rustc::middle::cstore::{LinkagePreference, NativeLibrary, ForeignModule};
@@ -664,7 +664,7 @@ impl<'a, 'tcx> CrateMetadata {
664664
tcx: TyCtxt<'tcx>,
665665
) -> ty::GenericPredicates<'tcx> {
666666
self.root.per_def.predicates.get(self, item_id).unwrap().decode((self, tcx))
667-
}
667+
}
668668

669669
crate fn get_predicates_defined_on(
670670
&self,
@@ -1290,87 +1290,68 @@ impl<'a, 'tcx> CrateMetadata {
12901290
fn imported_source_files(
12911291
&'a self,
12921292
local_source_map: &source_map::SourceMap,
1293-
) -> ReadGuard<'a, Vec<cstore::ImportedSourceFile>> {
1294-
{
1295-
let source_files = self.source_map_import_info.borrow();
1296-
if !source_files.is_empty() {
1297-
return source_files;
1298-
}
1299-
}
1300-
1301-
// Lock the source_map_import_info to ensure this only happens once
1302-
let mut source_map_import_info = self.source_map_import_info.borrow_mut();
1303-
1304-
if !source_map_import_info.is_empty() {
1305-
drop(source_map_import_info);
1306-
return self.source_map_import_info.borrow();
1307-
}
1308-
1309-
let external_source_map = self.root.source_map.decode(self);
1310-
1311-
let imported_source_files = external_source_map.map(|source_file_to_import| {
1312-
// We can't reuse an existing SourceFile, so allocate a new one
1313-
// containing the information we need.
1314-
let syntax_pos::SourceFile { name,
1315-
name_was_remapped,
1316-
src_hash,
1317-
start_pos,
1318-
end_pos,
1319-
mut lines,
1320-
mut multibyte_chars,
1321-
mut non_narrow_chars,
1322-
mut normalized_pos,
1323-
name_hash,
1324-
.. } = source_file_to_import;
1325-
1326-
let source_length = (end_pos - start_pos).to_usize();
1327-
1328-
// Translate line-start positions and multibyte character
1329-
// position into frame of reference local to file.
1330-
// `SourceMap::new_imported_source_file()` will then translate those
1331-
// coordinates to their new global frame of reference when the
1332-
// offset of the SourceFile is known.
1333-
for pos in &mut lines {
1334-
*pos = *pos - start_pos;
1335-
}
1336-
for mbc in &mut multibyte_chars {
1337-
mbc.pos = mbc.pos - start_pos;
1338-
}
1339-
for swc in &mut non_narrow_chars {
1340-
*swc = *swc - start_pos;
1341-
}
1342-
for np in &mut normalized_pos {
1343-
np.pos = np.pos - start_pos;
1344-
}
1345-
1346-
let local_version = local_source_map.new_imported_source_file(name,
1347-
name_was_remapped,
1348-
self.cnum.as_u32(),
1349-
src_hash,
1350-
name_hash,
1351-
source_length,
1352-
lines,
1353-
multibyte_chars,
1354-
non_narrow_chars,
1355-
normalized_pos);
1356-
debug!("CrateMetaData::imported_source_files alloc \
1357-
source_file {:?} original (start_pos {:?} end_pos {:?}) \
1358-
translated (start_pos {:?} end_pos {:?})",
1359-
local_version.name, start_pos, end_pos,
1360-
local_version.start_pos, local_version.end_pos);
1361-
1362-
cstore::ImportedSourceFile {
1363-
original_start_pos: start_pos,
1364-
original_end_pos: end_pos,
1365-
translated_source_file: local_version,
1366-
}
1367-
}).collect();
1368-
1369-
*source_map_import_info = imported_source_files;
1370-
drop(source_map_import_info);
1293+
) -> &[cstore::ImportedSourceFile] {
1294+
self.source_map_import_info.init_locking(|| {
1295+
let external_source_map = self.root.source_map.decode(self);
1296+
1297+
external_source_map.map(|source_file_to_import| {
1298+
// We can't reuse an existing SourceFile, so allocate a new one
1299+
// containing the information we need.
1300+
let syntax_pos::SourceFile { name,
1301+
name_was_remapped,
1302+
src_hash,
1303+
start_pos,
1304+
end_pos,
1305+
mut lines,
1306+
mut multibyte_chars,
1307+
mut non_narrow_chars,
1308+
mut normalized_pos,
1309+
name_hash,
1310+
.. } = source_file_to_import;
1311+
1312+
let source_length = (end_pos - start_pos).to_usize();
1313+
1314+
// Translate line-start positions and multibyte character
1315+
// position into frame of reference local to file.
1316+
// `SourceMap::new_imported_source_file()` will then translate those
1317+
// coordinates to their new global frame of reference when the
1318+
// offset of the SourceFile is known.
1319+
for pos in &mut lines {
1320+
*pos = *pos - start_pos;
1321+
}
1322+
for mbc in &mut multibyte_chars {
1323+
mbc.pos = mbc.pos - start_pos;
1324+
}
1325+
for swc in &mut non_narrow_chars {
1326+
*swc = *swc - start_pos;
1327+
}
1328+
for np in &mut normalized_pos {
1329+
np.pos = np.pos - start_pos;
1330+
}
13711331

1372-
// This shouldn't borrow twice, but there is no way to downgrade RefMut to Ref.
1373-
self.source_map_import_info.borrow()
1332+
let local_version = local_source_map.new_imported_source_file(name,
1333+
name_was_remapped,
1334+
self.cnum.as_u32(),
1335+
src_hash,
1336+
name_hash,
1337+
source_length,
1338+
lines,
1339+
multibyte_chars,
1340+
non_narrow_chars,
1341+
normalized_pos);
1342+
debug!("CrateMetaData::imported_source_files alloc \
1343+
source_file {:?} original (start_pos {:?} end_pos {:?}) \
1344+
translated (start_pos {:?} end_pos {:?})",
1345+
local_version.name, start_pos, end_pos,
1346+
local_version.start_pos, local_version.end_pos);
1347+
1348+
cstore::ImportedSourceFile {
1349+
original_start_pos: start_pos,
1350+
original_end_pos: end_pos,
1351+
translated_source_file: local_version,
1352+
}
1353+
}).collect()
1354+
})
13741355
}
13751356

13761357
/// Get the `DepNodeIndex` corresponding this crate. The result of this

‎src/librustc_mir/interpret/operand.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use super::{
1919
};
2020
pub use rustc::mir::interpret::ScalarMaybeUndef;
2121

22-
/// A `Value` represents a single immediate self-contained Rust value.
22+
/// An `Immediate` represents a single immediate self-contained Rust value.
2323
///
2424
/// For optimization of a few very common cases, there is also a representation for a pair of
2525
/// primitive values (`ScalarPair`). It allows Miri to avoid making allocations for checked binary

‎src/librustc_resolve/error_codes.rs

+27-1
Original file line numberDiff line numberDiff line change
@@ -1823,6 +1823,33 @@ trait Hello {
18231823
```
18241824
"##,
18251825

1826+
E0577: r##"
1827+
Something other than a module was found in visibility scope.
1828+
1829+
Erroneous code example:
1830+
1831+
```compile_fail,E0577,edition2018
1832+
pub struct Sea;
1833+
1834+
pub (in crate::Sea) struct Shark; // error!
1835+
1836+
fn main() {}
1837+
```
1838+
1839+
`Sea` is not a module, therefore it is invalid to use it in a visibility path.
1840+
To fix this error we need to ensure `Sea` is a module.
1841+
1842+
Please note that the visibility scope can only be applied on ancestors!
1843+
1844+
```edition2018
1845+
pub mod Sea {
1846+
pub (in crate::Sea) struct Shark; // ok!
1847+
}
1848+
1849+
fn main() {}
1850+
```
1851+
"##,
1852+
18261853
E0603: r##"
18271854
A private item was used outside its scope.
18281855
@@ -1990,6 +2017,5 @@ fn main() {}
19902017
// E0427, merged into 530
19912018
// E0467, removed
19922019
// E0470, removed
1993-
E0577,
19942020
E0578,
19952021
}

‎src/test/ui/resolve/resolve-bad-visibility.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ LL | pub(in too_soon) struct H;
3030

3131
error: aborting due to 5 previous errors
3232

33-
Some errors have detailed explanations: E0433, E0742.
33+
Some errors have detailed explanations: E0433, E0577, E0742.
3434
For more information about an error, try `rustc --explain E0433`.

‎src/test/ui/span/visibility-ty-params.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ LL | m!{ m<> }
1818

1919
error: aborting due to 3 previous errors
2020

21+
For more information about this error, try `rustc --explain E0577`.

0 commit comments

Comments
 (0)
Please sign in to comment.