1
Fork 0

Rollup merge of #137305 - nnethercote:rustc_middle-2, r=lcnr

Tweaks in and around `rustc_middle`

A bunch of tiny improvements I found while working on bigger things.

r? ```@lcnr```
This commit is contained in:
Matthias Krüger 2025-02-21 12:45:25 +01:00 committed by GitHub
commit 1f6c75e682
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 59 additions and 91 deletions

View file

@ -79,7 +79,7 @@ impl<'tcx> ConstMutationChecker<'_, 'tcx> {
let lint_root = self.body.source_scopes[source_info.scope]
.local_data
.as_ref()
.assert_crate_local()
.unwrap_crate_local()
.lint_root;
Some((lint_root, source_info.span, self.tcx.def_span(const_item)))

View file

@ -945,7 +945,7 @@ fn compute_layout<'tcx>(
let decl = &body.local_decls[local];
debug!(?decl);
// Do not `assert_crate_local` here, as post-borrowck cleanup may have already cleared
// Do not `unwrap_crate_local` here, as post-borrowck cleanup may have already cleared
// the information. This is alright, since `ignore_for_traits` is only relevant when
// this code runs on pre-cleanup MIR, and `ignore_for_traits = false` is the safer
// default.

View file

@ -85,7 +85,7 @@ fn has_ffi_unwind_calls(tcx: TyCtxt<'_>, local_def_id: LocalDefId) -> bool {
let lint_root = body.source_scopes[terminator.source_info.scope]
.local_data
.as_ref()
.assert_crate_local()
.unwrap_crate_local()
.lint_root;
let span = terminator.source_info.span;

View file

@ -154,7 +154,7 @@ impl<'tcx> FunctionItemRefChecker<'_, 'tcx> {
let lint_root = self.body.source_scopes[source_info.scope]
.local_data
.as_ref()
.assert_crate_local()
.unwrap_crate_local()
.lint_root;
// FIXME: use existing printing routines to print the function signature
let fn_sig = self.tcx.fn_sig(fn_id).instantiate(self.tcx, fn_args);

View file

@ -158,7 +158,7 @@ impl<'tcx> MirPatch<'tcx> {
let index = self.next_local;
self.next_local += 1;
let mut new_decl = LocalDecl::new(ty, span);
**new_decl.local_info.as_mut().assert_crate_local() = local_info;
**new_decl.local_info.as_mut().unwrap_crate_local() = local_info;
self.new_locals.push(new_decl);
Local::new(index)
}