Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore intentional unconstructed struct in ui test helper crate #48

Merged
merged 1 commit into from
Jun 8, 2024

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Jun 8, 2024

The point of this struct is testing what happens if #[ref_cast_custom] is not used from the same crate as the derive(RefCastCustom) struct.

use ref_cast::ref_cast_custom;
use ref_cast_test_suite::Struct;
#[ref_cast_custom]
fn ref_cast(s: &str) -> &Struct;

error[E0639]: cannot create non-exhaustive struct using struct expression
--> tests/ui/cross-crate.rs:5:32
|
5 | fn ref_cast(s: &str) -> &Struct;
| ^

Since rust-lang/rust#125572, it has started producing a new dead_code warning.

warning: struct `Struct` is never constructed
 --> tests/helper/lib.rs:5:12
  |
5 | pub struct Struct(#[allow(dead_code)] str);
  |            ^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

The point of this struct is testing what happens if `#[ref_cast_custom]`
is not used from the same crate as the `derive(RefCastCustom)` struct.

    warning: struct `Struct` is never constructed
     --> tests/helper/lib.rs:5:12
      |
    5 | pub struct Struct(#[allow(dead_code)] str);
      |            ^^^^^^
      |
      = note: `#[warn(dead_code)]` on by default
@dtolnay dtolnay merged commit 0668621 into master Jun 8, 2024
19 checks passed
@dtolnay dtolnay deleted the deadcode branch June 8, 2024 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant