Sitelet https://github.com/Snezhkko/cairo/commit/a3b8146db1841baa893ecc7c529deb74950b5619
Skip to content

Commit a3b8146

Browse files
authored
Fixed documentation. (starkware-libs#9137)
1 parent bfce30c commit a3b8146

6 files changed

Lines changed: 14 additions & 23 deletions

File tree

‎corelib/src/ec.cairo‎

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,7 @@ pub impl EcStateImpl of EcStateTrait {
204204
///
205205
/// # Returns
206206
///
207-
/// * `Option<NonZeroEcPoint>` - The resulting point, or None if the result is the zero point
208-
///
209-
/// # Panics
210-
///
211-
/// Panics if the result is the point at infinity.
207+
/// * `Option<NonZeroEcPoint>` - The resulting point, or None if the result is the zero point.
212208
#[inline]
213209
fn finalize_nz(self: EcState) -> Option<NonZeroEcPoint> nopanic {
214210
ec_state_try_finalize_nz(self)
@@ -268,10 +264,6 @@ pub impl EcPointImpl of EcPointTrait {
268264
///
269265
/// Returns `None` if no point with the given x-coordinate exists on the curve.
270266
///
271-
/// # Panics
272-
///
273-
/// Panics if `x` is 0, as this would be the point at infinity.
274-
///
275267
/// # Examples
276268
///
277269
/// ```
@@ -298,10 +290,6 @@ pub impl EcPointImpl of EcPointTrait {
298290
///
299291
/// A tuple containing the (x, y) coordinates of the point.
300292
///
301-
/// # Panics
302-
///
303-
/// Panics if the point is the point at infinity.
304-
///
305293
/// # Examples
306294
///
307295
/// ```

‎corelib/src/keyword_docs.cairo‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ mod keyword_continue {}
283283
mod keyword_return {}
284284

285285
/// ### The `break` keyword.
286-
/// Exits a loop early. Can only be used inside a `loop` expression.
286+
/// Exits a loop early. Can only be used inside `loop`, `while` or `for` loop blocks.
287287
///
288288
/// ### Example
289289
/// ```cairo

‎corelib/src/ops/range.cairo‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
//!
66
//! # Range Operator Forms
77
//!
8-
//! There is currently only a single range operator form: `start..end`, representing a range from
9-
//! `start` (inclusive) to `end` (exclusive).
8+
//! There are currently two range operator forms:
9+
//! `start..end`, representing a range from `start` (inclusive) to `end` (exclusive).
10+
//! `start..=end`, representing a range from `start` (inclusive) to `end` (inclusive).
1011

1112
use core::iter::{IntoIterator, Iterator};
1213
use core::num::traits::One;

‎corelib/src/sha256.cairo‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,11 @@ pub fn compute_sha256_byte_array(arr: @ByteArray) -> [u32; 8] {
113113
/// Adds padding to the input array according to the SHA-256 specification.
114114
///
115115
/// The padding follows FIPS 180-4:
116-
/// 1. Append a single '1' bit to the message
117-
/// 2. Append zeros until data length ≡ 448 (mod 512)
118-
/// 3. Append the original message length as a 64-bit big-endian integer
116+
/// 1. Append a single '1' bit to the message.
117+
/// 2. Append zeros until data length ≡ 448 (mod 512).
118+
/// 3. Append the original message length as a 64-bit big-endian integer.
119+
/// This implementation is made for provable execution and assumes the message bit length
120+
/// fits in 32 bits, with the high 32 bits of the 64-bit length field being zero.
119121
///
120122
/// # Arguments
121123
/// * `arr` - Array to pad (modified in place)

‎corelib/src/testing.cairo‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use crate::gas::GasBuiltin;
3333
/// // Making sure `gas_after` is exact
3434
/// core::gas::withdraw_gas().unwrap();
3535
///
36-
/// assert!(gas_after - gas_before < 100_000);
36+
/// assert!(gas_before - gas_after < 100_000);
3737
/// }
3838
/// ```
3939
pub extern fn get_available_gas() -> u128 implicits(GasBuiltin) nopanic;
@@ -56,7 +56,7 @@ pub extern fn get_available_gas() -> u128 implicits(GasBuiltin) nopanic;
5656
/// let gas_before = get_unspent_gas();
5757
/// gas_heavy_function();
5858
/// let gas_after = get_unspent_gas();
59-
/// assert!(gas_after - gas_before < 100_000);
59+
/// assert!(gas_before - gas_after < 100_000);
6060
/// }
6161
/// ```
6262
pub extern fn get_unspent_gas() -> u128 implicits(GasBuiltin) nopanic;

‎corelib/src/to_byte_array.cairo‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub trait FormatAsByteArray<T> {
7171
///
7272
/// let num: u32 = 42;
7373
/// let formatted = num.format_as_byte_array(16);
74-
/// assert!(formatted, "2a");
74+
/// assert!(formatted == "2a");
7575
/// ```
7676
fn format_as_byte_array(self: @T, base: NonZero<T>) -> ByteArray;
7777
}
@@ -180,7 +180,7 @@ fn append_formatted_to_byte_array<T, +Drop<T>, +Copy<T>, +DivRem<T>, +TryInto<T,
180180
}
181181
}
182182

183-
// Converts a digit (0-9, A-Z) to its ASCII representation in a base > 10.
183+
/// Converts a digit (0-9, a-z) to its ASCII representation in a base > 10.
184184
#[inline]
185185
fn get_big_base_digit_representation(digit_as_u8: u8) -> u8 {
186186
if digit_as_u8 < 10 {

0 commit comments

Comments
 (0)