Skip to content

Commit 20ffea6

Browse files
committed
Auto merge of rust-lang#100416 - Dylan-DPC:rollup-m344lh1, r=Dylan-DPC
Rollup of 11 pull requests Successful merges: - rust-lang#92744 (Check if enum from foreign crate has any non exhaustive variants when attempting a cast) - rust-lang#99110 (Determine match_has_guard from candidates instead of looking up thir table again) - rust-lang#100184 (Stabilize ptr_const_cast) - rust-lang#100192 ( Remove duplicated temporaries creating during box derefs elaboration) - rust-lang#100232 (Do not consider method call receiver as an argument in AST.) - rust-lang#100287 (linux: Use `pthread_setname_np` instead of `prctl`) - rust-lang#100351 (Use `&mut Diagnostic` instead of `&mut DiagnosticBuilder` unless needed) - rust-lang#100370 (Remove more Clean trait implementations) - rust-lang#100391 (Improve size assertions) - rust-lang#100398 (Improve `-Zhir-stats`) - rust-lang#100403 (Improve error messages when running rustdoc GUI tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents aeb5067 + f583bf6 commit 20ffea6

File tree

59 files changed

+952
-472
lines changed

Some content is hidden

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

59 files changed

+952
-472
lines changed

compiler/rustc_arena/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#![feature(rustc_attrs)]
2020
#![cfg_attr(test, feature(test))]
2121
#![feature(strict_provenance)]
22-
#![feature(ptr_const_cast)]
2322

2423
use smallvec::SmallVec;
2524

compiler/rustc_ast/src/ast.rs

