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

Merge with upstream #57

Merged
merged 9 commits into from
Nov 22, 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
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,10 @@ jobs:
- run: cargo install --root ${{ runner.tool_cache }}/cargo-ndk --version ${{ env.CARGO_NDK_VERSION }} cargo-ndk
- run: cargo ndk -t arm64-v8a check -p wasmtime

# Run clippy configuration
- run: rustup component add clippy
- run: cargo clippy --workspace

# common logic to cancel the entire run if this job fails
- run: gh run cancel ${{ github.run_id }}
if: failure() && github.event_name != 'pull_request'
Expand Down
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ edition.workspace = true
default-run = "wasmtime"
rust-version.workspace = true

[lints]
workspace = true

[lib]
doctest = false

Expand Down Expand Up @@ -121,6 +124,7 @@ members = [
]
exclude = [
'crates/wasi-common/WASI/tools/witx-cli',
'crates/wasi-common/WASI/tools/witx',
'docs/rust_wasi_markdown_parser',
]

Expand All @@ -132,6 +136,19 @@ edition = "2021"
# current stable release of Rust minus 2.
rust-version = "1.72.0"

[workspace.lints.rust]
# Turn on some lints which are otherwise allow-by-default in rustc.
unused_extern_crates = 'warn'
trivial_numeric_casts = 'warn'
unstable_features = 'warn'
unused_import_braces = 'warn'

[workspace.lints.clippy]
# The default set of lints in Clippy is viewed as "too noisy" right now so
# they're all turned off by default. Selective lints are then enabled below as
# necessary.
all = 'allow'

[workspace.dependencies]
arbitrary = { version = "1.3.1" }
wasmtime-wmemcheck = { path = "crates/wmemcheck", version = "=16.0.0" }
Expand Down
2 changes: 1 addition & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Unreleased.

## 15.0.0

Unreleased.
Released 2023-11-20

### Added

Expand Down
3 changes: 3 additions & 0 deletions cranelift/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ repository = "https://github.com/bytecodealliance/wasmtime"
publish = false
edition.workspace = true

[lints]
workspace = true

[[bin]]
name = "clif-util"
path = "src/clif-util.rs"
Expand Down
3 changes: 3 additions & 0 deletions cranelift/bforest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@ readme = "README.md"
keywords = ["btree", "forest", "set", "map"]
edition.workspace = true

[lints]
workspace = true

[dependencies]
cranelift-entity = { workspace = true }
3 changes: 1 addition & 2 deletions cranelift/bforest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
//! - Empty trees have a very small 32-bit footprint.
//! - All the trees in a forest can be cleared in constant time.

#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces)]
#![deny(missing_docs)]
#![no_std]

#[cfg(test)]
Expand Down
3 changes: 3 additions & 0 deletions cranelift/codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ keywords = ["compile", "compiler", "jit"]
build = "build.rs"
edition.workspace = true

[lints]
workspace = true

[dependencies]
anyhow = { workspace = true, optional = true }
bumpalo = "3"
Expand Down
3 changes: 3 additions & 0 deletions cranelift/codegen/meta/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ repository = "https://github.com/bytecodealliance/wasmtime"
readme = "README.md"
edition.workspace = true

[lints]
workspace = true

[package.metadata.docs.rs]
rustdoc-args = [ "--document-private-items" ]

Expand Down
4 changes: 1 addition & 3 deletions cranelift/codegen/shared/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
//! This library contains code that is common to both the `cranelift-codegen` and
//! `cranelift-codegen-meta` libraries.

#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces)]
#![cfg_attr(feature = "std", deny(unstable_features))]
#![deny(missing_docs)]

pub mod constant_hash;
pub mod constants;
Expand Down
4 changes: 1 addition & 3 deletions cranelift/codegen/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Cranelift code generation library.
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces)]
#![cfg_attr(feature = "std", deny(unstable_features))]
#![deny(missing_docs)]
#![no_std]
// Various bits and pieces of this crate might only be used for one platform or
// another, but it's not really too useful to learn about that all the time. On
Expand Down
3 changes: 3 additions & 0 deletions cranelift/entity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ readme = "README.md"
keywords = ["entity", "set", "map"]
edition.workspace = true

