Skip to content

Commit 2d2be57

Browse files
committed
Auto merge of #69094 - Dylan-DPC:rollup-4qe7uv1, r=Dylan-DPC
Rollup of 8 pull requests Successful merges: - #67585 (Improve `char::is_ascii_*` codegen) - #68914 (Speed up `SipHasher128`.) - #68994 (rustbuild: include channel in sanitizers installed name) - #69032 (ICE in nightly-2020-02-08: handle TerminatorKind::Yield in librustc_mir::transform::promote_consts::Validator method) - #69034 (parser: Remove `Parser::prev_token_kind`) - #69042 (Remove backtrace header text) - #69059 (Remove a few unused objects) - #69089 (Properly use the darwin archive format on Apple targets) Failed merges: r? @ghost
2 parents 2ed25f0 + d9982f1 commit 2d2be57

File tree

21 files changed

+199
-166
lines changed

21 files changed

+199
-166
lines changed

Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
121121

122122
[[package]]
123123
name = "backtrace"
124-
version = "0.3.40"
124+
version = "0.3.44"
125125
source = "registry+https://github.com/rust-lang/crates.io-index"
126-
checksum = "924c76597f0d9ca25d762c25a4d369d51267536465dc5064bdf0eb073ed477ea"
126+
checksum = "e4036b9bf40f3cf16aba72a3d65e8a520fc4bafcdc7079aea8f848c58c5b5536"
127127
dependencies = [
128128
"backtrace-sys",
129129
"cfg-if",

src/bootstrap/native.rs

+10-6
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ impl Step for Sanitizers {
571571
}
572572

573573
let out_dir = builder.native_dir(self.target).join("sanitizers");
574-
let runtimes = supported_sanitizers(&out_dir, self.target);
574+
let runtimes = supported_sanitizers(&out_dir, self.target, &builder.config.channel);
575575
if runtimes.is_empty() {
576576
return runtimes;
577577
}
@@ -635,7 +635,11 @@ pub struct SanitizerRuntime {
635635
}
636636

637637
/// Returns sanitizers available on a given target.
638-
fn supported_sanitizers(out_dir: &Path, target: Interned<String>) -> Vec<SanitizerRuntime> {
638+
fn supported_sanitizers(
639+
out_dir: &Path,
640+
target: Interned<String>,
641+
channel: &str,
642+
) -> Vec<SanitizerRuntime> {
639643
let mut result = Vec::new();
640644
match &*target {
641645
"x86_64-apple-darwin" => {
@@ -644,7 +648,7 @@ fn supported_sanitizers(out_dir: &Path, target: Interned<String>) -> Vec<Sanitiz
644648
cmake_target: format!("clang_rt.{}_osx_dynamic", s),
645649
path: out_dir
646650
.join(&format!("build/lib/darwin/libclang_rt.{}_osx_dynamic.dylib", s)),
647-
name: format!("librustc_rt.{}.dylib", s),
651+
name: format!("librustc-{}_rt.{}.dylib", channel, s),
648652
});
649653
}
650654
}
@@ -653,7 +657,7 @@ fn supported_sanitizers(out_dir: &Path, target: Interned<String>) -> Vec<Sanitiz
653657
result.push(SanitizerRuntime {
654658
cmake_target: format!("clang_rt.{}-x86_64", s),
655659
path: out_dir.join(&format!("build/lib/linux/libclang_rt.{}-x86_64.a", s)),
656-
name: format!("librustc_rt.{}.a", s),
660+
name: format!("librustc-{}_rt.{}.a", channel, s),
657661
});
658662
}
659663
}
@@ -662,7 +666,7 @@ fn supported_sanitizers(out_dir: &Path, target: Interned<String>) -> Vec<Sanitiz
662666
result.push(SanitizerRuntime {
663667
cmake_target: format!("clang_rt.{}-x86_64", s),
664668
path: out_dir.join(&format!("build/lib/fuchsia/libclang_rt.{}-x86_64.a", s)),
665-
name: format!("librustc_rt.{}.a", s),
669+
name: format!("librustc-{}_rt.{}.a", channel, s),
666670
});
667671
}
668672
}
@@ -671,7 +675,7 @@ fn supported_sanitizers(out_dir: &Path, target: Interned<String>) -> Vec<Sanitiz
671675
result.push(SanitizerRuntime {
672676
cmake_target: format!("clang_rt.{}-aarch64", s),
673677
path: out_dir.join(&format!("build/lib/fuchsia/libclang_rt.{}-aarch64.a", s)),
674-
name: format!("librustc_rt.{}.a", s),
678+
name: format!("librustc-{}_rt.{}.a", channel, s),
675679
});
676680
}
677681
}

