Skip to content

Commit 05cb29e

Browse files
committed
Auto merge of #54051 - kennytm:rollup, r=kennytm
Rollup of 10 pull requests Successful merges: - #53315 (use `NonZeroU32` in `newtype_index!`macro, change syntax) - #53932 ([NLL] Remove base_place) - #53942 (Rewrite `precompute_borrows_out_of_scope` for fewer hash table lookups.) - #53973 (Have rust-lldb look for the rust-enabled lldb) - #53981 (Implement initializer() for FileDesc) - #53987 (rustbuild: allow configuring llvm version suffix) - #53993 (rustc_resolve: don't record uniform_paths canaries as reexports.) - #54007 (crates that provide a `panic_handler` are exempt from the `unused_extern_crates` lint) - #54040 (update books for next release) - #54050 (Update `petgraph` dependency to 0.4.13 to fix build with nightly)
2 parents ff59ab1 + 51c3879 commit 05cb29e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+553
-342
lines changed

config.toml.example

+4
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@
8282
# passed to prefer linking to shared libraries.
8383
#link-shared = false
8484

85+
# When building llvm, this configures what is being appended to the version.
86+
# If absent, we let the version as-is.
87+
#version-suffix = "-rust"
88+
8589
# On MSVC you can compile LLVM with clang-cl, but the test suite doesn't pass
8690
# with clang-cl, so this is special in that it only compiles LLVM with clang-cl
8791
#clang-cl = '/path/to/clang-cl.exe'

