Add a small part of the real rust std

This commit is contained in:
2026-03-17 20:13:39 +01:00
parent 56a00d0403
commit 56ad115e58
18 changed files with 3005 additions and 1671 deletions

View File

@@ -12,7 +12,7 @@ impl IoBase for Stdin {
}
impl Read for Stdin {
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error> {
fn read(&mut self, buf: &mut [u8]) -> core::result::Result<usize, Self::Error> {
unsafe { File::from_raw_fd(0).read(buf) }
}
}
@@ -20,3 +20,20 @@ impl Read for Stdin {
pub fn stdin() -> Stdin {
Stdin
}
pub type Result<T> = core::result::Result<T, ()>;
pub(super) struct Repr();
// Part took from the real std
#[rustc_macro_transparency = "semiopaque"]
#[unstable(feature = "io_const_error", issue = "133448")]
#[allow_internal_unstable(hint_must_use, io_const_error_internals)]
pub macro const_error($kind:expr, $message:expr $(,)?) {
()
}
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Error {
repr: Repr,
}