Skip to content

Commit adac7a1

Browse files
committed
Allow unreachable_code for uncallable functions in WASM
1 parent 2c8f042 commit adac7a1

File tree

6 files changed

+18
-0
lines changed

6 files changed

+18
-0
lines changed

src/libstd/sys/cloudabi/shims/fs.rs

+3
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ pub fn rename(_old: &Path, _new: &Path) -> io::Result<()> {
251251
unsupported()
252252
}
253253

254+
// `FilePermissions` is uninhabited in CloudABI, so this function is
255+
// uncallable (but necessary for the public interface).
256+
#[allow(unreachable_code)]
254257
pub fn set_perm(_p: &Path, perm: FilePermissions) -> io::Result<()> {
255258
match perm.0 {}
256259
}

src/libstd/sys/cloudabi/shims/pipe.rs

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ impl AnonPipe {
1717
}
1818
}
1919

20+
// `AnonPipe` is uninhabited in CloudABI, so this function is
21+
// uncallable (but necessary for the public interface).
22+
#[allow(unreachable_code)]
2023
pub fn read2(p1: AnonPipe, _v1: &mut Vec<u8>, _p2: AnonPipe, _v2: &mut Vec<u8>) -> io::Result<()> {
2124
match p1.0 {}
2225
}

src/libstd/sys/sgx/fs.rs

+3
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ pub fn rename(_old: &Path, _new: &Path) -> io::Result<()> {
253253
unsupported()
254254
}
255255

256+
// `FilePermissions` is uninhabited in SGX, so this function is
257+
// uncallable (but necessary for the public interface).
258+
#[allow(unreachable_code)]
256259
pub fn set_perm(_p: &Path, perm: FilePermissions) -> io::Result<()> {
257260
match perm.0 {}
258261
}

src/libstd/sys/sgx/pipe.rs

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ impl AnonPipe {
1717
}
1818
}
1919

20+
// `AnonPipe` is uninhabited in SGX, so this function is
21+
// uncallable (but necessary for the public interface).
22+
#[allow(unreachable_code)]
2023
pub fn read2(p1: AnonPipe,
2124
_v1: &mut Vec<u8>,
2225
_p2: AnonPipe,

src/libstd/sys/wasm/fs.rs

+3
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ pub fn rename(_old: &Path, _new: &Path) -> io::Result<()> {
253253
unsupported()
254254
}
255255

256+
// `FilePermissions` is uninhabited in WASM, so this function is
257+
// uncallable (but necessary for the public interface).
258+
#[allow(unreachable_code)]
256259
pub fn set_perm(_p: &Path, perm: FilePermissions) -> io::Result<()> {
257260
match perm.0 {}
258261
}

src/libstd/sys/wasm/pipe.rs

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ impl AnonPipe {
1717
}
1818
}
1919

20+
// `AnonPipe` is uninhabited in WASM, so this function is
21+
// uncallable (but necessary for the public interface).
22+
#[allow(unreachable_code)]
2023
pub fn read2(p1: AnonPipe,
2124
_v1: &mut Vec<u8>,
2225
_p2: AnonPipe,

0 commit comments

Comments
 (0)