Skip to content

Commit 72dfbe2

Browse files
authored
Merge pull request #325 from baszalmstra/bump/rust_1_51_0
bump: rust 1.51.0
2 parents ba3bdd8 + 308e494 commit 72dfbe2

39 files changed

Lines changed: 163 additions & 164 deletions

File tree

crates/mun/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ pub enum ExitStatus {
1414
Error,
1515
}
1616

17-
impl Into<ExitStatus> for bool {
18-
fn into(self) -> ExitStatus {
19-
if self {
17+
impl From<bool> for ExitStatus {
18+
fn from(value: bool) -> Self {
19+
if value {
2020
ExitStatus::Success
2121
} else {
2222
ExitStatus::Error

crates/mun_abi/ffi

crates/mun_abi/src/struct_info.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub struct StructInfo {
2626
pub enum StructMemoryKind {
2727
/// A garbage collected struct is allocated on the heap and uses reference semantics when passed
2828
/// around.
29-
GC,
29+
Gc,
3030

3131
/// A value struct is allocated on the stack and uses value semantics when passed around.
3232
///
@@ -99,14 +99,14 @@ impl StructInfo {
9999

100100
impl Default for StructMemoryKind {
101101
fn default() -> Self {
102-
StructMemoryKind::GC
102+
StructMemoryKind::Gc
103103
}
104104
}
105105

106106
impl From<StructMemoryKind> for u64 {
107107
fn from(kind: StructMemoryKind) -> Self {
108108
match kind {
109-
StructMemoryKind::GC => 0,
109+
StructMemoryKind::Gc => 0,
110110
StructMemoryKind::Value => 1,
111111
}
112112
}
@@ -155,7 +155,7 @@ mod tests {
155155

156156
#[test]
157157
fn test_struct_info_memory_kind_gc() {
158-
let struct_memory_kind = StructMemoryKind::GC;
158+
let struct_memory_kind = StructMemoryKind::Gc;
159159
let struct_info = fake_struct_info(&[], &[], &[], struct_memory_kind.clone());
160160

161161
assert_eq!(struct_info.memory_kind, struct_memory_kind);

crates/mun_codegen/src/assembly.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,21 +109,21 @@ pub(crate) fn build_target_assembly(
109109
Arc::new(TargetAssembly { file })
110110
}
111111

112-
/// An `AssemblyIR` is a reference to an IR file stored on disk.
112+
/// An `AssemblyIr` is a reference to an IR file stored on disk.
113113
#[derive(Debug)]
114-
pub struct AssemblyIR {
114+
pub struct AssemblyIr {
115115
file: NamedTempFile,
116116
}
117117

118-
impl PartialEq for AssemblyIR {
118+
impl PartialEq for AssemblyIr {
119119
fn eq(&self, other: &Self) -> bool {
120120
self.path().eq(other.path())
121121
}
122122
}
123123

124-
impl Eq for AssemblyIR {}
124+
impl Eq for AssemblyIr {}
125125

126-
impl AssemblyIR {
126+
impl AssemblyIr {
127127
pub const EXTENSION: &'static str = "ll";
128128

129129
/// Returns the current location of the IR File.
@@ -141,7 +141,7 @@ impl AssemblyIR {
141141
pub(crate) fn build_assembly_ir(
142142
db: &dyn CodeGenDatabase,
143143
module_group: ModuleGroupId,
144-
) -> Arc<AssemblyIR> {
144+
) -> Arc<AssemblyIr> {
145145
// Setup the code generation context
146146
let inkwell_context = Context::create();
147147
let code_gen_context = CodeGenContext::new(&inkwell_context, db);
@@ -157,5 +157,5 @@ pub(crate) fn build_assembly_ir(
157157
.write_ir_to_file(file.path())
158158
.expect("could not write to temp file");
159159

160-
Arc::new(AssemblyIR { file })
160+
Arc::new(AssemblyIr { file })
161161
}

crates/mun_codegen/src/db.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::{AssemblyIR, ModuleGroupId, ModulePartition, TargetAssembly};
1+
use crate::{AssemblyIr, ModuleGroupId, ModulePartition, TargetAssembly};
22
use by_address::ByAddress;
33
use inkwell::targets::{CodeModel, InitializationConfig, RelocMode, Target, TargetTriple};
44
use std::sync::Arc;
@@ -25,7 +25,7 @@ pub trait CodeGenDatabase: hir::HirDatabase + hir::Upcast<dyn hir::HirDatabase>
2525

2626
/// Returns a file containing the IR for the specified module.
2727
#[salsa::invoke(crate::assembly::build_assembly_ir)]
28-
fn assembly_ir(&self, module_group: ModuleGroupId) -> Arc<AssemblyIR>;
28+
fn assembly_ir(&self, module_group: ModuleGroupId) -> Arc<AssemblyIr>;
2929

3030
/// Returns a fully linked shared object for the specified module.
3131
#[salsa::invoke(crate::assembly::build_target_assembly)]

crates/mun_codegen/src/ir/body.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ impl<'db, 'ink, 't> BodyIrGenerator<'db, 'ink, 't> {
357357

358358
match hir_struct.data(self.db.upcast()).memory_kind {
359359
hir::StructMemoryKind::Value => struct_lit.into(),
360-
hir::StructMemoryKind::GC => {
360+
hir::StructMemoryKind::Gc => {
361361
// TODO: Root memory in GC
362362
self.gen_struct_alloc_on_heap(hir_struct, struct_lit)
363363
}
@@ -594,7 +594,7 @@ impl<'db, 'ink, 't> BodyIrGenerator<'db, 'ink, 't> {
594594
..
595595
}) = ty
596596
{
597-
if s.data(self.db.upcast()).memory_kind == hir::StructMemoryKind::GC {
597+
if s.data(self.db.upcast()).memory_kind == hir::StructMemoryKind::Gc {
598598
return deref_heap_value(&self.builder, value);
599599
}
600600
}

crates/mun_codegen/src/ir/file.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::module_group::ModuleGroup;
33
use crate::{
44
code_gen::CodeGenContext,
55
ir::body::BodyIrGenerator,
6-
ir::file_group::FileGroupIR,
6+
ir::file_group::FileGroupIr,
77
ir::{function, type_table::TypeTable},
88
value::Global,
99
};
@@ -13,7 +13,7 @@ use std::collections::{BTreeMap, HashMap, HashSet};
1313

1414
/// The IR generated for a single source file.
1515
#[derive(Debug, Clone, Eq, PartialEq)]
16-
pub struct FileIR<'ink> {
16+
pub struct FileIr<'ink> {
1717
/// The LLVM module that contains the IR
1818
pub llvm_module: Module<'ink>,
1919
/// The `hir::Function`s that constitute the file's API.
@@ -23,9 +23,9 @@ pub struct FileIR<'ink> {
2323
/// Generates IR for the specified file.
2424
pub(crate) fn gen_file_ir<'db, 'ink>(
2525
code_gen: &CodeGenContext<'db, 'ink>,
26-
group_ir: &FileGroupIR<'ink>,
26+
group_ir: &FileGroupIr<'ink>,
2727
module_group: &ModuleGroup,
28-
) -> FileIR<'ink> {
28+
) -> FileIr<'ink> {
2929
let llvm_module = code_gen.context.create_module(&module_group.name);
3030

3131
let hir_types = &code_gen.hir_types;
@@ -124,5 +124,5 @@ pub(crate) fn gen_file_ir<'db, 'ink>(
124124
.filter(|&f| module_group.should_export_fn(code_gen.db, f))
125125
.collect();
126126

127-
FileIR { llvm_module, api }
127+
FileIr { llvm_module, api }
128128
}

crates/mun_codegen/src/ir/file_group.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::collections::BTreeMap;
1616
/// The IR generated for a group of files. It is used to generate IR for all of the group's files
1717
/// and the resulting `Assembly`'s symbols.
1818
#[derive(Debug, PartialEq, Eq)]
19-
pub struct FileGroupIR<'ink> {
19+
pub struct FileGroupIr<'ink> {
2020
/// The LLVM module that contains the IR
2121
pub(crate) llvm_module: Module<'ink>,
2222
/// The dispatch table
@@ -33,7 +33,7 @@ pub struct FileGroupIR<'ink> {
3333
pub(crate) fn gen_file_group_ir<'db, 'ink>(
3434
code_gen: &CodeGenContext<'db, 'ink>,
3535
module_group: &ModuleGroup,
36-
) -> FileGroupIR<'ink> {
36+
) -> FileGroupIr<'ink> {
3737
let llvm_module = code_gen.context.create_module("group_name");
3838

3939
// Use a `BTreeMap` to guarantee deterministically ordered output.
@@ -153,7 +153,7 @@ pub(crate) fn gen_file_group_ir<'db, 'ink>(
153153
None
154154
};
155155

156-
FileGroupIR {
156+
FileGroupIr {
157157
llvm_module,
158158
dispatch_table,
159159
type_table,

crates/mun_codegen/src/ir/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl<'db, 'ink> HirTypeCache<'db, 'ink> {
9494
pub fn get_struct_reference_type(&self, struct_ty: hir::Struct) -> BasicTypeEnum<'ink> {
9595
let ir_ty = self.get_struct_type(struct_ty);
9696
match struct_ty.data(self.db.upcast()).memory_kind {
97-
hir::StructMemoryKind::GC => {
97+
hir::StructMemoryKind::Gc => {
9898
// GC values are pointers to pointers
9999
// struct Foo {}
100100
// Foo**

crates/mun_codegen/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pub use inkwell::{builder::Builder, context::Context, module::Module, OptimizationLevel};
22

33
pub use crate::{
4-
assembly::{AssemblyIR, TargetAssembly},
4+
assembly::{AssemblyIr, TargetAssembly},
55
code_gen::AssemblyBuilder,
66
db::{CodeGenDatabase, CodeGenDatabaseStorage},
77
module_group::ModuleGroup,

0 commit comments

Comments
 (0)