Compiler warning about dead code when enum is used in a match against return value of FFI call #85677
Labels
A-FFI
Area: Foreign function interface (FFI)
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
C-bug
Category: This is a bug.
L-dead_code
Lint: dead_code
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I tried this code:
link to example in Rust playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=c3d9e0b917bfabeebeb6285a4aa73a6d
I expected to see this happen: no warning about dead code, since ResultEnumFromC is created on the C side and used in a match on the Rust side.
Instead, this happened: Compiler complained about ResultEnumFromC never being constructed (which is true on the Rust side, but I wouldn't expect this since it's the result of an FFI call).
Meta
Happens on Rust playground on stable, beta and nightly.
rustc --version --verbose
:Backtrace
The text was updated successfully, but these errors were encountered: