Skip to content

Commit 66ab7e6

Browse files
committedSep 21, 2023
Auto merge of #116027 - GuillaumeGomez:rollup-3zdi9lf, r=GuillaumeGomez
Rollup of 5 pull requests Successful merges: - #115257 (Improve invalid UTF-8 lint by finding the expression initializer) - #115936 (Prevent promotion of const fn calls in inline consts) - #115972 (rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const) - #116007 (Call panic_display directly in const_panic_fmt.) - #116019 (Delete obsolete `--disable-per-crate-search` rustdoc flag) r? `@ghost` `@rustbot` modify labels: rollup
2 parents e4a361a + e9aee82 commit 66ab7e6

File tree

97 files changed

+710
-583
lines changed

Some content is hidden

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

97 files changed

+710
-583
lines changed
 

‎compiler/rustc_borrowck/src/diagnostics/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc_index::IndexSlice;
1313
use rustc_infer::infer::LateBoundRegionConversionTime;
1414
use rustc_middle::mir::tcx::PlaceTy;
1515
use rustc_middle::mir::{
16-
AggregateKind, CallSource, Constant, FakeReadCause, Local, LocalInfo, LocalKind, Location,
16+
AggregateKind, CallSource, ConstOperand, FakeReadCause, Local, LocalInfo, LocalKind, Location,
1717
Operand, Place, PlaceRef, ProjectionElem, Rvalue, Statement, StatementKind, Terminator,
1818
TerminatorKind,
1919
};
@@ -101,12 +101,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
101101
let terminator = self.body[location.block].terminator();
102102
debug!("add_moved_or_invoked_closure_note: terminator={:?}", terminator);
103103
if let TerminatorKind::Call {
104-
func: Operand::Constant(box Constant { literal, .. }),
104+
func: Operand::Constant(box ConstOperand { const_, .. }),
105105
args,
106106
..
107107
} = &terminator.kind
108108
{
109-
if let ty::FnDef(id, _) = *literal.ty().kind() {
109+
if let ty::FnDef(id, _) = *const_.ty().kind() {
110110
debug!("add_moved_or_invoked_closure_note: id={:?}", id);
111111
if Some(self.infcx.tcx.parent(id)) == self.infcx.tcx.lang_items().fn_once_trait() {
112112
let closure = match args.first() {

‎compiler/rustc_borrowck/src/renumber.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ use crate::BorrowckInferCtxt;
44
use rustc_index::IndexSlice;
55
use rustc_infer::infer::NllRegionVariableOrigin;
66
use rustc_middle::mir::visit::{MutVisitor, TyContext};
7-
use rustc_middle::mir::Constant;
8-
use rustc_middle::mir::{Body, Location, Promoted};
7+
use rustc_middle::mir::{Body, ConstOperand, Location, Promoted};
98
use rustc_middle::ty::GenericArgsRef;
109
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable};
1110
use rustc_span::{Span, Symbol};
@@ -117,9 +116,9 @@ impl<'a, 'tcx> MutVisitor<'tcx> for RegionRenumberer<'a, 'tcx> {
117116
}
118117

119118
#[instrument(skip(self), level = "debug")]
120-
fn visit_constant(&mut self, constant: &mut Constant<'tcx>, location: Location) {
121-
let literal = constant.literal;
122-
constant.literal = self.renumber_regions(literal, || RegionCtxt::Location(location));
119+
fn visit_constant(&mut self, constant: &mut ConstOperand<'tcx>, location: Location) {
120+
let const_ = constant.const_;
121+
constant.const_ = self.renumber_regions(const_, || RegionCtxt::Location(location));
123122
debug!("constant: {:#?}", constant);
124123
}
125124
}

0 commit comments

Comments
 (0)
Please sign in to comment.