src/libcore/char/methods.rs

+40-10
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,10 @@ impl char {
10751075
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
10761076
#[inline]
10771077
pub const fn is_ascii_alphabetic(&self) -> bool {
1078-
self.is_ascii() && (*self as u8).is_ascii_alphabetic()
1078+
match *self {
1079+
'A'..='Z' | 'a'..='z' => true,
1080+
_ => false,
1081+
}
10791082
}
10801083

10811084
/// Checks if the value is an ASCII uppercase character:
@@ -1108,7 +1111,10 @@ impl char {
11081111
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
11091112
#[inline]
11101113
pub const fn is_ascii_uppercase(&self) -> bool {
1111-
self.is_ascii() && (*self as u8).is_ascii_uppercase()
1114+
match *self {
1115+
'A'..='Z' => true,
1116+
_ => false,
1117+
}
11121118
}
11131119

11141120
/// Checks if the value is an ASCII lowercase character:
@@ -1141,7 +1147,10 @@ impl char {
11411147
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
11421148
#[inline]
11431149
pub const fn is_ascii_lowercase(&self) -> bool {
1144-
self.is_ascii() && (*self as u8).is_ascii_lowercase()
1150+
match *self {
1151+
'a'..='z' => true,
1152+
_ => false,
1153+
}
11451154
}
11461155

11471156
/// Checks if the value is an ASCII alphanumeric character:
@@ -1177,7 +1186,10 @@ impl char {
11771186
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
11781187
#[inline]
11791188
pub const fn is_ascii_alphanumeric(&self) -> bool {
1180-
self.is_ascii() && (*self as u8).is_ascii_alphanumeric()
1189+
match *self {
1190+
'0'..='9' | 'A'..='Z' | 'a'..='z' => true,
1191+
_ => false,
1192+
}
11811193
}
11821194

11831195
/// Checks if the value is an ASCII decimal digit:
@@ -1210,7 +1222,10 @@ impl char {
12101222
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
12111223
#[inline]
12121224
pub const fn is_ascii_digit(&self) -> bool {
1213-
self.is_ascii() && (*self as u8).is_ascii_digit()
1225+
match *self {
1226+
'0'..='9' => true,
1227+
_ => false,
1228+
}
12141229
}
12151230

12161231
/// Checks if the value is an ASCII hexadecimal digit:
@@ -1246,7 +1261,10 @@ impl char {
12461261
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
12471262
#[inline]
12481263
pub const fn is_ascii_hexdigit(&self) -> bool {
1249-
self.is_ascii() && (*self as u8).is_ascii_hexdigit()
1264+
match *self {
1265+
'0'..='9' | 'A'..='F' | 'a'..='f' => true,
1266+
_ => false,
1267+
}
12501268
}
12511269

12521270
/// Checks if the value is an ASCII punctuation character:
@@ -1283,7 +1301,10 @@ impl char {
12831301
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
12841302
#[inline]
12851303
pub const fn is_ascii_punctuation(&self) -> bool {
1286-
self.is_ascii() && (*self as u8).is_ascii_punctuation()
1304+
match *self {
1305+
'!'..='/' | ':'..='@' | '['..='`' | '{'..='~' => true,
1306+
_ => false,
1307+
}
12871308
}
12881309

12891310
/// Checks if the value is an ASCII graphic character:
@@ -1316,7 +1337,10 @@ impl char {
13161337
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
13171338
#[inline]
13181339
pub const fn is_ascii_graphic(&self) -> bool {
1319-
self.is_ascii() && (*self as u8).is_ascii_graphic()
1340+
match *self {
1341+
'!'..='~' => true,
1342+
_ => false,
1343+
}
13201344
}
13211345

13221346
/// Checks if the value is an ASCII whitespace character:
@@ -1366,7 +1390,10 @@ impl char {
13661390
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
13671391
#[inline]
13681392
pub const fn is_ascii_whitespace(&self) -> bool {
1369-
self.is_ascii() && (*self as u8).is_ascii_whitespace()
1393+
match *self {
1394+
'\t' | '\n' | '\x0C' | '\r' | ' ' => true,
1395+
_ => false,
1396+
}
13701397
}
13711398

13721399
/// Checks if the value is an ASCII control character:
@@ -1401,6 +1428,9 @@ impl char {
14011428
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
14021429
#[inline]
14031430
pub const fn is_ascii_control(&self) -> bool {
1404-
self.is_ascii() && (*self as u8).is_ascii_control()
1431+
match *self {
1432+
'\0'..='\x1F' | '\x7F' => true,
1433+
_ => false,
1434+
}
14051435
}
14061436
}

src/librustc/infer/region_constraints/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,6 @@ impl TaintDirections {
339339
}
340340
}
341341

342-
pub struct ConstraintInfo {}
343-
344342
impl<'tcx> RegionConstraintCollector<'tcx> {
345343
pub fn new() -> Self {
346344
Self::default()

src/librustc_codegen_llvm/llvm/ffi.rs

+1
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ pub enum ArchiveKind {
459459
Other,
460460
K_GNU,
461461
K_BSD,
462+
K_DARWIN,
462463
K_COFF,
463464
}
464465

src/librustc_codegen_llvm/llvm/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ impl FromStr for ArchiveKind {
6969
match s {
7070
"gnu" => Ok(ArchiveKind::K_GNU),
7171
"bsd" => Ok(ArchiveKind::K_BSD),
72+
"darwin" => Ok(ArchiveKind::K_DARWIN),
7273
"coff" => Ok(ArchiveKind::K_COFF),
7374
_ => Err(()),
7475
}

src/librustc_codegen_ssa/back/link.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -765,20 +765,23 @@ fn link_sanitizer_runtime(sess: &Session, crate_type: config::CrateType, linker:
765765
let default_sysroot = filesearch::get_or_default_sysroot();
766766
let default_tlib =
767767
filesearch::make_target_lib_path(&default_sysroot, sess.opts.target_triple.triple());
768+
let channel = option_env!("CFG_RELEASE_CHANNEL")
769+
.map(|channel| format!("-{}", channel))
770+
.unwrap_or_default();
768771

769772
match sess.opts.target_triple.triple() {
770773
"x86_64-apple-darwin" => {
771774
// On Apple platforms, the sanitizer is always built as a dylib, and
772775
// LLVM will link to `@rpath/*.dylib`, so we need to specify an
773776
// rpath to the library as well (the rpath should be absolute, see
774777
// PR #41352 for details).
775-
let libname = format!("rustc_rt.{}", name);
778+
let libname = format!("rustc{}_rt.{}", channel, name);
776779
let rpath = default_tlib.to_str().expect("non-utf8 component in path");
777780
linker.args(&["-Wl,-rpath".into(), "-Xlinker".into(), rpath.into()]);
778781
linker.link_dylib(Symbol::intern(&libname));
779782
}
780783
"x86_64-unknown-linux-gnu" | "x86_64-fuchsia" | "aarch64-fuchsia" => {
781-
let filename = format!("librustc_rt.{}.a", name);
784+
let filename = format!("librustc{}_rt.{}.a", channel, name);
782785
let path = default_tlib.join(&filename);
783786
linker.link_whole_rlib(&path);
784787
}

src/librustc_codegen_ssa/build.rs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
fn main() {
2+
println!("cargo:rerun-if-changed=build.rs");
3+
println!("cargo:rerun-if-env-changed=CFG_RELEASE_CHANNEL");
4+
}

0 commit comments

Comments
 (0)