Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hash.sw, replaced #![foo] for #[foo] #5248

Merged
merged 2 commits into from
Nov 1, 2023
Merged
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
6 changes: 5 additions & 1 deletion forc-plugins/forc-fmt/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ fn format_file(
// TODO: Support formatting for incomplete/invalid sway code.
// https://github.com/FuelLabs/sway/issues/5012
debug!("{}", err);
bail!("Failed to compile: {:?}", file);
if let Some(file) = file.to_str() {
bail!("Failed to compile {}\n{}", file, err);
} else {
bail!("Failed to compile.\n{}", err);
}
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions sway-lib-std/src/hash.sw
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl Hasher {
self.write(bytes);
}

#![inline(never)]
#[inline(never)]
pub fn write_str_array<S>(ref mut self, s: S) {
__assert_is_str_array::<S>();
let str_size = __size_of_str_array::<S>();
Expand Down Expand Up @@ -159,7 +159,7 @@ impl Hash for str {
}

impl<A, B> Hash for (A, B) where A: Hash, B: Hash {
#![inline(never)]
#[inline(never)]
fn hash(self, ref mut state: Hasher) {
self.0.hash(state);
self.1.hash(state);
Expand Down Expand Up @@ -318,7 +318,7 @@ impl<T> Hash for [T; 10] where T: Hash {
/// assert(result = 0xa80f942f4112036dfc2da86daf6d2ef6ede3164dd56d1000eb82fa87c992450f);
/// }
/// ```
#![inline(never)]
#[inline(never)]
pub fn sha256<T>(s: T) -> b256 where T: Hash {
let mut hasher = Hasher::new();
s.hash(hasher);
Expand All @@ -338,7 +338,7 @@ pub fn sha256<T>(s: T) -> b256 where T: Hash {
/// assert(result = 0xa80f942f4112036dfc2da86daf6d2ef6ede3164dd56d1000eb82fa87c992450f);
/// }
/// ```
#![inline(never)]
#[inline(never)]
pub fn sha256_str_array<S>(param: S) -> b256 {
__assert_is_str_array::<S>();
let str_size = __size_of_str_array::<S>();
Expand Down Expand Up @@ -374,7 +374,7 @@ pub fn sha256_str_array<S>(param: S) -> b256 {
/// assert(result = 0x4375c8bcdc904e5f51752581202ae9ae2bb6eddf8de05d5567d9a6b0ae4789ad);
/// }
/// ```
#![inline(never)]
#[inline(never)]
pub fn keccak256<T>(s: T) -> b256 where T: Hash {
let mut hasher = Hasher::new();
s.hash(hasher);
Expand Down
Loading