Skip to content

Commit 3655175

Browse files
committed
Auto merge of #97111 - JohnTitor:rollup-x3vjf6u, r=JohnTitor
Rollup of 7 pull requests Successful merges: - #96329 (Add a couple tests for #90887 fixes) - #97009 (Allow `unused_macro_rules` in path tests) - #97075 (Add regression test for #81804) - #97079 (Change `Successors` to `impl Iterator<Item = BasicBlock>`) - #97080 (remove the `RelateResultCompare` trait) - #97093 (Migrate `maybe_recover_from_bad_type_plus` diagnostic) - #97102 (Update function pointer call error message) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 735efc0 + 5fdc849 commit 3655175

File tree

31 files changed

+250
-97
lines changed

31 files changed

+250
-97
lines changed

compiler/rustc_borrowck/src/dataflow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ impl<'tcx> OutOfScopePrecomputer<'_, 'tcx> {
199199
// Add successor BBs to the work list, if necessary.
200200
let bb_data = &self.body[bb];
201201
debug_assert!(hi == bb_data.statements.len());
202-
for &succ_bb in bb_data.terminator().successors() {
202+
for succ_bb in bb_data.terminator().successors() {
203203
if !self.visited.insert(succ_bb) {
204204
if succ_bb == location.block && first_lo > 0 {
205205
// `succ_bb` has been seen before. If it wasn't

compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
467467
block
468468
.terminator()
469469
.successors()
470-
.map(|bb| Location { statement_index: 0, block: *bb })
470+
.map(|bb| Location { statement_index: 0, block: bb })
471471
.filter(|s| visited_locations.insert(*s))
472472
.map(|s| {
473473
if self.is_back_edge(location, s) {
@@ -526,7 +526,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
526526
}
527527
} else {
528528
for bb in block.terminator().successors() {
529-
let successor = Location { statement_index: 0, block: *bb };
529+
let successor = Location { statement_index: 0, block: bb };
530530

531531
if !visited_locations.contains(&successor)
532532
&& self.find_loop_head_dfs(successor, loop_head, visited_locations)

compiler/rustc_borrowck/src/diagnostics/find_use.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ impl<'cx, 'tcx> UseFinder<'cx, 'tcx> {
6767
block_data
6868
.terminator()
6969
.successors()
70-
.filter(|&bb| Some(&Some(*bb)) != block_data.terminator().unwind())
71-
.map(|&bb| Location { statement_index: 0, block: bb }),
70+
.filter(|&bb| Some(&Some(bb)) != block_data.terminator().unwind())
71+
.map(|bb| Location { statement_index: 0, block: bb }),
7272
);
7373
}
7474
}

compiler/rustc_borrowck/src/nll.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ fn populate_polonius_move_facts(
108108
// We are at the terminator of an init that has a panic path,
109109
// and where the init should not happen on panic
110110

111-
for &successor in block_data.terminator().successors() {
111+
for successor in block_data.terminator().successors() {
112112
if body[successor].is_cleanup {
113113
continue;
114114
}

compiler/rustc_codegen_ssa/src/mir/analyze.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ pub fn cleanup_kinds(mir: &mir::Body<'_>) -> IndexVec<mir::BasicBlock, CleanupKi
328328
bb, data, result[bb], funclet
329329
);
330330

331-
for &succ in data.terminator().successors() {
331+
for succ in data.terminator().successors() {
332332
let kind = result[succ];
333333
debug!("cleanup_kinds: propagating {:?} to {:?}/{:?}", funclet, succ, kind);
334334
match kind {

compiler/rustc_const_eval/src/transform/check_consts/ops.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ impl<'tcx> NonConstOp<'tcx> for FnCallIndirect {
8989
ccx: &ConstCx<'_, 'tcx>,
9090
span: Span,
9191
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
92-
ccx.tcx.sess.struct_span_err(span, "function pointers are not allowed in const fn")
92+
ccx.tcx.sess.struct_span_err(
93+
span,
94+
&format!("function pointer calls are not allowed in {}s", ccx.const_kind()),
95+
)
9396
}
9497
}
9598

compiler/rustc_error_messages/locales/en-US/parser.ftl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,12 @@ parser-struct-literal-body-without-path =
55
parser-maybe-report-ambiguous-plus =
66
ambiguous `+` in a type
77
.suggestion = use parentheses to disambiguate
8+
9+
parser-maybe-recover-from-bad-type-plus =
10+
expected a path on the left-hand side of `+`, not `{$ty}`
11+
12+
parser-add-paren = try adding parentheses
13+
14+
parser-forgot-paren = perhaps you forgot parentheses?
15+
16+
parser-expect-path = expected a path

compiler/rustc_infer/src/infer/combine.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -776,21 +776,6 @@ pub trait ConstEquateRelation<'tcx>: TypeRelation<'tcx> {
776776
fn const_equate_obligation(&mut self, a: ty::Const<'tcx>, b: ty::Const<'tcx>);
777777
}
778778

779-
pub trait RelateResultCompare<'tcx, T> {
780-
fn compare<F>(&self, t: T, f: F) -> RelateResult<'tcx, T>
781-
where
782-
F: FnOnce() -> TypeError<'tcx>;
783-
}
784-
785-
impl<'tcx, T: Clone + PartialEq> RelateResultCompare<'tcx, T> for RelateResult<'tcx, T> {
786-
fn compare<F>(&self, t: T, f: F) -> RelateResult<'tcx, T>
787-
where
788-
F: FnOnce() -> TypeError<'tcx>,
789-
{
790-
self.clone().and_then(|s| if s == t { self.clone() } else { Err(f()) })
791-
}
792-
}
793-
794779
pub fn const_unification_error<'tcx>(
795780
a_is_expected: bool,
796781
(a, b): (ty::Const<'tcx>, ty::Const<'tcx>),

compiler/rustc_infer/src/infer/nll_relate/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ where
859859

860860
delegate: &'me mut D,
861861

862-
/// After we generalize this type, we are going to relative it to
862+
/// After we generalize this type, we are going to relate it to
863863
/// some other type. What will be the variance at this point?
864864
ambient_variance: ty::Variance,
865865

compiler/rustc_middle/src/mir/generic_graph.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn mir_fn_to_generic_graph<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'_>) -> Grap
2424
let terminator = body[source].terminator();
2525
let labels = terminator.kind.fmt_successor_labels();
2626

27-
for (&target, label) in terminator.successors().zip(labels) {
27+
for (target, label) in terminator.successors().zip(labels) {
2828
let src = node(def_id, source);
2929
let trg = node(def_id, target);
3030
edges.push(Edge::new(src, trg, label.to_string()));

0 commit comments

Comments
 (0)