Rollup merge of #112232 - fee1-dead-contrib:match-eq-const-msg, r=b-naber

Better error for non const `PartialEq` call generated by `match`

Resolves #90237
This commit is contained in:
Michael Goulet 2023-06-19 17:53:33 -07:00 committed by GitHub
commit 31d1fbf8d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 211 additions and 100 deletions

View file

@ -140,7 +140,7 @@ impl<'tcx> MockBlocks<'tcx> {
destination: self.dummy_place.clone(),
target: Some(TEMP_BLOCK),
unwind: UnwindAction::Continue,
from_hir_call: false,
call_source: CallSource::Misc,
fn_span: DUMMY_SP,
},
)

View file

@ -34,7 +34,7 @@ impl<'tcx> Visitor<'tcx> for FunctionItemRefChecker<'_, 'tcx> {
destination: _,
target: _,
unwind: _,
from_hir_call: _,
call_source: _,
fn_span: _,
} = &terminator.kind
{

View file

@ -1692,7 +1692,7 @@ impl<'tcx> Visitor<'tcx> for EnsureGeneratorFieldAssignmentsNeverAlias<'_> {
destination,
target: Some(_),
unwind: _,
from_hir_call: _,
call_source: _,
fn_span: _,
} => {
self.check_assigned_place(*destination, |this| {

View file

@ -30,8 +30,8 @@ use rustc_hir::intravisit::{self, Visitor};
use rustc_index::IndexVec;
use rustc_middle::mir::visit::Visitor as _;
use rustc_middle::mir::{
traversal, AnalysisPhase, Body, ClearCrossCrate, ConstQualifs, Constant, LocalDecl, MirPass,
MirPhase, Operand, Place, ProjectionElem, Promoted, RuntimePhase, Rvalue, SourceInfo,
traversal, AnalysisPhase, Body, CallSource, ClearCrossCrate, ConstQualifs, Constant, LocalDecl,
MirPass, MirPhase, Operand, Place, ProjectionElem, Promoted, RuntimePhase, Rvalue, SourceInfo,
Statement, StatementKind, TerminatorKind, START_BLOCK,
};
use rustc_middle::query::Providers;
@ -189,7 +189,7 @@ fn remap_mir_for_const_eval_select<'tcx>(
};
method(place)
}).collect();
terminator.kind = TerminatorKind::Call { func, args: arguments, destination, target, unwind, from_hir_call: false, fn_span };
terminator.kind = TerminatorKind::Call { func, args: arguments, destination, target, unwind, call_source: CallSource::Misc, fn_span };
}
_ => {}
}

View file

@ -54,7 +54,7 @@ fn lower_slice_len_call<'tcx>(
args,
destination,
target: Some(bb),
from_hir_call: true,
call_source: CallSource::Normal,
..
} => {
// some heuristics for fast rejection

View file

@ -500,7 +500,7 @@ impl<'tcx> CloneShimBuilder<'tcx> {
destination: dest,
target: Some(next),
unwind: UnwindAction::Cleanup(cleanup),
from_hir_call: true,
call_source: CallSource::Normal,
fn_span: self.span,
},
false,
@ -789,7 +789,7 @@ fn build_call_shim<'tcx>(
} else {
UnwindAction::Continue
},
from_hir_call: true,
call_source: CallSource::Misc,
fn_span: span,
},
false,