Skip to content

Commit 9b8119d

Browse files
committed
Auto merge of rust-lang#3193 - rust-lang:rustup-2023-11-27, r=RalfJung
Automatic Rustup
2 parents 547598b + fa6ecc9 commit 9b8119d

File tree

330 files changed

+4628
-3672
lines changed

Some content is hidden

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

330 files changed

+4628
-3672
lines changed

Cargo.lock

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3716,7 +3716,6 @@ dependencies = [
37163716
"rustc_const_eval",
37173717
"rustc_data_structures",
37183718
"rustc_error_codes",
3719-
"rustc_error_messages",
37203719
"rustc_errors",
37213720
"rustc_expand",
37223721
"rustc_feature",
@@ -3771,7 +3770,6 @@ dependencies = [
37713770
"intl-memoizer",
37723771
"rustc_baked_icu_data",
37733772
"rustc_data_structures",
3774-
"rustc_fluent_macro",
37753773
"rustc_macros",
37763774
"rustc_serialize",
37773775
"rustc_span",
@@ -3869,7 +3867,6 @@ dependencies = [
38693867
"rustc_arena",
38703868
"rustc_ast",
38713869
"rustc_data_structures",
3872-
"rustc_error_messages",
38733870
"rustc_index",
38743871
"rustc_macros",
38753872
"rustc_serialize",
@@ -4041,6 +4038,7 @@ dependencies = [
40414038
"rustc_query_impl",
40424039
"rustc_query_system",
40434040
"rustc_resolve",
4041+
"rustc_serialize",
40444042
"rustc_session",
40454043
"rustc_span",
40464044
"rustc_symbol_mangling",

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 11 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
560560
expr: &'hir hir::Expr<'hir>,
561561
overall_span: Span,
562562
) -> &'hir hir::Expr<'hir> {
563-
let constructor = self.arena.alloc(self.expr_lang_item_path(method_span, lang_item, None));
563+
let constructor = self.arena.alloc(self.expr_lang_item_path(method_span, lang_item));
564564
self.expr_call(overall_span, constructor, std::slice::from_ref(expr))
565565
}
566566

@@ -614,7 +614,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
614614
// Resume argument type: `ResumeTy`
615615
let unstable_span =
616616
self.mark_span_with_reason(DesugaringKind::Async, span, self.allow_gen_future.clone());
617-
let resume_ty = hir::QPath::LangItem(hir::LangItem::ResumeTy, unstable_span, None);
617+
let resume_ty = hir::QPath::LangItem(hir::LangItem::ResumeTy, unstable_span);
618618
let input_ty = hir::Ty {
619619
hir_id: self.next_id(),
620620
kind: hir::TyKind::Path(resume_ty),
@@ -818,19 +818,16 @@ impl<'hir> LoweringContext<'_, 'hir> {
818818
span,
819819
hir::LangItem::PinNewUnchecked,
820820
arena_vec![self; ref_mut_awaitee],
821-
Some(expr_hir_id),
822821
);
823822
let get_context = self.expr_call_lang_item_fn_mut(
824823
gen_future_span,
825824
hir::LangItem::GetContext,
826825
arena_vec![self; task_context],
827-
Some(expr_hir_id),
828826
);
829827
let call = self.expr_call_lang_item_fn(
830828
span,
831829
hir::LangItem::FuturePoll,
832830
arena_vec![self; new_unchecked, get_context],
833-
Some(expr_hir_id),
834831
);
835832
self.arena.alloc(self.expr_unsafe(call))
836833
};
@@ -843,12 +840,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
843840
let (x_pat, x_pat_hid) = self.pat_ident(gen_future_span, x_ident);
844841
let x_expr = self.expr_ident(gen_future_span, x_ident, x_pat_hid);
845842
let ready_field = self.single_pat_field(gen_future_span, x_pat);
846-
let ready_pat = self.pat_lang_item_variant(
847-
span,
848-
hir::LangItem::PollReady,
849-
ready_field,
850-
Some(expr_hir_id),
851-
);
843+
let ready_pat = self.pat_lang_item_variant(span, hir::LangItem::PollReady, ready_field);
852844
let break_x = self.with_loop_scope(loop_node_id, move |this| {
853845
let expr_break =
854846
hir::ExprKind::Break(this.lower_loop_destination(None), Some(x_expr));
@@ -859,12 +851,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
859851

860852
// `::std::task::Poll::Pending => {}`
861853
let pending_arm = {
862-
let pending_pat = self.pat_lang_item_variant(
863-
span,
864-
hir::LangItem::PollPending,
865-
&[],
866-
Some(expr_hir_id),
867-
);
854+
let pending_pat = self.pat_lang_item_variant(span, hir::LangItem::PollPending, &[]);
868855
let empty_block = self.expr_block_empty(span);
869856
self.arm(pending_pat, empty_block)
870857
};
@@ -922,7 +909,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
922909
span,
923910
hir::LangItem::IntoFutureIntoFuture,
924911
arena_vec![self; expr],
925-
Some(expr_hir_id),
926912
);
927913

928914
// match <into_future_expr> {
@@ -1379,8 +1365,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
13791365
fn lower_expr_range_closed(&mut self, span: Span, e1: &Expr, e2: &Expr) -> hir::ExprKind<'hir> {
13801366
let e1 = self.lower_expr_mut(e1);
13811367
let e2 = self.lower_expr_mut(e2);
1382-
let fn_path =
1383-
hir::QPath::LangItem(hir::LangItem::RangeInclusiveNew, self.lower_span(span), None);
1368+
let fn_path = hir::QPath::LangItem(hir::LangItem::RangeInclusiveNew, self.lower_span(span));
13841369
let fn_expr = self.arena.alloc(self.expr(span, hir::ExprKind::Path(fn_path)));
13851370
hir::ExprKind::Call(fn_expr, arena_vec![self; e1, e2])
13861371
}
@@ -1421,7 +1406,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
14211406
);
14221407

14231408
hir::ExprKind::Struct(
1424-
self.arena.alloc(hir::QPath::LangItem(lang_item, self.lower_span(span), None)),
1409+
self.arena.alloc(hir::QPath::LangItem(lang_item, self.lower_span(span))),
14251410
fields,
14261411
None,
14271412
)
@@ -1590,7 +1575,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
15901575
head_span,
15911576
hir::LangItem::IteratorNext,
15921577
arena_vec![self; ref_mut_iter],
1593-
None,
15941578
);
15951579
let arms = arena_vec![self; none_arm, some_arm];
15961580

@@ -1619,7 +1603,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
16191603
head_span,
16201604
hir::LangItem::IntoIterIntoIter,
16211605
arena_vec![self; head],
1622-
None,
16231606
)
16241607
};
16251608

@@ -1675,7 +1658,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
16751658
unstable_span,
16761659
hir::LangItem::TryTraitBranch,
16771660
arena_vec![self; sub_expr],
1678-
None,
16791661
)
16801662
};
16811663

@@ -1880,9 +1862,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
18801862
span: Span,
18811863
lang_item: hir::LangItem,
18821864
args: &'hir [hir::Expr<'hir>],
1883-
hir_id: Option<hir::HirId>,
18841865
) -> hir::Expr<'hir> {
1885-
let path = self.arena.alloc(self.expr_lang_item_path(span, lang_item, hir_id));
1866+
let path = self.arena.alloc(self.expr_lang_item_path(span, lang_item));
18861867
self.expr_call_mut(span, path, args)
18871868
}
18881869

@@ -1891,21 +1872,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
18911872
span: Span,
18921873
lang_item: hir::LangItem,
18931874
args: &'hir [hir::Expr<'hir>],
1894-
hir_id: Option<hir::HirId>,
18951875
) -> &'hir hir::Expr<'hir> {
1896-
self.arena.alloc(self.expr_call_lang_item_fn_mut(span, lang_item, args, hir_id))
1876+
self.arena.alloc(self.expr_call_lang_item_fn_mut(span, lang_item, args))
18971877
}
18981878

