Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 96218dd

Browse files
committed
Auto merge of rust-lang#125533 - workingjubilee:rollup-679cc5k, r=workingjubilee
Rollup of 9 pull requests Successful merges: - rust-lang#124080 (Some unstable changes to where opaque types get defined) - rust-lang#125271 (use posix_memalign on almost all Unix targets) - rust-lang#125433 (A small diagnostic improvement for dropping_copy_types) - rust-lang#125498 (Stop using the avx512er and avx512pf x86 target features) - rust-lang#125510 (remove proof tree formatting, make em shallow) - rust-lang#125513 (Don't eagerly monomorphize drop for types that are impossible to instantiate) - rust-lang#125514 (Structurally resolve before `builtin_index` in EUV) - rust-lang#125515 ( bootstrap: support target specific config overrides ) - rust-lang#125527 (Add manual Sync impl for ReentrantLockGuard) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 21e6de7 + f8346f0 commit 96218dd

File tree

77 files changed

+832
-661
lines changed

Some content is hidden

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

77 files changed

+832
-661
lines changed

‎compiler/rustc_hir_typeck/src/expr_use_visitor.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1741,7 +1741,11 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
17411741
}
17421742

17431743
PatKind::Slice(before, ref slice, after) => {
1744-
let Some(element_ty) = place_with_id.place.ty().builtin_index() else {
1744+
let Some(element_ty) = self
1745+
.cx
1746+
.try_structurally_resolve_type(pat.span, place_with_id.place.ty())
1747+
.builtin_index()
1748+
else {
17451749
debug!("explicit index of non-indexable type {:?}", place_with_id);
17461750
return Err(self
17471751
.cx

‎compiler/rustc_interface/src/tests.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -799,10 +799,7 @@ fn test_unstable_options_tracking_hash() {
799799
tracked!(mir_opt_level, Some(4));
800800
tracked!(move_size_limit, Some(4096));
801801
tracked!(mutable_noalias, false);
802-
tracked!(
803-
next_solver,
804-
Some(NextSolverConfig { coherence: true, globally: false, dump_tree: Default::default() })
805-
);
802+
tracked!(next_solver, Some(NextSolverConfig { coherence: true, globally: false }));
806803
tracked!(no_generate_arange_section, true);
807804
tracked!(no_jump_tables, true);
808805
tracked!(no_link, true);

‎compiler/rustc_lint/messages.ftl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ lint_drop_trait_constraints =
233233
lint_dropping_copy_types = calls to `std::mem::drop` with a value that implements `Copy` does nothing
234234
.label = argument has type `{$arg_ty}`
235235
.note = use `let _ = ...` to ignore the expression or result
236+
.suggestion = use `let _ = ...` to ignore the expression or result
236237
237238
lint_dropping_references = calls to `std::mem::drop` with a reference instead of an owned value does nothing
238239
.label = argument has type `{$arg_ty}`

‎compiler/rustc_lint/src/drop_forget_useless.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
use rustc_hir::{Arm, Expr, ExprKind, Node};
1+
use rustc_hir::{Arm, Expr, ExprKind, Node,StmtKind};
22
use rustc_middle::ty;
33
use rustc_session::{declare_lint, declare_lint_pass};
44
use rustc_span::sym;
55

66
use crate::{
77
lints::{
8-
DropCopyDiag, DropRefDiag, ForgetCopyDiag, ForgetRefDiag,UndroppedManuallyDropsDiag,
9-
UndroppedManuallyDropsSuggestion,
8+
DropCopyDiag, DropCopySuggestion,DropRefDiag, ForgetCopyDiag, ForgetRefDiag,
9+
UndroppedManuallyDropsDiag,UndroppedManuallyDropsSuggestion,
1010
},
1111
LateContext, LateLintPass, LintContext,
1212
};
@@ -164,10 +164,23 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetUseless {
164164
);
165165
}
166166
sym::mem_drop if is_copy && !drop_is_single_call_in_arm => {
167+
let sugg = if let Some((_, node)) = cx.tcx.hir().parent_iter(expr.hir_id).nth(0)
168+
&& let Node::Stmt(stmt) = node
169+
&& let StmtKind::Semi(e) = stmt.kind
170+
&& e.hir_id == expr.hir_id
171+
{
172+
DropCopySuggestion::Suggestion {
173+
start_span: expr.span.shrink_to_lo().until(arg.span),
174+
end_span: arg.span.shrink_to_hi().until(expr.span.shrink_to_hi()),
175+
}
176+
} else {
177+
DropCopySuggestion::Note
178+
};
179+
167180
cx.emit_span_lint(
168181
DROPPING_COPY_TYPES,
169182
expr.span,
170-
DropCopyDiag { arg_ty, label: arg.span },
183+
DropCopyDiag { arg_ty, label: arg.span, sugg },
171184
);
172185
}
173186
sym::mem_forget if is_copy => {

‎compiler/rustc_lint/src/lints.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,11 +677,25 @@ pub struct DropRefDiag<'a> {
677677

678678
#[derive(LintDiagnostic)]
679679
#[diag(lint_dropping_copy_types)]
680-
#[note]
681680
pub struct DropCopyDiag<'a> {
682681
pub arg_ty: Ty<'a>,
683682
#[label]
684683
pub label: Span,
684+
#[subdiagnostic]
685+
pub sugg: DropCopySuggestion,
686+
}
687+
688+
#[derive(Subdiagnostic)]
689+
pub enum DropCopySuggestion {
690+
#[note(lint_note)]
691+
Note,
692+
#[multipart_suggestion(lint_suggestion, style = "verbose", applicability = "maybe-incorrect")]
693+
Suggestion {
694+
#[suggestion_part(code = "let _ = ")]
695+
start_span: Span,
696+
#[suggestion_part(code = "")]
697+
end_span: Span,
698+
},
685699
}
686700

687701
#[derive(LintDiagnostic)]

‎compiler/rustc_middle/src/arena.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ macro_rules! arena_types {
6161
[] dtorck_constraint: rustc_middle::traits::query::DropckConstraint<'tcx>,
6262
[] candidate_step: rustc_middle::traits::query::CandidateStep<'tcx>,
6363
[] autoderef_bad_ty: rustc_middle::traits::query::MethodAutoderefBadTy<'tcx>,
64-
[] canonical_goal_evaluation: rustc_next_trait_solver::solve::inspect::GoalEvaluationStep<rustc_middle::ty::TyCtxt<'tcx>>,
64+
[] canonical_goal_evaluation:
65+
rustc_next_trait_solver::solve::inspect::CanonicalGoalEvaluationStep<
66+
rustc_middle::ty::TyCtxt<'tcx>
67+
>,
6568
[] query_region_constraints: rustc_middle::infer::canonical::QueryRegionConstraints<'tcx>,
6669
[] type_op_subtype:
6770
rustc_middle::infer::canonical::Canonical<'tcx,

‎compiler/rustc_middle/src/traits/solve/cache.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub struct EvaluationCache<'tcx> {
1717
#[derive(Debug, PartialEq, Eq)]
1818
pub struct CacheData<'tcx> {
1919
pub result: QueryResult<'tcx>,
20-
pub proof_tree: Option<&'tcx [inspect::GoalEvaluationStep<TyCtxt<'tcx>>]>,
20+
pub proof_tree: Option<&'tcx inspect::CanonicalGoalEvaluationStep<TyCtxt<'tcx>>>,
2121
pub additional_depth: usize,
2222
pub encountered_overflow: bool,
2323
}
@@ -28,7 +28,7 @@ impl<'tcx> EvaluationCache<'tcx> {
2828
&self,
2929
tcx: TyCtxt<'tcx>,
3030
key: CanonicalInput<'tcx>,
31-
proof_tree: Option<&'tcx [inspect::GoalEvaluationStep<TyCtxt<'tcx>>]>,
31+
proof_tree: Option<&'tcx inspect::CanonicalGoalEvaluationStep<TyCtxt<'tcx>>>,
3232
additional_depth: usize,
3333
encountered_overflow: bool,
3434
cycle_participants: FxHashSet<CanonicalInput<'tcx>>,
@@ -107,7 +107,7 @@ struct Success<'tcx> {
107107
#[derive(Clone, Copy)]
108108
pub struct QueryData<'tcx> {
109109
pub result: QueryResult<'tcx>,
110-
pub proof_tree: Option<&'tcx [inspect::GoalEvaluationStep<TyCtxt<'tcx>>]>,
110+
pub proof_tree: Option<&'tcx inspect::CanonicalGoalEvaluationStep<TyCtxt<'tcx>>>,
111111
}
112112

113113
/// The cache entry for a goal `CanonicalInput`.

‎compiler/rustc_middle/src/ty/context.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
103103
type PredefinedOpaques = solve::PredefinedOpaques<'tcx>;
104104
type DefiningOpaqueTypes = &'tcx ty::List<LocalDefId>;
105105
type ExternalConstraints = ExternalConstraints<'tcx>;
106-
type GoalEvaluationSteps = &'tcx [solve::inspect::GoalEvaluationStep<TyCtxt<'tcx>>];
106+
type CanonicalGoalEvaluationStepRef =
107+
&'tcx solve::inspect::CanonicalGoalEvaluationStep<TyCtxt<'tcx>>;
107108

