Repository navigation
Conversation
|
Some changes occurred in src/tools/clippy cc @rust-lang/clippy Some changes occurred in src/tools/rustfmt cc @rust-lang/rustfmt Some changes occurred in compiler/rustc_passes/src/check_attr.rs cc @jdonszelmann, @JonathanBrouwer Some changes occurred in compiler/rustc_attr_parsing cc @jdonszelmann, @JonathanBrouwer rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead. cc @rust-lang/rust-analyzer Some changes occurred in compiler/rustc_hir/src/attrs |
|
r? @davidtwco rustbot has assigned @davidtwco. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Should have done r? @ghost |
Reference changesdiff --git a/src/attributes.md b/src/attributes.md
index 696e6184..5b75095a 100644
--- a/src/attributes.md
+++ b/src/attributes.md
@@ -240,7 +240,6 @@ The following is an index of all built-in attributes.
- [`link`] --- Specifies a native library to link with an `extern` block.
- [`link_name`] --- Specifies the name of the symbol for functions or statics in an `extern` block.
- [`link_ordinal`] --- Specifies the ordinal of the symbol for functions or statics in an `extern` block.
- - [`no_link`] --- Prevents linking an extern crate.
- [`repr`] --- Controls type layout.
- [`crate_type`] --- Specifies the type of crate (library, executable, etc.).
- [`no_main`] --- Disables emitting the `main` symbol.
@@ -323,7 +322,6 @@ The following is an index of all built-in attributes.
[`naked`]: attributes/codegen.md#the-naked-attribute
[`no_builtins`]: attributes/codegen.md#the-no_builtins-attribute
[`no_implicit_prelude`]: names/preludes.md#the-no_implicit_prelude-attribute
-[`no_link`]: items/extern-crates.md#the-no_link-attribute
[`no_main`]: crates-and-source-files.md#the-no_main-attribute
[`no_mangle`]: abi.md#the-no_mangle-attribute
[`no_std`]: names/preludes.md#the-no_std-attribute
diff --git a/src/items/extern-crates.md b/src/items/extern-crates.md
index ffad1d98..feb55409 100644
--- a/src/items/extern-crates.md
+++ b/src/items/extern-crates.md
@@ -59,40 +59,6 @@ An external crate dependency can be declared without binding its name in scope b
r[items.extern-crate.underscore.macro_use]
The [`macro_use` attribute] works as usual and imports the macro names into the [`macro_use` prelude].
-<!-- template:attributes -->
-r[items.extern-crate.no_link]
-## The `no_link` attribute
-
-r[items.extern-crate.no_link.intro]
-The *`no_link` [attribute][attributes]* may be applied to an `extern crate` item to prevent linking the crate.
-
-> [!NOTE]
-> This is helpful, e.g., when only the macros of a crate are needed.
-
-> [!EXAMPLE]
-> <!-- ignore: requires external crates -->
-> ```rust,ignore
-> #[no_link]
-> extern crate other_crate;
->
-> other_crate::some_macro!();
-> ```
-
-r[items.extern-crate.no_link.syntax]
-The `no_link` attribute uses the [MetaWord] syntax.
-
-r[items.extern-crate.no_link.allowed-positions]
-The `no_link` attribute may only be applied to an `extern crate` declaration.
-
-> [!NOTE]
-> `rustc` ignores use in other positions but lints against it. This may become an error in the future.
-
-r[items.extern-crate.no_link.duplicates]
-Only the first use of `no_link` on an `extern crate` declaration has effect.
-
-> [!NOTE]
-> `rustc` lints against any use following the first. This may become an error in the future.
-
[identifier]: ../identifiers.md
[RFC 940]: https://github.com/rust-lang/rfcs/blob/master/text/0940-hyphens-considered-harmful.md
[`macro_use` attribute]: ../macros-by-example.md#the-macro_use-attribute |
|
@bjorn3 mostly for my understanding - would this change need an MCP? |
|
I think it would need a lang FCP as this affects the language. It definitively needs a crater run if we want to go through with removing it. |
|
@bors try |
This comment has been minimized.
This comment has been minimized.
[DO NOT MERGE] Remove #[no_link] attribute
|
@craterbot check |
|
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
🎉 Experiment
Footnotes
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
8a562fd to
5c0445a
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Opened #164028 for the future incompat warning. Will leave this PR open for when we can remove it. |
5c0445a to
4c270d4
Compare
|
Some changes occurred in compiler/rustc_attr_ir |
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
☔ The latest upstream changes (presumably #165234) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
View all comments
This is a pre-1.0 attribute that accidentally got stabilized. It was meant for compiler plugins, not regular crates. #152854 (comment) It is also rather fragile. If you use any function defined inside a crate you import using #[no_link] it might or might not work depending on if another crate has a normal dependency on it, if the function is codegened cross-crate and if the call site is optimized out or not. As such I think it should be deprecated and eventually removed.
Fixes #152854
This PR is probably not something we can merge immediately, but should be enough for a crater run.