Skip to content

update msrv, fix fallout #91

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

Merged
merged 2 commits into from
Jan 17, 2025
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
111 changes: 29 additions & 82 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,114 +1,76 @@
name: CI
on:
pull_request:
push: # bors
branches:
- staging
- trying
merge_group:

env:
CI: 1
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: false
CARGO_PROFILE_RELEASE_DEBUG: false
RUSTFLAGS: -D warnings -W unreachable-pub
MIRIFLAGS: -Zmiri-check-number-validity -Zmiri-symbolic-alignment-check -Zmiri-tag-raw-pointers
MIRIFLAGS: -Zmiri-strict-provenance -Zmiri-symbolic-alignment-check

jobs:
cargo-test:
name: Tests
if: ${{ github.event.pusher.name == 'bors[bot]' }}
runs-on: ubuntu-latest
steps:

- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.59.0
profile: minimal
override: true
uses: dtolnay/[email protected]

- name: Enable caching
uses: Swatinem/rust-cache@v1.3.0
uses: Swatinem/rust-cache@v2

- name: Compile
uses: actions-rs/cargo@v1
with:
command: test
args: --all --all-targets --examples --no-run
run: cargo test --all --all-targets --examples --no-run

- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all --all-targets --examples
run: cargo test --all --all-targets --examples

cargo-test-msrv:
name: Tests (1.41.0)
name: Tests (1.80.0)
runs-on: ubuntu-latest
steps:

- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install arbitrary nightly toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2022-01-01
profile: minimal
toolchain: nightly-2025-01-01

- name: Install msrv toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.41.0
profile: minimal
override: true
uses: dtolnay/[email protected]

- name: Generate minimal-versions lockfile
uses: actions-rs/cargo@v1
with:
command: +nightly-2022-01-01
args: -Z minimal-versions generate-lockfile
run: cargo +nightly-2025-01-01 -Zminimal-versions generate-lockfile

- name: Enable caching
uses: Swatinem/rust-cache@v1.3.0
uses: Swatinem/rust-cache@v2

- name: Compile
uses: actions-rs/cargo@v1
with:
command: test
args: --locked --all --all-targets --examples --no-run
run: cargo test --locked --all --all-targets --examples --no-run

- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --locked --all --all-targets --examples
run: cargo test --locked --all --all-targets --examples

cargo-fmt:
name: Formatting
runs-on: ubuntu-latest
steps:

- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Instal toolchain
uses: actions-rs/toolchain@v1
- name: Install toolchain
uses: dtolnay/rust-toolchain@1.84
with:
profile: minimal
toolchain: 1.59.0
override: true
components: rustfmt

- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
run: cargo fmt --all -- --check

cargo-clippy:
name: Lints
Expand All @@ -118,47 +80,32 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install beta toolchain
uses: actions-rs/toolchain@v1
- name: Install toolchain
uses: dtolnay/rust-toolchain@1.84
with:
profile: minimal
toolchain: 1.59.0
override: true
components: clippy

- name: Check style
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all --all-targets
- name: Check clippy
run: cargo clippy --all --all-targets

cargo-miri:
name: Miri
runs-on: ubuntu-latest
steps:

- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@nightly
with:
profile: minimal
toolchain: nightly
override: true
components: miri

- name: Enable caching
uses: Swatinem/rust-cache@v1.3.0
uses: Swatinem/rust-cache@v2

- name: Miri setup
uses: actions-rs/cargo@v1
with:
command: miri
args: setup
run: cargo miri setup

- name: Miri test
uses: actions-rs/cargo@v1
with:
command: miri
args: test --workspace --all-features
run: cargo miri test --workspace --all-features
30 changes: 15 additions & 15 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = [
"crates/erasable",
"crates/ptr-union",
Expand Down
10 changes: 5 additions & 5 deletions crates/erasable/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[package]
name = "erasable"
version = "1.2.1"
edition = "2018"
version = "1.3.0"
edition = "2021"
rust-version = "1.80"

authors = ["Christopher Durham (cad97) <[email protected]>"]
description = "Type-erased thin pointers."
repository = "https://github.com/CAD97/pointer-utils/tree/master/crates/erasable"
readme = "README.md"
keywords = ["thin","pointer","type","erasure"]
categories = ["data-structures","no-std","rust-patterns"]
keywords = ["thin", "pointer", "type", "erasure"]
categories = ["data-structures", "no-std", "rust-patterns"]
license = "MIT OR Apache-2.0"

[package.metadata.workspaces]
Expand Down
4 changes: 2 additions & 2 deletions crates/erasable/build.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::env;

fn main() {
println!("cargo:rustc-check-cfg=cfg(has_extern_type, has_never, enforce_1_1_0_semantics)");

let cfg = autocfg::new();

cfg.emit_expression_cfg("{ extern { type T; } () }", "has_extern_type");
// NB: Requires this impl to cover `T: ?Sized`, which is not the case as of 2020-09-01.
// cfg.emit_type_cfg("std::sync::Weak::into_raw", "has_Weak__into_raw");
cfg.emit_type_cfg("!", "has_never");

if let Ok(var) = env::var("ERASABLE_ENFORCE_1_1_0_SEMANTICS") {
Expand Down
8 changes: 4 additions & 4 deletions crates/erasable/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -720,13 +720,11 @@ macro_rules! impl_erasable {
}

#[cfg(feature = "alloc")]
impl_erasable!(for<T>
Box<T>,
impl_erasable!(
for<T> Box<T>,
sync::Arc<T>,
#[cfg(has_Weak__into_raw)]
sync::Weak<T>,
rc::Rc<T>,
#[cfg(has_Weak__into_raw)]
rc::Weak<T>,
);

Expand All @@ -749,11 +747,13 @@ unsafe impl ErasablePtr for ! {
}

#[inline(always)]
#[allow(clippy::needless_lifetimes)]
unsafe fn erase_lt<'a, 'b, T: ?Sized>(this: &'a T) -> &'b T {
&*(this as *const T)
}

#[inline(always)]
#[allow(clippy::needless_lifetimes)]
unsafe fn erase_lt_mut<'a, 'b, T: ?Sized>(this: &'a mut T) -> &'b mut T {
&mut *(this as *mut T)
}
2 changes: 1 addition & 1 deletion crates/erasable/tests/smoke.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! These tests don't really assert anything, they just exercise the API.
//! This is primarily intended to be run under miri as a sanitizer.

#![allow(unused, clippy::redundant_clone, clippy::unnecessary_operation)]
#![allow(unused, clippy::style)]

use erasable::{Erasable, ErasablePtr, ErasedPtr, Thin};

Expand Down
9 changes: 4 additions & 5 deletions crates/ptr-union/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
[package]
name = "ptr-union"
version = "2.2.2"
edition = "2018"
version = "2.3.0"
edition = "2021"

authors = ["Christopher Durham (cad97) <[email protected]>"]
description = "Pointer union types the size of a pointer by storing the tag in the alignment bits."
repository = "https://github.com/CAD97/pointer-utils/tree/master/crates/ptr-union"
readme = "README.md"
keywords = ["thin","pointer","union","enum"]
categories = ["data-structures","no-std","rust-patterns"]
keywords = ["thin", "pointer", "union", "enum"]
categories = ["data-structures", "no-std", "rust-patterns"]
license = "MIT OR Apache-2.0"

[package.metadata.workspaces]
Expand Down
2 changes: 2 additions & 0 deletions crates/ptr-union/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
fn main() {
let cfg = autocfg::new();
println!("cargo::rustc-check-cfg=cfg(has_never, has_strict_provenance)");
cfg.emit_type_cfg("!", "has_never");
cfg.emit_expression_cfg("<*const ()>::addr", "has_strict_provenance");
autocfg::rerun_path("build.rs");
}
Loading
Loading