Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
manual_assert
  • Loading branch information
ShaharNaveh committed Jun 27, 2026
commit e1d133163b637c2e393982ee8e064355dd2d4acd
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
flamescope = { version = "0.1.2", optional = true }

rustls = { workspace = true, optional = true }
rustls-graviola = { workspace = true, optional = true }

Check warning on line 52 in Cargo.toml

View workflow job for this annotation

GitHub Actions / cargo shear

shear/misplaced_optional_dependency

misplaced optional dependency `rustls-graviola` (remove the `optional` flag and move to `[dev-dependencies]`)

[target.'cfg(windows)'.dependencies]
libc = { workspace = true }
Expand Down Expand Up @@ -407,6 +407,7 @@
iter_filter_is_some = "warn"
large_futures = "warn"
large_types_passed_by_value = "warn"
manual_assert = "warn"
manual_instant_elapsed = "warn"
manual_is_variant_and = "warn"
map_unwrap_or = "warn"
Expand Down
7 changes: 4 additions & 3 deletions crates/vm/src/function/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ const fn zst_ref_out_of_thin_air<T: 'static>(x: T) -> &'static T {
// operation. if T isn't zero-sized, we don't have to worry about it because we'll fail to compile.
core::mem::forget(x);
const {
if core::mem::size_of::<T>() != 0 {
panic!("can't use a non-zero-sized type here")
}
assert!(
core::mem::size_of::<T>() == 0,
"can't use a non-zero-sized type here"
);
// SAFETY: we just confirmed that T is zero-sized, so we can
// pull a value of it out of thin air.
unsafe { core::ptr::NonNull::<T>::dangling().as_ref() }
Expand Down
9 changes: 4 additions & 5 deletions crates/vm/src/types/slot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1667,11 +1667,10 @@ pub trait Initializer: PyPayload {
.matches(&class_name_for_debug as &str)
.count()
== 2;
if double_appearance {
panic!(
"This type `{class_name_for_debug}` doesn't seem to support `init`. Override `slot_init` instead: {msg}"
);
}
assert!(
!double_appearance,
"This type `{class_name_for_debug}` doesn't seem to support `init`. Override `slot_init` instead: {msg}"
)
}
}
return Err(err);
Expand Down
4 changes: 1 addition & 3 deletions crates/vm/src/vm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -883,9 +883,7 @@ impl VirtualMachine {
fn initialize(&mut self) {
flame_guard!("init VirtualMachine");

if self.initialized {
panic!("Double Initialize Error");
}
assert!(!self.initialized, "Double Initialize Error");

// Initialize main thread ident before any threading operations
#[cfg(feature = "threading")]
Expand Down
Loading