mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-01-10 08:18:00 -05:00
chore(hal,core): use core::{error::Error,format} instead of std
This allows `wgpu-hal` to be used in `no_std` environments, except that currently, only the `noop` backend supports `no_std`. In the future, `cfg(all(gles, webgl))` should also be `no_std`, but that requires further work. Co-Authored_by: Kevin Reid <kpreid@switchb.org>
This commit is contained in:
@@ -303,7 +303,7 @@ impl fmt::Display for DeviceMismatch {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for DeviceMismatch {}
|
||||
impl core::error::Error for DeviceMismatch {}
|
||||
|
||||
#[derive(Clone, Debug, Error)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use alloc::{boxed::Box, string::String, sync::Arc, vec::Vec};
|
||||
use core::fmt;
|
||||
use std::error::Error; // TODO(https://github.com/gfx-rs/wgpu/issues/6826): use core::error after MSRV bump
|
||||
use core::{error::Error, fmt};
|
||||
|
||||
use thiserror::Error;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
//! RenderDoc integration - <https://renderdoc.org/>
|
||||
#![cfg_attr(not(any(feature = "gles", feature = "vulkan")), allow(dead_code))]
|
||||
|
||||
use alloc::format;
|
||||
use alloc::string::String;
|
||||
use core::{ffi, ptr};
|
||||
|
||||
|
||||
@@ -240,8 +240,9 @@
|
||||
|
||||
extern crate alloc;
|
||||
extern crate wgpu_types as wgt;
|
||||
// TODO(https://github.com/gfx-rs/wgpu/issues/6826): disable std except on noop and gles-WebGL.
|
||||
// Requires Rust 1.81 for core::error::Error.
|
||||
// Each of these backends needs `std` in some fashion; usually `std::thread` functions.
|
||||
// TODO(https://github.com/gfx-rs/wgpu/issues/6826): gles-WebGL backend should be made no-std
|
||||
#[cfg(any(dx12, gles, metal, vulkan))]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
|
||||
@@ -290,12 +291,12 @@ use alloc::boxed::Box;
|
||||
use alloc::{borrow::Cow, string::String, sync::Arc, vec::Vec};
|
||||
use core::{
|
||||
borrow::Borrow,
|
||||
error::Error,
|
||||
fmt,
|
||||
num::NonZeroU32,
|
||||
ops::{Range, RangeInclusive},
|
||||
ptr::NonNull,
|
||||
};
|
||||
use std::error::Error; // TODO(https://github.com/gfx-rs/wgpu/issues/6826): use core::error after MSRV bump
|
||||
|
||||
use bitflags::bitflags;
|
||||
use parking_lot::Mutex;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use alloc::{boxed::Box, string::String, vec, vec::Vec};
|
||||
use core::fmt;
|
||||
use std::error; // TODO(https://github.com/gfx-rs/wgpu/issues/6826): use core::error after MSRV bump
|
||||
use core::{error, fmt};
|
||||
|
||||
use parking_lot::Mutex;
|
||||
use raw_window_handle::{HasDisplayHandle, HasWindowHandle};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use core::fmt;
|
||||
use std::error; // TODO(https://github.com/gfx-rs/wgpu/issues/6826): use core::error after MSRV bump
|
||||
use core::{error, fmt};
|
||||
use std::thread;
|
||||
|
||||
use crate::*;
|
||||
|
||||
Reference in New Issue
Block a user