Skip to content

Commit 6666945

Browse files
authored
Merge pull request #1220 from spkenv/rust-1.87
Update to Rust 1.87.0
2 parents 0f6c63c + f5df33c commit 6666945

File tree

32 files changed

+400
-242
lines changed

32 files changed

+400
-242
lines changed

.github/workflows/rust.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- uses: actions/checkout@v2
2020
- uses: actions-rs/toolchain@v1
2121
with:
22-
toolchain: 1.86.0
22+
toolchain: 1.87.0
2323
target: x86_64-pc-windows-gnu
2424
override: true
2525
- name: Prepare VM
@@ -40,7 +40,7 @@ jobs:
4040
runs-on: ubuntu-latest
4141
timeout-minutes: 45
4242
container:
43-
image: rust:1.86.0
43+
image: rust:1.87.0
4444
options: --security-opt seccomp=unconfined --privileged
4545
env:
4646
# Disable cnproc because we're in a container

.site/spi/.spdev.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ release_notes: |
66
77
toolchain:
88
- kind: Rust
9-
toolchain: 1.86.0
9+
toolchain: 1.87.0
1010
additional_toolchains:
1111
- nightly
1212
- kind: Shell

crates/spfs/src/check.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,10 @@ where
206206
tracing::debug!(?tag, "Checking tag");
207207
self.reporter.visit_tag(&tag);
208208
let result = self.check_digest(tag.target).await?;
209-
let res = CheckTagResult::Checked { tag, result };
209+
let res = CheckTagResult::Checked {
210+
tag: Box::new(tag),
211+
result,
212+
};
210213
self.reporter.checked_tag(&res);
211214
Ok(res)
212215
}
@@ -812,7 +815,7 @@ pub enum CheckTagResult {
812815
Missing,
813816
/// The tag was checked
814817
Checked {
815-
tag: tracking::Tag,
818+
tag: Box<tracking::Tag>,
816819
result: CheckObjectResult,
817820
},
818821
}

crates/spfs/src/error.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub enum Error {
6161
#[error(transparent)]
6262
Utf8Error(#[from] Utf8Error),
6363
#[error("Error communicating with the server: {0:?}")]
64-
Tonic(#[from] tonic::Status),
64+
Tonic(Box<tonic::Status>),
6565
#[error(transparent)]
6666
TokioJoinError(#[from] tokio::task::JoinError),
6767
#[error("Failed to spawn {0}")]
@@ -290,6 +290,12 @@ impl From<spfs_proto::digest::Error> for Error {
290290
}
291291
}
292292

293+
impl From<tonic::Status> for Error {
294+
fn from(value: tonic::Status) -> Self {
295+
Error::Tonic(Box::new(value))
296+
}
297+
}
298+
293299
/// An OS error represents an error that may have an associated
294300
/// error code from the operating system
295301
pub trait OsError {

crates/spfs/src/graph/layer.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ impl Layer {
122122
pub(super) fn digest_encode(&self, writer: &mut impl std::io::Write) -> Result<()> {
123123
// Includes any annotations regardless of the EncodingFormat setting
124124
let annotations = self.annotations();
125-
let result = if let Some(manifest_digest) = self.manifest() {
125+
if let Some(manifest_digest) = self.manifest() {
126126
let manifest_result =
127127
encoding::write_digest(&mut *writer, manifest_digest).map_err(Error::Encoding);
128128
for entry in annotations {
@@ -141,9 +141,7 @@ impl Layer {
141141
"Invalid Layer object for legacy encoding, it has no manifest or annotation data"
142142
.to_string(),
143143
))
144-
};
145-
146-
result
144+
}
147145
}
148146

149147
pub(super) fn legacy_encode(&self, writer: &mut impl std::io::Write) -> Result<()> {
@@ -153,15 +151,13 @@ impl Layer {
153151
"Invalid Layer object for legacy encoding, it has annotation data. Annotations are not supported with legacy encoding".to_string(),
154152
));
155153
}
156-
let result = if let Some(manifest_digest) = self.manifest() {
154+
if let Some(manifest_digest) = self.manifest() {
157155
encoding::write_digest(writer, manifest_digest).map_err(Error::Encoding)
158156
} else {
159157
Err(Error::String(
160158
"Invalid Layer object for legacy encoding, it has no manifest data".to_string(),
161159
))
162-
};
163-
164-
result
160+
}
165161
}
166162
}
167163

crates/spfs/src/resolve.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,7 @@ async fn render_via_subcommand(
7575
}
7676
_ => Err(Error::process_spawn_error(
7777
"spfs-render",
78-
std::io::Error::new(
79-
std::io::ErrorKind::Other,
80-
"process exited with non-zero status",
81-
),
78+
std::io::Error::other("process exited with non-zero status"),
8279
None,
8380
)),
8481
};

crates/spfs/src/server/payload.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,7 @@ where
211211
{
212212
// the stream must return io errors in order to be converted to a reader
213213
let mapped_stream = http_body_util::BodyDataStream::new(body)
214-
.map_err(|err| {
215-
std::io::Error::new(
216-
std::io::ErrorKind::Other,
217-
format!("Failed to read response body: {err:?}"),
218-
)
219-
})
214+
.map_err(|err| std::io::Error::other(format!("Failed to read response body: {err:?}")))
220215
.into_async_read();
221216
let stream_reader = tokio_util::compat::FuturesAsyncReadCompatExt::compat(mapped_stream);
222217
let buffered_reader = tokio::io::BufReader::new(stream_reader);

crates/spfs/src/storage/fs/renderer_unix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,5 +643,5 @@ where
643643
Ok(unsafe { tokio::fs::File::from_raw_fd(fd) })
644644
})
645645
.await
646-
.map_err(|_join_err| std::io::Error::new(std::io::ErrorKind::Other, "mkdir task panic'd"))?
646+
.map_err(|_join_err| std::io::Error::other("mkdir task panic'd"))?
647647
}

crates/spfs/src/storage/rpc/payload.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,7 @@ where
200200
{
201201
// the stream must return io errors in order to be converted to a reader
202202
let mapped_stream = http_body_util::BodyDataStream::new(body)
203-
.map_err(|err| {
204-
std::io::Error::new(
205-
std::io::ErrorKind::Other,
206-
format!("Failed to read response body: {err:?}"),
207-
)
208-
})
203+
.map_err(|err| std::io::Error::other(format!("Failed to read response body: {err:?}")))
209204
.into_async_read();
210205
let stream_reader = tokio_util::compat::FuturesAsyncReadCompatExt::compat(mapped_stream);
211206
let buffered_reader = tokio::io::BufReader::new(stream_reader);

crates/spk-build/src/build/binary_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ async fn test_build_bad_options() {
544544
assert!(
545545
matches!(
546546
res,
547-
Err(crate::Error::SpkSpecError(spk_schema::Error::String(_)))
547+
Err(crate::Error::SpkSpecError(ref schema_err)) if matches!(&**schema_err, spk_schema::Error::String(_))
548548
),
549549
"got {res:?}"
550550
);

0 commit comments

Comments
 (0)