108109
type Ty = Ty<'tcx>;
109110
type Tys = &'tcx List<Ty<'tcx>>;

‎compiler/rustc_mir_build/src/build/expr/as_place.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use crate::build::expr::category::Category;
44
use crate::build::ForGuard::{OutsideGuard, RefWithinGuard};
55
use crate::build::{BlockAnd, BlockAndExtension, Builder, Capture, CaptureMap};
66
use rustc_hir::def_id::LocalDefId;
7-
use rustc_middle::bug;
87
use rustc_middle::hir::place::Projection as HirProjection;
98
use rustc_middle::hir::place::ProjectionKind as HirProjectionKind;
109
use rustc_middle::middle::region;
@@ -13,6 +12,7 @@ use rustc_middle::mir::*;
1312
use rustc_middle::thir::*;
1413
use rustc_middle::ty::AdtDef;
1514
use rustc_middle::ty::{self, CanonicalUserTypeAnnotation, Ty, Variance};
15+
use rustc_middle::{bug, span_bug};
1616
use rustc_span::Span;
1717
use rustc_target::abi::{FieldIdx, VariantIdx, FIRST_VARIANT};
1818
use tracing::{debug, instrument, trace};
@@ -252,7 +252,18 @@ fn strip_prefix<'a, 'tcx>(
252252

253253
impl<'tcx> PlaceBuilder<'tcx> {
254254
pub(in crate::build) fn to_place(&self, cx: &Builder<'_, 'tcx>) -> Place<'tcx> {
255-
self.try_to_place(cx).unwrap()
255+
self.try_to_place(cx).unwrap_or_else(|| match self.base {
256+
PlaceBase::Local(local) => span_bug!(
257+
cx.local_decls[local].source_info.span,
258+
"could not resolve local: {local:#?} + {:?}",
259+
self.projection
260+
),
261+
PlaceBase::Upvar { var_hir_id, closure_def_id: _ } => span_bug!(
262+
cx.tcx.hir().span(var_hir_id.0),
263+
"could not resolve upvar: {var_hir_id:?} + {:?}",
264+
self.projection
265+
),
266+
})
256267
}
257268

258269
/// Creates a `Place` or returns `None` if an upvar cannot be resolved

‎compiler/rustc_monomorphize/src/collector.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,6 +1434,15 @@ impl<'v> RootCollector<'_, 'v> {
14341434
{
14351435
debug!("RootCollector: ADT drop-glue for `{id:?}`",);
14361436

1437+
// This type is impossible to instantiate, so we should not try to
1438+
// generate a `drop_in_place` instance for it.
1439+
if self.tcx.instantiate_and_check_impossible_predicates((
1440+
id.owner_id.to_def_id(),
1441+
ty::List::empty(),
1442+
)) {
1443+
return;
1444+
}
1445+
14371446
let ty = self.tcx.type_of(id.owner_id.to_def_id()).no_bound_vars().unwrap();
14381447
visit_drop_use(self.tcx, ty, true, DUMMY_SP, self.output);
14391448
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /