Skip to content

Commit 16c1598

Browse files
committed
Auto merge of #54051 - kennytm:rollup, r=kennytm
Rollup of 11 pull requests Successful merges: - #51366 (stabilize #[panic_handler]) - #53162 (rustdoc: collect trait impls as an early pass) - #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) Failed merges: r? @ghost
2 parents 06da917 + 46b5282 commit 16c1598

File tree

79 files changed

+705
-393
lines changed

Some content is hidden

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

79 files changed

+705
-393
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

+4-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)",
@@ -2433,6 +2433,7 @@ name = "rustdoc"
24332433
version = "0.0.0"
24342434
dependencies = [
24352435
"minifier 0.0.19 (registry+https://github.com/rust-lang/crates.io-index)",
2436+
"parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
24362437
"pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
24372438
"tempfile 3.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
24382439
]
@@ -3243,7 +3244,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
32433244
"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
32443245
"checksum pest 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0fce5d8b5cc33983fc74f78ad552b5522ab41442c4ca91606e4236eb4b5ceefc"
32453246
"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"
3247+
"checksum petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f"
32473248
"checksum phf 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)" = "7d37a244c75a9748e049225155f56dbcb98fe71b192fd25fd23cb914b5ad62f2"
32483249
"checksum phf_codegen 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)" = "4e4048fe7dd7a06b8127ecd6d3803149126e9b33c7558879846da3a63f734f2b"
32493250
"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/session/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ pub struct Session {
159159
/// Metadata about the allocators for the current crate being compiled
160160
pub has_global_allocator: Once<bool>,
161161

162+
/// Metadata about the panic handlers for the current crate being compiled
163+
pub has_panic_handler: Once<bool>,
164+
162165
/// Cap lint level specified by a driver specifically.
163166
pub driver_lint_caps: FxHashMap<lint::LintId, lint::Level>,
164167
}
@@ -1160,6 +1163,7 @@ pub fn build_session_(
11601163
(*GLOBAL_JOBSERVER).clone()
11611164
},
11621165
has_global_allocator: Once::new(),
1166+
has_panic_handler: Once::new(),
11631167
driver_lint_caps: FxHashMap(),
11641168
};
11651169

src/librustc/ty/query/config.rs

+6
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,12 @@ impl<'tcx> QueryDescription<'tcx> for queries::has_global_allocator<'tcx> {
464464
}
465465
}
466466

