Skip to content

Commit 37370d5

Browse files
committed
cleanup: fmt
1 parent e2992c7 commit 37370d5

File tree

7 files changed

+49
-30
lines changed

7 files changed

+49
-30
lines changed

compiler/rustc_smir/src/stable_mir/unstable/convert/internal.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use rustc_smir::Tables;
1010
use rustc_span::Symbol;
1111
use stable_mir::abi::Layout;
1212
use stable_mir::compiler_interface::BridgeTys;
13-
use stable_mir::unstable::{RustcInternal, InternalCx};
1413
use stable_mir::mir::alloc::AllocId;
1514
use stable_mir::mir::mono::{Instance, MonoItem, StaticDef};
1615
use stable_mir::mir::{BinOp, Mutability, Place, ProjectionElem, RawPtrKind, Safety, UnOp};
@@ -20,11 +19,11 @@ use stable_mir::ty::{
2019
GenericArgKind, GenericArgs, IntTy, MirConst, Movability, Pattern, Region, RigidTy, Span,
2120
TermKind, TraitRef, Ty, TyConst, UintTy, VariantDef, VariantIdx,
2221
};
22+
use stable_mir::unstable::{InternalCx, RustcInternal};
2323
use stable_mir::{CrateItem, CrateNum, DefId, IndexedVal};
2424

2525
use crate::{rustc_smir, stable_mir};
2626