src/Cargo.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ dependencies = [
138138
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
139139
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
140140
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
141-
"petgraph 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
141+
"petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
142142
"pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
143143
"serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)",
144144
"serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1471,7 +1471,7 @@ dependencies = [
14711471

14721472
[[package]]
14731473
name = "petgraph"
1474-
version = "0.4.12"
1474+
version = "0.4.13"
14751475
source = "registry+https://github.com/rust-lang/crates.io-index"
14761476
dependencies = [
14771477
"fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3243,7 +3243,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
32433243
"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
32443244
"checksum pest 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0fce5d8b5cc33983fc74f78ad552b5522ab41442c4ca91606e4236eb4b5ceefc"
32453245
"checksum pest_derive 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ab94faafeb93f4c5e3ce81ca0e5a779529a602ad5d09ae6d21996bfb8b6a52bf"
3246-
"checksum petgraph 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "8b30dc85588cd02b9b76f5e386535db546d21dc68506cff2abebee0b6445e8e4"
3246+
"checksum petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f"
32473247
"checksum phf 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)" = "7d37a244c75a9748e049225155f56dbcb98fe71b192fd25fd23cb914b5ad62f2"
32483248
"checksum phf_codegen 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)" = "4e4048fe7dd7a06b8127ecd6d3803149126e9b33c7558879846da3a63f734f2b"
32493249
"checksum phf_generator 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)" = "05a079dd052e7b674d21cb31cbb6c05efd56a2cd2827db7692e2f1a507ebd998"

src/bootstrap/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ serde_json = "1.0.2"
4747
toml = "0.4"
4848
lazy_static = "0.2"
4949
time = "0.1"
50-
petgraph = "0.4.12"
50+
petgraph = "0.4.13"
5151

5252
[dev-dependencies]
5353
pretty_assertions = "0.5"

src/bootstrap/config.rs

+3
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ pub struct Config {
8686
pub llvm_targets: Option<String>,
8787
pub llvm_experimental_targets: String,
8888
pub llvm_link_jobs: Option<u32>,
89+
pub llvm_version_suffix: Option<String>,
8990

9091
pub lld_enabled: bool,
9192
pub lldb_enabled: bool,
@@ -256,6 +257,7 @@ struct Llvm {
256257
experimental_targets: Option<String>,
257258
link_jobs: Option<u32>,
258259
link_shared: Option<bool>,
260+
version_suffix: Option<String>,
259261
clang_cl: Option<String>
260262
}
261263

@@ -516,6 +518,7 @@ impl Config {
516518
config.llvm_experimental_targets = llvm.experimental_targets.clone()
517519
.unwrap_or("WebAssembly;RISCV".to_string());
518520
config.llvm_link_jobs = llvm.link_jobs;
521+
config.llvm_version_suffix = llvm.version_suffix.clone();
519522
config.llvm_clang_cl = llvm.clang_cl.clone();
520523
}
521524

src/bootstrap/dist.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -2056,7 +2056,8 @@ impl Step for Lldb {
20562056
drop(fs::remove_dir_all(&image));
20572057

20582058
// Prepare the image directory
2059-
let dst = image.join("bin");
2059+
let root = image.join("lib/rustlib").join(&*target);
2060+
let dst = root.join("bin");
20602061
t!(fs::create_dir_all(&dst));
20612062
for program in &["lldb", "lldb-argdumper", "lldb-mi", "lldb-server"] {
20622063
let exe = bindir.join(exe(program, &target));
@@ -2065,7 +2066,7 @@ impl Step for Lldb {
20652066

20662067
// The libraries.
20672068
let libdir = builder.llvm_out(target).join("lib");
2068-
let dst = image.join("lib");
2069+
let dst = root.join("lib");
20692070
t!(fs::create_dir_all(&dst));
20702071
for entry in t!(fs::read_dir(&libdir)) {
20712072
let entry = entry.unwrap();
@@ -2093,7 +2094,7 @@ impl Step for Lldb {
20932094
let entry = t!(entry);
20942095
if let Ok(name) = entry.file_name().into_string() {
20952096
if name.starts_with("python") {
2096-
let dst = image.join(libdir_name)
2097+
let dst = root.join(libdir_name)
20972098
.join(entry.file_name());
20982099
t!(fs::create_dir_all(&dst));
20992100
builder.cp_r(&entry.path(), &dst);

src/bootstrap/native.rs

+4
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,10 @@ impl Step for Llvm {
239239
cfg.define("LLVM_NATIVE_BUILD", builder.llvm_out(builder.config.build).join("build"));
240240
}
241241

242+
if let Some(ref suffix) = builder.config.llvm_version_suffix {
243+
cfg.define("LLVM_VERSION_SUFFIX", suffix);
244+
}
245+
242246
if let Some(ref python) = builder.config.python {
243247
cfg.define("PYTHON_EXECUTABLE", python);
244248
}

src/doc/nomicon

src/doc/reference

src/etc/rust-lldb

+17-9
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,35 @@
1212
# Exit if anything fails
1313
set -e
1414

15-
LLDB_VERSION=`lldb --version 2>/dev/null | head -1 | cut -d. -f1`
15+
# Find out where to look for the pretty printer Python module
16+
RUSTC_SYSROOT=`rustc --print sysroot`
17+
18+
# Find the host triple so we can find lldb in rustlib.
19+
host=`rustc -vV | sed -n -e 's/^host: //p'`
20+
21+
lldb=lldb
22+
if [ -f "$RUSTC_SYSROOT/lib/rustlib/$host/bin/lldb" ]; then
23+
lldb="$RUSTC_SYSROOT/lib/rustlib/$host/bin/lldb"
24+
else
25+
LLDB_VERSION=`"$lldb" --version 2>/dev/null | head -1 | cut -d. -f1`
1626

17-
if [ "$LLDB_VERSION" = "lldb-350" ]
18-
then
19-
echo "***"
27+
if [ "$LLDB_VERSION" = "lldb-350" ]
28+
then
29+
echo "***"
2030
echo \
2131
"WARNING: This version of LLDB has known issues with Rust and cannot \
2232
display the contents of local variables!"
23-
echo "***"
33+
echo "***"
34+
fi
2435
fi
2536

26-
# Find out where to look for the pretty printer Python module
27-
RUSTC_SYSROOT=`rustc --print sysroot`
28-
2937
# Prepare commands that will be loaded before any file on the command line has been loaded
3038
script_import="command script import \"$RUSTC_SYSROOT/lib/rustlib/etc/lldb_rust_formatters.py\""
3139
category_definition="type summary add --no-value --python-function lldb_rust_formatters.print_val -x \".*\" --category Rust"
3240
category_enable="type category enable Rust"
3341

3442
# Call LLDB with the commands added to the argument list
35-
exec lldb --one-line-before-file="$script_import" \
43+
exec "$lldb" --one-line-before-file="$script_import" \
3644
--one-line-before-file="$category_definition" \
3745
--one-line-before-file="$category_enable" \
3846
"$@"

src/librustc/dep_graph/dep_node.rs

+1
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,7 @@ define_dep_nodes!( <'tcx>
574574
[] IsPanicRuntime(CrateNum),
575575
[] IsCompilerBuiltins(CrateNum),
576576
[] HasGlobalAllocator(CrateNum),
577+
[] HasPanicHandler(CrateNum),
577578
[input] ExternCrate(DefId),
578579
[eval_always] LintLevels,
579580
[] Specializes { impl1: DefId, impl2: DefId },

src/librustc/dep_graph/graph.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ pub struct DepGraph {
3939
fingerprints: Lrc<Lock<IndexVec<DepNodeIndex, Fingerprint>>>
4040
}
4141

42-
newtype_index!(DepNodeIndex);
42+
newtype_index! {
43+
pub struct DepNodeIndex { .. }
44+
}
4345

4446
impl DepNodeIndex {
45-
const INVALID: DepNodeIndex = DepNodeIndex(::std::u32::MAX);
47+
const INVALID: DepNodeIndex = DepNodeIndex::MAX;
4648
}
4749

4850
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
@@ -1125,14 +1127,16 @@ impl DepNodeColorMap {
11251127
match self.values[index] {
11261128
COMPRESSED_NONE => None,
11271129
COMPRESSED_RED => Some(DepNodeColor::Red),
1128-
value => Some(DepNodeColor::Green(DepNodeIndex(value - COMPRESSED_FIRST_GREEN)))
1130+
value => Some(DepNodeColor::Green(DepNodeIndex::from_u32(
1131+
value - COMPRESSED_FIRST_GREEN
1132+
)))
11291133
}
11301134
}
11311135

11321136
fn insert(&mut self, index: SerializedDepNodeIndex, color: DepNodeColor) {
11331137
self.values[index] = match color {
11341138
DepNodeColor::Red => COMPRESSED_RED,
1135-
DepNodeColor::Green(index) => index.0 + COMPRESSED_FIRST_GREEN,
1139+
DepNodeColor::Green(index) => index.as_u32() + COMPRESSED_FIRST_GREEN,
11361140
}
11371141
}
11381142
}

src/librustc/dep_graph/serialized.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ use dep_graph::DepNode;
1414
use ich::Fingerprint;
1515
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
1616

17-
newtype_index!(SerializedDepNodeIndex);
17+
newtype_index! {
18+
pub struct SerializedDepNodeIndex { .. }
19+
}
1820

1921
/// Data for use when recompiling the **current crate**.
2022
#[derive(Debug, RustcEncodable, RustcDecodable)]

src/librustc/hir/def_id.rs

+9-21
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ use serialize;
1515
use std::fmt;
1616
use std::u32;
1717

18-
newtype_index!(CrateNum
19-
{
18+
newtype_index! {
19+
pub struct CrateNum {
2020
ENCODABLE = custom
2121
DEBUG_FORMAT = "crate{}",
2222

@@ -27,40 +27,28 @@ newtype_index!(CrateNum
2727
/// Virtual crate for builtin macros
2828
// FIXME(jseyfried): this is also used for custom derives until proc-macro crates get
2929
// `CrateNum`s.
30-
const BUILTIN_MACROS_CRATE = u32::MAX,
30+
const BUILTIN_MACROS_CRATE = CrateNum::MAX_AS_U32,
3131

3232
/// A CrateNum value that indicates that something is wrong.
33-
const INVALID_CRATE = u32::MAX - 1,
33+
const INVALID_CRATE = CrateNum::MAX_AS_U32 - 1,
3434

3535
/// A special CrateNum that we use for the tcx.rcache when decoding from
3636
/// the incr. comp. cache.
37-
const RESERVED_FOR_INCR_COMP_CACHE = u32::MAX - 2,
38-
});
37+
const RESERVED_FOR_INCR_COMP_CACHE = CrateNum::MAX_AS_U32 - 2,
38+
}
39+
}
3940

4041
impl CrateNum {
4142
pub fn new(x: usize) -> CrateNum {
42-
assert!(x < (u32::MAX as usize));
43-
CrateNum(x as u32)
44-
}
45-
46-
pub fn from_u32(x: u32) -> CrateNum {
47-
CrateNum(x)
48-
}
49-
50-
pub fn as_usize(&self) -> usize {
51-
self.0 as usize
52-
}
53-
54-
pub fn as_u32(&self) -> u32 {
55-
self.0
43+
CrateNum::from_usize(x)
5644
}
5745

5846
pub fn as_def_id(&self) -> DefId { DefId { krate: *self, index: CRATE_DEF_INDEX } }
5947
}
6048

6149
impl fmt::Display for CrateNum {
6250
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
63-
fmt::Display::fmt(&self.0, f)
51+
fmt::Display::fmt(&self.as_u32(), f)
6452
}
6553
}
6654

src/librustc/ich/impls_mir.rs

-5
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for mir::Local {
102102
fn hash_stable<W: StableHasherResult>(&self,
103103
hcx: &mut StableHashingContext<'a>,
104104
hasher: &mut StableHasher<W>) {
105-
use rustc_data_structures::indexed_vec::Idx;
106105
self.index().hash_stable(hcx, hasher);
107106
}
108107
}
@@ -112,7 +111,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for mir::BasicBlock {
112111
fn hash_stable<W: StableHasherResult>(&self,
113112
hcx: &mut StableHashingContext<'a>,
114113
hasher: &mut StableHasher<W>) {
115-
use rustc_data_structures::indexed_vec::Idx;
116114
self.index().hash_stable(hcx, hasher);
117115
}
118116
}
@@ -122,7 +120,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for mir::Field {
122120
fn hash_stable<W: StableHasherResult>(&self,
123121
hcx: &mut StableHashingContext<'a>,
124122
hasher: &mut StableHasher<W>) {
125-
use rustc_data_structures::indexed_vec::Idx;
126123
self.index().hash_stable(hcx, hasher);
127124
}
128125
}
@@ -133,7 +130,6 @@ for mir::SourceScope {
133130
fn hash_stable<W: StableHasherResult>(&self,
134131
hcx: &mut StableHashingContext<'a>,
135132
hasher: &mut StableHasher<W>) {
136-
use rustc_data_structures::indexed_vec::Idx;
137133
self.index().hash_stable(hcx, hasher);
138134
}
139135
}
@@ -143,7 +139,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for mir::Promoted {
143139
fn hash_stable<W: StableHasherResult>(&self,
144140
hcx: &mut StableHashingContext<'a>,
145141
hasher: &mut StableHasher<W>) {
146-
use rustc_data_structures::indexed_vec::Idx;
147142
self.index().hash_stable(hcx, hasher);
148143
}
149144
}

src/librustc/ich/impls_ty.rs

-3
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for ty::RegionVid {
143143
fn hash_stable<W: StableHasherResult>(&self,
144144
hcx: &mut StableHashingContext<'a>,
145145
hasher: &mut StableHasher<W>) {
146-
use rustc_data_structures::indexed_vec::Idx;
147146
self.index().hash_stable(hcx, hasher);
148147
}
149148
}
@@ -153,7 +152,6 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::CanonicalVar {
153152
fn hash_stable<W: StableHasherResult>(&self,
154153
hcx: &mut StableHashingContext<'gcx>,
155154
hasher: &mut StableHasher<W>) {
156-
use rustc_data_structures::indexed_vec::Idx;
157155
self.index().hash_stable(hcx, hasher);
158156
}
159157
}
@@ -774,7 +772,6 @@ impl_stable_hash_for!(enum ty::cast::CastKind {
774772
FnPtrAddrCast
775773
});
776774

777-
impl_stable_hash_for!(tuple_struct ::middle::region::FirstStatementIndex { idx });
778775
impl_stable_hash_for!(struct ::middle::region::Scope { id, code });
779776

780777
impl<'a> ToStableHashKey<StableHashingContext<'a>> for region::Scope {

src/librustc/infer/error_reporting/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ use syntax::ast::DUMMY_NODE_ID;
7373
use syntax_pos::{Pos, Span};
7474
use errors::{Applicability, DiagnosticBuilder, DiagnosticStyledString};
7575

76-
use rustc_data_structures::indexed_vec::Idx;
77-
7876
mod note;
7977

8078
mod need_type_info;

src/librustc/infer/region_constraints/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use self::CombineMapType::*;
1616
use super::{MiscVariable, RegionVariableOrigin, SubregionOrigin};
1717
use super::unify_key;
1818

19-
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
19+
use rustc_data_structures::indexed_vec::IndexVec;
2020
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
2121
use rustc_data_structures::unify as ut;
2222
use ty::{self, Ty, TyCtxt};

src/librustc/infer/unify_key.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ impl UnifyValue for RegionVidKey {
4949

5050
impl UnifyKey for ty::RegionVid {
5151
type Value = RegionVidKey;
52-
fn index(&self) -> u32 { self.0 }
53-
fn from_index(i: u32) -> ty::RegionVid { ty::RegionVid(i) }
52+
fn index(&self) -> u32 { u32::from(*self) }
53+
fn from_index(i: u32) -> ty::RegionVid { ty::RegionVid::from(i) }
5454
fn tag() -> &'static str { "RegionVid" }
5555
}
5656

src/librustc/middle/region.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,13 @@ pub struct BlockRemainder {
159159
pub first_statement_index: FirstStatementIndex,
160160
}
161161

162-
newtype_index!(FirstStatementIndex
163-
{
164-
pub idx
162+
newtype_index! {
163+
pub struct FirstStatementIndex {
165164
MAX = SCOPE_DATA_REMAINDER_MAX
166-
});
165+
}
166+
}
167+
168+
impl_stable_hash_for!(struct ::middle::region::FirstStatementIndex { private });
167169

168170
impl From<ScopeData> for Scope {
169171
#[inline]

0 commit comments

Comments
 (0)