-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update for Cairo 2.4.3 * Improve taint (#58) * update taint to use fxhash * remove debug + timing * clippy and fmt * remove file * Update for Cairo 2.5.0 --------- Co-authored-by: technovision99 <[email protected]>
- Loading branch information
1 parent
39d328e
commit b0be7d8
Showing
115 changed files
with
5,140 additions
and
2,313 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
[crate_roots] | ||
core = "src" | ||
|
||
[config.global] | ||
edition = "2023_11" | ||
|
||
[config.global.experimental_features] | ||
negative_impls = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#[generate_trait] | ||
pub impl BoolImpl<T, +Drop<T>> of BoolTrait<T> { | ||
/// Returns `Some(t)` if the `bool` is `true`, or `None` otherwise. | ||
/// | ||
/// # Examples | ||
/// | ||
/// ``` | ||
/// assert(false.then_some(0) == Option::None); | ||
/// assert(true.then_some(0) == Option::Some(0)); | ||
/// ``` | ||
#[inline(always)] | ||
fn then_some(self: bool, t: T) -> Option<T> nopanic { | ||
if self { | ||
Option::Some(t) | ||
} else { | ||
Option::None | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,34 @@ | ||
#[derive(Copy, Drop)] | ||
extern type Box<T>; | ||
pub extern type Box<T>; | ||
|
||
// These functions are only exposed in the corelib through the trait below since calling them | ||
// directly with tuples panics due to auto unpacking of the tuple. | ||
// TODO(Gil): Expose in the core lib when the described behaviour is fixed. | ||
extern fn into_box<T>(value: T) -> Box<T> nopanic; | ||
extern fn unbox<T>(box: Box<T>) -> T nopanic; | ||
extern fn box_forward_snapshot<T>(value: @Box<T>) -> Box<@T> nopanic; | ||
|
||
#[generate_trait] | ||
impl BoxImpl<T> of BoxTrait<T> { | ||
pub impl BoxImpl<T> of BoxTrait<T> { | ||
#[inline(always)] | ||
#[must_use] | ||
fn new(value: T) -> Box<T> nopanic { | ||
into_box(value) | ||
} | ||
#[inline(always)] | ||
#[must_use] | ||
fn unbox(self: Box<T>) -> T nopanic { | ||
unbox(self) | ||
} | ||
#[must_use] | ||
fn as_snapshot(self: @Box<T>) -> Box<@T> nopanic { | ||
box_forward_snapshot(self) | ||
} | ||
} | ||
|
||
impl BoxDebug<T, impl TDebug: core::fmt::Debug<T>> of core::fmt::Debug<Box<T>> { | ||
fn fmt(self: @Box<T>, ref f: core::fmt::Formatter) -> Result<(), core::fmt::Error> { | ||
write!(f, "&")?; | ||
TDebug::fmt(self.as_snapshot().unbox(), ref f) | ||
} | ||
} |
Oops, something went wrong.