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

GEN-188: Release error-stack@0.5.0 #4706

Merged
merged 8 commits into from
Jul 12, 2024
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
15 changes: 2 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -550,31 +550,20 @@ jobs:
toolchain: ${{ steps.publish.outputs.rust-toolchain }}
working-directory: ${{ matrix.directory }}

- name: Install tools
if: always() && steps.publish.outputs.has-rust == 'true' && github.event_name == 'pull_request' || github.event_name == 'merge_group'
uses: taiki-e/install-action@2335425120e645291d84cec8194c63983a0c8ee5 # v2.41.10
with:
tool: cargo-semver-checks

- name: Login
run: |
[[ -n "${{ secrets.CARGO_REGISTRY_TOKEN }}" ]]
cargo login "${{ secrets.CARGO_REGISTRY_TOKEN }}"

- name: SemVer check
if: always() && steps.publish.outputs.has-rust == 'true' && github.event_name == 'pull_request' || github.event_name == 'merge_group'
working-directory: ${{ matrix.directory }}
run: cargo semver-checks check-release

- name: Publish (dry run)
if: always() && steps.publish.outputs.has-rust == 'true' && github.event_name == 'pull_request' || github.event_name == 'merge_group'
working-directory: ${{ matrix.directory }}
run: cargo publish --all-features --dry-run
run: cargo publish --all-features --dry-run --no-verify

- name: Publish
if: always() && steps.publish.outputs.has-rust == 'true' && github.event_name == 'push' && github.ref == 'refs/heads/main'
working-directory: ${{ matrix.directory }}
run: cargo publish --all-features
run: cargo publish --all-features --no-verify

passed:
name: Tests passed
Expand Down
72 changes: 36 additions & 36 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion libs/error-stack/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ All notable changes to `error-stack` will be documented in this file.

- Support for [`defmt`](https://defmt.ferrous-systems.com)

## 0.5.0 - Unreleased
## [0.5.0](https://github.com/hashintel/hash/tree/error-stack%400.5.0/libs/error-stack) - 2024-07-12

### Features

Expand All @@ -15,6 +15,7 @@ All notable changes to `error-stack` will be documented in this file.
### Breaking Changes

- `Backtrace`s are not included in the `std` feature anymore. Instead, the `backtrace` feature is used which is enabled by default ([#4685](https://github.com/hashintel/hash/pull/4685))
- Remove deprecated `IntoReport` ([#4706](https://github.com/hashintel/hash/pull/4706))

## [0.4.1](https://github.com/hashintel/hash/tree/error-stack%400.4.1/libs/error-stack) - 2023-09-04

Expand Down
2 changes: 1 addition & 1 deletion libs/error-stack/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "error-stack"
version = "0.4.1"
version = "0.5.0"
authors = ["HASH"]
edition = "2021"
rust-version = "1.63.0"
Expand Down
5 changes: 5 additions & 0 deletions libs/error-stack/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ fn main() {
println!("cargo:warning=The `backtrace` feature requires Rust 1.65.0 or later.");
exit(1);
}

println!("cargo:rustc-check-cfg=cfg(rust_1_81)");
if trimmed_rustc_version >= Version::new(1, 81, 0) {
println!("cargo:rustc-cfg=rust_1_81");
}
}
14 changes: 13 additions & 1 deletion libs/error-stack/src/context.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#[cfg(any(feature = "std", rust_1_81))]
use alloc::string::{String, ToString};
#[cfg(rust_1_81)]
use core::error::Error;
#[cfg(nightly)]
use core::error::Request;
use core::{error::Error, fmt};
use core::fmt;
#[cfg(all(feature = "std", not(rust_1_81)))]
use std::error::Error;

use crate::Report;

Expand Down Expand Up @@ -67,32 +72,38 @@ pub trait Context: fmt::Display + fmt::Debug + Send + Sync + 'static {
/// This method only exists to avoid the requirement of specialization and to get the sources
/// for `Error`.
#[doc(hidden)]
#[cfg(any(feature = "std", rust_1_81))]
fn __source(&self) -> Option<&(dyn Error + 'static)> {
None
}
}

/// Captures an error message as the context of a [`Report`].
#[cfg(any(feature = "std", rust_1_81))]
pub(crate) struct SourceContext(String);

#[cfg(any(feature = "std", rust_1_81))]
impl SourceContext {
pub(crate) fn from_error(value: &dyn Error) -> Self {
Self(value.to_string())
}
}

#[cfg(any(feature = "std", rust_1_81))]
impl fmt::Debug for SourceContext {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&self.0, fmt)
}
}

#[cfg(any(feature = "std", rust_1_81))]
impl fmt::Display for SourceContext {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&self.0, fmt)
}
}

#[cfg(any(feature = "std", rust_1_81))]
impl Context for SourceContext {}

impl<C> From<C> for Report<C>
Expand All @@ -106,6 +117,7 @@ where
}
}

#[cfg(any(feature = "std", rust_1_81))]
impl<C: Error + Send + Sync + 'static> Context for C {
#[cfg(nightly)]
fn provide<'a>(&'a self, request: &mut Request<'a>) {
Expand Down
9 changes: 7 additions & 2 deletions libs/error-stack/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#![cfg(any(feature = "std", rust_1_81))]

#[cfg(rust_1_81)]
use core::error::Error;
#[cfg(nightly)]
use core::error::{Error, Request};
use core::error::Request;
use core::fmt;
#[cfg(not(nightly))]
#[cfg(all(feature = "std", not(rust_1_81)))]
use std::error::Error;

use crate::Report;
Expand Down Expand Up @@ -32,6 +36,7 @@ impl<C> fmt::Display for ReportError<C> {
}
}

#[cfg(any(feature = "std", rust_1_81))]
impl<C> Error for ReportError<C> {
#[cfg(nightly)]
fn provide<'a>(&'a self, request: &mut Request<'a>) {
Expand Down
6 changes: 1 addition & 5 deletions libs/error-stack/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,11 +516,7 @@ pub use self::{
result::Result,
};
#[doc(inline)]
#[allow(deprecated)]
pub use self::{
future::FutureExt,
result::{IntoReport, ResultExt},
};
pub use self::{future::FutureExt, result::ResultExt};

#[cfg(test)]
#[allow(dead_code)]
Expand Down
Loading
Loading