Skip to content

Commit 16c7256

Browse files
committed
Auto merge of rust-lang#120620 - matthiaskrgr:rollup-sscmbsm, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - rust-lang#119543 (add avx512fp16 to x86 target features) - rust-lang#120004 (Release notes for 1.76) - rust-lang#120562 (Revert unsound libcore changes) - rust-lang#120566 (coverage: Use normal `edition:` headers in coverage tests) - rust-lang#120570 (Suggest changing type to const parameters if we encounter a type in the trait bound position) - rust-lang#120571 (Miscellaneous diagnostics cleanups) - rust-lang#120573 (Remove `BorrowckErrors::tainted_by_errors`) - rust-lang#120592 (Remove unnecessary `.to_string()`/`.as_str()`s) - rust-lang#120610 (hir: Remove the generic type parameter from `MaybeOwned`) - rust-lang#120616 (Fix ICE on field access on a tainted type after const-eval failure) Failed merges: - rust-lang#120569 (coverage: Improve handling of function/closure spans) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 671eb38 + 326839b commit 16c7256

File tree

80 files changed

+717
-789
lines changed

Some content is hidden

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

80 files changed

+717
-789
lines changed

RELEASES.md

+93
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,96 @@
1+
Version 1.76.0 (2024-02-08)
2+
==========================
3+
4+
<a id="1.76.0-Language"></a>
5+
6+
Language
7+
--------
8+
- [Document Rust ABI compatibility between various types](https://github.com/rust-lang/rust/pull/115476/)
9+
- [Also: guarantee that char and u32 are ABI-compatible](https://github.com/rust-lang/rust/pull/118032/)
10+
- [Warn against ambiguous wide pointer comparisons](https://github.com/rust-lang/rust/pull/117758/)
11+
12+
<a id="1.76.0-Compiler"></a>
13+
14+
Compiler
15+
--------
16+
- [Lint pinned `#[must_use]` pointers (in particular, `Box<T>` where `T` is `#[must_use]`) in `unused_must_use`.](https://github.com/rust-lang/rust/pull/118054/)
17+
- [Soundness fix: fix computing the offset of an unsized field in a packed struct](https://github.com/rust-lang/rust/pull/118540/)
18+
- [Soundness fix: fix dynamic size/align computation logic for packed types with dyn Trait tail](https://github.com/rust-lang/rust/pull/118538/)
19+
- [Add `$message_type` field to distinguish json diagnostic outputs](https://github.com/rust-lang/rust/pull/115691/)
20+
- [Enable Rust to use the EHCont security feature of Windows](https://github.com/rust-lang/rust/pull/118013/)
21+
- [Add tier 3 {x86_64,i686}-win7-windows-msvc targets](https://github.com/rust-lang/rust/pull/118150/)
22+
- [Add tier 3 aarch64-apple-watchos target](https://github.com/rust-lang/rust/pull/119074/)
23+
- [Add tier 3 arm64e-apple-ios & arm64e-apple-darwin targets](https://github.com/rust-lang/rust/pull/115526/)
24+
25+
Refer to Rust's [platform support page][platform-support-doc]
26+
for more information on Rust's tiered platform support.
27+
28+
<a id="1.76.0-Libraries"></a>
29+
30+
Libraries
31+
---------
32+
- [Add a column number to `dbg!()`](https://github.com/rust-lang/rust/pull/114962/)
33+
- [Add `std::hash::{DefaultHasher, RandomState}` exports](https://github.com/rust-lang/rust/pull/115694/)
34+
- [Fix rounding issue with exponents in fmt](https://github.com/rust-lang/rust/pull/116301/)
35+
- [Add T: ?Sized to `RwLockReadGuard` and `RwLockWriteGuard`'s Debug impls.](https://github.com/rust-lang/rust/pull/117138/)
36+
- [Windows: Allow `File::create` to work on hidden files](https://github.com/rust-lang/rust/pull/116438/)
37+
38+
<a id="1.76.0-Stabilized-APIs"></a>
39+
40+
Stabilized APIs
41+
---------------
42+
43+
- [`Arc::unwrap_or_clone`](https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.unwrap_or_clone)
44+
- [`Rc::unwrap_or_clone`](https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#method.unwrap_or_clone)
45+
- [`Result::inspect`](https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.inspect)
46+
- [`Result::inspect_err`](https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.inspect_err)
47+
- [`Option::inspect`](https://doc.rust-lang.org/stable/std/option/enum.Option.html#method.inspect)
48+
- [`type_name_of_val`](https://doc.rust-lang.org/stable/std/any/fn.type_name_of_val.html)
49+
- [`std::hash::{DefaultHasher, RandomState}`](https://doc.rust-lang.org/stable/std/hash/index.html#structs)
50+
These were previously available only through `std::collections::hash_map`.
51+
- [`ptr::{from_ref, from_mut}`](https://doc.rust-lang.org/stable/std/ptr/fn.from_ref.html)
52+
- [`ptr::addr_eq`](https://doc.rust-lang.org/stable/std/ptr/fn.addr_eq.html)
53+
54+
<a id="1.76.0-Cargo"></a>
55+
56+
Cargo
57+
-----
58+
59+
See [Cargo release notes](https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-176-2024-02-08).
60+
61+
<a id="1.76.0-Rustdoc"></a>
62+
63+
Rustdoc
64+
-------
65+
66+
- [Don't merge cfg and doc(cfg) attributes for re-exports](https://github.com/rust-lang/rust/pull/113091/)
67+
- [rustdoc: allow resizing the sidebar / hiding the top bar](https://github.com/rust-lang/rust/pull/115660/)
68+
- [rustdoc-search: add support for traits and associated types](https://github.com/rust-lang/rust/pull/116085/)
69+
- [rustdoc: Add highlighting for comments in items declaration](https://github.com/rust-lang/rust/pull/117869/)
70+
71+
<a id="1.76.0-Compatibility-Notes"></a>
72+
73+
Compatibility Notes
74+
-------------------
75+
- [Add allow-by-default lint for unit bindings](https://github.com/rust-lang/rust/pull/112380/)
76+
This is expected to be upgraded to a warning by default in a future Rust
77+
release. Some macros emit bindings with type `()` with user-provided spans,
78+
which means that this lint will warn for user code.
79+
- [Remove x86_64-sun-solaris target.](https://github.com/rust-lang/rust/pull/118091/)
80+
- [Remove asmjs-unknown-emscripten target](https://github.com/rust-lang/rust/pull/117338/)
81+
- [Report errors in jobserver inherited through environment variables](https://github.com/rust-lang/rust/pull/113730/)
82+
This [may warn](https://github.com/rust-lang/rust/issues/120515) on benign problems too.
83+
- [Update the minimum external LLVM to 16.](https://github.com/rust-lang/rust/pull/117947/)
84+
- [Improve `print_tts`](https://github.com/rust-lang/rust/pull/114571/)
85+
This change can break some naive manual parsing of token trees in proc macro
86+
code which expect a particular structure after `.to_string()`, rather than just arbitrary Rust code.
87+
- [Make `IMPLIED_BOUNDS_ENTAILMENT` into a hard error from a lint](https://github.com/rust-lang/rust/pull/117984/)
88+
- [Vec's allocation behavior was changed when collecting some iterators](https://github.com/rust-lang/rust/pull/110353)
89+
Allocation behavior is currently not specified, nevertheless changes can be surprising.
90+
See [`impl FromIterator for Vec`](https://doc.rust-lang.org/nightly/std/vec/struct.Vec.html#impl-FromIterator%3CT%3E-for-Vec%3CT%3E)
91+
for more details.
92+
- [Properly reject `default` on free const items](https://github.com/rust-lang/rust/pull/117818/)
93+
194
Version 1.75.0 (2023-12-28)
295
==========================
396

compiler/rustc_ast_lowering/src/item.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub(super) struct ItemLowerer<'a, 'hir> {
2525
pub(super) tcx: TyCtxt<'hir>,
2626
pub(super) resolver: &'a mut ResolverAstLowering,
2727
pub(super) ast_index: &'a IndexSlice<LocalDefId, AstOwner<'a>>,
28-
pub(super) owners: &'a mut IndexVec<LocalDefId, hir::MaybeOwner<&'hir hir::OwnerInfo<'hir>>>,
28+
pub(super) owners: &'a mut IndexVec<LocalDefId, hir::MaybeOwner<'hir>>,
2929
}
3030

3131
/// When we have a ty alias we *may* have two where clauses. To give the best diagnostics, we set the span
@@ -64,10 +64,7 @@ impl<'a, 'hir> ItemLowerer<'a, 'hir> {
6464
}
6565
}
6666

67-
pub(super) fn lower_node(
68-
&mut self,
69-
def_id: LocalDefId,
70-
) -> hir::MaybeOwner<&'hir hir::OwnerInfo<'hir>> {
67+
pub(super) fn lower_node(&mut self, def_id: LocalDefId) -> hir::MaybeOwner<'hir> {
7168
let owner = self.owners.ensure_contains_elem(def_id, || hir::MaybeOwner::Phantom);
7269
if let hir::MaybeOwner::Phantom = owner {
7370
let node = self.ast_index[def_id];

compiler/rustc_ast_lowering/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ struct LoweringContext<'a, 'hir> {
9999
/// Attributes inside the owner being lowered.
100100
attrs: SortedMap<hir::ItemLocalId, &'hir [Attribute]>,
101101
/// Collect items that were created by lowering the current owner.
102-
children: Vec<(LocalDefId, hir::MaybeOwner<&'hir hir::OwnerInfo<'hir>>)>,
102+
children: Vec<(LocalDefId, hir::MaybeOwner<'hir>)>,
103103

104104
coroutine_kind: Option<hir::CoroutineKind>,
105105

@@ -415,7 +415,7 @@ fn index_crate<'a>(
415415
/// This hash will then be part of the crate_hash which is stored in the metadata.
416416
fn compute_hir_hash(
417417
tcx: TyCtxt<'_>,
418-
owners: &IndexSlice<LocalDefId, hir::MaybeOwner<&hir::OwnerInfo<'_>>>,
418+
owners: &IndexSlice<LocalDefId, hir::MaybeOwner<'_>>,
419419
) -> Fingerprint {
420420
let mut hir_body_nodes: Vec<_> = owners
421421
.iter_enumerated()

compiler/rustc_borrowck/src/borrowck_errors.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
130130
noun_old: &str,
131131
old_opt_via: &str,
132132
previous_end_span: Option<Span>,
133-
) -> DiagnosticBuilder<'cx> {
133+
) -> DiagnosticBuilder<'tcx> {
134134
let mut err = struct_span_code_err!(
135135
self.dcx(),
136136
new_loan_span,
@@ -162,7 +162,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
162162
old_opt_via: &str,
163163
previous_end_span: Option<Span>,
164164
second_borrow_desc: &str,
165-
) -> DiagnosticBuilder<'cx> {
165+
) -> DiagnosticBuilder<'tcx> {
166166
let mut err = struct_span_code_err!(
167167
self.dcx(),
168168
new_loan_span,
@@ -194,7 +194,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
194194
kind_old: &str,
195195
msg_old: &str,
196196
old_load_end_span: Option<Span>,
197-
) -> DiagnosticBuilder<'cx> {
197+
) -> DiagnosticBuilder<'tcx> {
198198
let via = |msg: &str| if msg.is_empty() { "".to_string() } else { format!(" (via {msg})") };
199199
let mut err = struct_span_code_err!(
200200
self.dcx(),
@@ -235,7 +235,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
235235
span: Span,
236236
borrow_span: Span,
237237
desc: &str,
238-
) -> DiagnosticBuilder<'cx> {
238+
) -> DiagnosticBuilder<'tcx> {
239239
struct_span_code_err!(
240240
self.dcx(),
241241
span,
@@ -252,7 +252,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
252252
span: Span,
253253
desc: &str,
254254
is_arg: bool,
255-
) -> DiagnosticBuilder<'cx> {
255+
) -> DiagnosticBuilder<'tcx> {
256256
let msg = if is_arg { "to immutable argument" } else { "twice to immutable variable" };
257257
struct_span_code_err!(self.dcx(), span, E0384, "cannot assign {} {}", msg, desc)
258258
}
@@ -265,7 +265,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
265265
&self,
266266
move_from_span: Span,
267267
move_from_desc: &str,
268-
) -> DiagnosticBuilder<'cx> {
268+
) -> DiagnosticBuilder<'tcx> {
269269
struct_span_code_err!(
270270
self.dcx(),
271271
move_from_span,
@@ -283,7 +283,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
283283
move_from_span: Span,
284284
ty: Ty<'_>,
285285
is_index: Option<bool>,
286-
) -> DiagnosticBuilder<'cx> {
286+
) -> DiagnosticBuilder<'tcx> {
287287
let type_name = match (&ty.kind(), is_index) {
288288
(&ty::Array(_, _), Some(true)) | (&ty::Array(_, _), None) => "array",
289289
(&ty::Slice(_), _) => "slice",
@@ -304,7 +304,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
304304
&self,
305305
move_from_span: Span,
306306
container_ty: Ty<'_>,
307-
) -> DiagnosticBuilder<'cx> {
307+
) -> DiagnosticBuilder<'tcx> {
308308
struct_span_code_err!(
309309
self.dcx(),
310310
move_from_span,

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
327327
&mut self,
328328
mpi: MovePathIndex,
329329
move_span: Span,
330-
err: &mut DiagnosticBuilder<'_>,
330+
err: &mut DiagnosticBuilder<'tcx>,
331331
in_pattern: &mut bool,
332332
move_spans: UseSpans<'_>,
333333
) {
@@ -486,7 +486,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
486486
desired_action: InitializationRequiringAction,
487487
span: Span,
488488
use_spans: UseSpans<'tcx>,
489-
) -> DiagnosticBuilder<'cx> {
489+
) -> DiagnosticBuilder<'tcx> {
490490
// We need all statements in the body where the binding was assigned to later find all
491491
// the branching code paths where the binding *wasn't* assigned to.
492492
let inits = &self.move_data.init_path_map[mpi];
@@ -880,7 +880,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
880880
location: Location,
881881
(place, _span): (Place<'tcx>, Span),
882882
borrow: &BorrowData<'tcx>,
883-
) -> DiagnosticBuilder<'cx> {
883+
) -> DiagnosticBuilder<'tcx> {
884884
let borrow_spans = self.retrieve_borrow_spans(borrow);
885885
let borrow_span = borrow_spans.args_or_use();
886886

@@ -930,7 +930,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
930930
(place, span): (Place<'tcx>, Span),
931931
gen_borrow_kind: BorrowKind,
932932
issued_borrow: &BorrowData<'tcx>,
933-
) -> DiagnosticBuilder<'cx> {
933+
) -> DiagnosticBuilder<'tcx> {
934934
let issued_spans = self.retrieve_borrow_spans(issued_borrow);
935935
let issued_span = issued_spans.args_or_use();
936936

@@ -2129,7 +2129,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
21292129
drop_span: Span,
21302130
borrow_spans: UseSpans<'tcx>,
21312131
explanation: BorrowExplanation<'tcx>,
2132-
) -> DiagnosticBuilder<'cx> {
2132+
) -> DiagnosticBuilder<'tcx> {
21332133
debug!(
21342134
"report_local_value_does_not_live_long_enough(\
21352135
{:?}, {:?}, {:?}, {:?}, {:?}\
@@ -2304,7 +2304,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
23042304
&mut self,
23052305
drop_span: Span,
23062306
borrow_span: Span,
2307-
) -> DiagnosticBuilder<'cx> {
2307+
) -> DiagnosticBuilder<'tcx> {
23082308
debug!(
23092309
"report_thread_local_value_does_not_live_long_enough(\
23102310
{:?}, {:?}\
@@ -2329,7 +2329,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
23292329
borrow_spans: UseSpans<'tcx>,
23302330
proper_span: Span,
23312331
explanation: BorrowExplanation<'tcx>,
2332-
) -> DiagnosticBuilder<'cx> {
2332+
) -> DiagnosticBuilder<'tcx> {
23332333
if let BorrowExplanation::MustBeValidFor { category, span, from_closure: false, .. } =
23342334
explanation
23352335
{
@@ -2440,7 +2440,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
24402440
"consider consuming the `{ty}` when turning it into an \
24412441
`Iterator`",
24422442
),
2443-
"into_iter".to_string(),
2443+
"into_iter",
24442444
Applicability::MaybeIncorrect,
24452445
);
24462446
}
@@ -2496,7 +2496,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
24962496
return_span: Span,
24972497
category: ConstraintCategory<'tcx>,
24982498
opt_place_desc: Option<&String>,
2499-
) -> Option<DiagnosticBuilder<'cx>> {
2499+
) -> Option<DiagnosticBuilder<'tcx>> {
25002500
let return_kind = match category {
25012501
ConstraintCategory::Return(_) => "return",
25022502
ConstraintCategory::Yield => "yield",
@@ -2591,7 +2591,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
25912591
constraint_span: Span,
25922592
captured_var: &str,
25932593
scope: &str,
2594-
) -> DiagnosticBuilder<'cx> {
2594+
) -> DiagnosticBuilder<'tcx> {
25952595
let tcx = self.infcx.tcx;
25962596
let args_span = use_span.args_or_use();
25972597

@@ -2699,7 +2699,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
26992699
upvar_span: Span,
27002700
upvar_name: Symbol,
27012701
escape_span: Span,
2702-
) -> DiagnosticBuilder<'cx> {
2702+
) -> DiagnosticBuilder<'tcx> {
27032703
let tcx = self.infcx.tcx;
27042704

27052705
let escapes_from = tcx.def_descr(self.mir_def_id().to_def_id());

compiler/rustc_borrowck/src/diagnostics/move_errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
288288
&mut self,
289289
place: Place<'tcx>,
290290
span: Span,
291-
) -> DiagnosticBuilder<'a> {
291+
) -> DiagnosticBuilder<'tcx> {
292292
let description = if place.projection.len() == 1 {
293293
format!("static item {}", self.describe_any_place(place.as_ref()))
294294
} else {
@@ -310,7 +310,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
310310
deref_target_place: Place<'tcx>,
311311
span: Span,
312312
use_spans: Option<UseSpans<'tcx>>,
313-
) -> DiagnosticBuilder<'a> {
313+
) -> DiagnosticBuilder<'tcx> {
314314
// Inspect the type of the content behind the
315315
// borrow to provide feedback about why this
316316
// was a move rather than a copy.

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,12 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
198198
{
199199
let span = self.body.local_decls[local].source_info.span;
200200
mut_error = Some(span);
201-
if let Some((buffer, c)) = self.get_buffered_mut_error(span) {
201+
if let Some((buffered_err, c)) = self.get_buffered_mut_error(span) {
202202
// We've encountered a second (or more) attempt to mutably borrow an
203203
// immutable binding, so the likely problem is with the binding
204204
// declaration, not the use. We collect these in a single diagnostic
205205
// and make the binding the primary span of the error.
206-
err = buffer;
206+
err = buffered_err;
207207
count = c + 1;
208208
if count == 2 {
209209
err.replace_span_with(span, false);
@@ -924,7 +924,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
924924
err.span_suggestion_verbose(
925925
expr.span.shrink_to_lo(),
926926
"use a mutable iterator instead",
927-
"mut ".to_string(),
927+
"mut ",
928928
Applicability::MachineApplicable,
929929
);
930930
}

compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,6 @@ impl OutlivesSuggestionBuilder {
251251
diag.sort_span = mir_span.shrink_to_hi();
252252

253253
// Buffer the diagnostic
254-
mbcx.buffer_non_error_diag(diag);
254+
mbcx.buffer_non_error(diag);
255255
}
256256
}

0 commit comments

Comments
 (0)