Skip to content

Commit 211d1e0

Browse files
committed
Auto merge of #63648 - Centril:rollup-2kpdrj1, r=Centril
Rollup of 6 pull requests Successful merges: - #63149 (resolve: Populate external modules in more automatic and lazy way) - #63545 (Feature gate 'yield $expr?' pre-expansion) - #63548 (Update rustc-demangle to 0.1.16.) - #63558 (Remap paths for proc-macro crates.) - #63641 (add git keyword to submodule comments in config.example.toml) - #63642 (Rename overflowing_{add,sub,mul} intrinsics to wrapping_{add,sub,mul}.) Failed merges: r? @ghost
2 parents bdfd698 + e8fb78b commit 211d1e0

File tree

25 files changed

+271
-207
lines changed

25 files changed

+271
-207
lines changed

Cargo.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ dependencies = [
106106
"cfg-if 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
107107
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
108108
"libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
109-
"rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
109+
"rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
110110
"rustc-std-workspace-core 1.0.0",
111111
]
112112

@@ -2729,7 +2729,7 @@ dependencies = [
27292729

27302730
[[package]]
27312731
name = "rustc-demangle"
2732-
version = "0.1.15"
2732+
version = "0.1.16"
27332733
source = "registry+https://github.com/rust-lang/crates.io-index"
27342734
dependencies = [
27352735
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2887,7 +2887,7 @@ dependencies = [
28872887
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
28882888
"punycode 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
28892889
"rustc 0.0.0",
2890-
"rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
2890+
"rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
28912891
"rustc_data_structures 0.0.0",
28922892
"rustc_metadata 0.0.0",
28932893
"rustc_target 0.0.0",
@@ -4592,7 +4592,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
45924592
"checksum rustc-ap-serialize 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "61673783f2089e01033ffa82d1988f55175402071b31253a358292e1624d4602"
45934593
"checksum rustc-ap-syntax 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28f3dd1346d5b0269c07a4a78855e309a298ab569c9c1302d4d4f57f8eee4e84"
45944594
"checksum rustc-ap-syntax_pos 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45e67b526dbda3a0c7dab91c8947d43685e7697f52686a4949da3c179cd7c979"
4595-
"checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af"
4595+
"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
45964596
"checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8"
45974597
"checksum rustc-rayon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0d2e07e19601f21c59aad953c2632172ba70cb27e685771514ea66e4062b3363"
45984598
"checksum rustc-rayon-core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79d38ca7cbc22fa59f09d8534ea4b27f67b0facf0cbe274433aceea227a02543"

config.toml.example

+2-2
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@
141141
# library and facade crates.
142142
#compiler-docs = false
143143

144-
# Indicate whether submodules are managed and updated automatically.
144+
# Indicate whether git submodules are managed and updated automatically.
145145
#submodules = true
146146

147-
# Update submodules only when the checked out commit in the submodules differs
147+
# Update git submodules only when the checked out commit in the submodules differs
148148
# from what is committed in the main rustc repo.
149149
#fast-submodules = true
150150

src/bootstrap/bin/rustc.rs

+11-6
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,13 @@ fn main() {
102102
// FIXME: the fact that core here is excluded is due to core_arch from our stdarch submodule
103103
// being broken on the beta compiler with bootstrap passed, so this is a temporary workaround
104104
// (we've just snapped, so there are no cfg(bootstrap) related annotations in core).
105-
if stage == "0" && crate_name != Some("core") {
106-
cmd.arg("--cfg").arg("bootstrap");
105+
if stage == "0" {
106+
if crate_name != Some("core") {
107+
cmd.arg("--cfg").arg("bootstrap");
108+
} else {
109+
// NOTE(eddyb) see FIXME above, except now we need annotations again in core.
110+
cmd.arg("--cfg").arg("boostrap_stdarch_ignore_this");
111+
}
107112
}
108113

109114
// Print backtrace in case of ICE
@@ -276,10 +281,6 @@ fn main() {
276281
cmd.arg("-C").arg("target-feature=-crt-static");
277282
}
278283
}
279-
280-
if let Ok(map) = env::var("RUSTC_DEBUGINFO_MAP") {
281-
cmd.arg("--remap-path-prefix").arg(&map);
282-
}
283284
} else {
284285
// Override linker if necessary.
285286
if let Ok(host_linker) = env::var("RUSTC_HOST_LINKER") {
@@ -296,6 +297,10 @@ fn main() {
296297
}
297298
}
298299

300+
if let Ok(map) = env::var("RUSTC_DEBUGINFO_MAP") {
301+
cmd.arg("--remap-path-prefix").arg(&map);
302+
}
303+
299304
// Force all crates compiled by this compiler to (a) be unstable and (b)
300305
// allow the `rustc_private` feature to link to other unstable crates
301306
// also in the sysroot. We also do this for host crates, since those

src/libcore/intrinsics.rs

+22
Original file line numberDiff line numberDiff line change
@@ -1293,18 +1293,40 @@ extern "rust-intrinsic" {
12931293
/// The stabilized versions of this intrinsic are available on the integer
12941294
/// primitives via the `wrapping_add` method. For example,
12951295
/// [`std::u32::wrapping_add`](../../std/primitive.u32.html#method.wrapping_add)
1296+
#[cfg(boostrap_stdarch_ignore_this)]
12961297
pub fn overflowing_add<T>(a: T, b: T) -> T;
12971298
/// Returns (a - b) mod 2<sup>N</sup>, where N is the width of T in bits.
12981299
/// The stabilized versions of this intrinsic are available on the integer
12991300
/// primitives via the `wrapping_sub` method. For example,
13001301
/// [`std::u32::wrapping_sub`](../../std/primitive.u32.html#method.wrapping_sub)
1302+
#[cfg(boostrap_stdarch_ignore_this)]
13011303
pub fn overflowing_sub<T>(a: T, b: T) -> T;
13021304
/// Returns (a * b) mod 2<sup>N</sup>, where N is the width of T in bits.
13031305
/// The stabilized versions of this intrinsic are available on the integer
13041306
/// primitives via the `wrapping_mul` method. For example,
13051307
/// [`std::u32::wrapping_mul`](../../std/primitive.u32.html#method.wrapping_mul)
1308+
#[cfg(boostrap_stdarch_ignore_this)]
13061309
pub fn overflowing_mul<T>(a: T, b: T) -> T;
13071310

1311+
/// Returns (a + b) mod 2<sup>N</sup>, where N is the width of T in bits.
1312+
/// The stabilized versions of this intrinsic are available on the integer
1313+
/// primitives via the `wrapping_add` method. For example,
1314+
/// [`std::u32::wrapping_add`](../../std/primitive.u32.html#method.wrapping_add)
1315+
#[cfg(not(boostrap_stdarch_ignore_this))]
1316+
pub fn wrapping_add<T>(a: T, b: T) -> T;
1317+
/// Returns (a - b) mod 2<sup>N</sup>, where N is the width of T in bits.
1318+
/// The stabilized versions of this intrinsic are available on the integer
1319+
/// primitives via the `wrapping_sub` method. For example,
1320+
/// [`std::u32::wrapping_sub`](../../std/primitive.u32.html#method.wrapping_sub)
1321+
#[cfg(not(boostrap_stdarch_ignore_this))]
1322+
pub fn wrapping_sub<T>(a: T, b: T) -> T;
1323+
/// Returns (a * b) mod 2<sup>N</sup>, where N is the width of T in bits.
1324+
/// The stabilized versions of this intrinsic are available on the integer
1325+
/// primitives via the `wrapping_mul` method. For example,
1326+
/// [`std::u32::wrapping_mul`](../../std/primitive.u32.html#method.wrapping_mul)
1327+
#[cfg(not(boostrap_stdarch_ignore_this))]
1328+
pub fn wrapping_mul<T>(a: T, b: T) -> T;
1329+
13081330
/// Computes `a + b`, while saturating at numeric bounds.
13091331
/// The stabilized versions of this intrinsic are available on the integer
13101332
/// primitives via the `saturating_add` method. For example,

src/libcore/num/mod.rs

+42-6
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,13 @@ $EndFeature, "
11121112
without modifying the original"]
11131113
#[inline]
11141114
pub const fn wrapping_add(self, rhs: Self) -> Self {
1115-
intrinsics::overflowing_add(self, rhs)
1115+
#[cfg(boostrap_stdarch_ignore_this)] {
1116+
intrinsics::overflowing_add(self, rhs)
1117+
}
1118+
1119+
#[cfg(not(boostrap_stdarch_ignore_this))] {
1120+
intrinsics::wrapping_add(self, rhs)
1121+
}
11161122
}
11171123
}
11181124

@@ -1135,7 +1141,13 @@ $EndFeature, "
11351141
without modifying the original"]
11361142
#[inline]
11371143
pub const fn wrapping_sub(self, rhs: Self) -> Self {
1138-
intrinsics::overflowing_sub(self, rhs)
1144+
#[cfg(boostrap_stdarch_ignore_this)] {
1145+
intrinsics::overflowing_sub(self, rhs)
1146+
}
1147+
1148+
#[cfg(not(boostrap_stdarch_ignore_this))] {
1149+
intrinsics::wrapping_sub(self, rhs)
1150+
}
11391151
}
11401152
}
11411153