1899-
fn expr_lang_item_path(
1900-
&mut self,
1901-
span: Span,
1902-
lang_item: hir::LangItem,
1903-
hir_id: Option<hir::HirId>,
1904-
) -> hir::Expr<'hir> {
1905-
self.expr(
1906-
span,
1907-
hir::ExprKind::Path(hir::QPath::LangItem(lang_item, self.lower_span(span), hir_id)),
1908-
)
1879+
fn expr_lang_item_path(&mut self, span: Span, lang_item: hir::LangItem) -> hir::Expr<'hir> {
1880+
self.expr(span, hir::ExprKind::Path(hir::QPath::LangItem(lang_item, self.lower_span(span))))
19091881
}
19101882

19111883
/// `<LangItem>::name`
@@ -1918,7 +1890,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
19181890
let path = hir::ExprKind::Path(hir::QPath::TypeRelative(
19191891
self.arena.alloc(self.ty(
19201892
span,
1921-
hir::TyKind::Path(hir::QPath::LangItem(lang_item, self.lower_span(span), None)),
1893+
hir::TyKind::Path(hir::QPath::LangItem(lang_item, self.lower_span(span))),
19221894
)),
19231895
self.arena.alloc(hir::PathSegment::new(
19241896
Ident::new(name, span),

compiler/rustc_ast_lowering/src/index.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
8989
}
9090
}
9191

92-
self.nodes.insert(hir_id.local_id, ParentedNode { parent: self.parent_node, node: node });
92+
self.nodes.insert(hir_id.local_id, ParentedNode { parent: self.parent_node, node });
9393
}
9494

9595
fn with_parent<F: FnOnce(&mut Self)>(&mut self, parent_node_id: HirId, f: F) {

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ use rustc_data_structures::fx::FxHashMap;
5555
use rustc_data_structures::sorted_map::SortedMap;
5656
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
5757
use rustc_data_structures::sync::Lrc;
58-
use rustc_errors::{
59-
DiagnosticArgFromDisplay, DiagnosticMessage, Handler, StashKey, SubdiagnosticMessage,
60-
};
61-
use rustc_fluent_macro::fluent_messages;
58+
use rustc_errors::{DiagnosticArgFromDisplay, Handler, StashKey};
6259
use rustc_hir as hir;
6360
use rustc_hir::def::{DefKind, LifetimeRes, Namespace, PartialRes, PerNS, Res};
6461
use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID, LOCAL_CRATE};
@@ -94,7 +91,7 @@ mod lifetime_collector;
9491
mod pat;
9592
mod path;
9693

97-
fluent_messages! { "../messages.ftl" }
94+
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
9895

9996
struct LoweringContext<'a, 'hir> {
10097
tcx: TyCtxt<'hir>,
@@ -2304,21 +2301,21 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
23042301

23052302
fn pat_cf_continue(&mut self, span: Span, pat: &'hir hir::Pat<'hir>) -> &'hir hir::Pat<'hir> {
23062303
let field = self.single_pat_field(span, pat);
2307-
self.pat_lang_item_variant(span, hir::LangItem::ControlFlowContinue, field, None)
2304+
self.pat_lang_item_variant(span, hir::LangItem::ControlFlowContinue, field)
23082305
}
23092306

23102307
fn pat_cf_break(&mut self, span: Span, pat: &'hir hir::Pat<'hir>) -> &'hir hir::Pat<'hir> {
23112308
let field = self.single_pat_field(span, pat);
2312-
self.pat_lang_item_variant(span, hir::LangItem::ControlFlowBreak, field, None)
2309+
self.pat_lang_item_variant(span, hir::LangItem::ControlFlowBreak, field)
23132310
}
23142311

23152312
fn pat_some(&mut self, span: Span, pat: &'hir hir::Pat<'hir>) -> &'hir hir::Pat<'hir> {
23162313
let field = self.single_pat_field(span, pat);
2317-
self.pat_lang_item_variant(span, hir::LangItem::OptionSome, field, None)
2314+
self.pat_lang_item_variant(span, hir::LangItem::OptionSome, field)
23182315
}
23192316

23202317
fn pat_none(&mut self, span: Span) -> &'hir hir::Pat<'hir> {
2321-
self.pat_lang_item_variant(span, hir::LangItem::OptionNone, &[], None)
2318+
self.pat_lang_item_variant(span, hir::LangItem::OptionNone, &[])
23222319
}
23232320

23242321
fn single_pat_field(
@@ -2341,9 +2338,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
23412338
span: Span,
23422339
lang_item: hir::LangItem,
23432340
fields: &'hir [hir::PatField<'hir>],
2344-
hir_id: Option<hir::HirId>,
23452341
) -> &'hir hir::Pat<'hir> {
2346-
let qpath = hir::QPath::LangItem(lang_item, self.lower_span(span), hir_id);
2342+
let qpath = hir::QPath::LangItem(lang_item, self.lower_span(span));
23472343
self.pat(span, hir::PatKind::Struct(qpath, fields, false))
23482344
}
23492345

compiler/rustc_ast_passes/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,10 @@
1515
#![deny(rustc::untranslatable_diagnostic)]
1616
#![deny(rustc::diagnostic_outside_of_impl)]
1717

18-
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
19-
use rustc_fluent_macro::fluent_messages;
20-
2118
pub mod ast_validation;
2219
mod errors;
2320
pub mod feature_gate;
2421
pub mod node_count;
2522
pub mod show_span;
2623

27-
fluent_messages! { "../messages.ftl" }
24+
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }

