Skip to content

Commit 82c34ad

Browse files
committed
Auto merge of rust-lang#3667 - RalfJung:rustup, r=RalfJung
Rustup
2 parents 0d66db9 + c0fe47d commit 82c34ad

File tree

252 files changed

+3968
-1599
lines changed

Some content is hidden

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

252 files changed

+3968
-1599
lines changed

Cargo.lock

+129-148
Large diffs are not rendered by default.

RELEASES.md

+128
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,131 @@
1+
Version 1.79.0 (2024-06-13)
2+
==========================
3+
4+
<a id="1.79.0-Language"></a>
5+
6+
Language
7+
--------
8+
- [Stabilize inline `const {}` expressions.](https://github.com/rust-lang/rust/pull/104087/)
9+
- [Prevent opaque types being instantiated twice with different regions within the same function.](https://github.com/rust-lang/rust/pull/116935/)
10+
- [Stabilize WebAssembly target features that are in phase 4 and 5.](https://github.com/rust-lang/rust/pull/117457/)
11+
- [Add the `redundant_lifetimes` lint to detect lifetimes which are semantically redundant.](https://github.com/rust-lang/rust/pull/118391/)
12+
- [Stabilize the `unnameable_types` lint for public types that can't be named.](https://github.com/rust-lang/rust/pull/120144/)
13+
- [Enable debuginfo in macros, and stabilize `-C collapse-macro-debuginfo` and `#[collapse_debuginfo]`.](https://github.com/rust-lang/rust/pull/120845/)
14+
- [Propagate temporary lifetime extension into `if` and `match` expressions.](https://github.com/rust-lang/rust/pull/121346/)
15+
- [Restrict promotion of `const fn` calls.](https://github.com/rust-lang/rust/pull/121557/)
16+
- [Warn against refining impls of crate-private traits with `refining_impl_trait` lint.](https://github.com/rust-lang/rust/pull/121720/)
17+
- [Stabilize associated type bounds (RFC 2289).](https://github.com/rust-lang/rust/pull/122055/)
18+
- [Stabilize importing `main` from other modules or crates.](https://github.com/rust-lang/rust/pull/122060/)
19+
- [Check return types of function types for well-formedness](https://github.com/rust-lang/rust/pull/115538)
20+
- [Rework `impl Trait` lifetime inference](https://github.com/rust-lang/rust/pull/116891/)
21+
- [Change inductive trait solver cycles to be ambiguous](https://github.com/rust-lang/rust/pull/122791)
22+
23+
<a id="1.79.0-Compiler"></a>
24+
25+
Compiler
26+
--------
27+
- [Define `-C strip` to only affect binaries, not artifacts like `.pdb`.](https://github.com/rust-lang/rust/pull/115120/)
28+
- [Stabilize `-Crelro-level` for controlling runtime link hardening.](https://github.com/rust-lang/rust/pull/121694/)
29+
- [Stabilize checking of `cfg` names and values at compile-time with `--check-cfg`.](https://github.com/rust-lang/rust/pull/123501/)
30+
*Note that this only stabilizes the compiler part, the Cargo part is still unstable in this release.*
31+
- [Add `aarch64-apple-visionos` and `aarch64-apple-visionos-sim` tier 3 targets.](https://github.com/rust-lang/rust/pull/121419/)
32+
- [Add `riscv32ima-unknown-none-elf` tier 3 target.](https://github.com/rust-lang/rust/pull/122696/)
33+
- [Promote several Windows targets to tier 2](https://github.com/rust-lang/rust/pull/121712): `aarch64-pc-windows-gnullvm`, `i686-pc-windows-gnullvm`, and `x86_64-pc-windows-gnullvm`.
34+
35+
Refer to Rust's [platform support page][platform-support-doc]
36+
for more information on Rust's tiered platform support.
37+
38+
<a id="1.79.0-Libraries"></a>
39+
40+
Libraries
41+
---------
42+
43+
- [Implement `FromIterator` for `(impl Default + Extend, impl Default + Extend)`.](https://github.com/rust-lang/rust/pull/107462/)
44+
- [Implement `{Div,Rem}Assign<NonZero<X>>` on `X`.](https://github.com/rust-lang/rust/pull/121952/)
45+
- [Document overrides of `clone_from()` in core/std.](https://github.com/rust-lang/rust/pull/122201/)
46+
- [Link MSVC default lib in core.](https://github.com/rust-lang/rust/pull/122268/)
47+
- [Caution against using `transmute` between pointers and integers.](https://github.com/rust-lang/rust/pull/122379/)
48+
- [Enable frame pointers for the standard library.](https://github.com/rust-lang/rust/pull/122646/)
49+
50+
<a id="1.79.0-Stabilized-APIs"></a>
51+
52+
Stabilized APIs
53+
---------------
54+
55+
- [`{integer}::unchecked_add`](https://doc.rust-lang.org/stable/core/primitive.i32.html#method.unchecked_add)
56+
- [`{integer}::unchecked_mul`](https://doc.rust-lang.org/stable/core/primitive.i32.html#method.unchecked_mul)
57+
- [`{integer}::unchecked_sub`](https://doc.rust-lang.org/stable/core/primitive.i32.html#method.unchecked_sub)
58+
- [`<[T]>::split_at_unchecked`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_at_unchecked)
59+
- [`<[T]>::split_at_mut_unchecked`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_at_mut_unchecked)
60+
- [`<[u8]>::utf8_chunks`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.utf8_chunks)
61+
- [`str::Utf8Chunks`](https://doc.rust-lang.org/stable/core/str/struct.Utf8Chunks.html)
62+
- [`str::Utf8Chunk`](https://doc.rust-lang.org/stable/core/str/struct.Utf8Chunk.html)
63+
- [`<*const T>::is_aligned`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.is_aligned)
64+
- [`<*mut T>::is_aligned`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.is_aligned-1)
65+
- [`NonNull::is_aligned`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.is_aligned)
66+
- [`<*const [T]>::len`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.len)
67+
- [`<*mut [T]>::len`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.len-1)
68+
- [`<*const [T]>::is_empty`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.is_empty)
69+
- [`<*mut [T]>::is_empty`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.is_empty-1)
70+
- [`NonNull::<[T]>::is_empty`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.is_empty)
71+
- [`CStr::count_bytes`](https://doc.rust-lang.org/stable/core/ffi/c_str/struct.CStr.html#method.count_bytes)
72+
- [`io::Error::downcast`](https://doc.rust-lang.org/stable/std/io/struct.Error.html#method.downcast)
73+
- [`num::NonZero<T>`](https://doc.rust-lang.org/stable/core/num/struct.NonZero.html)
74+
- [`path::absolute`](https://doc.rust-lang.org/stable/std/path/fn.absolute.html)
75+
- [`proc_macro::Literal::byte_character`](https://doc.rust-lang.org/stable/proc_macro/struct.Literal.html#method.byte_character)
76+
- [`proc_macro::Literal::c_string`](https://doc.rust-lang.org/stable/proc_macro/struct.Literal.html#method.c_string)
77+
78+
These APIs are now stable in const contexts:
79+
80+
- [`Atomic*::into_inner`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicUsize.html#method.into_inner)
81+
- [`io::Cursor::new`](https://doc.rust-lang.org/stable/std/io/struct.Cursor.html#method.new)
82+
- [`io::Cursor::get_ref`](https://doc.rust-lang.org/stable/std/io/struct.Cursor.html#method.get_ref)
83+
- [`io::Cursor::position`](https://doc.rust-lang.org/stable/std/io/struct.Cursor.html#method.position)
84+
- [`io::empty`](https://doc.rust-lang.org/stable/std/io/fn.empty.html)
85+
- [`io::repeat`](https://doc.rust-lang.org/stable/std/io/fn.repeat.html)
86+
- [`io::sink`](https://doc.rust-lang.org/stable/std/io/fn.sink.html)
87+
- [`panic::Location::caller`](https://doc.rust-lang.org/stable/std/panic/struct.Location.html#method.caller)
88+
- [`panic::Location::file`](https://doc.rust-lang.org/stable/std/panic/struct.Location.html#method.file)
89+
- [`panic::Location::line`](https://doc.rust-lang.org/stable/std/panic/struct.Location.html#method.line)
90+
- [`panic::Location::column`](https://doc.rust-lang.org/stable/std/panic/struct.Location.html#method.column)
91+
92+
<a id="1.79.0-Cargo"></a>
93+
94+
Cargo
95+
-----
96+
97+
- [Prevent dashes in `lib.name`, always normalizing to `_`.](https://github.com/rust-lang/cargo/pull/12783/)
98+
- [Stabilize MSRV-aware version requirement selection in `cargo add`.](https://github.com/rust-lang/cargo/pull/13608/)
99+
- [Switch to using `gitoxide` by default for listing files.](https://github.com/rust-lang/cargo/pull/13696/)
100+
- [Error on `[project]` in Edition 2024; `cargo fix --edition` will change it to `[package]`.](https://github.com/rust-lang/cargo/pull/13747/)
101+
102+
<a id="1.79.0-Rustdoc"></a>
103+
104+
Rustdoc
105+
-----
106+
107+
- [Always display stability version even if it's the same as the containing item.](https://github.com/rust-lang/rust/pull/118441/)
108+
- [Show a single search result for items with multiple paths.](https://github.com/rust-lang/rust/pull/119912/)
109+
- [Support typing `/` in docs to begin a search.](https://github.com/rust-lang/rust/pull/123355/)
110+
111+
<a id="1.79.0-Misc"></a>
112+
113+
Misc
114+
----
115+
116+
<a id="1.79.0-Compatibility-Notes"></a>
117+
118+
Compatibility Notes
119+
-------------------
120+
121+
- [Update the minimum external LLVM to 17.](https://github.com/rust-lang/rust/pull/122649/)
122+
- [`RustcEncodable` and `RustcDecodable` are soft-destabilized, to be removed
123+
from the prelude in next edition.](https://github.com/rust-lang/rust/pull/116016/)
124+
- [The `wasm_c_abi` future-incompatibility lint will warn about use of the
125+
non-spec-compliant C ABI.](https://github.com/rust-lang/rust/pull/117918/)
126+
Use `wasm-bindgen v0.2.88` to generate forward-compatible bindings.
127+
- [Check return types of function types for well-formedness](https://github.com/rust-lang/rust/pull/115538)
128+
1129
Version 1.78.0 (2024-05-02)
2130
==========================
3131

compiler/rustc_ast_ir/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ rustc_data_structures = { path = "../rustc_data_structures", optional = true }
99
rustc_macros = { path = "../rustc_macros", optional = true }
1010
rustc_serialize = { path = "../rustc_serialize", optional = true }
1111
rustc_span = { path = "../rustc_span", optional = true }
12-
smallvec = { version = "1.8.1" }
1312
# tidy-alphabetical-end
1413

1514
[features]

compiler/rustc_baked_icu_data/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ icu_list = "1.2"
99
icu_locid = "1.2"
1010
icu_locid_transform = "1.3.2"
1111
icu_provider = "1.2"
12-
icu_provider_adapters = "1.2"
1312
zerovec = "0.10.0"
1413
# tidy-alphabetical-end
1514

compiler/rustc_codegen_cranelift/src/base.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -832,9 +832,10 @@ fn codegen_stmt<'tcx>(
832832
let val = match null_op {
833833
NullOp::SizeOf => layout.size.bytes(),
834834
NullOp::AlignOf => layout.align.abi.bytes(),
835-
NullOp::OffsetOf(fields) => {
836-
layout.offset_of_subfield(fx, fields.iter()).bytes()
837-
}
835+
NullOp::OffsetOf(fields) => fx
836+
.tcx
837+
.offset_of_subfield(ParamEnv::reveal_all(), layout, fields.iter())
838+
.bytes(),
838839
NullOp::UbChecks => {
839840
let val = fx.tcx.sess.ub_checks();
840841
let val = CValue::by_val(

compiler/rustc_codegen_cranelift/src/constant.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ pub(crate) fn codegen_const_value<'tcx>(
110110
if fx.clif_type(layout.ty).is_some() {
111111
return CValue::const_val(fx, layout, int);
112112
} else {
113-
let raw_val = int.size().truncate(int.assert_bits(int.size()));
113+
let raw_val = int.size().truncate(int.to_bits(int.size()));
114114
let val = match int.size().bytes() {
115115
1 => fx.bcx.ins().iconst(types::I8, raw_val as i64),
116116
2 => fx.bcx.ins().iconst(types::I16, raw_val as i64),
@@ -501,12 +501,12 @@ pub(crate) fn mir_operand_get_const_val<'tcx>(
501501
Ordering::Equal => scalar_int,
502502
Ordering::Less => match ty.kind() {
503503
ty::Uint(_) => ScalarInt::try_from_uint(
504-
scalar_int.assert_uint(scalar_int.size()),
504+
scalar_int.to_uint(scalar_int.size()),
505505
fx.layout_of(*ty).size,
506506
)
507507
.unwrap(),
508508
ty::Int(_) => ScalarInt::try_from_int(
509-
scalar_int.assert_int(scalar_int.size()),
509+
scalar_int.to_int(scalar_int.size()),
510510
fx.layout_of(*ty).size,
511511
)
512512
.unwrap(),

compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ pub(crate) fn codegen_x86_llvm_intrinsic_call<'tcx>(
902902
.span_fatal(span, "Index argument for `_mm_cmpestri` is not a constant");
903903
};
904904

905-
let imm8 = imm8.try_to_u8().unwrap_or_else(|_| panic!("kind not scalar: {:?}", imm8));
905+
let imm8 = imm8.to_u8();
906906

907907
codegen_inline_asm_inner(
908908
fx,
@@ -955,7 +955,7 @@ pub(crate) fn codegen_x86_llvm_intrinsic_call<'tcx>(
955955
.span_fatal(span, "Index argument for `_mm_cmpestrm` is not a constant");
956956
};
957957

958-
let imm8 = imm8.try_to_u8().unwrap_or_else(|_| panic!("kind not scalar: {:?}", imm8));
958+
let imm8 = imm8.to_u8();
959959

960960
codegen_inline_asm_inner(
961961
fx,
@@ -1003,7 +1003,7 @@ pub(crate) fn codegen_x86_llvm_intrinsic_call<'tcx>(
10031003
);
10041004
};
10051005

1006-
let imm8 = imm8.try_to_u8().unwrap_or_else(|_| panic!("kind not scalar: {:?}", imm8));
1006+
let imm8 = imm8.to_u8();
10071007

10081008
codegen_inline_asm_inner(
10091009
fx,
@@ -1040,7 +1040,7 @@ pub(crate) fn codegen_x86_llvm_intrinsic_call<'tcx>(
10401040
);
10411041
};
10421042

1043-
let imm8 = imm8.try_to_u8().unwrap_or_else(|_| panic!("kind not scalar: {:?}", imm8));
1043+
let imm8 = imm8.to_u8();
10441044

10451045
codegen_inline_asm_inner(
10461046
fx,
@@ -1195,7 +1195,7 @@ pub(crate) fn codegen_x86_llvm_intrinsic_call<'tcx>(
11951195
.span_fatal(span, "Func argument for `_mm_sha1rnds4_epu32` is not a constant");
11961196
};
11971197

1198-
let func = func.try_to_u8().unwrap_or_else(|_| panic!("kind not scalar: {:?}", func));
1198+
let func = func.to_u8();
11991199

12001200
codegen_inline_asm_inner(
12011201
fx,

compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
147147

148148
let total_len = lane_count * 2;
149149

150-
let indexes =
151-
idx.iter().map(|idx| idx.unwrap_leaf().try_to_u32().unwrap()).collect::<Vec<u32>>();
150+
let indexes = idx.iter().map(|idx| idx.unwrap_leaf().to_u32()).collect::<Vec<u32>>();
152151

153152
for &idx in &indexes {
154153
assert!(u64::from(idx) < total_len, "idx {} out of range 0..{}", idx, total_len);
@@ -282,9 +281,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
282281
fx.tcx.dcx().span_fatal(span, "Index argument for `simd_insert` is not a constant");
283282
};
284283

285-
let idx: u32 = idx_const
286-
.try_to_u32()
287-
.unwrap_or_else(|_| panic!("kind not scalar: {:?}", idx_const));
284+
let idx: u32 = idx_const.to_u32();
288285
let (lane_count, _lane_ty) = base.layout().ty.simd_size_and_type(fx.tcx);
289286
if u64::from(idx) >= lane_count {
290287
fx.tcx.dcx().span_fatal(
@@ -330,9 +327,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
330327
return;
331328
};
332329

333-
let idx = idx_const
334-
.try_to_u32()
335-
.unwrap_or_else(|_| panic!("kind not scalar: {:?}", idx_const));
330+
let idx = idx_const.to_u32();
336331
let (lane_count, _lane_ty) = v.layout().ty.simd_size_and_type(fx.tcx);
337332
if u64::from(idx) >= lane_count {
338333
fx.tcx.dcx().span_fatal(

compiler/rustc_codegen_cranelift/src/value_and_place.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ impl<'tcx> CValue<'tcx> {
327327

328328
let val = match layout.ty.kind() {
329329
ty::Uint(UintTy::U128) | ty::Int(IntTy::I128) => {
330-
let const_val = const_val.assert_bits(layout.size);
330+
let const_val = const_val.to_bits(layout.size);
331331
let lsb = fx.bcx.ins().iconst(types::I64, const_val as u64 as i64);
332332
let msb = fx.bcx.ins().iconst(types::I64, (const_val >> 64) as u64 as i64);
333333
fx.bcx.ins().iconcat(lsb, msb)
@@ -339,7 +339,7 @@ impl<'tcx> CValue<'tcx> {
339339
| ty::Ref(..)
340340
| ty::RawPtr(..)
341341
| ty::FnPtr(..) => {
342-
let raw_val = const_val.size().truncate(const_val.assert_bits(layout.size));
342+
let raw_val = const_val.size().truncate(const_val.to_bits(layout.size));
343343
fx.bcx.ins().iconst(clif_ty, raw_val as i64)
344344
}
345345
ty::Float(FloatTy::F32) => {

compiler/rustc_codegen_gcc/src/common.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
166166
let bitsize = if layout.is_bool() { 1 } else { layout.size(self).bits() };
167167
match cv {
168168
Scalar::Int(int) => {
169-
let data = int.assert_bits(layout.size(self));
169+
let data = int.to_bits(layout.size(self));
170170

171171
// FIXME(antoyo): there's some issues with using the u128 code that follows, so hard-code
172172
// the paths for floating-point values.

compiler/rustc_codegen_llvm/src/common.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ impl<'ll, 'tcx> ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
244244
let bitsize = if layout.is_bool() { 1 } else { layout.size(self).bits() };
245245
match cv {
246246
Scalar::Int(int) => {
247-
let data = int.assert_bits(layout.size(self));
247+
let data = int.to_bits(layout.size(self));
248248
let llval = self.const_uint_big(self.type_ix(bitsize), data);
249249
if matches!(layout.primitive(), Pointer(_)) {
250250
unsafe { llvm::LLVMConstIntToPtr(llval, llty) }

compiler/rustc_codegen_llvm/src/intrinsic.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -1109,10 +1109,12 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
11091109
tcx.normalize_erasing_late_bound_regions(ty::ParamEnv::reveal_all(), callee_ty.fn_sig(tcx));
11101110
let arg_tys = sig.inputs();
11111111

1112-
// Vectors must be immediates (non-power-of-2 #[repr(packed)] are not)
1113-
for (ty, arg) in arg_tys.iter().zip(args) {
1114-
if ty.is_simd() && !matches!(arg.val, OperandValue::Immediate(_)) {
1115-
return_error!(InvalidMonomorphization::SimdArgument { span, name, ty: *ty });
1112+
// Sanity-check: all vector arguments must be immediates.
1113+
if cfg!(debug_assertions) {
1114+
for (ty, arg) in arg_tys.iter().zip(args) {
1115+
if ty.is_simd() {
1116+
assert!(matches!(arg.val, OperandValue::Immediate(_)));
1117+
}
11161118
}
11171119
}
11181120

@@ -1221,7 +1223,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
12211223
.iter()
12221224
.enumerate()
12231225
.map(|(arg_idx, val)| {
1224-
let idx = val.unwrap_leaf().try_to_i32().unwrap();
1226+
let idx = val.unwrap_leaf().to_i32();
12251227
if idx >= i32::try_from(total_len).unwrap() {
12261228
bx.sess().dcx().emit_err(InvalidMonomorphization::SimdIndexOutOfBounds {
12271229
span,

compiler/rustc_codegen_ssa/src/common.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ pub fn asm_const_to_str<'tcx>(
163163
let mir::ConstValue::Scalar(scalar) = const_value else {
164164
span_bug!(sp, "expected Scalar for promoted asm const, but got {:#?}", const_value)
165165
};
166-
let value = scalar.assert_bits(ty_and_layout.size);
166+
let value = scalar.assert_scalar_int().to_bits(ty_and_layout.size);
167167
match ty_and_layout.ty.kind() {
168168
ty::Uint(_) => value.to_string(),
169169
ty::Int(int_ty) => match int_ty.normalize(tcx.sess.target.pointer_width) {

compiler/rustc_codegen_ssa/src/mir/rvalue.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,10 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
680680
bx.cx().const_usize(val)
681681
}
682682
mir::NullOp::OffsetOf(fields) => {
683-
let val = layout.offset_of_subfield(bx.cx(), fields.iter()).bytes();
683+
let val = bx
684+
.tcx()
685+
.offset_of_subfield(bx.param_env(), layout, fields.iter())
686+
.bytes();
684687
bx.cx().const_usize(val)
685688
}
686689
mir::NullOp::UbChecks => {

0 commit comments

Comments
 (0)