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

Compile crate with stable rust #20

Closed
3 tasks
declanvk opened this issue Nov 17, 2022 · 2 comments
Closed
3 tasks

Compile crate with stable rust #20

declanvk opened this issue Nov 17, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@declanvk
Copy link
Owner

declanvk commented Nov 17, 2022

Currently we have to use the nightly distribution of rust because we need some unstable features.

Nightly features we use:


After removing all unstable features (or they get promoted to stable) we should expand the github actions matrix to run all the build and tests for multiple version of rust: nightly, beta, stable, and a pegged MSRV.

@declanvk
Copy link
Owner Author

Additionally we're maintaining local copies of unstable methods behind the following features:

I've subscribed to all 6 of these issues, so I should know if one moves to stable, in which case we can remove the local copy and use stdlib.

declanvk added a commit that referenced this issue Nov 17, 2022
**Description**
Work towards issue #20

For each unstable standard library function we depend on, copy the
implementation and documentation into the local crate and replace
all usages of it.

Added links to tracking issues so we can eventually swap back.

**Motivation**
This change is needed so that this crate can compile using the
stable rust distribution.

The downside to this change is that we will no longer receive fixes
or other patches that the stdlib does on their version. If they
uncover an issue, we won't know about it. Going to mitigate this
by subscribing to each tracking issue.

**Testing Done**
 - `cargo test`
 - `cargo miri test`
 - `cargo clippy`
@declanvk declanvk added the enhancement New feature or request label Nov 17, 2022
declanvk pushed a commit that referenced this issue Nov 19, 2022
**Description**
 - Remove `strict_provenance` and replace with usage of `sptr` crate,
   which is by the same person who authored the strict provenance
   change.
 - Add miri testing section with flags that should enable testing of
   strict provenance.
 - Also fix `perfcnt` and `criterion-perf-events` accidentally being
   added to regular dependencies. Moved those back to dev-dependencies.

**Motivation**
Partial progress towards #20.

Ideally we'd just use the strict_provenance APIs in the standard lib,
but those are still unstable (probably will be for some time).

**Testing Done**
 - `cargo build --all-targets`
 - `cargo test`
 - `cargo miri test`
 - `cargo clippy`
declanvk pushed a commit that referenced this issue Nov 21, 2022
**Description**
Replace use of `NonNull::<[T]>::get_unchecked_mut` function call with
a copy from the standard library.

This function is used to index into a pointer to a slice (`*const [T]`)
and return a pointer to an element (`*const T`) without doing bounds
checking.

**Motivation**
This change is a partial solution towards issue #20. The only remaining
unstable feature used is `hasher_prefixfree_extras`.

**Testing Done**
 - `cargo test`
 - `cargo miri test`
 - `cargo fmt`
 - `cargo clippy`
@declanvk declanvk self-assigned this Nov 21, 2022
declanvk pushed a commit that referenced this issue Nov 21, 2022
**Description**
Remove last nightly feature, `hasher_prefixfree_extras` and replace with
copy from the standard library implementation.

**Motivation**
This change should allow us to compile the crate on stable, part of the
work tracked in issue #20.

**Testing Done**
 - `cargo test`
 - `cargo clippy`
 - `cargo fmt`
declanvk added a commit that referenced this issue Nov 21, 2022
**Description**
 - Remove `strict_provenance` and replace with usage of `sptr` crate,
   which is by the same person who authored the strict provenance
   change.
 - Add miri testing section with flags that should enable testing of
   strict provenance.
 - Also fix `perfcnt` and `criterion-perf-events` accidentally being
   added to regular dependencies. Moved those back to dev-dependencies.

**Motivation**
Partial progress towards #20.

Ideally we'd just use the strict_provenance APIs in the standard lib,
but those are still unstable (probably will be for some time).

**Testing Done**
 - `cargo build --all-targets`
 - `cargo test`
 - `cargo miri test`
 - `cargo clippy`
declanvk added a commit that referenced this issue Nov 21, 2022
**Description**
Replace use of `NonNull::<[T]>::get_unchecked_mut` function call with
a copy from the standard library.

This function is used to index into a pointer to a slice (`*const [T]`)
and return a pointer to an element (`*const T`) without doing bounds
checking.

**Motivation**
This change is a partial solution towards issue #20. The only remaining
unstable feature used is `hasher_prefixfree_extras`.

**Testing Done**
 - `cargo test`
 - `cargo miri test`
 - `cargo fmt`
 - `cargo clippy`
declanvk added a commit that referenced this issue Nov 21, 2022
**Description**
Remove last nightly feature, `hasher_prefixfree_extras` and replace with
copy from the standard library implementation.

**Motivation**
This change should allow us to compile the crate on stable, part of the
work tracked in issue #20.

**Testing Done**
 - `cargo test`
 - `cargo clippy`
 - `cargo fmt`
declanvk added a commit that referenced this issue Nov 21, 2022
**Description**
 - Update CI to run multiple versions of rust: stable, beta, nightly,
   and 1.62 (as MSRV)
 - Update documentation to use `+nightly` when required, assuming a
   stable-preferred development environment.
 - In CI when running under the `nightly` version of rust, enable the
   `nightly` cargo feature when building and running tests
 - Add a new job that runs miri tests

**Motivation**
This change is taking advantage of the completion of issue #20, now
that we don't strictly require any nightly unstable features. This
allows us to test on multiple versions of rust.

**Testing Done**
None
@declanvk
Copy link
Owner Author

The crate now compiles with the stable version of rust, and there is also a nightly cargo feature to opt the internal back in to using nightly features.

See https://github.com/declanvk/blart/actions/runs/3512050106/jobs/5883375643 for an example of compile and testing with stable rust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant