Skip to content

Tracking Issue for future-incompatibility lint no_link_attr_used #164032

Open

Description

@bjorn3

This is the tracking issue for the no_link_attr_used future-compatibility warning and other related errors. The goal of this page is to describe why this change was made and how you can fix code that is affected by it. It also provides a place to ask questions or register a complaint if you feel the change should not be made. For more information on the policy around future-compatibility warnings, see our breaking change policy guidelines.

What is the warning for?

Usage of the #[no_link] attribute.

Why was this change made?

This is a pre-1.0 attribute that accidentally got stabilized. It was only meant for compiler plugins which we no longer support, not for regular crates. It is rather fragile and can easily lead to linker errors depending on where rustc decides to codegen functions and statics, which varies between rustc versions. It might also be unsound if a crate for example expects a global constructor it defined to run. Using it doesn't have an effect on the size of the produced binaries except when it defines a #[used] static given that we remove all unused functions and statics at link time already.

Example

#[no_link]
extern crate foo;

Recommendations

Remove the #[no_link] attribute.

When will this warning become a hard error?

Possibly in a couple of releases given that a crater run showed barely any usage.

Steps

  • Implement the lint
  • Raise lint level to deny
  • Change the lint to report in dependencies
  • Switch to a hard error

Implementation history

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 9, 2026
  2. added
    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
    A-linkersArea: linkers... you gotta love linkers
    A-attributesArea: Attributes (`#[…]`, `#![…]`)
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-attributesArea: Attributes (`#[…]`, `#![…]`)A-linkersArea: linkers... you gotta love linkersC-future-incompatibilityCategory: Future-incompatibility lintsC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-langRelevant to the language team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions