-
-
Notifications
You must be signed in to change notification settings - Fork 759
refactor: remove the encapsulation for rspack_fs::Error
#10942
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
Conversation
✅ Deploy Preview for rspack canceled.
|
rspack_fs::Error
rspack_fs::Error
📦 Binary Size-limit
❌ Size increased by 356.80MB from 59.52MB to 416.32MB (⬆️599.48%) |
CodSpeed Performance ReportMerging #10942 will not alter performanceComparing Summary
|
10127f0
to
cdb7592
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes the custom rspack_fs::Error
wrapper and uses std::io::Error
directly, simplifying error handling and aiming to reduce binary size. It updates all filesystem operations to propagate standard I/O errors, replaces to_fs_result
conversions with ?
, and integrates diagnostic conversions where appropriate.
- Exposed
std::io::Error
as the filesystem error type and removed the customError
enum. - Updated all
to_fs_result
calls to direct?
propagation and addedinto_diagnostic()
for richer error reports. - Refactored filesystem implementations (
native_fs
,memory_fs
, intermediate, core utilities) to align with the new error model.
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
packages/rspack-test-tools/package.json | Added a test-wasm script for WASM-based tests |
crates/rspack_storage/src/fs/error.rs | Switched FSError::inner to use std::io::Error directly |
crates/rspack_plugin_sri/src/html.rs | Added .into_diagnostic() on read_file |
crates/rspack_plugin_dll/src/lib_manifest_plugin.rs | Wrapped async filesystem calls with .into_diagnostic() |
crates/rspack_fs/src/native_fs.rs | Removed to_fs_result wrappers; propagate std::io::Error |
crates/rspack_fs/src/memory_fs.rs | Replaced custom error construction with Error::new |
crates/rspack_fs/src/lib.rs | Removed export of custom error types; aliased to std::io::Error |
crates/rspack_fs/src/intermediate.rs | Simplified UTF-8 error return to std::io::Error::other |
crates/rspack_fs/src/file_metadata.rs | Simplified metadata calls (modified()? , accessed()? ) |
crates/rspack_fs/src/error.rs | Replaced the Error enum with a type alias to std::io::Error |
crates/rspack_core/src/utils/fs_trim.rs | Changed try_match to return FsResult<bool> |
crates/rspack_core/src/resolver/boxfs.rs | Simplified ResolverFileSystem error mappings |
crates/rspack_core/src/compiler/mod.rs | Added .into_diagnostic() around various await calls |
Comments suppressed due to low confidence (3)
crates/rspack_fs/src/memory_fs.rs:243
- [nitpick] The error message is ungrammatical. Consider using "file does not exist" for clarity and proper tense.
_ => Err(Error::new(ErrorKind::NotFound, "file not exist")),
crates/rspack_fs/src/memory_fs.rs:255
- [nitpick] This error message could be improved to "file does not exist" to follow standard English usage.
None => Err(Error::new(ErrorKind::NotFound, "file not exist")),
crates/rspack_fs/src/intermediate.rs:25
- [nitpick] Consider capitalizing "UTF-8" and refining the message to "invalid UTF-8 line" for clarity.
Err(_) => Err(std::io::Error::other("invalid utf8 line")),
crates/rspack_fs/src/native_fs.rs
Outdated
@@ -80,43 +80,43 @@ impl WritableFileSystem for NativeFileSystem { | |||
impl WritableFileSystem for NativeFileSystem { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] There are two identical impl WritableFileSystem for NativeFileSystem
blocks in this file. Consider merging them into one implementation to reduce duplication.
Copilot uses AI. Check for mistakes.
f022f88
to
c9804a3
Compare
There could be some thing wrong with ci linux tools, which produce ~1MB larger artifact than the that in my pc with cross-compilation. But I have no time to investigate currently. UPDATE: it seems the ci use GLIBC with newer version |
Summary
rspack_fs::Error
contains onlystd::io::Error
for two years. So here considering remove the encapsulation.There could be some thing wrong with ci linux tools, which produce ~1MB larger artifact than the that in my pc with cross-compilation.
Checklist