467+
impl<'tcx> QueryDescription<'tcx> for queries::has_panic_handler<'tcx> {
468+
fn describe(_: TyCtxt, _: CrateNum) -> String {
469+
"checking if the crate has_panic_handler".to_string()
470+
}
471+
}
472+
467473
impl<'tcx> QueryDescription<'tcx> for queries::extern_crate<'tcx> {
468474
fn describe(_: TyCtxt, _: DefId) -> String {
469475
"getting crate's ExternCrateData".to_string()

src/librustc/ty/query/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ define_queries! { <'tcx>
381381
[fatal_cycle] fn is_panic_runtime: IsPanicRuntime(CrateNum) -> bool,
382382
[fatal_cycle] fn is_compiler_builtins: IsCompilerBuiltins(CrateNum) -> bool,
383383
[fatal_cycle] fn has_global_allocator: HasGlobalAllocator(CrateNum) -> bool,
384+
[fatal_cycle] fn has_panic_handler: HasPanicHandler(CrateNum) -> bool,
384385
[fatal_cycle] fn is_sanitizer_runtime: IsSanitizerRuntime(CrateNum) -> bool,
385386
[fatal_cycle] fn is_profiler_runtime: IsProfilerRuntime(CrateNum) -> bool,
386387
[fatal_cycle] fn panic_strategy: GetPanicStrategy(CrateNum) -> PanicStrategy,

src/librustc/ty/query/plumbing.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1168,6 +1168,7 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>,
11681168
DepKind::IsPanicRuntime => { force!(is_panic_runtime, krate!()); }
11691169
DepKind::IsCompilerBuiltins => { force!(is_compiler_builtins, krate!()); }
11701170
DepKind::HasGlobalAllocator => { force!(has_global_allocator, krate!()); }
1171+
DepKind::HasPanicHandler => { force!(has_panic_handler, krate!()); }
11711172
DepKind::ExternCrate => { force!(extern_crate, def_id!()); }
11721173
DepKind::LintLevels => { force!(lint_levels, LOCAL_CRATE); }
11731174
DepKind::InScopeTraits => { force!(in_scope_traits_map, def_id!().index); }

src/librustc_metadata/cstore_impl.rs

+1
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ provide! { <'tcx> tcx, def_id, other, cdata,
173173
is_panic_runtime => { cdata.root.panic_runtime }
174174
is_compiler_builtins => { cdata.root.compiler_builtins }
175175
has_global_allocator => { cdata.root.has_global_allocator }
176+
has_panic_handler => { cdata.root.has_panic_handler }
176177
is_sanitizer_runtime => { cdata.root.sanitizer_runtime }
177178
is_profiler_runtime => { cdata.root.profiler_runtime }
178179
panic_strategy => { cdata.root.panic_strategy }

src/librustc_metadata/encoder.rs

+2
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
484484
let is_proc_macro = tcx.sess.crate_types.borrow().contains(&CrateType::ProcMacro);
485485
let has_default_lib_allocator = attr::contains_name(&attrs, "default_lib_allocator");
486486
let has_global_allocator = *tcx.sess.has_global_allocator.get();
487+
let has_panic_handler = *tcx.sess.has_panic_handler.try_get().unwrap_or(&false);
487488

488489
let root = self.lazy(&CrateRoot {
489490
name: tcx.crate_name(LOCAL_CRATE),
@@ -494,6 +495,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
494495
panic_strategy: tcx.sess.panic_strategy(),
495496
edition: hygiene::default_edition(),
496497
has_global_allocator: has_global_allocator,
498+
has_panic_handler: has_panic_handler,
497499
has_default_lib_allocator: has_default_lib_allocator,
498500
plugin_registrar_fn: tcx.sess
499501
.plugin_registrar_fn

src/librustc_metadata/schema.rs

+1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ pub struct CrateRoot {
193193
pub panic_strategy: PanicStrategy,
194194
pub edition: Edition,
195195
pub has_global_allocator: bool,
196+
pub has_panic_handler: bool,
196197
pub has_default_lib_allocator: bool,
197198
pub plugin_registrar_fn: Option<DefIndex>,
198199
pub macro_derive_registrar: Option<DefIndex>,

src/librustc_mir/borrow_check/mod.rs

+4-46
Original file line numberDiff line numberDiff line change
@@ -1605,10 +1605,6 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
16051605
place_span: (&Place<'tcx>, Span),
16061606
flow_state: &Flows<'cx, 'gcx, 'tcx>,
16071607
) {
1608-
// FIXME: analogous code in check_loans first maps `place` to
1609-
// its base_path ... but is that what we want here?
1610-
let place = self.base_path(place_span.0);
1611-
16121608
let maybe_uninits = &flow_state.uninits;
16131609

16141610
// Bad scenarios:
@@ -1646,8 +1642,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
16461642
//
16471643
// This code covers scenarios 1, 2, and 3.
16481644

1649-
debug!("check_if_full_path_is_moved place: {:?}", place);
1650-
match self.move_path_closest_to(place) {
1645+
debug!("check_if_full_path_is_moved place: {:?}", place_span.0);
1646+
match self.move_path_closest_to(place_span.0) {
16511647
Ok(mpi) => {
16521648
if maybe_uninits.contains(&mpi) {
16531649
self.report_use_of_moved_or_uninitialized(
@@ -1677,10 +1673,6 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
16771673
place_span: (&Place<'tcx>, Span),
16781674
flow_state: &Flows<'cx, 'gcx, 'tcx>,
16791675
) {
1680-
// FIXME: analogous code in check_loans first maps `place` to
1681-
// its base_path ... but is that what we want here?
1682-
let place = self.base_path(place_span.0);
1683-
16841676
let maybe_uninits = &flow_state.uninits;
16851677

16861678
// Bad scenarios:
@@ -1709,8 +1701,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
17091701
//
17101702
// This code covers scenario 1.
17111703

1712-
debug!("check_if_path_or_subpath_is_moved place: {:?}", place);
1713-
if let Some(mpi) = self.move_path_for_place(place) {
1704+
debug!("check_if_path_or_subpath_is_moved place: {:?}", place_span.0);
1705+
if let Some(mpi) = self.move_path_for_place(place_span.0) {
17141706
if let Some(child_mpi) = maybe_uninits.has_any_child_of(mpi) {
17151707
self.report_use_of_moved_or_uninitialized(
17161708
context,
@@ -1813,11 +1805,6 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
18131805
let tcx = self.tcx;
18141806
match base.ty(self.mir, tcx).to_ty(tcx).sty {
18151807
ty::Adt(def, _) if def.has_dtor(tcx) => {
1816-
1817-
// FIXME: analogous code in
1818-
// check_loans.rs first maps
1819-
// `base` to its base_path.
1820-
18211808
self.check_if_path_or_subpath_is_moved(
18221809
context, InitializationRequiringAction::Assignment,
18231810
(base, span), flow_state);
@@ -2190,35 +2177,6 @@ enum Overlap {
21902177
Disjoint,
21912178
}
21922179

2193-
impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
2194-
// FIXME (#16118): function intended to allow the borrow checker
2195-
// to be less precise in its handling of Box while still allowing
2196-
// moves out of a Box. They should be removed when/if we stop
2197-
// treating Box specially (e.g. when/if DerefMove is added...)
2198-
2199-
fn base_path<'d>(&self, place: &'d Place<'tcx>) -> &'d Place<'tcx> {
2200-
//! Returns the base of the leftmost (deepest) dereference of an
2201-
//! Box in `place`. If there is no dereference of an Box
2202-
//! in `place`, then it just returns `place` itself.
2203-
2204-
let mut cursor = place;
2205-
let mut deepest = place;
2206-
loop {
2207-
let proj = match *cursor {
2208-
Place::Promoted(_) |
2209-
Place::Local(..) | Place::Static(..) => return deepest,
2210-
Place::Projection(ref proj) => proj,
2211-
};
2212-
if proj.elem == ProjectionElem::Deref
2213-
&& place.ty(self.mir, self.tcx).to_ty(self.tcx).is_box()
2214-
{
2215-
deepest = &proj.base;
2216-
}
2217-
cursor = &proj.base;
2218-
}
2219-
}
2220-
}
2221-
22222180
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
22232181
struct Context {
22242182
kind: ContextKind,

0 commit comments

Comments
 (0)