27-
2827
impl RustcInternal for CrateItem {
2928
type T<'tcx> = rustc_span::def_id::DefId;
3029
fn internal<'tcx>(
@@ -447,9 +446,10 @@ impl RustcInternal for BoundVariableKind {
447446
match self {
448447
BoundVariableKind::Ty(kind) => rustc_ty::BoundVariableKind::Ty(match kind {
449448
BoundTyKind::Anon => rustc_ty::BoundTyKind::Anon,
450-
BoundTyKind::Param(def, symbol) => {
451-
rustc_ty::BoundTyKind::Param(def.0.internal(tables, tcx), Symbol::intern(symbol))
452-
}
449+
BoundTyKind::Param(def, symbol) => rustc_ty::BoundTyKind::Param(
450+
def.0.internal(tables, tcx),
451+
Symbol::intern(symbol),
452+
),
453453
}),
454454
BoundVariableKind::Region(kind) => rustc_ty::BoundVariableKind::Region(match kind {
455455
BoundRegionKind::BrAnon => rustc_ty::BoundRegionKind::Anon,
@@ -542,7 +542,10 @@ impl RustcInternal for ExistentialTraitRef {
542542
tcx: impl InternalCx<'tcx>,
543543
) -> Self::T<'tcx> {
544544
use rustc_smir::context::SmirExistentialTraitRef;
545-
tcx.new_from_args(self.def_id.0.internal(tables, tcx), self.generic_args.internal(tables, tcx))
545+
tcx.new_from_args(
546+
self.def_id.0.internal(tables, tcx),
547+
self.generic_args.internal(tables, tcx),
548+
)
546549
}
547550
}
548551

compiler/rustc_smir/src/stable_mir/unstable/convert/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,12 @@
88
99
use std::ops::RangeInclusive;
1010

11-
1211
use rustc_smir::Tables;
1312
use rustc_smir::context::SmirCtxt;
14-
1513
use stable_mir::compiler_interface::BridgeTys;
1614

17-
use crate::{rustc_smir, stable_mir};
18-
1915
use super::Stable;
20-
16+
use crate::{rustc_smir, stable_mir};
2117

2218
mod internal;
2319
mod stable;

compiler/rustc_smir/src/stable_mir/unstable/convert/stable/abi.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ use stable_mir::abi::{
1313
WrappingRange,
1414
};
1515
use stable_mir::compiler_interface::BridgeTys;
16-
use stable_mir::unstable::Stable;
1716
use stable_mir::target::MachineSize as Size;
1817
use stable_mir::ty::{Align, VariantIdx};
18+
use stable_mir::unstable::Stable;
1919
use stable_mir::{IndexedVal, opaque};
2020

2121
use crate::{rustc_smir, stable_mir};
@@ -211,7 +211,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::Variants<rustc_abi::FieldIdx, rustc_abi::
211211
VariantsShape::Multiple {
212212
tag: tag.stable(tables, cx),
213213
tag_encoding: tag_encoding.stable(tables, cx),
214-
tag_field: tag_field.stable(tables,cx),
214+
tag_field: tag_field.stable(tables, cx),
215215
variants: variants.iter().as_slice().stable(tables, cx),
216216
}
217217
}

compiler/rustc_smir/src/stable_mir/unstable/convert/stable/mir.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ use rustc_smir::Tables;
66
use rustc_smir::bridge::SmirError;
77
use rustc_smir::context::SmirCtxt;
88
use stable_mir::compiler_interface::BridgeTys;
9-
use stable_mir::unstable::Stable;
109
use stable_mir::mir::alloc::GlobalAlloc;
1110
use stable_mir::mir::{ConstOperand, Statement, UserTypeProjection, VarDebugInfoFragment};
1211
use stable_mir::ty::{Allocation, ConstantKind, MirConst};
12+
use stable_mir::unstable::Stable;
1313
use stable_mir::{Error, alloc, opaque};
1414

1515
use crate::{rustc_smir, stable_mir};
@@ -848,7 +848,11 @@ impl<'tcx> Stable<'tcx> for mir::interpret::Allocation {
848848

849849
impl<'tcx> Stable<'tcx> for mir::interpret::AllocId {
850850
type T = stable_mir::mir::alloc::AllocId;
851-
fn stable<'cx>(&self, tables: &mut Tables<'cx, BridgeTys>, _: &SmirCtxt<'cx, BridgeTys>) -> Self::T {
851+
fn stable<'cx>(
852+
&self,
853+
tables: &mut Tables<'cx, BridgeTys>,
854+
_: &SmirCtxt<'cx, BridgeTys>,
855+
) -> Self::T {
852856
tables.create_alloc_id(*self)
853857
}
854858
}

compiler/rustc_smir/src/stable_mir/unstable/convert/stable/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ impl<'tcx> Stable<'tcx> for rustc_span::Symbol {
8686
impl<'tcx> Stable<'tcx> for rustc_span::Span {
8787
type T = stable_mir::ty::Span;
8888

89-
fn stable<'cx>(&self, tables: &mut Tables<'cx, BridgeTys>, _: &SmirCtxt<'cx, BridgeTys>) -> Self::T {
89+
fn stable<'cx>(
90+
&self,
91+
tables: &mut Tables<'cx, BridgeTys>,
92+
_: &SmirCtxt<'cx, BridgeTys>,
93+
) -> Self::T {
9094
tables.create_span(*self)
9195
}
9296
}

compiler/rustc_smir/src/stable_mir/unstable/convert/stable/ty.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ use rustc_smir::Tables;
66
use rustc_smir::context::SmirCtxt;
77
use stable_mir::alloc;
88
use stable_mir::compiler_interface::BridgeTys;
9-
use stable_mir::unstable::Stable;
109
use stable_mir::ty::{
1110
AdtKind, FloatTy, GenericArgs, GenericParamDef, IntTy, Region, RigidTy, TyKind, UintTy,
1211
};
12+
use stable_mir::unstable::Stable;
1313

1414
use crate::{rustc_smir, stable_mir};
1515

@@ -290,7 +290,11 @@ impl<'tcx> Stable<'tcx> for ty::FnSig<'tcx> {
290290
impl<'tcx> Stable<'tcx> for ty::BoundTyKind {
291291
type T = stable_mir::ty::BoundTyKind;
292292

293-
fn stable<'cx>(&self, tables: &mut Tables<'cx, BridgeTys>, _: &SmirCtxt<'cx, BridgeTys>) -> Self::T {
293+
fn stable<'cx>(
294+
&self,
295+
tables: &mut Tables<'cx, BridgeTys>,
296+
_: &SmirCtxt<'cx, BridgeTys>,
297+
) -> Self::T {
294298
use stable_mir::ty::BoundTyKind;
295299

296300
match self {
@@ -305,7 +309,11 @@ impl<'tcx> Stable<'tcx> for ty::BoundTyKind {
305309
impl<'tcx> Stable<'tcx> for ty::BoundRegionKind {
306310
type T = stable_mir::ty::BoundRegionKind;
307311

308-
fn stable<'cx>(&self, tables: &mut Tables<'cx, BridgeTys>, _: &SmirCtxt<'cx, BridgeTys>) -> Self::T {
312+
fn stable<'cx>(
313+
&self,
314+
tables: &mut Tables<'cx, BridgeTys>,
315+
_: &SmirCtxt<'cx, BridgeTys>,
316+
) -> Self::T {
309317
use stable_mir::ty::BoundRegionKind;
310318

311319
match self {
@@ -1108,7 +1116,11 @@ impl<'tcx> Stable<'tcx> for ty::AssocItem {
11081116
impl<'tcx> Stable<'tcx> for ty::ImplTraitInTraitData {
11091117
type T = stable_mir::ty::ImplTraitInTraitData;
11101118

1111-
fn stable<'cx>(&self, tables: &mut Tables<'cx, BridgeTys>, _: &SmirCtxt<'cx, BridgeTys>) -> Self::T {
1119+
fn stable<'cx>(
1120+
&self,
1121+
tables: &mut Tables<'cx, BridgeTys>,
1122+
_: &SmirCtxt<'cx, BridgeTys>,
1123+
) -> Self::T {
11121124
use stable_mir::ty::ImplTraitInTraitData;
11131125
match self {
11141126
ty::ImplTraitInTraitData::Trait { fn_def_id, opaque_def_id } => {

compiler/rustc_smir/src/stable_mir/unstable/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
//! Module that collects the things that have no stability guarantees.
22
//!
3-
//! We want to keep StableMIR definitions and logic separate from
4-
//! any sort of conversion and usage of internal rustc code. So we
3+
//! We want to keep StableMIR definitions and logic separate from
4+
//! any sort of conversion and usage of internal rustc code. So we
55
//! restrict the usage of internal items to be inside this module.
66
77
use rustc_hir::def::DefKind;
88
use rustc_middle::ty::{List, Ty, TyCtxt};
99
use rustc_middle::{mir, ty};
1010
use rustc_smir::Tables;
11-
use rustc_smir::context::{SmirCtxt, SmirExistentialProjection, SmirExistentialTraitRef, SmirTraitRef};
12-
11+
use rustc_smir::context::{
12+
SmirCtxt, SmirExistentialProjection, SmirExistentialTraitRef, SmirTraitRef,
13+
};
1314
use stable_mir::{CtorKind, ItemKind};
1415

15-
use crate::{rustc_smir, stable_mir};
16-
1716
use super::compiler_interface::BridgeTys;
17+
use crate::{rustc_smir, stable_mir};
1818

1919
pub(crate) mod convert;
2020

@@ -84,15 +84,15 @@ impl<'tcx> InternalCx<'tcx> for TyCtxt<'tcx> {
8484
fn lifetimes_re_erased(self) -> ty::Region<'tcx> {
8585
self.lifetimes.re_erased
8686
}
87-
87+
8888
fn mk_bound_variable_kinds_from_iter<I, T>(self, iter: I) -> T::Output
8989
where
9090
I: Iterator<Item = T>,
9191
T: ty::CollectAndApply<ty::BoundVariableKind, &'tcx List<ty::BoundVariableKind>>,
9292
{
9393
TyCtxt::mk_bound_variable_kinds_from_iter(self, iter)
9494
}
95-
95+
9696
fn mk_place_elems(self, v: &[mir::PlaceElem<'tcx>]) -> &'tcx List<mir::PlaceElem<'tcx>> {
9797
TyCtxt::mk_place_elems(self, v)
9898
}
@@ -103,10 +103,10 @@ impl<'tcx> InternalCx<'tcx> for TyCtxt<'tcx> {
103103
}
104104

105105
/// Trait that defines the methods that are fine to call from [`RustcInternal`].
106-
///
106+
///
107107
/// This trait is only for [`RustcInternal`]. Any other other access to rustc's internals
108108
/// should go through [`crate::rustc_smir::context::SmirCtxt`].
109-
pub trait InternalCx<'tcx> : Copy + Clone {
109+
pub trait InternalCx<'tcx>: Copy + Clone {
110110
fn tcx(self) -> TyCtxt<'tcx>;
111111

112112
fn lift<T: ty::Lift<TyCtxt<'tcx>>>(self, value: T) -> Option<T::Lifted>;

0 commit comments

Comments
 (0)