Skip to content

Commit d022dd4

Browse files
committed
Auto merge of #51023 - kennytm:rollup, r=kennytm
Rollup of 9 pull requests Successful merges: - #50864 (Add NetBSD/arm target specs) - #50956 (rust-gdb: work around the re-used -d argument in cgdb) - #50964 (Make sure that queries have predictable symbol names.) - #50965 (Update LLVM to pull in another wasm fix) - #50972 (Add -Z no-parallel-llvm flag) - #50979 (Fix span for type-only arguments) - #50981 (Shrink `LiveNode`.) - #50995 (move type out of unsafe block) - #51011 ( rustdoc: hide macro export statements from docs) Failed merges:
2 parents a76bff8 + 98606cf commit d022dd4

File tree

17 files changed

+137
-45
lines changed

17 files changed

+137
-45
lines changed

src/bootstrap/native.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,8 +596,10 @@ impl Step for Openssl {
596596
"arm-linux-androideabi" => "android",
597597
"arm-unknown-linux-gnueabi" => "linux-armv4",
598598
"arm-unknown-linux-gnueabihf" => "linux-armv4",
599+
"armv6-unknown-netbsd-eabihf" => "BSD-generic32",
599600
"armv7-linux-androideabi" => "android-armv7",
600601
"armv7-unknown-linux-gnueabihf" => "linux-armv4",
602+
"armv7-unknown-netbsd-eabihf" => "BSD-generic32",
601603
"i586-unknown-linux-gnu" => "linux-elf",
602604
"i586-unknown-linux-musl" => "linux-elf",
603605
"i686-apple-darwin" => "darwin-i386-cc",

src/etc/rust-gdb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc"
2121
# different/specific command (defaults to `gdb`).
2222
RUST_GDB="${RUST_GDB:-gdb}"
2323
PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" ${RUST_GDB} \
24-
-d "$GDB_PYTHON_MODULE_DIRECTORY" \
24+
--directory="$GDB_PYTHON_MODULE_DIRECTORY" \
2525
-iex "add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY" \
2626
"$@"

src/libcore/str/mod.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2246,13 +2246,11 @@ impl str {
22462246
#[inline(always)]
22472247
#[rustc_const_unstable(feature="const_str_as_bytes")]
22482248
pub const fn as_bytes(&self) -> &[u8] {
2249-
unsafe {
2250-
union Slices<'a> {
2251-
str: &'a str,
2252-
slice: &'a [u8],
2253-
}
2254-
Slices { str: self }.slice
2249+
union Slices<'a> {
2250+
str: &'a str,
2251+
slice: &'a [u8],
22552252
}
2253+
unsafe { Slices { str: self }.slice }
22562254
}
22572255

22582256
/// Converts a mutable string slice to a mutable byte slice. To convert the

src/libpanic_unwind/gcc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const UNWIND_DATA_REG: (i32, i32) = (24, 25); // I0, I1
143143
// The personality routine for most of our targets, except ARM, which has a slightly different ABI
144144
// (however, iOS goes here as it uses SjLj unwinding). Also, the 64-bit Windows implementation
145145
// lives in seh64_gnu.rs
146-
#[cfg(all(any(target_os = "ios", not(target_arch = "arm"))))]
146+
#[cfg(all(any(target_os = "ios", target_os = "netbsd", not(target_arch = "arm"))))]
147147
#[lang = "eh_personality"]
148148
#[no_mangle]
149149
#[allow(unused)]
@@ -184,7 +184,7 @@ unsafe extern "C" fn rust_eh_personality(version: c_int,
184184

185185
// ARM EHABI personality routine.
186186
// http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038b/IHI0038B_ehabi.pdf
187-
#[cfg(all(target_arch = "arm", not(target_os = "ios")))]
187+
#[cfg(all(target_arch = "arm", not(target_os = "ios"), not(target_os = "netbsd")))]
188188
#[lang = "eh_personality"]
189189
#[no_mangle]
190190
unsafe extern "C" fn rust_eh_personality(state: uw::_Unwind_State,

src/librustc/middle/liveness.rs

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
//! enclosing function. On the way down the tree, it identifies those AST
5252
//! nodes and variable IDs that will be needed for the liveness analysis
5353
//! and assigns them contiguous IDs. The liveness id for an AST node is
54-
//! called a `live_node` (it's a newtype'd usize) and the id for a variable
55-
//! is called a `variable` (another newtype'd usize).
54+
//! called a `live_node` (it's a newtype'd u32) and the id for a variable
55+
//! is called a `variable` (another newtype'd u32).
5656
//!
5757
//! On the way back up the tree, as we are about to exit from a function
5858
//! declaration we allocate a `liveness` instance. Now that we know
@@ -112,7 +112,7 @@ use lint;
112112
use util::nodemap::{NodeMap, NodeSet};
113113

114114
use std::collections::VecDeque;
115-
use std::{fmt, usize};
115+
use std::{fmt, u32};
116116
use std::io::prelude::*;
117117
use std::io;
118118
use std::rc::Rc;
@@ -134,23 +134,17 @@ enum LoopKind<'a> {
134134
}
135135

136136
#[derive(Copy, Clone, PartialEq)]
137-
struct Variable(usize);
137+
struct Variable(u32);
138138

139-
#[derive(Copy, PartialEq)]
140-
struct LiveNode(usize);
139+
#[derive(Copy, Clone, PartialEq)]
140+
struct LiveNode(u32);
141141

142142
impl Variable {
143-
fn get(&self) -> usize { let Variable(v) = *self; v }
143+
fn get(&self) -> usize { self.0 as usize }
144144
}
145145

146146
impl LiveNode {
147-
fn get(&self) -> usize { let LiveNode(v) = *self; v }
148-
}
149-
150-
impl Clone for LiveNode {
151-
fn clone(&self) -> LiveNode {
152-
LiveNode(self.get())
153-
}
147+
fn get(&self) -> usize { self.0 as usize }
154148
}
155149

156150
#[derive(Copy, Clone, PartialEq, Debug)]
@@ -233,11 +227,11 @@ impl fmt::Debug for Variable {
233227

234228
impl LiveNode {
235229
fn is_valid(&self) -> bool {
236-
self.get() != usize::MAX
230+
self.0 != u32::MAX
237231
}
238232
}
239233

240-
fn invalid_node() -> LiveNode { LiveNode(usize::MAX) }
234+
fn invalid_node() -> LiveNode { LiveNode(u32::MAX) }
241235

242236
struct CaptureInfo {
243237
ln: LiveNode,
@@ -285,7 +279,7 @@ impl<'a, 'tcx> IrMaps<'a, 'tcx> {
285279
}
286280

287281
fn add_live_node(&mut self, lnk: LiveNodeKind) -> LiveNode {
288-
let ln = LiveNode(self.num_live_nodes);
282+
let ln = LiveNode(self.num_live_nodes as u32);
289283
self.lnks.push(lnk);
290284
self.num_live_nodes += 1;
291285

@@ -303,7 +297,7 @@ impl<'a, 'tcx> IrMaps<'a, 'tcx> {
303297
}
304298

305299
fn add_variable(&mut self, vk: VarKind) -> Variable {
306-
let v = Variable(self.num_vars);
300+
let v = Variable(self.num_vars as u32);
307301
self.var_kinds.push(vk);
308302
self.num_vars += 1;
309303

@@ -708,7 +702,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
708702
for var_idx in 0..self.ir.num_vars {
709703
let idx = node_base_idx + var_idx;
710704
if test(idx).is_valid() {
711-
write!(wr, " {:?}", Variable(var_idx))?;
705+
write!(wr, " {:?}", Variable(var_idx as u32))?;
712706
}
713707
}
714708
Ok(())
@@ -848,7 +842,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
848842
debug!("^^ liveness computation results for body {} (entry={:?})",
849843
{
850844
for ln_idx in 0..self.ir.num_live_nodes {
851-
debug!("{:?}", self.ln_str(LiveNode(ln_idx)));
845+
debug!("{:?}", self.ln_str(LiveNode(ln_idx as u32)));
852846
}
853847
body.id
854848
},

src/librustc/session/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,6 +1337,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
13371337
"enable the experimental Chalk-based trait solving engine"),
13381338
cross_lang_lto: CrossLangLto = (CrossLangLto::Disabled, parse_cross_lang_lto, [TRACKED],
13391339
"generate build artifacts that are compatible with linker-based LTO."),
1340+
no_parallel_llvm: bool = (false, parse_bool, [UNTRACKED],
1341+
"don't run LLVM in parallel (while keeping codegen-units and ThinLTO)"),
13401342
}
13411343

13421344
pub fn default_lib_output() -> CrateType {

src/librustc/ty/maps/plumbing.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,16 @@ macro_rules! define_maps {
701701
})*
702702
}
703703

704+
// This module and the functions in it exist only to provide a
705+
// predictable symbol name prefix for query providers. This is helpful
706+
// for analyzing queries in profilers.
707+
pub(super) mod __query_compute {
708+
$(#[inline(never)]
709+
pub fn $name<F: FnOnce() -> R, R>(f: F) -> R {
710+
f()
711+
})*
712+
}
713+
704714
$(impl<$tcx> QueryConfig<$tcx> for queries::$name<$tcx> {
705715
type Key = $K;
706716
type Value = $V;
@@ -722,9 +732,12 @@ macro_rules! define_maps {
722732
DepNode::new(tcx, $node(*key))
723733
}
724734

735+
#[inline]
725736
fn compute(tcx: TyCtxt<'_, 'tcx, '_>, key: Self::Key) -> Self::Value {
726-
let provider = tcx.maps.providers[key.map_crate()].$name;
727-
provider(tcx.global_tcx(), key)
737+
__query_compute::$name(move || {
738+
let provider = tcx.maps.providers[key.map_crate()].$name;
739+
provider(tcx.global_tcx(), key)
740+
})
728741
}
729742

730743
fn handle_cycle_error(tcx: TyCtxt<'_, 'tcx, '_>) -> Self::Value {

src/librustc_codegen_llvm/back/write.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1738,7 +1738,9 @@ fn start_executing_work(tcx: TyCtxt,
17381738
.binary_search_by_key(&cost, |&(_, cost)| cost)
17391739
.unwrap_or_else(|e| e);
17401740
work_items.insert(insertion_index, (work, cost));
1741-
helper.request_token();
1741+
if !cgcx.opts.debugging_opts.no_parallel_llvm {
1742+
helper.request_token();
1743+
}
17421744
}
17431745
}
17441746

@@ -1842,7 +1844,9 @@ fn start_executing_work(tcx: TyCtxt,
18421844
};
18431845
work_items.insert(insertion_index, (llvm_work_item, cost));
18441846

1845-
helper.request_token();
1847+
if !cgcx.opts.debugging_opts.no_parallel_llvm {
1848+
helper.request_token();
1849+
}
18461850
assert_eq!(main_thread_worker_state,
18471851
MainThreadWorkerState::Codegenning);
18481852
main_thread_worker_state = MainThreadWorkerState::Idle;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
12+
13+
pub fn target() -> TargetResult {
14+
let mut base = super::netbsd_base::opts();
15+
base.max_atomic_width = Some(64);
16+
Ok(Target {
17+
llvm_target: "armv6-unknown-netbsdelf-eabihf".to_string(),
18+
target_endian: "little".to_string(),
19+
target_pointer_width: "32".to_string(),
20+
target_c_int_width: "32".to_string(),
21+
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
22+
arch: "arm".to_string(),
23+
target_os: "netbsd".to_string(),
24+
target_env: "eabihf".to_string(),
25+
target_vendor: "unknown".to_string(),
26+
linker_flavor: LinkerFlavor::Gcc,
27+
28+
options: TargetOptions {
29+
features: "+v6,+vfp2".to_string(),
30+
abi_blacklist: super::arm_base::abi_blacklist(),
31+
.. base
32+
}
33+
})
34+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
12+
13+
pub fn target() -> TargetResult {
14+
let base = super::netbsd_base::opts();
15+
Ok(Target {
16+
llvm_target: "armv7-unknown-netbsdelf-eabihf".to_string(),
17+
target_endian: "little".to_string(),
18+
target_pointer_width: "32".to_string(),
19+
target_c_int_width: "32".to_string(),
20+
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
21+
arch: "arm".to_string(),
22+
target_os: "netbsd".to_string(),
23+
target_env: "eabihf".to_string(),
24+
target_vendor: "unknown".to_string(),
25+
linker_flavor: LinkerFlavor::Gcc,
26+
27+
options: TargetOptions {
28+
features: "+v7,+vfp3,+d16,+thumb2,-neon".to_string(),
29+
cpu: "generic".to_string(),
30+
max_atomic_width: Some(64),
31+
abi_blacklist: super::arm_base::abi_blacklist(),
32+
.. base
33+
}
34+
})
35+
}

0 commit comments

Comments
 (0)