@@ -1157,7 +1169,13 @@ $EndFeature, "
11571169
without modifying the original"]
11581170
#[inline]
11591171
pub const fn wrapping_mul(self, rhs: Self) -> Self {
1160-
intrinsics::overflowing_mul(self, rhs)
1172+
#[cfg(boostrap_stdarch_ignore_this)] {
1173+
intrinsics::overflowing_mul(self, rhs)
1174+
}
1175+
1176+
#[cfg(not(boostrap_stdarch_ignore_this))] {
1177+
intrinsics::wrapping_mul(self, rhs)
1178+
}
11611179
}
11621180
}
11631181

@@ -3031,7 +3049,13 @@ $EndFeature, "
30313049
without modifying the original"]
30323050
#[inline]
30333051
pub const fn wrapping_add(self, rhs: Self) -> Self {
3034-
intrinsics::overflowing_add(self, rhs)
3052+
#[cfg(boostrap_stdarch_ignore_this)] {
3053+
intrinsics::overflowing_add(self, rhs)
3054+
}
3055+
3056+
#[cfg(not(boostrap_stdarch_ignore_this))] {
3057+
intrinsics::wrapping_add(self, rhs)
3058+
}
30353059
}
30363060
}
30373061

@@ -3053,7 +3077,13 @@ $EndFeature, "
30533077
without modifying the original"]
30543078
#[inline]
30553079
pub const fn wrapping_sub(self, rhs: Self) -> Self {
3056-
intrinsics::overflowing_sub(self, rhs)
3080+
#[cfg(boostrap_stdarch_ignore_this)] {
3081+
intrinsics::overflowing_sub(self, rhs)
3082+
}
3083+
3084+
#[cfg(not(boostrap_stdarch_ignore_this))] {
3085+
intrinsics::wrapping_sub(self, rhs)
3086+
}
30573087
}
30583088
}
30593089

