Skip to content

Commit f2b04ad

Browse files
committed
Merge branch 'alic/binding_lint' into 'master'
chore: Enable linting error for `bindings_with_variant_name` Reference for the lint: https://doc.rust-lang.org/beta/nightly-rustc/rustc_lint/builtin/static.BINDINGS_WITH_VARIANT_NAME.html This lint is currently only a warning on our current Rust version. I recommend turning it into an error. The failure can be quite nasty. Consider this example: ```Rust pub enum PayloadType { Summary, Data } // ... later somewhere let x = PayloadType::Data; match x { Summary => println!("summary"), Data => println!("data"), } ``` Now, in the ic repo, the above code will print "summary", because without the fully-qualified path, Summary is just a bound variable (instead of a sum type variant) **This lint is deny-by-default since Rust 1.68.2 ([this MR](rust-lang/rust#104154)), but we're still on an older version. That's why I suggest we enable it pro-actively.** See merge request dfinity-lab/public/ic!12636
2 parents 93684ff + 5cbef72 commit f2b04ad

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

.bazelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ build --incompatible_strict_action_env # use an environment with a static value
1919
# default to optimized and unstripped binaries.
2020
build --compilation_mode=opt
2121
build --@rules_rust//:extra_rustc_flags=-Cdebug-assertions=on
22+
build --@rules_rust//:extra_rustc_flag=-Dbindings_with_variant_name
2223
build --strip=never
2324

2425
build --strategy_regexp=ic-os/.*=local

0 commit comments

Comments
 (0)