Skip to content

Commit

Permalink
Improved formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
ReubenHillyard committed Sep 27, 2023
1 parent ecd4cc6 commit 29fb779
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/commands/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ pub fn test_main() {
emit_llvm: None,
},
}
.run()
.unwrap();
.run()
.unwrap();

let program_output = Command::new(output).output().expect("program not found");
assert_eq!(program_output.status.code(), Some(27), "program failed");
Expand Down
2 changes: 1 addition & 1 deletion src/ir_gen/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl<'ctx> CompilerWithBuilder<'ctx, '_> {
ptr
}
}
.as_ptr_to(tag::Pi);
.as_ptr_to(tag::Pi);
let dest_captures_ptr = self.build_store_pi_static_part(
dest_pi_ptr,
raw_function,
Expand Down
34 changes: 17 additions & 17 deletions src/ir_gen/initialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ impl<'ctx> Compiler<'ctx> {
/// [`tag::CapturesCloneFn`].
/// * Destroy function delegates to a field [`tag::CapturesDestroyFn`].
fn add_delegating_builtin<B: BuiltinType>(&mut self, b: B)
where
B: Structure,
tag::TotalSize: FieldOf<B, Ty=tag::Usize>,
tag::CapturesCloneFn: FieldOf<B, Ty=tag::CapturesCloneFn>,
tag::CapturesDestroyFn: FieldOf<B, Ty=tag::CapturesDestroyFn>,
tag::Captures: FieldOf<B, Ty=tag::Captures>,
where
B: Structure,
tag::TotalSize: FieldOf<B, Ty = tag::Usize>,
tag::CapturesCloneFn: FieldOf<B, Ty = tag::CapturesCloneFn>,
tag::CapturesDestroyFn: FieldOf<B, Ty = tag::CapturesDestroyFn>,
tag::Captures: FieldOf<B, Ty = tag::Captures>,
{
self.add_delegating_size_fn(b);
self.add_delegating_clone_fn(b);
Expand All @@ -45,9 +45,9 @@ impl<'ctx> Compiler<'ctx> {
/// Requires `b` is the tag of a built-in type whose size function delegates to a field
/// [`tag::TotalSize`].
fn add_delegating_size_fn<B: BuiltinType>(&mut self, b: B)
where
B: Structure,
tag::TotalSize: FieldOf<B, Ty=tag::Usize>,
where
B: Structure,
tag::TotalSize: FieldOf<B, Ty = tag::Usize>,
{
let mut function = self.add_function(tag::SizeFn, B::get_name_of(tag::SizeFn));
let arg_ptr = function.args.arg_ptr.as_ptr_to(b);
Expand All @@ -62,10 +62,10 @@ impl<'ctx> Compiler<'ctx> {
/// Requires `b` is the tag of a built-in type whose clone function copies the static part and
/// then delegates to a field [`tag::CapturesCloneFn`].
fn add_delegating_clone_fn<B: BuiltinType>(&mut self, b: B)
where
B: Structure,
tag::CapturesCloneFn: FieldOf<B, Ty=tag::CapturesCloneFn>,
tag::Captures: FieldOf<B, Ty=tag::Captures>,
where
B: Structure,
tag::CapturesCloneFn: FieldOf<B, Ty = tag::CapturesCloneFn>,
tag::Captures: FieldOf<B, Ty = tag::Captures>,
{
let mut function = self.add_function(tag::CloneFn, B::get_name_of(tag::CloneFn));
let src_ptr = function.args.src_ptr.as_ptr_to(b);
Expand Down Expand Up @@ -97,10 +97,10 @@ impl<'ctx> Compiler<'ctx> {
/// Requires `b` is the tag of a built-in type whose destroy function delegates to a field
/// [`tag::CapturesDestroyFn`].
fn add_delegating_destroy_fn<B: BuiltinType>(&mut self, b: B)
where
B: Structure,
tag::CapturesDestroyFn: FieldOf<B, Ty=tag::CapturesDestroyFn>,
tag::Captures: FieldOf<B, Ty=tag::Captures>,
where
B: Structure,
tag::CapturesDestroyFn: FieldOf<B, Ty = tag::CapturesDestroyFn>,
tag::Captures: FieldOf<B, Ty = tag::Captures>,
{
let mut function = self.add_function(tag::DestroyFn, B::get_name_of(tag::DestroyFn));
let arg_ptr = function.args.arg_ptr.as_ptr_to(b);
Expand Down
2 changes: 1 addition & 1 deletion src/ir_gen/values/captures/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl CaptureOffsetIndexable for Partial {
type Offset = Read;
}

pub trait CaptureIndexable: CaptureOffsetIndexable<Offset=Read> {
pub trait CaptureIndexable: CaptureOffsetIndexable<Offset = Read> {
type Elem: Flow;
}

Expand Down
4 changes: 2 additions & 2 deletions src/ir_gen/values/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ impl<'ctx> Compiler<'ctx> {
_b: B,
f: F,
) -> FnValue<'ctx, F>
where
B: HasAssociatedFn<F>,
where
B: HasAssociatedFn<F>,
{
self.get_function_ptr(B::get_name_of(f))
.unwrap()
Expand Down
8 changes: 4 additions & 4 deletions src/ir_gen/values/members.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ impl<'ctx> CompilerWithBuilder<'ctx, '_> {
&mut self,
ptr: PtrValue<'ctx, F, S>,
) -> PtrValue<'ctx, F, tag::Captures>
where
tag::Captures: FieldOf<S, Ty=tag::Captures>,
where
tag::Captures: FieldOf<S, Ty = tag::Captures>,
{
self.build_get_field_ptr(ptr, tag::Captures)
}

/// Builds a load of a given field of a given pointer to a structure.
pub fn build_load_field<S: Structure, FieldTy: LoadStore, Field: FieldOf<S, Ty=FieldTy>>(
pub fn build_load_field<S: Structure, FieldTy: LoadStore, Field: FieldOf<S, Ty = FieldTy>>(
&mut self,
ptr: PtrValue<'ctx, Read, S>,
field: Field,
Expand All @@ -63,7 +63,7 @@ impl<'ctx> CompilerWithBuilder<'ctx, '_> {
/// Builds a store of a given field of a given pointer to a structure.
///
/// Requires the specified field is only stored to by this one call.
pub fn build_store_field<S: Structure, FieldTy: LoadStore, Field: FieldOf<S, Ty=FieldTy>>(
pub fn build_store_field<S: Structure, FieldTy: LoadStore, Field: FieldOf<S, Ty = FieldTy>>(
&mut self,
ptr: PtrValue<'ctx, Write, S>,
field: Field,
Expand Down
5 changes: 3 additions & 2 deletions src/ir_gen/values/tags/builtin_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ pub trait HasAssociatedFn<F: Function>: Object {
///
/// Built-in types must have associated special members: size, clone, and destroy functions.
pub trait BuiltinType:
HasAssociatedFn<tag::SizeFn> + HasAssociatedFn<tag::CloneFn> + HasAssociatedFn<tag::DestroyFn>
{}
HasAssociatedFn<tag::SizeFn> + HasAssociatedFn<tag::CloneFn> + HasAssociatedFn<tag::DestroyFn>
{
}

impl HasAssociatedFn<tag::SizeFn> for tag::Universe {
const NAMED: &'static str = "universe_size";
Expand Down
4 changes: 2 additions & 2 deletions src/typing/unification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ mod detail {
neu = func;
match arg.force(defs) {
Value::Neutral(Neutral::Principal(Principal::Variable(
VVariable::Local(level),
))) => args.push(level),
VVariable::Local(level),
))) => args.push(level),
arg => return Err(TypeError::NonLevelInSpine(arg)),
}
}
Expand Down

0 comments on commit 29fb779

Please sign in to comment.