Skip to content

Commit

Permalink
Unrolled build for rust-lang#129345
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#129345 - compiler-errors:scratch4, r=jieyouxu

Use shorthand field initialization syntax more aggressively in the compiler

Caught these when cleaning up rust-lang#129344 and decided to run clippy to find the rest
  • Loading branch information
rust-timer authored Aug 21, 2024
2 parents 982c6f8 + 0b2525c commit a5cf7bb
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 30 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1421,7 +1421,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
};
hir::FnHeader {
safety: self.lower_safety(h.safety, default_safety),
asyncness: asyncness,
asyncness,
constness: self.lower_constness(h.constness),
abi: self.lower_extern(h.ext),
}
Expand Down
6 changes: 2 additions & 4 deletions compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,10 +562,8 @@ impl<'a> AstValidator<'a> {
FnHeader { safety: _, coroutine_kind, constness, ext }: FnHeader,
) {
let report_err = |span| {
self.dcx().emit_err(errors::FnQualifierInExtern {
span: span,
block: self.current_extern_span(),
});
self.dcx()
.emit_err(errors::FnQualifierInExtern { span, block: self.current_extern_span() });
};
match coroutine_kind {
Some(knd) => report_err(knd.span()),
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_ssa/src/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1500,7 +1500,7 @@ impl<'a> Linker for L4Bender<'a> {

impl<'a> L4Bender<'a> {
pub fn new(cmd: Command, sess: &'a Session) -> L4Bender<'a> {
L4Bender { cmd, sess: sess, hinted_static: false }
L4Bender { cmd, sess, hinted_static: false }
}

fn hint_static(&mut self) {
Expand All @@ -1520,7 +1520,7 @@ pub struct AixLinker<'a> {

impl<'a> AixLinker<'a> {
pub fn new(cmd: Command, sess: &'a Session) -> AixLinker<'a> {
AixLinker { cmd, sess: sess, hinted_static: None }
AixLinker { cmd, sess, hinted_static: None }
}

fn hint_static(&mut self) {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/check/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ fn check_start_fn_ty(tcx: TyCtxt<'_>, start_def_id: DefId) {
}
if sig.header.asyncness.is_async() {
let span = tcx.def_span(it.owner_id);
tcx.dcx().emit_err(errors::StartAsync { span: span });
tcx.dcx().emit_err(errors::StartAsync { span });
error = true;
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
{
if self.check_and_add_sugg_binding(LetStmt {
ty_hir_id_opt: if let Some(ty) = ty { Some(ty.hir_id) } else { None },
binding_id: binding_id,
binding_id,
span: pat.span,
init_hir_id: init.hir_id,
}) {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_incremental/src/persist/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ fn delete_old(sess: &Session, path: &Path) {
debug!("garbage_collect_session_directories() - deleting `{}`", path.display());

if let Err(err) = safe_remove_dir_all(path) {
sess.dcx().emit_warn(errors::SessionGcFailed { path: path, err });
sess.dcx().emit_warn(errors::SessionGcFailed { path, err });
} else {
delete_session_dir_lock_file(sess, &lock_file_path(path));
}
Expand Down
8 changes: 2 additions & 6 deletions compiler/rustc_metadata/src/locator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1002,11 +1002,7 @@ impl CrateError {
if !locator.crate_rejections.via_filename.is_empty() {
let mismatches = locator.crate_rejections.via_filename.iter();
for CrateMismatch { path, .. } in mismatches {
dcx.emit_err(errors::CrateLocationUnknownType {
span,
path: path,
crate_name,
});
dcx.emit_err(errors::CrateLocationUnknownType { span, path, crate_name });
dcx.emit_err(errors::LibFilenameForm {
span,
dll_prefix: &locator.dll_prefix,
Expand Down Expand Up @@ -1035,7 +1031,7 @@ impl CrateError {
}
dcx.emit_err(errors::NewerCrateVersion {
span,
crate_name: crate_name,
crate_name,
add_info,
found_crates,
});
Expand Down
7 changes: 1 addition & 6 deletions compiler/rustc_mir_build/src/thir/cx/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,7 @@ impl<'tcx> Cx<'tcx> {
let lhs =
self.thir.exprs.push(Expr { temp_lifetime, ty: discr_ty, span, kind });
let bin = ExprKind::Binary { op: BinOp::Add, lhs, rhs: offset };
self.thir.exprs.push(Expr {
temp_lifetime,
ty: discr_ty,
span: span,
kind: bin,
})
self.thir.exprs.push(Expr { temp_lifetime, ty: discr_ty, span, kind: bin })
}
None => offset,
};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl<'tcx> ConstToPat<'tcx> {
let err = TypeNotPartialEq { span: self.span, non_peq_ty: ty };
let e = self.tcx().dcx().emit_err(err);
let kind = PatKind::Error(e);
return Box::new(Pat { span: self.span, ty: ty, kind });
return Box::new(Pat { span: self.span, ty, kind });
}
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_transform/src/coroutine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ fn compute_storage_conflicts<'mir, 'tcx>(
// Compute the storage conflicts for all eligible locals.
let mut visitor = StorageConflictVisitor {
body,
saved_locals: saved_locals,
saved_locals,
local_conflicts: BitMatrix::from_row_n(&ineligible_locals, body.local_decls.len()),
eligible_storage_live: BitSet::new_empty(body.local_decls.len()),
};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_transform/src/dataflow_const_prop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ impl<'a, 'tcx> ConstAnalysis<'a, 'tcx> {
tcx,
local_decls: &body.local_decls,
ecx: InterpCx::new(tcx, DUMMY_SP, param_env, DummyMachine),
param_env: param_env,
param_env,
}
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_query_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ pub fn query_system<'tcx>(
local_providers,
extern_providers,
encode_query_results: encode_all_query_results,
try_mark_green: try_mark_green,
try_mark_green,
},
jobs: AtomicU64::new(1),
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
let label_span = ident.span.shrink_to_hi();
let mut spans = MultiSpan::from_span(label_span);
spans.push_span_label(label_span, "put a macro name here");
err.subdiagnostic(MaybeMissingMacroRulesName { spans: spans });
err.subdiagnostic(MaybeMissingMacroRulesName { spans });
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ pub fn transform_instance<'tcx>(
.drop_trait()
.unwrap_or_else(|| bug!("typeid_for_instance: couldn't get drop_trait lang item"));
let predicate = ty::ExistentialPredicate::Trait(ty::ExistentialTraitRef {
def_id: def_id,
def_id,
args: List::empty(),
});
let predicates = tcx.mk_poly_existential_predicates(&[ty::Binder::dummy(predicate)]);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_smir/src/rustc_smir/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ pub(super) fn allocation_filter<'tcx>(
));
}
Allocation {
bytes: bytes,
bytes,
provenance: ProvenanceMap { ptrs },
align: alloc.align.bytes(),
mutability: alloc.mutability.stable(tables),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/traits/auto_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
let reported =
tcx.dcx().emit_err(UnableToConstructConstantValue {
span: tcx.def_span(unevaluated.def),
unevaluated: unevaluated,
unevaluated,
});
Err(ErrorHandled::Reported(reported.into(), tcx.def_span(unevaluated.def)))
}
Expand Down

0 comments on commit a5cf7bb

Please sign in to comment.