@@ -3076,7 +3106,13 @@ $EndFeature, "
30763106
without modifying the original"]
30773107
#[inline]
30783108
pub const fn wrapping_mul(self, rhs: Self) -> Self {
3079-
intrinsics::overflowing_mul(self, rhs)
3109+
#[cfg(boostrap_stdarch_ignore_this)] {
3110+
intrinsics::overflowing_mul(self, rhs)
3111+
}
3112+
3113+
#[cfg(not(boostrap_stdarch_ignore_this))] {
3114+
intrinsics::wrapping_mul(self, rhs)
3115+
}
30803116
}
30813117

30823118
doc_comment! {

src/librustc_codegen_llvm/intrinsic.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> {
328328
},
329329
"ctlz" | "ctlz_nonzero" | "cttz" | "cttz_nonzero" | "ctpop" | "bswap" |
330330
"bitreverse" | "add_with_overflow" | "sub_with_overflow" |
331-
"mul_with_overflow" | "overflowing_add" | "overflowing_sub" | "overflowing_mul" |
331+
"mul_with_overflow" | "wrapping_add" | "wrapping_sub" | "wrapping_mul" |
332332
"unchecked_div" | "unchecked_rem" | "unchecked_shl" | "unchecked_shr" |
333333
"unchecked_add" | "unchecked_sub" | "unchecked_mul" | "exact_div" |
334334
"rotate_left" | "rotate_right" | "saturating_add" | "saturating_sub" => {
@@ -398,9 +398,9 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> {
398398

399399
return;
400400
},
401-
"overflowing_add" => self.add(args[0].immediate(), args[1].immediate()),
402-
"overflowing_sub" => self.sub(args[0].immediate(), args[1].immediate()),
403-
"overflowing_mul" => self.mul(args[0].immediate(), args[1].immediate()),
401+
"wrapping_add" => self.add(args[0].immediate(), args[1].immediate()),
402+
"wrapping_sub" => self.sub(args[0].immediate(), args[1].immediate()),
403+
"wrapping_mul" => self.mul(args[0].immediate(), args[1].immediate()),
404404
"exact_div" =>
405405
if signed {
406406
self.exactsdiv(args[0].immediate(), args[1].immediate())

src/librustc_codegen_utils/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test = false
1313
flate2 = "1.0"
1414
log = "0.4"
1515
punycode = "0.4.0"
16-
rustc-demangle = "0.1.15"
16+
rustc-demangle = "0.1.16"
1717

1818
syntax = { path = "../libsyntax" }
1919
syntax_pos = { path = "../libsyntax_pos" }

src/librustc_mir/interpret/intrinsics.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,18 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
110110
};
111111
self.write_scalar(out_val, dest)?;
112112
}
113-
| "overflowing_add"
114-
| "overflowing_sub"
115-
| "overflowing_mul"
113+
| "wrapping_add"
114+
| "wrapping_sub"
115+
| "wrapping_mul"
116116
| "add_with_overflow"
117117
| "sub_with_overflow"
118118
| "mul_with_overflow" => {
119119
let lhs = self.read_immediate(args[0])?;
120120
let rhs = self.read_immediate(args[1])?;
121121
let (bin_op, ignore_overflow) = match intrinsic_name {
122-
"overflowing_add" => (BinOp::Add, true),
123-
"overflowing_sub" => (BinOp::Sub, true),
124-
"overflowing_mul" => (BinOp::Mul, true),
122+
"wrapping_add" => (BinOp::Add, true),
123+
"wrapping_sub" => (BinOp::Sub, true),
124+
"wrapping_mul" => (BinOp::Mul, true),
125125
"add_with_overflow" => (BinOp::Add, false),
126126
"sub_with_overflow" => (BinOp::Sub, false),
127127
"mul_with_overflow" => (BinOp::Mul, false),

src/librustc_mir/transform/qualify_consts.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,9 @@ impl Qualif for IsNotPromotable {
537537
| "cttz_nonzero"
538538
| "ctlz"
539539
| "ctlz_nonzero"
540-
| "overflowing_add"
541-
| "overflowing_sub"
542-
| "overflowing_mul"
540+
| "wrapping_add"
541+
| "wrapping_sub"
542+
| "wrapping_mul"
543543
| "unchecked_shl"
544544
| "unchecked_shr"
545545
| "rotate_left"

src/librustc_mir/transform/qualify_min_const_fn.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,9 @@ fn is_intrinsic_whitelisted(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool {
379379
| "add_with_overflow" // ~> .overflowing_add
380380
| "sub_with_overflow" // ~> .overflowing_sub
381381
| "mul_with_overflow" // ~> .overflowing_mul
382-
| "overflowing_add" // ~> .wrapping_add
383-
| "overflowing_sub" // ~> .wrapping_sub
384-
| "overflowing_mul" // ~> .wrapping_mul
382+
| "wrapping_add" // ~> .wrapping_add
383+
| "wrapping_sub" // ~> .wrapping_sub
384+
| "wrapping_mul" // ~> .wrapping_mul
385385
| "saturating_add" // ~> .saturating_add
386386
| "saturating_sub" // ~> .saturating_sub
387387
| "unchecked_shl" // ~> .wrapping_shl

0 commit comments

Comments
 (0)