[lints]
workspace = true

[dependencies]
serde = { version = "1.0.188", optional = true }
serde_derive = { version = "1.0.188", optional = true }
Expand Down
5 changes: 3 additions & 2 deletions cranelift/entity/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
//! references allocated from an associated memory pool. It has a much smaller footprint than
//! `Vec`.

#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces)]
#![deny(missing_docs)]
#![no_std]

extern crate alloc;
Expand Down Expand Up @@ -203,6 +202,7 @@ mod map;
mod primary;
mod set;
mod sparse;
mod unsigned;

pub use self::boxed_slice::BoxedSlice;
pub use self::iter::{Iter, IterMut};
Expand All @@ -212,6 +212,7 @@ pub use self::map::SecondaryMap;
pub use self::primary::PrimaryMap;
pub use self::set::EntitySet;
pub use self::sparse::{SparseMap, SparseMapValue, SparseSet};
pub use self::unsigned::Unsigned;

/// A collection of tests to ensure that use of the different `entity_impl!` forms will generate
/// `EntityRef` implementations that behave the same way.
Expand Down
71 changes: 71 additions & 0 deletions cranelift/entity/src/unsigned.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/// Helper trait used to add `unsigned()` methods to primitive signed integer
/// types.
///
/// The purpose of this trait is to signal the intent that the sign bit of a
/// signed integer is intended to be discarded and the value is instead
/// understood to be a "bag of bits" where the conversion to an unsigned number
/// is intended to be lossless. This can be used for example when converting a
/// signed integer into a larger width with zero-extension.
pub trait Unsigned {
/// The unsigned integer for this type which has the same width.
type Unsigned;

/// View this signed integer as an unsigned integer of the same width.
///
/// All bits are preserved.
fn unsigned(self) -> Self::Unsigned;
}

impl Unsigned for i8 {
type Unsigned = u8;

#[inline]
fn unsigned(self) -> u8 {
self as u8
}
}

impl Unsigned for i16 {
type Unsigned = u16;

#[inline]
fn unsigned(self) -> u16 {
self as u16
}
}

impl Unsigned for i32 {
type Unsigned = u32;

#[inline]
fn unsigned(self) -> u32 {
self as u32
}
}

impl Unsigned for i64 {
type Unsigned = u64;

#[inline]
fn unsigned(self) -> u64 {
self as u64
}
}

impl Unsigned for i128 {
type Unsigned = u128;

#[inline]
fn unsigned(self) -> u128 {
self as u128
}
}

impl Unsigned for isize {
type Unsigned = usize;

#[inline]
fn unsigned(self) -> usize {
self as usize
}
}
3 changes: 3 additions & 0 deletions cranelift/filetests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ repository = "https://github.com/bytecodealliance/wasmtime"
publish = false
edition.workspace = true

[lints]
workspace = true

[dependencies]
cranelift-codegen = { workspace = true, features = ["disas"] }
cranelift-frontend = { workspace = true }
Expand Down
8 changes: 1 addition & 7 deletions cranelift/filetests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
//! This crate contains the main test driver as well as implementations of the
//! available filetest commands.

#![deny(
missing_docs,
trivial_numeric_casts,
unused_extern_crates,
unstable_features
)]
#![warn(unused_import_braces)]
#![deny(missing_docs)]

pub use crate::function_runner::TestFileCompiler;
use crate::runner::TestRunner;
Expand Down
3 changes: 3 additions & 0 deletions cranelift/frontend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ repository = "https://github.com/bytecodealliance/wasmtime"
readme = "README.md"
edition.workspace = true

[lints]
workspace = true

[dependencies]
cranelift-codegen = { workspace = true }
target-lexicon = { workspace = true }
Expand Down
4 changes: 1 addition & 3 deletions cranelift/frontend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,7 @@
//! }
//! ```

