Skip to content

Commit

Permalink
Allow unreachable_code for uncallable functions in WASM
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Jan 3, 2019
1 parent 2c8f042 commit adac7a1
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libstd/sys/cloudabi/shims/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ pub fn rename(_old: &Path, _new: &Path) -> io::Result<()> {
unsupported()
}

// `FilePermissions` is uninhabited in CloudABI, so this function is
// uncallable (but necessary for the public interface).
#[allow(unreachable_code)]
pub fn set_perm(_p: &Path, perm: FilePermissions) -> io::Result<()> {
match perm.0 {}
}
Expand Down
3 changes: 3 additions & 0 deletions src/libstd/sys/cloudabi/shims/pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ impl AnonPipe {
}
}

// `AnonPipe` is uninhabited in CloudABI, so this function is
// uncallable (but necessary for the public interface).
#[allow(unreachable_code)]
pub fn read2(p1: AnonPipe, _v1: &mut Vec<u8>, _p2: AnonPipe, _v2: &mut Vec<u8>) -> io::Result<()> {
match p1.0 {}
}
3 changes: 3 additions & 0 deletions src/libstd/sys/sgx/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ pub fn rename(_old: &Path, _new: &Path) -> io::Result<()> {
unsupported()
}

// `FilePermissions` is uninhabited in SGX, so this function is
// uncallable (but necessary for the public interface).
#[allow(unreachable_code)]
pub fn set_perm(_p: &Path, perm: FilePermissions) -> io::Result<()> {
match perm.0 {}
}
Expand Down
3 changes: 3 additions & 0 deletions src/libstd/sys/sgx/pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ impl AnonPipe {
}
}

// `AnonPipe` is uninhabited in SGX, so this function is
// uncallable (but necessary for the public interface).
#[allow(unreachable_code)]
pub fn read2(p1: AnonPipe,
_v1: &mut Vec<u8>,
_p2: AnonPipe,
Expand Down
3 changes: 3 additions & 0 deletions src/libstd/sys/wasm/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ pub fn rename(_old: &Path, _new: &Path) -> io::Result<()> {
unsupported()
}

// `FilePermissions` is uninhabited in WASM, so this function is
// uncallable (but necessary for the public interface).
#[allow(unreachable_code)]
pub fn set_perm(_p: &Path, perm: FilePermissions) -> io::Result<()> {
match perm.0 {}
}
Expand Down
3 changes: 3 additions & 0 deletions src/libstd/sys/wasm/pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ impl AnonPipe {
}
}

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

0 comments on commit adac7a1

Please sign in to comment.