+25-23
Original file line numberDiff line numberDiff line change
@@ -1338,14 +1338,13 @@ pub enum ExprKind {
13381338
///
13391339
/// The `PathSegment` represents the method name and its generic arguments
13401340
/// (within the angle brackets).
1341-
/// The first element of the vector of an `Expr` is the expression that evaluates
1342-
/// to the object on which the method is being called on (the receiver),
1343-
/// and the remaining elements are the rest of the arguments.
1344-
/// Thus, `x.foo::<Bar, Baz>(a, b, c, d)` is represented as
1345-
/// `ExprKind::MethodCall(PathSegment { foo, [Bar, Baz] }, [x, a, b, c, d])`.
1341+
/// The standalone `Expr` is the receiver expression.
1342+
/// The vector of `Expr` is the arguments.
1343+
/// `x.foo::<Bar, Baz>(a, b, c, d)` is represented as
1344+
/// `ExprKind::MethodCall(PathSegment { foo, [Bar, Baz] }, x, [a, b, c, d])`.
13461345
/// This `Span` is the span of the function, without the dot and receiver
13471346
/// (e.g. `foo(a, b)` in `x.foo(a, b)`
1348-
MethodCall(PathSegment, Vec<P<Expr>>, Span),
1347+
MethodCall(PathSegment, P<Expr>, Vec<P<Expr>>, Span),
13491348
/// A tuple (e.g., `(a, b, c, d)`).
13501349
Tup(Vec<P<Expr>>),
13511350
/// A binary operation (e.g., `a + b`, `a * b`).
@@ -3030,22 +3029,25 @@ pub type ForeignItem = Item<ForeignItemKind>;
30303029
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
30313030
mod size_asserts {
30323031
use super::*;
3032+
use rustc_data_structures::static_assert_size;
30333033
// These are in alphabetical order, which is easy to maintain.
3034-
rustc_data_structures::static_assert_size!(AssocItemKind, 72);
3035-
rustc_data_structures::static_assert_size!(Attribute, 152);
3036-
rustc_data_structures::static_assert_size!(Block, 48);
3037-
rustc_data_structures::static_assert_size!(Expr, 104);
3038-
rustc_data_structures::static_assert_size!(Fn, 192);
3039-
rustc_data_structures::static_assert_size!(ForeignItemKind, 72);
3040-
rustc_data_structures::static_assert_size!(GenericBound, 88);
3041-
rustc_data_structures::static_assert_size!(Generics, 72);
3042-
rustc_data_structures::static_assert_size!(Impl, 200);
3043-
rustc_data_structures::static_assert_size!(Item, 200);
3044-
rustc_data_structures::static_assert_size!(ItemKind, 112);
3045-
rustc_data_structures::static_assert_size!(Lit, 48);
3046-
rustc_data_structures::static_assert_size!(Pat, 120);
3047-
rustc_data_structures::static_assert_size!(Path, 40);
3048-
rustc_data_structures::static_assert_size!(PathSegment, 24);
3049-
rustc_data_structures::static_assert_size!(Stmt, 32);
3050-
rustc_data_structures::static_assert_size!(Ty, 96);
3034+
static_assert_size!(AssocItem, 160);
3035+
static_assert_size!(AssocItemKind, 72);
3036+
static_assert_size!(Attribute, 152);
3037+
static_assert_size!(Block, 48);
3038+
static_assert_size!(Expr, 104);
3039+
static_assert_size!(Fn, 192);
3040+
static_assert_size!(ForeignItem, 160);
3041+
static_assert_size!(ForeignItemKind, 72);
3042+
static_assert_size!(GenericBound, 88);
3043+
static_assert_size!(Generics, 72);
3044+
static_assert_size!(Impl, 200);
3045+
static_assert_size!(Item, 200);
3046+
static_assert_size!(ItemKind, 112);
3047+
static_assert_size!(Lit, 48);
3048+
static_assert_size!(Pat, 120);
3049+
static_assert_size!(Path, 40);
3050+
static_assert_size!(PathSegment, 24);
3051+
static_assert_size!(Stmt, 32);
3052+
static_assert_size!(Ty, 96);
30513053
}

compiler/rustc_ast/src/mut_visit.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1302,10 +1302,11 @@ pub fn noop_visit_expr<T: MutVisitor>(
13021302
vis.visit_expr(f);
13031303
visit_exprs(args, vis);
13041304
}
1305-
ExprKind::MethodCall(PathSegment { ident, id, args }, exprs, span) => {
1305+
ExprKind::MethodCall(PathSegment { ident, id, args }, receiver, exprs, span) => {
13061306
vis.visit_ident(ident);
13071307
vis.visit_id(id);
13081308
visit_opt(args, |args| vis.visit_generic_args(args));
1309+
vis.visit_expr(receiver);
13091310
visit_exprs(exprs, vis);
13101311
vis.visit_span(span);
13111312
}

compiler/rustc_ast/src/util/parser.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,9 @@ pub fn contains_exterior_struct_lit(value: &ast::Expr) -> bool {
396396
contains_exterior_struct_lit(&x)
397397
}
398398

399-
ast::ExprKind::MethodCall(.., ref exprs, _) => {
399+
ast::ExprKind::MethodCall(_, ref receiver, _, _) => {
400400
// X { y: 1 }.bar(...)
401-
contains_exterior_struct_lit(&exprs[0])
401+
contains_exterior_struct_lit(&receiver)
402402
}
403403

404404
_ => false,

compiler/rustc_ast/src/visit.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -813,8 +813,9 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) {
813813
visitor.visit_expr(callee_expression);
814814
walk_list!(visitor, visit_expr, arguments);
815815
}
816-
ExprKind::MethodCall(ref segment, ref arguments, _span) => {
816+
ExprKind::MethodCall(ref segment, ref receiver, ref arguments, _span) => {
817817
visitor.visit_path_segment(expression.span, segment);
818+
visitor.visit_expr(receiver);
818819
walk_list!(visitor, visit_expr, arguments);
819820
}
820821
ExprKind::Binary(_, ref left_expression, ref right_expression) => {

compiler/rustc_ast_lowering/src/expr.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,17 @@ impl<'hir> LoweringContext<'_, 'hir> {
6262
hir::ExprKind::Call(f, self.lower_exprs(args))
6363
}
6464
}
65-
ExprKind::MethodCall(ref seg, ref args, span) => {
65+
ExprKind::MethodCall(ref seg, ref receiver, ref args, span) => {
6666
let hir_seg = self.arena.alloc(self.lower_path_segment(
6767
e.span,
6868
seg,
6969
ParamMode::Optional,
7070
ParenthesizedGenericArgs::Err,
7171
ImplTraitContext::Disallowed(ImplTraitPosition::Path),
7272
));
73-
let args = self.lower_exprs(args);
73+
let args = self.arena.alloc_from_iter(
74+
[&*receiver].into_iter().chain(args.iter()).map(|x| self.lower_expr_mut(x)),
75+
);
7476
hir::ExprKind::MethodCall(hir_seg, args, self.lower_span(span))
7577
}
7678
ExprKind::Binary(binop, ref lhs, ref rhs) => {

compiler/rustc_ast_passes/src/ast_validation.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ use rustc_ast::walk_list;
1313
use rustc_ast::*;
1414
use rustc_ast_pretty::pprust::{self, State};
1515
use rustc_data_structures::fx::FxHashMap;
16-
use rustc_errors::{
17-
error_code, pluralize, struct_span_err, Applicability, DiagnosticBuilder, ErrorGuaranteed,
18-
};
16+
use rustc_errors::{error_code, pluralize, struct_span_err, Applicability, Diagnostic};
1917
use rustc_parse::validate_attr;
2018
use rustc_session::lint::builtin::{
2119
DEPRECATED_WHERE_CLAUSE_LOCATION, MISSING_ABI, PATTERNS_IN_FNS_WITHOUT_BODY,
@@ -477,7 +475,7 @@ impl<'a> AstValidator<'a> {
477475
ctx: &str,
478476
msg: &str,
479477
sugg: &str,
480-
help: impl FnOnce(&mut DiagnosticBuilder<'_, ErrorGuaranteed>),
478+
help: impl FnOnce(&mut Diagnostic),
481479
) {
482480
let source_map = self.session.source_map();
483481
let end = source_map.end_point(sp);
@@ -1196,7 +1194,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
11961194
let msg = "free function without a body";
11971195
let ext = sig.header.ext;
11981196

1199-
let f = |e: &mut DiagnosticBuilder<'_, _>| {
1197+
let f = |e: &mut Diagnostic| {
12001198
if let Extern::Implicit(start_span) | Extern::Explicit(_, start_span) = &ext
12011199
{
12021200
let start_suggestion = if let Extern::Explicit(abi, _) = ext {

compiler/rustc_ast_pretty/src/pprust/state/expr.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,13 @@ impl<'a> State<'a> {
193193
self.print_call_post(args)
194194
}
195195

196-
fn print_expr_method_call(&mut self, segment: &ast::PathSegment, args: &[P<ast::Expr>]) {
197-
let base_args = &args[1..];
198-
self.print_expr_maybe_paren(&args[0], parser::PREC_POSTFIX);
196+
fn print_expr_method_call(
197+
&mut self,
198+
segment: &ast::PathSegment,
199+
receiver: &ast::Expr,
200+
base_args: &[P<ast::Expr>],
201+
) {
202+
self.print_expr_maybe_paren(receiver, parser::PREC_POSTFIX);
199203
self.word(".");
200204
self.print_ident(segment.ident);
201205
if let Some(ref args) = segment.args {
@@ -303,8 +307,8 @@ impl<'a> State<'a> {
303307
ast::ExprKind::Call(ref func, ref args) => {
304308
self.print_expr_call(func, &args);
305309
}
306-
ast::ExprKind::MethodCall(ref segment, ref args, _) => {
307-
self.print_expr_method_call(segment, &args);
310+
ast::ExprKind::MethodCall(ref segment, ref receiver, ref args, _) => {
311+
self.print_expr_method_call(segment, &receiver, &args);
308312
}
309313
ast::ExprKind::Binary(op, ref lhs, ref rhs) => {
310314
self.print_expr_binary(op, lhs, rhs);

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
451451

452452
fn suggest_borrow_fn_like(
453453
&self,
454-
err: &mut DiagnosticBuilder<'tcx, ErrorGuaranteed>,
454+
err: &mut Diagnostic,
455455
ty: Ty<'tcx>,
456456
move_sites: &[MoveSite],
457457
value_name: &str,
@@ -526,12 +526,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
526526
true
527527
}
528528

529-
fn suggest_adding_copy_bounds(
530-
&self,
531-
err: &mut DiagnosticBuilder<'tcx, ErrorGuaranteed>,
532-
ty: Ty<'tcx>,
533-
span: Span,
534-
) {
529+
fn suggest_adding_copy_bounds(&self, err: &mut Diagnostic, ty: Ty<'tcx>, span: Span) {
535530
let tcx = self.infcx.tcx;
536531
let generics = tcx.generics_of(self.mir_def_id());
537532

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
783783

784784
fn maybe_suggest_constrain_dyn_trait_impl(
785785
&self,
786-
diag: &mut DiagnosticBuilder<'tcx, ErrorGuaranteed>,
786+
diag: &mut Diagnostic,
787787
f: Region<'tcx>,
788788
o: Region<'tcx>,
789789
category: &ConstraintCategory<'tcx>,

compiler/rustc_builtin_macros/src/assert/context.rs

+10-11
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ impl<'cx, 'a> Context<'cx, 'a> {
240240
self.manage_cond_expr(prefix);
241241
self.manage_cond_expr(suffix);
242242
}
243-
ExprKind::MethodCall(_, ref mut local_exprs, _) => {
244-
for local_expr in local_exprs.iter_mut().skip(1) {
243+
ExprKind::MethodCall(_, _,ref mut local_exprs, _) => {
244+
for local_expr in local_exprs.iter_mut() {
245245
self.manage_cond_expr(local_expr);
246246
}
247247
}
@@ -377,14 +377,12 @@ impl<'cx, 'a> Context<'cx, 'a> {
377377
id: DUMMY_NODE_ID,
378378
ident: Ident::new(sym::try_capture, self.span),
379379
},
380-
vec![
381-
expr_paren(self.cx, self.span, self.cx.expr_addr_of(self.span, wrapper)),
382-
expr_addr_of_mut(
383-
self.cx,
384-
self.span,
385-
self.cx.expr_path(Path::from_ident(capture)),
386-
),
387-
],
380+
expr_paren(self.cx, self.span, self.cx.expr_addr_of(self.span, wrapper)),
381+
vec![expr_addr_of_mut(
382+
self.cx,
383+
self.span,
384+
self.cx.expr_path(Path::from_ident(capture)),
385+
)],
388386
self.span,
389387
))
390388
.add_trailing_semicolon();
@@ -442,10 +440,11 @@ fn expr_addr_of_mut(cx: &ExtCtxt<'_>, sp: Span, e: P<Expr>) -> P<Expr> {
442440
fn expr_method_call(
443441
cx: &ExtCtxt<'_>,
444442
path: PathSegment,
443+
receiver: P<Expr>,
445444
args: Vec<P<Expr>>,
446445
span: Span,
447446
) -> P<Expr> {
448-
cx.expr(span, ExprKind::MethodCall(path, args, span))
447+
cx.expr(span, ExprKind::MethodCall(path, receiver, args, span))
449448
}
450449

451450
fn expr_paren(cx: &ExtCtxt<'_>, sp: Span, e: P<Expr>) -> P<Expr> {

compiler/rustc_const_eval/src/interpret/operand.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -823,9 +823,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
823823
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
824824
mod size_asserts {
825825
use super::*;
826+
use rustc_data_structures::static_assert_size;
826827
// These are in alphabetical order, which is easy to maintain.
827-
rustc_data_structures::static_assert_size!(Immediate, 56);
828-
rustc_data_structures::static_assert_size!(ImmTy<'_>, 72);
829-
rustc_data_structures::static_assert_size!(Operand, 64);
830-
rustc_data_structures::static_assert_size!(OpTy<'_>, 88);
828+
static_assert_size!(Immediate, 56);
829+
static_assert_size!(ImmTy<'_>, 72);
830+
static_assert_size!(Operand, 64);
831+
static_assert_size!(OpTy<'_>, 88);
831832
}

compiler/rustc_const_eval/src/interpret/place.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -891,10 +891,11 @@ where
891891
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
892892
mod size_asserts {
893893
use super::*;
894+
use rustc_data_structures::static_assert_size;
894895
// These are in alphabetical order, which is easy to maintain.
895-
rustc_data_structures::static_assert_size!(MemPlaceMeta, 24);
896-
rustc_data_structures::static_assert_size!(MemPlace, 40);
897-
rustc_data_structures::static_assert_size!(MPlaceTy<'_>, 64);
898-
rustc_data_structures::static_assert_size!(Place, 48);
899-
rustc_data_structures::static_assert_size!(PlaceTy<'_>, 72);
896+
static_assert_size!(MemPlaceMeta, 24);
897+
static_assert_size!(MemPlace, 40);
898+
static_assert_size!(MPlaceTy<'_>, 64);
899+
static_assert_size!(Place, 48);
900+
static_assert_size!(PlaceTy<'_>, 72);
900901
}

compiler/rustc_expand/src/mbe/macro_rules.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_ast::{NodeId, DUMMY_NODE_ID};
1414
use rustc_ast_pretty::pprust;
1515
use rustc_attr::{self as attr, TransparencyError};
1616
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
17-
use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed};
17+
use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder};
1818
use rustc_feature::Features;
1919
use rustc_lint_defs::builtin::{
2020
RUST_2021_INCOMPATIBLE_OR_PATTERNS, SEMICOLON_IN_EXPRESSIONS_FROM_MACROS,
@@ -608,11 +608,7 @@ enum ExplainDocComment {
608608
},
609609
}
610610

611-
fn annotate_doc_comment(
612-
err: &mut DiagnosticBuilder<'_, ErrorGuaranteed>,
613-
sm: &SourceMap,
614-
span: Span,
615-
) {
611+
fn annotate_doc_comment(err: &mut Diagnostic, sm: &SourceMap, span: Span) {
616612
if let Ok(src) = sm.span_to_snippet(span) {
617613
if src.starts_with("///") || src.starts_with("/**") {
618614
err.subdiagnostic(ExplainDocComment::Outer { span });

compiler/rustc_hir/src/hir.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -3491,16 +3491,16 @@ impl<'hir> Node<'hir> {
34913491
mod size_asserts {
34923492
use super::*;
34933493
// These are in alphabetical order, which is easy to maintain.
3494-
rustc_data_structures::static_assert_size!(Block<'static>, 48);
3495-
rustc_data_structures::static_assert_size!(Expr<'static>, 56);
3496-
rustc_data_structures::static_assert_size!(ForeignItem<'static>, 72);
3497-
rustc_data_structures::static_assert_size!(GenericBound<'_>, 48);
3498-
rustc_data_structures::static_assert_size!(Generics<'static>, 56);
3499-
rustc_data_structures::static_assert_size!(ImplItem<'static>, 88);
3500-
rustc_data_structures::static_assert_size!(Impl<'static>, 80);
3501-
rustc_data_structures::static_assert_size!(Item<'static>, 80);
3502-
rustc_data_structures::static_assert_size!(Pat<'static>, 88);
3503-
rustc_data_structures::static_assert_size!(QPath<'static>, 24);
3504-
rustc_data_structures::static_assert_size!(TraitItem<'static>, 96);
3505-
rustc_data_structures::static_assert_size!(Ty<'static>, 72);
3494+
static_assert_size!(Block<'static>, 48);
3495+
static_assert_size!(Expr<'static>, 56);
3496+
static_assert_size!(ForeignItem<'static>, 72);
3497+
static_assert_size!(GenericBound<'_>, 48);
3498+
static_assert_size!(Generics<'static>, 56);
3499+
static_assert_size!(ImplItem<'static>, 88);
3500+
static_assert_size!(Impl<'static>, 80);
3501+
static_assert_size!(Item<'static>, 80);
3502+
static_assert_size!(Pat<'static>, 88);
3503+
static_assert_size!(QPath<'static>, 24);
3504+
static_assert_size!(TraitItem<'static>, 96);
3505+
static_assert_size!(Ty<'static>, 72);
35063506
}

compiler/rustc_lint/src/unused.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -608,8 +608,7 @@ trait UnusedDelimLint {
608608
ref call_or_other => {
609609
let (args_to_check, ctx) = match *call_or_other {
610610
Call(_, ref args) => (&args[..], UnusedDelimsCtx::FunctionArg),
611-
// first "argument" is self (which sometimes needs delims)
612-
MethodCall(_, ref args, _) => (&args[1..], UnusedDelimsCtx::MethodArg),
611+
MethodCall(_, _, ref args, _) => (&args[..], UnusedDelimsCtx::MethodArg),
613612
// actual catch-all arm
614613
_ => {
615614
return;

compiler/rustc_middle/src/thir.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -814,8 +814,8 @@ impl<'tcx> fmt::Display for Pat<'tcx> {
814814
mod size_asserts {
815815
use super::*;
816816
// These are in alphabetical order, which is easy to maintain.
817-
rustc_data_structures::static_assert_size!(Block, 56);
818-
rustc_data_structures::static_assert_size!(Expr<'_>, 104);
819-
rustc_data_structures::static_assert_size!(Pat<'_>, 24);
820-
rustc_data_structures::static_assert_size!(Stmt<'_>, 120);
817+
static_assert_size!(Block, 56);
818+
static_assert_size!(Expr<'_>, 104);
819+
static_assert_size!(Pat<'_>, 24);
820+
static_assert_size!(Stmt<'_>, 120);
821821
}

compiler/rustc_mir_build/src/build/matches/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
170170

171171
let mut arm_candidates = self.create_match_candidates(scrutinee_place.clone(), &arms);
172172

173-
let match_has_guard = arms.iter().copied().any(|arm| self.thir[arm].guard.is_some());
173+
let match_has_guard = arm_candidates.iter().any(|(_, candidate)| candidate.has_guard);
174174
let mut candidates =
175175
arm_candidates.iter_mut().map(|(_, candidate)| candidate).collect::<Vec<_>>();
176176

compiler/rustc_mir_transform/src/elaborate_box_derefs.rs

-8
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ impl<'tcx, 'a> MutVisitor<'tcx> for ElaborateBoxDerefVisitor<'tcx, 'a> {
7070
build_ptr_tys(tcx, base_ty.boxed_ty(), self.unique_did, self.nonnull_did);
7171

7272
let ptr_local = self.patch.new_temp(ptr_ty, source_info.span);
73-
self.local_decls.push(LocalDecl::new(ptr_ty, source_info.span));
7473

7574
self.patch.add_statement(location, StatementKind::StorageLive(ptr_local));
7675

@@ -125,13 +124,6 @@ impl<'tcx> MirPass<'tcx> for ElaborateBoxDerefs {
125124
index += 1;
126125
}
127126

128-
if let Some(terminator) = terminator
129-
&& !matches!(terminator.kind, TerminatorKind::Yield{..})
130-
{
131-
let location = Location { block, statement_index: index };
132-
visitor.visit_terminator(terminator, location);
133-
}
134-
135127
let location = Location { block, statement_index: index };
136128
match terminator {
137129
// yielding into a box is handled when lowering generators

0 commit comments

Comments
 (0)