Skip to content

Commit 90e88f3

Browse files
authored
build: upgrade to rust v1.86.0 (#584)
1 parent d43f596 commit 90e88f3

File tree

57 files changed

+174
-348
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+174
-348
lines changed

Cargo.lock

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/mun_abi/src/type_info.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ impl<'a> TypeDefinition<'a> {
107107

108108
/// Returns the size of the type in bytes
109109
pub fn size_in_bytes(&self) -> usize {
110-
((self.size_in_bits + 7) / 8)
110+
self.size_in_bits
111+
.div_ceil(8)
111112
.try_into()
112113
.expect("cannot covert size in bytes to platform size")
113114
}

crates/mun_codegen/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ apple-codesign = { workspace = true }
1919
array-init = { workspace = true }
2020
by_address = { workspace = true }
2121
bytemuck = { workspace = true }
22-
mun_db = { version = "0.6.0-dev", path = "../mun_db" }
2322
mun_hir = { version = "0.6.0-dev", path = "../mun_hir" }
2423
mun_hir_input = { version = "0.6.0-dev", path = "../mun_hir_input" }
2524
inkwell = { workspace = true, features = ["llvm14-0", "target-x86", "target-aarch64"] }

crates/mun_codegen/src/code_gen/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ impl<'db, 'ink> CodeGenContext<'db, 'ink> {
3232
Self {
3333
context,
3434
rust_types: RefCell::new(HashMap::default()),
35-
hir_types: HirTypeCache::new(context, db.upcast(), target_machine.get_target_data()),
35+
hir_types: HirTypeCache::new(context, db, target_machine.get_target_data()),
3636
optimization_level: db.optimization_level(),
3737
target_machine,
38-
db: db.upcast(),
38+
db,
3939
}
4040
}
4141

crates/mun_codegen/src/code_gen/symbols/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ fn gen_struct_info<'ink>(
209209
.len()
210210
.try_into()
211211
.expect("could not convert num_fields to smaller bit size"),
212-
memory_kind: hir_struct.data(db.upcast()).memory_kind,
212+
memory_kind: hir_struct.data(db).memory_kind,
213213
}
214214
}
215215

