Skip to content

beta regression: forbid(warnings) interacts poorly with common derives. #81218

Closed
@pnkfelix

Description

@pnkfelix

Spawned off of #80988, but specifically talking about forbid and derive interacting in a surprising manner.

Code

I tried this code (play):

#![forbid(warnings)]

#[derive(serde::Serialize)]
struct Bar;

I expected to see this happen: Successful diagnostic-free compile, just like what happens on stable 1.49 Rust

Instead, this happened:

error[E0453]: allow(non_upper_case_globals) incompatible with previous forbid
 --> src/lib.rs:3:10
  |
1 | #![forbid(warnings)]
  |           -------- `forbid` level set here
2 | 
3 | #[derive(serde::Serialize)]
  |          ^^^^^^^^^^^^^^^^ overruled by previous forbid
  |
  = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0453]: allow(unused_attributes) incompatible with previous forbid
 --> src/lib.rs:3:10
  |
1 | #![forbid(warnings)]
  |           -------- `forbid` level set here
2 | 
3 | #[derive(serde::Serialize)]
  |          ^^^^^^^^^^^^^^^^ overruled by previous forbid
  |
  = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0453]: allow(rust_2018_idioms) incompatible with previous forbid
 --> src/lib.rs:3:10
  |
1 | #![forbid(warnings)]
  |           -------- `forbid` level set here
2 | 
3 | #[derive(serde::Serialize)]
  |          ^^^^^^^^^^^^^^^^ overruled by previous forbid
  |
  = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0453]: allow(unused_macros) incompatible with previous forbid
 --> src/lib.rs:3:10
  |
1 | #![forbid(warnings)]
  |           -------- `forbid` level set here
2 | 
3 | #[derive(serde::Serialize)]
  |          ^^^^^^^^^^^^^^^^ overruled by previous forbid
  |
  = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 4 previous errors

Version it worked on

It most recently worked on: Rust 1.49

Version with regression

1.50.0-beta.6

@rustbot modify labels: +regression-from-stable-to-beta -regression-untriaged

Metadata

Metadata

Labels

P-highHigh priorityT-langRelevant to the language team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions