Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions kani-compiler/src/codegen_cprover_gotoc/codegen/typ.rs
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ impl<'tcx, 'r> GotocCtx<'tcx, 'r> {
let flds: Vec<_> =
tys.iter().enumerate().map(|(i, t)| (GotocCtx::tuple_fld_name(i), *t)).collect();
// tuple cannot have other initial offset
self.codegen_struct_fields(flds, &layout.layout.0, Size::ZERO)
self.codegen_struct_fields(flds, &layout.layout, Size::ZERO)
}

/// A closure is a struct of all its environments. That is, a closure is
Expand Down Expand Up @@ -980,7 +980,7 @@ impl<'tcx, 'r> GotocCtx<'tcx, 'r> {
}
fields.extend(ctx.codegen_alignment_padding(
offset,
&type_and_layout.layout.0,
&type_and_layout.layout,
fields.len(),
));
fields
Expand Down Expand Up @@ -1175,7 +1175,7 @@ impl<'tcx, 'r> GotocCtx<'tcx, 'r> {
self.ensure_struct(self.ty_mangled_name(ty), self.ty_pretty_name(ty), |ctx, _| {
let variant = &def.variants().raw[0];
let layout = ctx.layout_of(ty);
ctx.codegen_variant_struct_fields(variant, subst, &layout.layout.0, Size::ZERO)
ctx.codegen_variant_struct_fields(variant, subst, &layout.layout, Size::ZERO)
})
}

Expand Down Expand Up @@ -1293,7 +1293,7 @@ impl<'tcx, 'r> GotocCtx<'tcx, 'r> {
Some(variant) => {
// a single enum is pretty much like a struct
let layout = gcx.layout_of(ty).layout;
gcx.codegen_variant_struct_fields(variant, subst, &layout.0, Size::ZERO)
gcx.codegen_variant_struct_fields(variant, subst, &layout, Size::ZERO)
}
}
})
Expand Down
6 changes: 6 additions & 0 deletions kani-compiler/src/kani_queries/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ pub struct QueryDb {
kani_functions: OnceCell<HashMap<KaniFunction, FnDef>>,
}

// SAFETY: QueryDb is always used behind Arc<Mutex<>> which provides proper synchronization.
// The FnDef type from rustc_public is not Send due to ThreadLocalIndex, but we ensure
// it's only accessed within the appropriate rustc_public context and never actually sent
// between threads.
unsafe impl Send for QueryDb {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tbh, I recommend using thread local instead of unsafe impl for future proofing things, but for the current implementation of QueryDb and rustc_public, this should work.


impl QueryDb {
pub fn new() -> Arc<Mutex<QueryDb>> {
Arc::new(Mutex::new(QueryDb::default()))
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT

[toolchain]
channel = "nightly-2025-11-20"
channel = "nightly-2025-11-21"
components = ["llvm-tools", "rustc-dev", "rust-src", "rustfmt"]
Loading