Skip to content

Commit 5a3a2d5

Browse files
committed
Auto merge of #3293 - rust-lang:rustup-2024-02-10, r=saethlin
Automatic Rustup
2 parents a5077d9 + 45d5d4b commit 5a3a2d5

File tree

952 files changed

+14500
-6848
lines changed

Some content is hidden

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

952 files changed

+14500
-6848
lines changed

Cargo.lock

+8-7
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"
556556

557557
[[package]]
558558
name = "clippy"
559-
version = "0.1.77"
559+
version = "0.1.78"
560560
dependencies = [
561561
"anstream",
562562
"clippy_config",
@@ -584,7 +584,7 @@ dependencies = [
584584

585585
[[package]]
586586
name = "clippy_config"
587-
version = "0.1.77"
587+
version = "0.1.78"
588588
dependencies = [
589589
"rustc-semver",
590590
"serde",
@@ -607,7 +607,7 @@ dependencies = [
607607

608608
[[package]]
609609
name = "clippy_lints"
610-
version = "0.1.77"
610+
version = "0.1.78"
611611
dependencies = [
612612
"arrayvec",
613613
"cargo_metadata 0.18.0",
@@ -632,7 +632,7 @@ dependencies = [
632632

633633
[[package]]
634634
name = "clippy_utils"
635-
version = "0.1.77"
635+
version = "0.1.78"
636636
dependencies = [
637637
"arrayvec",
638638
"clippy_config",
@@ -1003,7 +1003,7 @@ checksum = "a0afaad2b26fa326569eb264b1363e8ae3357618c43982b3f285f0774ce76b69"
10031003

10041004
[[package]]
10051005
name = "declare_clippy_lint"
1006-
version = "0.1.77"
1006+
version = "0.1.78"
10071007
dependencies = [
10081008
"itertools",
10091009
"quote",
@@ -2090,9 +2090,9 @@ dependencies = [
20902090

20912091
[[package]]
20922092
name = "jobserver"
2093-
version = "0.1.27"
2093+
version = "0.1.28"
20942094
source = "registry+https://github.com/rust-lang/crates.io-index"
2095-
checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d"
2095+
checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6"
20962096
dependencies = [
20972097
"libc",
20982098
]
@@ -4374,6 +4374,7 @@ dependencies = [
43744374
"rustc_middle",
43754375
"rustc_session",
43764376
"rustc_span",
4377+
"rustc_ty_utils",
43774378
"tracing",
43784379
]
43794380

RELEASES.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Language
77
--------
88
- [Document Rust ABI compatibility between various types](https://github.com/rust-lang/rust/pull/115476/)
99
- [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/)
10+
- [Add lint `ambiguous_wide_pointer_comparisons` that supersedes `clippy::vtable_address_comparisons`](https://github.com/rust-lang/rust/pull/117758)
1111

1212
<a id="1.76.0-Compiler"></a>
1313

compiler/rustc_arena/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
#![cfg_attr(test, feature(test))]
2323
#![feature(strict_provenance)]
2424
#![deny(unsafe_op_in_unsafe_fn)]
25-
#![deny(rustc::untranslatable_diagnostic)]
26-
#![deny(rustc::diagnostic_outside_of_impl)]
2725
#![allow(internal_features)]
2826
#![allow(clippy::mut_from_ref)] // Arena allocators are one of the places where this pattern is fine.
2927

compiler/rustc_ast/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
#![feature(min_specialization)]
1919
#![feature(negative_impls)]
2020
#![feature(stmt_expr_attributes)]
21-
#![deny(rustc::untranslatable_diagnostic)]
22-
#![deny(rustc::diagnostic_outside_of_impl)]
2321

2422
#[macro_use]
2523
extern crate rustc_macros;

compiler/rustc_ast_lowering/src/asm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
205205
&sym.qself,
206206
&sym.path,
207207
ParamMode::Optional,
208-
&ImplTraitContext::Disallowed(ImplTraitPosition::Path),
208+
ImplTraitContext::Disallowed(ImplTraitPosition::Path),
209209
None,
210210
);
211211
hir::InlineAsmOperand::SymStatic { path, def_id }

compiler/rustc_ast_lowering/src/block.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
8585
let ty = l
8686
.ty
8787
.as_ref()
88-
.map(|t| self.lower_ty(t, &ImplTraitContext::Disallowed(ImplTraitPosition::Variable)));
88+
.map(|t| self.lower_ty(t, ImplTraitContext::Disallowed(ImplTraitPosition::Variable)));
8989
let init = l.kind.init().map(|init| self.lower_expr(init));
9090
let hir_id = self.lower_node_id(l.id);
9191
let pat = self.lower_pat(&l.pat);

compiler/rustc_ast_lowering/src/delegation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
218218
&delegation.qself,
219219
&delegation.path,
220220
ParamMode::Optional,
221-
&ImplTraitContext::Disallowed(ImplTraitPosition::Path),
221+
ImplTraitContext::Disallowed(ImplTraitPosition::Path),
222222
None,
223223
);
224224
let block = delegation.body.as_deref();

compiler/rustc_ast_lowering/src/errors.rs

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
use rustc_errors::{codes::*, DiagnosticArgFromDisplay};
1+
use rustc_errors::{
2+
codes::*, AddToDiagnostic, Diagnostic, DiagnosticArgFromDisplay, SubdiagnosticMessageOp,
3+
};
24
use rustc_macros::{Diagnostic, Subdiagnostic};
35
use rustc_span::{symbol::Ident, Span, Symbol};
46

@@ -38,14 +40,8 @@ pub struct InvalidAbi {
3840

3941
pub struct InvalidAbiReason(pub &'static str);
4042

41-
impl rustc_errors::AddToDiagnostic for InvalidAbiReason {
42-
fn add_to_diagnostic_with<F>(self, diag: &mut rustc_errors::Diagnostic, _: F)
43-
where
44-
F: Fn(
45-
&mut rustc_errors::Diagnostic,
46-
rustc_errors::SubdiagnosticMessage,
47-
) -> rustc_errors::SubdiagnosticMessage,
48-
{
43+
impl AddToDiagnostic for InvalidAbiReason {
44+
fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
4945
#[allow(rustc::untranslatable_diagnostic)]
5046
diag.note(self.0);
5147
}

compiler/rustc_ast_lowering/src/expr.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
9999
seg,
100100
ParamMode::Optional,
101101
ParenthesizedGenericArgs::Err,
102-
&ImplTraitContext::Disallowed(ImplTraitPosition::Path),
102+
ImplTraitContext::Disallowed(ImplTraitPosition::Path),
103103
None,
104104
// Method calls can't have bound modifiers
105105
None,
@@ -141,13 +141,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
141141
ExprKind::Cast(expr, ty) => {
142142
let expr = self.lower_expr(expr);
143143
let ty =
144-
self.lower_ty(ty, &ImplTraitContext::Disallowed(ImplTraitPosition::Cast));
144+
self.lower_ty(ty, ImplTraitContext::Disallowed(ImplTraitPosition::Cast));
145145
hir::ExprKind::Cast(expr, ty)
146146
}
147147
ExprKind::Type(expr, ty) => {
148148
let expr = self.lower_expr(expr);
149149
let ty =
150-
self.lower_ty(ty, &ImplTraitContext::Disallowed(ImplTraitPosition::Cast));
150+
self.lower_ty(ty, ImplTraitContext::Disallowed(ImplTraitPosition::Cast));
151151
hir::ExprKind::Type(expr, ty)
152152
}
153153
ExprKind::AddrOf(k, m, ohs) => {
@@ -267,7 +267,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
267267
qself,
268268
path,
269269
ParamMode::Optional,
270-
&ImplTraitContext::Disallowed(ImplTraitPosition::Path),
270+
ImplTraitContext::Disallowed(ImplTraitPosition::Path),
271271
None,
272272
);
273273
hir::ExprKind::Path(qpath)
@@ -295,7 +295,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
295295
ExprKind::OffsetOf(container, fields) => hir::ExprKind::OffsetOf(
296296
self.lower_ty(
297297
container,
298-
&ImplTraitContext::Disallowed(ImplTraitPosition::OffsetOf),
298+
ImplTraitContext::Disallowed(ImplTraitPosition::OffsetOf),
299299
),
300300
self.arena.alloc_from_iter(fields.iter().map(|&ident| self.lower_ident(ident))),
301301
),
@@ -314,7 +314,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
314314
&se.qself,
315315
&se.path,
316316
ParamMode::Optional,
317-
&ImplTraitContext::Disallowed(ImplTraitPosition::Path),
317+
ImplTraitContext::Disallowed(ImplTraitPosition::Path),
318318
None,
319319
)),
320320
self.arena
@@ -1241,7 +1241,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
12411241
qself,
12421242
path,
12431243
ParamMode::Optional,
1244-
&ImplTraitContext::Disallowed(ImplTraitPosition::Path),
1244+
ImplTraitContext::Disallowed(ImplTraitPosition::Path),
12451245
None,
12461246
);
12471247
// Destructure like a tuple struct.
@@ -1261,7 +1261,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
12611261
qself,
12621262
path,
12631263
ParamMode::Optional,
1264-
&ImplTraitContext::Disallowed(ImplTraitPosition::Path),
1264+
ImplTraitContext::Disallowed(ImplTraitPosition::Path),
12651265
None,
12661266
);
12671267
// Destructure like a unit struct.
@@ -1286,7 +1286,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
12861286
&se.qself,
12871287
&se.path,
12881288
ParamMode::Optional,
1289-
&ImplTraitContext::Disallowed(ImplTraitPosition::Path),
1289+
ImplTraitContext::Disallowed(ImplTraitPosition::Path),
12901290
None,
12911291
);
12921292
let fields_omitted = match &se.rest {

compiler/rustc_ast_lowering/src/index.rs

+37-6
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct NodeCollector<'a, 'hir> {
1515
bodies: &'a SortedMap<ItemLocalId, &'hir Body<'hir>>,
1616

1717
/// Outputs
18-
nodes: IndexVec<ItemLocalId, Option<ParentedNode<'hir>>>,
18+
nodes: IndexVec<ItemLocalId, ParentedNode<'hir>>,
1919
parenting: LocalDefIdMap<ItemLocalId>,
2020

2121
/// The parent of this node
@@ -29,16 +29,19 @@ pub(super) fn index_hir<'hir>(
2929
tcx: TyCtxt<'hir>,
3030
item: hir::OwnerNode<'hir>,
3131
bodies: &SortedMap<ItemLocalId, &'hir Body<'hir>>,
32-
) -> (IndexVec<ItemLocalId, Option<ParentedNode<'hir>>>, LocalDefIdMap<ItemLocalId>) {
33-
let mut nodes = IndexVec::new();
32+
num_nodes: usize,
33+
) -> (IndexVec<ItemLocalId, ParentedNode<'hir>>, LocalDefIdMap<ItemLocalId>) {
34+
let zero_id = ItemLocalId::new(0);
35+
let err_node = ParentedNode { parent: zero_id, node: Node::Err(item.span()) };
36+
let mut nodes = IndexVec::from_elem_n(err_node, num_nodes);
3437
// This node's parent should never be accessed: the owner's parent is computed by the
3538
// hir_owner_parent query. Make it invalid (= ItemLocalId::MAX) to force an ICE whenever it is
3639
// used.
37-
nodes.push(Some(ParentedNode { parent: ItemLocalId::INVALID, node: item.into() }));
40+
nodes[zero_id] = ParentedNode { parent: ItemLocalId::INVALID, node: item.into() };
3841
let mut collector = NodeCollector {
3942
tcx,
4043
owner: item.def_id(),
41-
parent_node: ItemLocalId::new(0),
44+
parent_node: zero_id,
4245
nodes,
4346
bodies,
4447
parenting: Default::default(),
@@ -54,6 +57,14 @@ pub(super) fn index_hir<'hir>(
5457
OwnerNode::ForeignItem(item) => collector.visit_foreign_item(item),
5558
};
5659

60+
for (local_id, node) in collector.nodes.iter_enumerated() {
61+
if let Node::Err(span) = node.node {
62+
let hir_id = HirId { owner: item.def_id(), local_id };
63+
let msg = format!("ID {hir_id} not encountered when visiting item HIR");
64+
tcx.dcx().span_delayed_bug(*span, msg);
65+
}
66+
}
67+
5768
(collector.nodes, collector.parenting)
5869
}
5970

@@ -88,7 +99,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
8899
}
89100
}
90101

91-
self.nodes.insert(hir_id.local_id, ParentedNode { parent: self.parent_node, node });
102+
self.nodes[hir_id.local_id] = ParentedNode { parent: self.parent_node, node };
92103
}
93104

94105
fn with_parent<F: FnOnce(&mut Self)>(&mut self, parent_node_id: HirId, f: F) {
@@ -254,6 +265,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
254265
}
255266

256267
fn visit_path_segment(&mut self, path_segment: &'hir PathSegment<'hir>) {
268+
// FIXME: walk path segment with `path_segment.hir_id` parent.
257269
self.insert(path_segment.ident.span, path_segment.hir_id, Node::PathSegment(path_segment));
258270
intravisit::walk_path_segment(self, path_segment);
259271
}
@@ -348,4 +360,23 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
348360

349361
self.visit_nested_foreign_item(id);
350362
}
363+
364+
fn visit_where_predicate(&mut self, predicate: &'hir WherePredicate<'hir>) {
365+
match predicate {
366+
WherePredicate::BoundPredicate(pred) => {
367+
self.insert(pred.span, pred.hir_id, Node::WhereBoundPredicate(pred));
368+
self.with_parent(pred.hir_id, |this| {
369+
intravisit::walk_where_predicate(this, predicate)
370+
})
371+
}
372+
_ => intravisit::walk_where_predicate(self, predicate),
373+
}
374+
}
375+
376+
fn visit_array_length(&mut self, len: &'hir ArrayLen) {
377+
match len {
378+
ArrayLen::Infer(inf) => self.insert(inf.span, inf.hir_id, Node::ArrayLenInfer(inf)),
379+
ArrayLen::Body(..) => intravisit::walk_array_len(self, len),
380+
}
381+
}
351382
}

0 commit comments

Comments
 (0)