#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces)]
#![cfg_attr(feature = "std", deny(unstable_features))]
#![deny(missing_docs)]
#![no_std]

#[allow(unused_imports)] // #[macro_use] is required for no_std
Expand Down
2 changes: 2 additions & 0 deletions cranelift/fuzzgen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ readme = "README.md"
edition.workspace = true
publish = false

[lints]
workspace = true

[dependencies]
cranelift = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion cranelift/fuzzgen/src/function_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1401,7 +1401,7 @@ where
DataValue::I8(i) => builder.ins().iconst(ty, i as u8 as i64),
DataValue::I16(i) => builder.ins().iconst(ty, i as u16 as i64),
DataValue::I32(i) => builder.ins().iconst(ty, i as u32 as i64),
DataValue::I64(i) => builder.ins().iconst(ty, i as i64),
DataValue::I64(i) => builder.ins().iconst(ty, i),
DataValue::I128(i) => {
let hi = builder.ins().iconst(I64, (i >> 64) as i64);
let lo = builder.ins().iconst(I64, i as i64);
Expand Down
3 changes: 3 additions & 0 deletions cranelift/interpreter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ license = "Apache-2.0 WITH LLVM-exception"
readme = "README.md"
edition.workspace = true

[lints]
workspace = true

[dependencies]
cranelift-codegen = { workspace = true }
cranelift-entity = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions cranelift/interpreter/src/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@ where
let overflow = if is_signed {
x < (min as i128) || x > (max as i128)
} else {
x < 0 || (x as u128) > (max as u128)
x < 0 || (x as u128) > max
};
// bounds check
if overflow {
Expand All @@ -1102,7 +1102,7 @@ where
x
} else {
let x = if x < 0 { 0 } else { x };
let x = u128::min(x as u128, max as u128);
let x = u128::min(x as u128, max);
x as i128
};

Expand Down
2 changes: 2 additions & 0 deletions cranelift/interpreter/src/value.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//! The [DataValueExt] trait is an extension trait for [DataValue]. It provides a lot of functions
//! used by the rest of the interpreter.

#![allow(trivial_numeric_casts)]

use core::convert::TryFrom;
use core::fmt::{self, Display, Formatter};
use cranelift_codegen::data_value::{DataValue, DataValueCastFailure};
Expand Down
3 changes: 3 additions & 0 deletions cranelift/isle/isle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ readme = "../README.md"
repository = "https://github.com/bytecodealliance/wasmtime/tree/main/cranelift/isle"
version = "0.103.0"

[lints]
workspace = true

[dependencies]
codespan-reporting = { version = "0.11.1", optional = true }
log = { workspace = true, optional = true }
Expand Down
3 changes: 3 additions & 0 deletions cranelift/jit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ license = "Apache-2.0 WITH LLVM-exception"
readme = "README.md"
edition.workspace = true

[lints]
workspace = true

[dependencies]
cranelift-module = { workspace = true }
cranelift-native = { workspace = true }
Expand Down
9 changes: 1 addition & 8 deletions cranelift/jit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@
//! There is an [example project](https://github.com/bytecodealliance/cranelift-jit-demo/)
//! which shows how to use some of the features of `cranelift_jit`.

#![deny(
missing_docs,
trivial_numeric_casts,
unused_extern_crates,
unstable_features,
unreachable_pub
)]
#![warn(unused_import_braces)]
#![deny(missing_docs, unreachable_pub)]

mod backend;
mod compiled_blob;
Expand Down
3 changes: 3 additions & 0 deletions cranelift/module/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ license = "Apache-2.0 WITH LLVM-exception"
readme = "README.md"
edition.workspace = true

[lints]
workspace = true

[dependencies]
cranelift-codegen = { workspace = true }
cranelift-control = { workspace = true }
Expand Down
4 changes: 1 addition & 3 deletions cranelift/module/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
//! Top-level lib.rs for `cranelift_module`.

#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces)]
#![cfg_attr(feature = "std", deny(unstable_features))]
#![deny(missing_docs)]
#![no_std]

#[cfg(not(feature = "std"))]
Expand Down
Loading