Skip to content

Commit

Permalink
rust/src/lib.rs: affirm a deliberate choice triggering a warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
dot-asm committed Jul 29, 2024
1 parent 9470787 commit b6d05c4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

#![allow(unexpected_cfgs)]

This comment has been minimized.

Copy link
@nazar-pc

nazar-pc Sep 15, 2024

You're supposed to define features in Cargo.toml, not in build.rs, then you'll not have to suppress warnings here. Users of the library should specify that they want cuda feature and then build.rs will either succeed in compiling software with cuda support or compilation will fail.

It is both surprising and confusing for Rust developers when features exist, but not defined in Cargo.toml. Users don't expect CUDA support unless they enable the feature, even if compiler happens to be present on the machine. Enabling it anyway unless user overrides NVCC environment variable with something broken it just backwards.


// Declare C/C++ counterpart as following:
// extern "C" { fn foobar(...) -> sppark::Error; }
#[repr(C)]
Expand Down

0 comments on commit b6d05c4

Please sign in to comment.