Skip to content

Commit 8e78cd9

Browse files
committed
Improve some comments.
1 parent 0ee976e commit 8e78cd9

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

crates/nvvm/src/lib.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub fn ir_version() -> (i32, i32) {
2121
let mut minor_ir = MaybeUninit::uninit();
2222
let mut major_dbg = MaybeUninit::uninit();
2323
let mut minor_dbg = MaybeUninit::uninit();
24-
// according to the docs this cant fail
24+
// according to the docs this can't fail
2525
let _ = nvvm_sys::nvvmIRVersion(
2626
major_ir.as_mut_ptr(),
2727
minor_ir.as_mut_ptr(),
@@ -39,7 +39,7 @@ pub fn dbg_version() -> (i32, i32) {
3939
let mut minor_ir = MaybeUninit::uninit();
4040
let mut major_dbg = MaybeUninit::uninit();
4141
let mut minor_dbg = MaybeUninit::uninit();
42-
// according to the docs this cant fail
42+
// according to the docs this can't fail
4343
let _ = nvvm_sys::nvvmIRVersion(
4444
major_ir.as_mut_ptr(),
4545
minor_ir.as_mut_ptr(),
@@ -55,12 +55,17 @@ pub fn nvvm_version() -> (i32, i32) {
5555
unsafe {
5656
let mut major = MaybeUninit::uninit();
5757
let mut minor = MaybeUninit::uninit();
58-
// according to the docs this cant fail
58+
// according to the docs this can't fail
5959
let _ = nvvm_sys::nvvmVersion(major.as_mut_ptr(), minor.as_mut_ptr());
6060
(major.assume_init(), minor.assume_init())
6161
}
6262
}
6363

64+
/// Rust version of `nvvmResult`.
65+
/// - `NVVM_SUCCESS` isn't covered because this type only covers the error cases, due to Rust
66+
/// having `Result` where the success case is separate from the error cases.
67+
/// - `NVVM_ERROR_INVALID_PROGRAM` isn't covered because it's not possible to get an invalid
68+
/// program handle through this safe api.
6469
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
6570
pub enum NvvmError {
6671
/// The NVVM compiler ran out of memory.
@@ -79,8 +84,6 @@ pub enum NvvmError {
7984
/// Compilation failed because of bad IR or other reasons. Getting the compiler
8085
/// log should yield more info.
8186
CompilationError,
82-
// InvalidProgram isnt handled because its not possible
83-
// to get an invalid program handle through this safe api
8487
}
8588

8689
impl Display for NvvmError {

0 commit comments

Comments
 (0)