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

type_length_limit is inconsistently warned about with incremental #87384

Open
illicitonion opened this issue Jul 22, 2021 · 4 comments
Open

type_length_limit is inconsistently warned about with incremental #87384

illicitonion opened this issue Jul 22, 2021 · 4 comments
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@illicitonion
Copy link

I have this library crate:

#![type_length_limit = "95595489"]

pub fn main() {
    println!("Hello, world!");
}

When I build it with 1.55.0-nightly (27277d966 2021-07-16) I get no warnings.

When I try to perform edition migrations with it by running cargo +nightly fix --edition, I get warnings:

   Migrating src/lib.rs from 2018 edition to 2021
warning: unused attribute
 --> src/lib.rs:1:1
  |
1 | #![type_length_limit = "95595489"]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_attributes)]` on by default

warning: crate-level attribute should be in the root module
 --> src/lib.rs:1:1
  |
1 | #![type_length_limit = "95595489"]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: 2 warnings emitted

As far as I know, this attribute is valid and has effect where it currently is, and either the 2021 edition migration is slightly broken, the 2021 edition has changed the behaviour of this attribute in a way I haven't seen documented.

rustc --version --verbose:

rustc 1.55.0-nightly (b41936b92 2021-07-20)
binary: rustc
commit-hash: b41936b92cd8463020207cb2f62a4247942ef2e4
commit-date: 2021-07-20
host: x86_64-apple-darwin
release: 1.55.0-nightly
LLVM version: 12.0.1
@illicitonion illicitonion added the C-bug Category: This is a bug. label Jul 22, 2021
@ehuss
Copy link
Contributor

ehuss commented Jul 22, 2021

Hm, this seems to be unrelated to the edition or migration stuff, but instead seems to be a problem with incremental. I'm able to reproduce by running this command twice:

rustc lib.rs --crate-name foo --crate-type lib -C incremental=incremental

I'll try to bisect.

@ehuss ehuss changed the title type_length_limit is inconsistently warned about with 2021 edition migration type_length_limit is inconsistently warned about with incremental Jul 22, 2021
@ehuss
Copy link
Contributor

ehuss commented Jul 22, 2021

Bisected to #86674, cc @Aaron1011.

@ehuss ehuss added the A-incr-comp Area: Incremental compilation label Jul 22, 2021
@Aaron1011
Copy link
Member

This is caused by a longstanding issue with incremental compilation - we use the global untracked state Session.used_attrs to emit these warnings. Since the limits query doesn't get re-run, the attributes that it marks as used will not get marked in the new compilation session.

As a short-term fix, we can mark the limits query as eval_always.

@stuhood
Copy link

stuhood commented Sep 21, 2021

Is a fix for this likely to make an upcoming release? It would be good not to need to skip incremental compilation.

@Noratrieb Noratrieb added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants