Skip to content

Commit

Permalink
Fixed references to static muts, removed stabilized features' gates.
Browse files Browse the repository at this point in the history
  • Loading branch information
rice7th committed Feb 27, 2024
1 parent 9f49058 commit 3464394
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions c-scape/src/errno_.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use alloc::borrow::ToOwned;
use alloc::format;
use core::cell::SyncUnsafeCell;
use core::ptr::{copy_nonoverlapping, null_mut};
use core::ptr::{addr_of_mut, copy_nonoverlapping, null_mut};
use libc::{c_char, c_int};

/// Return the address of the thread-local `errno` state.
Expand All @@ -15,7 +15,7 @@ unsafe extern "C" fn __errno_location() -> *mut c_int {

#[cfg_attr(feature = "thread", thread_local)]
static mut ERRNO: i32 = 0;
&mut ERRNO
addr_of_mut!(ERRNO)
}

#[no_mangle]
Expand Down
14 changes: 7 additions & 7 deletions c-scape/src/fs/xattr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use crate::{convert_res, READ_BUFFER};
use core::cmp::min;
use core::ffi::CStr;
use core::ptr::copy_nonoverlapping;
use core::ptr::{addr_of_mut, copy_nonoverlapping};
use core::slice;
use libc::{c_char, c_int, c_void, size_t, ssize_t};
use rustix::fd::BorrowedFd;
Expand All @@ -26,7 +26,7 @@ unsafe extern "C" fn getxattr(
match convert_res(rustix::fs::getxattr(
path,
name,
addr_of_mut!(READ_BUFFER[..min(len, READ_BUFFER.len())]),
&mut *addr_of_mut!(READ_BUFFER[..min(len, READ_BUFFER.len())]),
)) {
Some(size) => {
// If `size` is 0, `value` could be null.
Expand Down Expand Up @@ -56,7 +56,7 @@ unsafe extern "C" fn lgetxattr(
match convert_res(rustix::fs::lgetxattr(
path,
name,
addr_of_mut!(READ_BUFFER[..min(len, READ_BUFFER.len())]),
&mut *addr_of_mut!(READ_BUFFER[..min(len, READ_BUFFER.len())]),
)) {
Some(size) => {
// If `size` is 0, `value` could be null.
Expand Down Expand Up @@ -86,7 +86,7 @@ unsafe extern "C" fn fgetxattr(
match convert_res(rustix::fs::fgetxattr(
fd,
name,
addr_of_mut!(READ_BUFFER[..min(len, READ_BUFFER.len())]),
&mut *addr_of_mut!(READ_BUFFER[..min(len, READ_BUFFER.len())]),
)) {
Some(size) => {
// If `size` is 0, `value` could be null.
Expand Down Expand Up @@ -169,7 +169,7 @@ unsafe extern "C" fn listxattr(path: *const c_char, list: *mut c_char, len: size
// a slice, use a temporary copy.
match convert_res(rustix::fs::listxattr(
path,
addr_of_mut!(READ_BUFFER[..min(len, READ_BUFFER.len())]),
&mut *addr_of_mut!(READ_BUFFER[..min(len, READ_BUFFER.len())]),
)) {
Some(size) => {
// If `size` is 0, `value` could be null.
Expand All @@ -192,7 +192,7 @@ unsafe extern "C" fn llistxattr(path: *const c_char, list: *mut c_char, len: siz
// a slice, use a temporary copy.
match convert_res(rustix::fs::llistxattr(
path,
addr_of_mut!(READ_BUFFER[..min(len, READ_BUFFER.len())]),
&mut *addr_of_mut!(READ_BUFFER[..min(len, READ_BUFFER.len())]),
)) {
Some(size) => {
// If `size` is 0, `value` could be null.
Expand All @@ -215,7 +215,7 @@ unsafe extern "C" fn flistxattr(fd: c_int, list: *mut c_char, len: size_t) -> ss
// a slice, use a temporary copy.
match convert_res(rustix::fs::flistxattr(
fd,
addr_of_mut!([..min(len, READ_BUFFER.len())]),
&mut *addr_of_mut!(READ_BUFFER[..min(len, READ_BUFFER.len())]),
)) {
Some(size) => {
// If `size` is 0, `value` could be null.
Expand Down
1 change: 0 additions & 1 deletion c-scape/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#![feature(exposed_provenance)]
#![feature(inline_const)]
#![feature(sync_unsafe_cell)]
#![feature(ip_in_core)]
#![feature(linkage)]
#![deny(fuzzy_provenance_casts, lossy_provenance_casts)]

Expand Down
1 change: 0 additions & 1 deletion tests/example_crates.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Run the programs in the `example-crates` directory and compare their
//! outputs with expected outputs.

#![feature(cfg_target_abi)]

use std::sync::OnceLock;

Expand Down

0 comments on commit 3464394

Please sign in to comment.