compiler/rustc_attr/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
#[macro_use]
1515
extern crate rustc_macros;
1616

17-
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
18-
use rustc_fluent_macro::fluent_messages;
19-
2017
mod builtin;
2118
mod session_diagnostics;
2219

@@ -29,4 +26,4 @@ pub use rustc_ast::attr::*;
2926

3027
pub(crate) use rustc_session::HashStableContext;
3128

32-
fluent_messages! { "../messages.ftl" }
29+
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }

compiler/rustc_borrowck/src/constraint_generation.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_middle::mir::{
99
};
1010
use rustc_middle::ty::visit::TypeVisitable;
1111
use rustc_middle::ty::GenericArgsRef;
12-
use rustc_middle::ty::{self, RegionVid, Ty, TyCtxt};
12+
use rustc_middle::ty::{self, Ty, TyCtxt};
1313

1414
use crate::{
1515
borrow_set::BorrowSet, facts::AllFacts, location::LocationTable, places_conflict,
@@ -18,7 +18,7 @@ use crate::{
1818

1919
pub(super) fn generate_constraints<'tcx>(
2020
infcx: &InferCtxt<'tcx>,
21-
liveness_constraints: &mut LivenessValues<RegionVid>,
21+
liveness_constraints: &mut LivenessValues,
2222
all_facts: &mut Option<AllFacts>,
2323
location_table: &LocationTable,
2424
body: &Body<'tcx>,
@@ -43,7 +43,7 @@ struct ConstraintGeneration<'cg, 'tcx> {
4343
infcx: &'cg InferCtxt<'tcx>,
4444
all_facts: &'cg mut Option<AllFacts>,
4545
location_table: &'cg LocationTable,
46-
liveness_constraints: &'cg mut LivenessValues<RegionVid>,
46+
liveness_constraints: &'cg mut LivenessValues,
4747
borrow_set: &'cg BorrowSet<'tcx>,
4848
body: &'cg Body<'tcx>,
4949
}
@@ -167,7 +167,7 @@ impl<'cx, 'tcx> ConstraintGeneration<'cx, 'tcx> {
167167

168168
self.infcx.tcx.for_each_free_region(&live_ty, |live_region| {
169169
let vid = live_region.as_var();
170-
self.liveness_constraints.add_element(vid, location);
170+
self.liveness_constraints.add_location(vid, location);
171171
});
172172
}
173173

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
413413
(None, &[][..], 0)
414414
};
415415
if let Some(def_id) = def_id
416-
&& let Some(node) = hir.find(hir.local_def_id_to_hir_id(def_id))
416+
&& let Some(node) = hir.find(self.infcx.tcx.local_def_id_to_hir_id(def_id))
417417
&& let Some(fn_sig) = node.fn_sig()
418418
&& let Some(ident) = node.ident()
419419
&& let Some(pos) = args.iter().position(|arg| arg.hir_id == expr.hir_id)
@@ -445,7 +445,6 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
445445
&& let hir::ExprKind::Path(hir::QPath::LangItem(
446446
LangItem::IntoIterIntoIter,
447447
_,
448-
_,
449448
)) = call_expr.kind
450449
{
451450
// Do not suggest `.clone()` in a `for` loop, we already suggest borrowing.
@@ -1346,11 +1345,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
13461345
// };
13471346
// corresponding to the desugaring of a for loop `for <pat> in <head> { <body> }`.
13481347
if let hir::ExprKind::Call(path, [arg]) = ex.kind
1349-
&& let hir::ExprKind::Path(hir::QPath::LangItem(
1350-
LangItem::IntoIterIntoIter,
1351-
_,
1352-
_,
1353-
)) = path.kind
1348+
&& let hir::ExprKind::Path(hir::QPath::LangItem(LangItem::IntoIterIntoIter, _)) =
1349+
path.kind
13541350
&& arg.span.contains(self.issue_span)
13551351
{
13561352
// Find `IntoIterator::into_iter(<head>)`
@@ -1368,10 +1364,10 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
13681364
..
13691365
}) = stmt.kind
13701366
&& let hir::ExprKind::Call(path, _args) = call.kind
1371-
&& let hir::ExprKind::Path(hir::QPath::LangItem(LangItem::IteratorNext, _, _)) =
1367+
&& let hir::ExprKind::Path(hir::QPath::LangItem(LangItem::IteratorNext, _)) =
13721368
path.kind
13731369
&& let hir::PatKind::Struct(path, [field, ..], _) = bind.pat.kind
1374-
&& let hir::QPath::LangItem(LangItem::OptionSome, pat_span, _) = path
1370+
&& let hir::QPath::LangItem(LangItem::OptionSome, pat_span) = path
13751371
&& call.span.contains(self.issue_span)
13761372
{
13771373
// Find `<pat>` and the span for the whole `for` loop.
@@ -2076,8 +2072,15 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
20762072
.map(|name| format!("function `{name}`"))
20772073
.unwrap_or_else(|| {
20782074
match &self.infcx.tcx.def_kind(self.mir_def_id()) {
2075+
DefKind::Closure
2076+
if self
2077+
.infcx
2078+
.tcx
2079+
.is_coroutine(self.mir_def_id().to_def_id()) =>
2080+
{
2081+
"enclosing coroutine"
2082+
}
20792083
DefKind::Closure => "enclosing closure",
2080-
DefKind::Coroutine => "enclosing coroutine",
20812084
kind => bug!("expected closure or coroutine, found {:?}", kind),
20822085
}
20832086
.to_string()
@@ -3247,7 +3250,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
32473250
) -> Option<AnnotatedBorrowFnSignature<'tcx>> {
32483251
debug!("annotate_fn_sig: did={:?} sig={:?}", did, sig);
32493252
let is_closure = self.infcx.tcx.is_closure(did.to_def_id());
3250-
let fn_hir_id = self.infcx.tcx.hir().local_def_id_to_hir_id(did);
3253+
let fn_hir_id = self.infcx.tcx.local_def_id_to_hir_id(did);
32513254
let fn_decl = self.infcx.tcx.hir().fn_decl_by_hir_id(fn_hir_id)?;
32523255

32533256
// We need to work out which arguments to highlight. We do this by looking

0 commit comments

Comments
 (0)