Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/asm.rs
Original file line number Diff line number Diff line change
@@ -206,7 +206,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
if let Some(def_id) = static_def_id {
let path = self.lower_qpath(
sym.id,
&sym.qself,
sym.qself.as_ref(),
&sym.path,
ParamMode::Optional,
AllowReturnTypeNotation::No,
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/delegation.rs
Original file line number Diff line number Diff line change
@@ -337,7 +337,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
} else {
let path = self.lower_qpath(
delegation.id,
&delegation.qself,
delegation.qself.as_ref(),
&delegation.path,
ParamMode::Optional,
AllowReturnTypeNotation::No,
10 changes: 5 additions & 5 deletions compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
@@ -318,7 +318,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
ExprKind::Path(qself, path) => {
let qpath = self.lower_qpath(
e.id,
qself,
qself.as_ref(),
path,
ParamMode::Optional,
AllowReturnTypeNotation::No,
@@ -363,7 +363,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
hir::ExprKind::Struct(
self.arena.alloc(self.lower_qpath(
e.id,
&se.qself,
se.qself.as_ref(),
&se.path,
ParamMode::Optional,
AllowReturnTypeNotation::No,
@@ -1357,7 +1357,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
);
let qpath = self.lower_qpath(
callee.id,
qself,
qself.as_ref(),
path,
ParamMode::Optional,
AllowReturnTypeNotation::No,
@@ -1378,7 +1378,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
if let Some((qself, path)) = self.extract_unit_struct_path(lhs) {
let qpath = self.lower_qpath(
lhs.id,
qself,
qself.as_ref(),
path,
ParamMode::Optional,
AllowReturnTypeNotation::No,
@@ -1404,7 +1404,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
}));
let qpath = self.lower_qpath(
lhs.id,
&se.qself,
se.qself.as_ref(),
&se.path,
ParamMode::Optional,
AllowReturnTypeNotation::No,
6 changes: 3 additions & 3 deletions compiler/rustc_ast_lowering/src/format.rs
Original file line number Diff line number Diff line change
@@ -282,7 +282,7 @@ fn make_argument<'hir>(
fn make_count<'hir>(
ctx: &mut LoweringContext<'_, 'hir>,
sp: Span,
count: &Option<FormatCount>,
count: Option<&FormatCount>,
argmap: &mut FxIndexMap<(usize, ArgumentType), Option<Span>>,
) -> hir::Expr<'hir> {
match count {
@@ -377,8 +377,8 @@ fn make_format_spec<'hir>(
| ((debug_hex == Some(FormatDebugHex::Lower)) as u32) << 4
| ((debug_hex == Some(FormatDebugHex::Upper)) as u32) << 5;
let flags = ctx.expr_u32(sp, flags);
let precision = make_count(ctx, sp, precision, argmap);
let width = make_count(ctx, sp, width, argmap);
let precision = make_count(ctx, sp, precision.as_ref(), argmap);
let width = make_count(ctx, sp, width.as_ref(), argmap);
let format_placeholder_new = ctx.arena.alloc(ctx.expr_lang_item_type_relative(
sp,
hir::LangItem::FormatPlaceholder,
10 changes: 5 additions & 5 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1129,7 +1129,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
fn lower_path_ty(
&mut self,
t: &Ty,
qself: &Option<ptr::P<QSelf>>,
qself: Option<&ptr::P<QSelf>>,
path: &Path,
param_mode: ParamMode,
itctx: ImplTraitContext,
@@ -1255,7 +1255,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
return self.lower_ty_direct(ty, itctx);
}
TyKind::Path(qself, path) => {
return self.lower_path_ty(t, qself, path, ParamMode::Explicit, itctx);
return self.lower_path_ty(t, qself.as_ref(), path, ParamMode::Explicit, itctx);
}
TyKind::ImplicitSelf => {
let hir_id = self.next_id();
@@ -1919,7 +1919,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
) -> hir::TraitRef<'hir> {
let path = match self.lower_qpath(
p.ref_id,
&None,
None,
&p.path,
ParamMode::Explicit,
AllowReturnTypeNotation::No,
@@ -2070,7 +2070,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
{
let qpath = self.lower_qpath(
ty_id,
&None,
None,
path,
ParamMode::Optional,
AllowReturnTypeNotation::No,
@@ -2146,7 +2146,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
{
let qpath = self.lower_qpath(
expr.id,
&None,
None,
path,
ParamMode::Optional,
AllowReturnTypeNotation::No,
6 changes: 3 additions & 3 deletions compiler/rustc_ast_lowering/src/pat.rs
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
PatKind::TupleStruct(qself, path, pats) => {
let qpath = self.lower_qpath(
pattern.id,
qself,
qself.as_ref(),
path,
ParamMode::Optional,
AllowReturnTypeNotation::No,
@@ -59,7 +59,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
PatKind::Path(qself, path) => {
let qpath = self.lower_qpath(
pattern.id,
qself,
qself.as_ref(),
path,
ParamMode::Optional,
AllowReturnTypeNotation::No,
@@ -71,7 +71,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
PatKind::Struct(qself, path, fields, etc) => {
let qpath = self.lower_qpath(
pattern.id,
qself,
qself.as_ref(),
path,
ParamMode::Optional,
AllowReturnTypeNotation::No,
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/path.rs
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
pub(crate) fn lower_qpath(
&mut self,
id: NodeId,
qself: &Option<ptr::P<QSelf>>,
qself: Option<&ptr::P<QSelf>>,
p: &Path,
param_mode: ParamMode,
allow_return_type_notation: AllowReturnTypeNotation,
12 changes: 6 additions & 6 deletions compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
@@ -1110,9 +1110,9 @@ impl<'a> State<'a> {
self.commasep_cmnt(b, exprs, |s, e| s.print_expr(e, FixupContext::default()), |e| e.span)
}

pub fn print_opt_lifetime(&mut self, lifetime: &Option<ast::Lifetime>) {
if let Some(lt) = *lifetime {
self.print_lifetime(lt);
pub fn print_opt_lifetime(&mut self, lifetime: Option<&ast::Lifetime>) {
if let Some(lt) = lifetime {
self.print_lifetime(*lt);
self.nbsp();
}
}
@@ -1163,12 +1163,12 @@ impl<'a> State<'a> {
}
ast::TyKind::Ref(lifetime, mt) => {
self.word("&");
self.print_opt_lifetime(lifetime);
self.print_opt_lifetime(lifetime.as_ref());
self.print_mt(mt, false);
}
ast::TyKind::PinnedRef(lifetime, mt) => {
self.word("&");
self.print_opt_lifetime(lifetime);
self.print_opt_lifetime(lifetime.as_ref());
self.word("pin ");
self.print_mt(mt, true);
}
@@ -1752,7 +1752,7 @@ impl<'a> State<'a> {
}
SelfKind::Region(lt, m) => {
self.word("&");
self.print_opt_lifetime(lt);
self.print_opt_lifetime(lt.as_ref());
self.print_mutability(*m, false);
self.word("self")
}
4 changes: 2 additions & 2 deletions compiler/rustc_ast_pretty/src/pprust/state/expr.rs
Original file line number Diff line number Diff line change
@@ -147,7 +147,7 @@ impl<'a> State<'a> {

fn print_expr_struct(
&mut self,
qself: &Option<P<ast::QSelf>>,
qself: Option<&P<ast::QSelf>>,
path: &ast::Path,
fields: &[ast::ExprField],
rest: &ast::StructRest,
@@ -399,7 +399,7 @@ impl<'a> State<'a> {
self.print_expr_repeat(element, count);
}
ast::ExprKind::Struct(se) => {
self.print_expr_struct(&se.qself, &se.path, &se.fields, &se.rest);
self.print_expr_struct(se.qself.as_ref(), &se.path, &se.fields, &se.rest);
}
ast::ExprKind::Tup(exprs) => {
self.print_expr_tup(exprs);
20 changes: 10 additions & 10 deletions compiler/rustc_ast_pretty/src/pprust/state/item.rs
Original file line number Diff line number Diff line change
@@ -390,18 +390,18 @@ impl<'a> State<'a> {
ast::ItemKind::Delegation(deleg) => self.print_delegation(
&item.attrs,
&item.vis,
&deleg.qself,
deleg.qself.as_ref(),
&deleg.path,
DelegationKind::Single,
&deleg.body,
deleg.body.as_ref(),
),
ast::ItemKind::DelegationMac(deleg) => self.print_delegation(
&item.attrs,
&item.vis,
&deleg.qself,
deleg.qself.as_ref(),
&deleg.prefix,
deleg.suffixes.as_ref().map_or(DelegationKind::Glob, |s| DelegationKind::List(s)),
&deleg.body,
deleg.body.as_ref(),
),
}
self.ann.post(self, AnnNode::Item(item))
@@ -583,18 +583,18 @@ impl<'a> State<'a> {
ast::AssocItemKind::Delegation(deleg) => self.print_delegation(
&item.attrs,
vis,
&deleg.qself,
deleg.qself.as_ref(),
&deleg.path,
DelegationKind::Single,
&deleg.body,
deleg.body.as_ref(),
),
ast::AssocItemKind::DelegationMac(deleg) => self.print_delegation(
&item.attrs,
vis,
&deleg.qself,
deleg.qself.as_ref(),
&deleg.prefix,
deleg.suffixes.as_ref().map_or(DelegationKind::Glob, |s| DelegationKind::List(s)),
&deleg.body,
deleg.body.as_ref(),
),
}
self.ann.post(self, AnnNode::SubItem(id))
@@ -604,10 +604,10 @@ impl<'a> State<'a> {
&mut self,
attrs: &[ast::Attribute],
vis: &ast::Visibility,
qself: &Option<P<ast::QSelf>>,
qself: Option<&P<ast::QSelf>>,
path: &ast::Path,
kind: DelegationKind<'_>,
body: &Option<P<ast::Block>>,
body: Option<&P<ast::Block>>,
) {
if body.is_some() {
self.head("");
14 changes: 10 additions & 4 deletions compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
@@ -2939,7 +2939,13 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
span,
..
},
) => self.report_escaping_data(borrow_span, &name, upvar_span, upvar_name, span),
) => self.report_escaping_data(
borrow_span,
name.as_deref(),
upvar_span,
upvar_name,
span,
),
(Some(name), explanation) => self.report_local_value_does_not_live_long_enough(
location,
&name,
@@ -2992,7 +2998,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
borrow_span,
span,
category,
opt_place_desc.as_ref(),
opt_place_desc.as_deref(),
) {
return diag;
}
@@ -3335,7 +3341,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
borrow_span: Span,
return_span: Span,
category: ConstraintCategory<'tcx>,
opt_place_desc: Option<&String>,
opt_place_desc: Option<&str>,
) -> Result<(), Diag<'infcx>> {
let return_kind = match category {
ConstraintCategory::Return(_) => "return",
@@ -3538,7 +3544,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
fn report_escaping_data(
&self,
borrow_span: Span,
name: &Option<String>,
name: Option<&str>,
upvar_span: Span,
upvar_name: Symbol,
escape_span: Span,
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
@@ -213,7 +213,7 @@ fn do_mir_borrowck<'tcx>(

// Dump MIR results into a file, if that is enabled. This lets us
// write unit-tests, as well as helping with debugging.
nll::dump_nll_mir(&infcx, body, &regioncx, &opt_closure_req, &borrow_set);
nll::dump_nll_mir(&infcx, body, &regioncx, opt_closure_req.as_ref(), &borrow_set);

// We also have a `#[rustc_regions]` annotation that causes us to dump
// information.
@@ -222,7 +222,7 @@ fn do_mir_borrowck<'tcx>(
&infcx,
body,
&regioncx,
&opt_closure_req,
opt_closure_req.as_ref(),
&opaque_type_values,
diags_buffer,
);
6 changes: 3 additions & 3 deletions compiler/rustc_borrowck/src/nll.rs
Original file line number Diff line number Diff line change
@@ -203,7 +203,7 @@ pub(super) fn dump_nll_mir<'tcx>(
infcx: &BorrowckInferCtxt<'tcx>,
body: &Body<'tcx>,
regioncx: &RegionInferenceContext<'tcx>,
closure_region_requirements: &Option<ClosureRegionRequirements<'tcx>>,
closure_region_requirements: Option<&ClosureRegionRequirements<'tcx>>,
borrow_set: &BorrowSet<'tcx>,
) {
let tcx = infcx.tcx;
@@ -249,7 +249,7 @@ pub(super) fn dump_nll_mir<'tcx>(
pub(crate) fn emit_nll_mir<'tcx>(
tcx: TyCtxt<'tcx>,
regioncx: &RegionInferenceContext<'tcx>,
closure_region_requirements: &Option<ClosureRegionRequirements<'tcx>>,
closure_region_requirements: Option<&ClosureRegionRequirements<'tcx>>,
borrow_set: &BorrowSet<'tcx>,
pass_where: PassWhere,
out: &mut dyn io::Write,
@@ -296,7 +296,7 @@ pub(super) fn dump_annotation<'tcx, 'infcx>(
infcx: &'infcx BorrowckInferCtxt<'tcx>,
body: &Body<'tcx>,
regioncx: &RegionInferenceContext<'tcx>,
closure_region_requirements: &Option<ClosureRegionRequirements<'tcx>>,
closure_region_requirements: Option<&ClosureRegionRequirements<'tcx>>,
opaque_type_values: &FxIndexMap<LocalDefId, OpaqueHiddenType<'tcx>>,
diagnostics_buffer: &mut BorrowckDiagnosticsBuffer<'infcx, 'tcx>,
) {
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/polonius/dump.rs
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ fn emit_polonius_mir<'tcx>(
crate::nll::emit_nll_mir(
tcx,
regioncx,
closure_region_requirements,
closure_region_requirements.as_ref(),
borrow_set,
pass_where.clone(),
out,
Loading