crates/mun_codegen/src/db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::{AssemblyIr, ModuleGroupId, ModulePartition, TargetAssembly};
1414
/// generation cache is pretty granular there is still a benefit to not having
1515
/// to recompile assemblies if not required.
1616
#[salsa::query_group(CodeGenDatabaseStorage)]
17-
pub trait CodeGenDatabase: mun_hir::HirDatabase + mun_db::Upcast<dyn mun_hir::HirDatabase> {
17+
pub trait CodeGenDatabase: mun_hir::HirDatabase {
1818
/// Set the optimization level used to generate assemblies
1919
#[salsa::input]
2020
fn optimization_level(&self) -> inkwell::OptimizationLevel;

crates/mun_codegen/src/ir/body.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ impl<'db, 'ink, 't> BodyIrGenerator<'db, 'ink, 't> {
168168
.map(|(idx, ty)| {
169169
let param = self.fn_value.get_nth_param(idx as u32).unwrap();
170170
if let Some(s) = ty.as_struct() {
171-
if s.data(self.db.upcast()).memory_kind == abi::StructMemoryKind::Value {
171+
if s.data(self.db).memory_kind == abi::StructMemoryKind::Value {
172172
deref_heap_value(&self.builder, param)
173173
} else {
174174
param
@@ -199,9 +199,7 @@ impl<'db, 'ink, 't> BodyIrGenerator<'db, 'ink, 't> {
199199
self.builder.build_return(None);
200200
} else if let Some(value) = ret_value {
201201
let ret_value = if let Some(hir_struct) = fn_ret_type.as_struct() {
202-
if hir_struct.data(self.db.upcast()).memory_kind
203-
== mun_hir::StructMemoryKind::Value
204-
{
202+
if hir_struct.data(self.db).memory_kind == mun_hir::StructMemoryKind::Value {
205203
self.gen_struct_alloc_on_heap(hir_struct, value.into_struct_value())
206204
} else {
207205
value
@@ -224,8 +222,7 @@ impl<'db, 'ink, 't> BodyIrGenerator<'db, 'ink, 't> {
224222
tail,
225223
} => self.gen_block(expr, statements, *tail),
226224
Expr::Path(ref p) => {
227-
let resolver =
228-
mun_hir::resolver_for_expr(self.db.upcast(), self.body.owner(), expr);
225+
let resolver = mun_hir::resolver_for_expr(self.db, self.body.owner(), expr);
229226
Some(self.gen_path_expr(p, expr, &resolver))
230227
}
231228
Expr::Literal(lit) => Some(self.gen_literal(lit, expr)),
@@ -372,7 +369,7 @@ impl<'db, 'ink, 't> BodyIrGenerator<'db, 'ink, 't> {
372369
}
373370
let struct_lit = value.into_struct_value();
374371

375-
match hir_struct.data(self.db.upcast()).memory_kind {
372+
match hir_struct.data(self.db).memory_kind {
376373
mun_hir::StructMemoryKind::Value => struct_lit.into(),
377374
mun_hir::StructMemoryKind::Gc => {
378375
// TODO: Root memory in GC
@@ -573,7 +570,7 @@ impl<'db, 'ink, 't> BodyIrGenerator<'db, 'ink, 't> {
573570
resolver: &Resolver,
574571
) -> inkwell::values::BasicValueEnum<'ink> {
575572
match resolver
576-
.resolve_path_as_value_fully(self.db.upcast(), path)
573+
.resolve_path_as_value_fully(self.db, path)
577574
.expect("unknown path")
578575
.0
579576
{
@@ -603,7 +600,7 @@ impl<'db, 'ink, 't> BodyIrGenerator<'db, 'ink, 't> {
603600
) -> BasicValueEnum<'ink> {
604601
let ty = &self.infer[expr];
605602
if let Some(s) = ty.as_struct() {
606-
if s.data(self.db.upcast()).memory_kind == mun_hir::StructMemoryKind::Gc {
603+
if s.data(self.db).memory_kind == mun_hir::StructMemoryKind::Gc {
607604
return deref_heap_value(&self.builder, value);
608605
}
609606
}
@@ -618,7 +615,7 @@ impl<'db, 'ink, 't> BodyIrGenerator<'db, 'ink, 't> {
618615
resolver: &Resolver,
619616
) -> inkwell::values::PointerValue<'ink> {
620617
match resolver
621-
.resolve_path_as_value_fully(self.db.upcast(), path)
618+
.resolve_path_as_value_fully(self.db, path)
622619
.expect("unknown path")
623620
.0
624621
{
@@ -647,7 +644,7 @@ impl<'db, 'ink, 't> BodyIrGenerator<'db, 'ink, 't> {
647644
TyKind::Float(_) => self.gen_binary_op_float(lhs, rhs, op),
648645
TyKind::Int(ty) => self.gen_binary_op_int(lhs, rhs, op, ty.signedness),
649646
TyKind::Struct(s) => {
650-
if s.data(self.db.upcast()).memory_kind == mun_hir::StructMemoryKind::Value {
647+
if s.data(self.db).memory_kind == mun_hir::StructMemoryKind::Value {
651648
self.gen_binary_op_value_struct(lhs, rhs, op)
652649
} else {
653650
self.gen_binary_op_heap_struct(lhs, rhs, op)
@@ -1064,8 +1061,7 @@ impl<'db, 'ink, 't> BodyIrGenerator<'db, 'ink, 't> {
10641061
let body = self.body.clone();
10651062
match &body[expr] {
10661063
Expr::Path(ref p) => {
1067-
let resolver =
1068-
mun_hir::resolver_for_expr(self.db.upcast(), self.body.owner(), expr);
1064+
let resolver = mun_hir::resolver_for_expr(self.db, self.body.owner(), expr);
10691065
Some(self.gen_path_place_expr(p, expr, &resolver))
10701066
}
10711067
Expr::Field {

crates/mun_codegen/src/ir/intrinsics.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,8 @@ fn collect_expr<'ink>(
5959
}
6060

6161
if let Expr::Path(path) = expr {
62-
let resolver = mun_hir::resolver_for_expr(db.upcast(), body.owner(), expr_id);
63-
if let Some((ValueNs::StructId(_), _)) =
64-
resolver.resolve_path_as_value_fully(db.upcast(), path)
65-
{
62+
let resolver = mun_hir::resolver_for_expr(db, body.owner(), expr_id);
63+
if let Some((ValueNs::StructId(_), _)) = resolver.resolve_path_as_value_fully(db, path) {
6664
collect_intrinsic(context, target, &intrinsics::new, intrinsics);
6765
// self.collect_intrinsic( module, entries, &intrinsics::drop);
6866
*needs_alloc = true;

crates/mun_codegen/src/ir/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ impl<'db, 'ink> HirTypeCache<'db, 'ink> {
173173
/// that should be used for variables.
174174
pub fn get_struct_reference_type(&self, struct_ty: mun_hir::Struct) -> BasicTypeEnum<'ink> {
175175
let ir_ty = self.get_struct_type(struct_ty);
176-
match struct_ty.data(self.db.upcast()).memory_kind {
176+
match struct_ty.data(self.db).memory_kind {
177177
mun_hir::StructMemoryKind::Gc => {
178178
// GC values are pointers to pointers
179179
// struct Foo {}

crates/mun_codegen/src/mock.rs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -35,36 +35,6 @@ impl salsa::Database for MockDatabase {
3535
}
3636
}
3737

38-
impl mun_db::Upcast<dyn mun_hir::AstDatabase> for MockDatabase {
39-
fn upcast(&self) -> &(dyn mun_hir::AstDatabase + 'static) {
40-
self
41-
}
42-
}
43-
44-
impl mun_db::Upcast<dyn SourceDatabase> for MockDatabase {
45-
fn upcast(&self) -> &(dyn SourceDatabase + 'static) {
46-
self
47-
}
48-
}
49-
50-
impl mun_db::Upcast<dyn mun_hir::DefDatabase> for MockDatabase {
51-
fn upcast(&self) -> &(dyn mun_hir::DefDatabase + 'static) {
52-
self
53-
}
54-
}
55-
56-
impl mun_db::Upcast<dyn mun_hir::HirDatabase> for MockDatabase {
57-
fn upcast(&self) -> &(dyn mun_hir::HirDatabase + 'static) {
58-
self
59-
}
60-
}
61-
62-
impl mun_db::Upcast<dyn CodeGenDatabase> for MockDatabase {
63-
fn upcast(&self) -> &(dyn CodeGenDatabase + 'static) {
64-
self
65-
}
66-
}
67-
6838
impl Default for MockDatabase {
6939
fn default() -> Self {
7040
let mut db = MockDatabase {

0 commit comments

Comments
 (0)