Skip to content

Add new unstable attribute: #[export_visibility = ...].#151431

Open
anforowicz wants to merge 1 commit intorust-lang:mainfrom
anforowicz:export-visibility
Open

Add new unstable attribute: #[export_visibility = ...].#151431
anforowicz wants to merge 1 commit intorust-lang:mainfrom
anforowicz:export-visibility

Conversation

@anforowicz
Copy link
Contributor

This PR is an implementation of the RFC tracked in #151425

@rustbot
Copy link
Collaborator

rustbot commented Jan 20, 2026

Some changes occurred in compiler/rustc_hir/src/attrs

cc @jdonszelmann, @JonathanBrouwer

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

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 20, 2026
@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jan 20, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 20, 2026

r? @chenyukang

rustbot has assigned @chenyukang.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@Kivooeo
Copy link
Member

Kivooeo commented Jan 20, 2026

i had a quick look, mostly looks good, but i'd like to maybe @JonathanBrouwer take a look on this as well, i may overlooked something

r? JonathanBrouwer

@JonathanBrouwer
Copy link
Contributor

Would like to take a look, will do so tomorrow :)

@rust-bors

This comment has been minimized.

Copy link
Contributor

@JonathanBrouwer JonathanBrouwer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor questions, looks good on a high level :)

View changes since this review

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 21, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 21, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot

This comment has been minimized.

@rustbot rustbot added the A-run-make Area: port run-make Makefiles to rmake.rs label Jan 27, 2026
@anforowicz anforowicz force-pushed the export-visibility branch 3 times, most recently from 88ddd87 to a741ebc Compare January 27, 2026 22:55
@rust-bors

This comment has been minimized.

@rustbot

This comment has been minimized.

@tgross35
Copy link
Contributor

tgross35 commented Feb 4, 2026

I believe that should be reserved for approving reviews. Like Reviewed-bys have to be explicitly given by the reviewer since it kind of indicates they (at least partially) stand behind the change. Would be nice if bors did some auto handling here, like collecting checkmarks to r=.

No need for credit for drive by reviews, thank you for the thought though :)

@JonathanBrouwer
Copy link
Contributor

Ah, then only r=me :)
Thanks for explaining

@rust-bors

This comment has been minimized.

@anforowicz
Copy link
Contributor Author

Thanks for all the review feedback @JonathanBrouwer and @tgross35!

Looks good to me.

@anforowicz You mentioned that "This PR is not yet ready for a re-review", is this fixed now?

It seems fixed now - the automated checks for this PR are green.

FWIW I am still having trouble testing this PR locally, but maybe this shouldn't block merging the PR. The trouble I am experiencing is that after rebasing I am getting (unrelated, also repro-able at origin/master) errors like:

$ ./x.py build
Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.10s
/usr/local/google/home/lukasza/src/github/rust/build/x86_64-unknown-linux-gnu/ci-llvm/bin/llvm-strip does not exist; skipping copy
Building stage1 compiler artifacts (stage0 -> stage1, x86_64-unknown-linux-gnu)
   Compiling rustc_driver v0.0.0 (/usr/local/google/home/lukasza/src/github/rust/compiler/rustc_driver)
error: linking with `cc` failed: exit status: 1
...
          rust-lld: error: relocation refers to a discarded section: .text._ZNK4llvm11raw_ostream12is_displayedEv
          >>> defined in /usr/local/google/home/lukasza/src/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_codegen_llvm-3bdf55b058d5a716.rlib(ef10e86dc40538c1-CoverageMappingWrapper.o)
          >>> referenced by CoverageMappingWrapper.cpp
          >>>               ef10e86dc40538c1-CoverageMappingWrapper.o:(.sframe+0x30) in archive /usr/local/google/home/lukasza/src/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_codegen_llvm-3bdf55b058d5a716.rlib
...

@anforowicz
Copy link
Contributor Author

trouble testing this PR locally [...] after rebasing

I started from scratch (git rm rust and git clone ...) but I still experience the same error... :-( Maybe I should try bisecting.

☔ The latest upstream changes (presumably #152104) made this pull request unmergeable. Please resolve the merge conflicts.

FWIW I have (blindly, without rebuilding/testing locally) rebased again and pushed the new commit.

@rustbot

This comment has been minimized.

@zmodem
Copy link
Contributor

zmodem commented Feb 4, 2026

$ ./x.py build
[...] referenced by CoverageMappingWrapper.cpp
          >>>               ef10e86dc40538c1-CoverageMappingWrapper.o:(.sframe+0x30)

I hit the same issue earlier this week. The reason is the my system GCC got upgraded to a version that enables sframes by default, which lld does not support, causing these linker errors.

I worked around it by building with CXX=clang++ ./x.py build.

@JonathanBrouwer
Copy link
Contributor

@bors r+ rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 4, 2026

📌 Commit 7fa9d42 has been approved by JonathanBrouwer

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 4, 2026
@anforowicz
Copy link
Contributor Author

$ ./x.py build
[...] referenced by CoverageMappingWrapper.cpp
          >>>               ef10e86dc40538c1-CoverageMappingWrapper.o:(.sframe+0x30)

I hit the same issue earlier this week. The reason is the my system GCC got upgraded to a version that enables sframes by default, which lld does not support, causing these linker errors.

I worked around it by building with CXX=clang++ ./x.py build.

Thanks for chiming in. It's quite possible that we are experiencing the same issue. OTOH, when running CXX=clang++ ./x.py build I get: '-Werror=unguarded-availability-new': no option '-Wunguarded-availability-new', so this workaround doesn't seem to help on my machine.

@JonathanBrouwer
Copy link
Contributor

Actually @bors rollup=iffy
Since this adds a new linker attribute and a few tests for this, and these tend to unexpectedly fail on other targets

Zalathar added a commit to Zalathar/rust that referenced this pull request Feb 5, 2026
…nathanBrouwer

Add new unstable attribute: `#[export_visibility = ...]`.

This PR is an implementation of the RFC tracked in rust-lang#151425
rust-bors bot pushed a commit that referenced this pull request Feb 5, 2026
Rollup of 15 pull requests

Successful merges:

 - #151431 (Add new unstable attribute: `#[export_visibility = ...]`.)
 - #146900 (Add avr_target_feature)
 - #152033 (Rename trait `DepNodeParams` to `DepNodeKey`)
 - #152142 (Convert to inline diagnostics in `rustc_hir_typeck`)
 - #152020 (Remove dummy loads on offload codegen)
 - #152023 (Some `rustc_query_system` cleanups)
 - #152068 (Convert to inline diagnostics in `rustc_resolve`)
 - #152081 (Port depgraph testing attributes to parser)
 - #152090 (Port reexport_test_harness_main to attr parser)
 - #152105 (Convert to inline diagnostics in `rustc_ast_lowering`)
 - #152108 (Convert to inline diagnostics in `rustc_expand`)
 - #152114 (Convert to inline diagnostics in `rustc_mir_transform`)
 - #152115 (Convert to inline diagnostics in `rustc_metadata`)
 - #152116 (Remove rustdoc GUI flaky test)
 - #152128 (Adopt matches-logical-or-141497.rs to LLVM HEAD)

Failed merges:

 - #152070 (Convert to inline diagnostics in `rustc_pattern_analysis`)
 - #152106 (Convert to inline diagnostics in `rustc_ast_passes`)
 - #152109 (Convert to inline diagnostics in `rustc_errors`)
 - #152117 (Convert to inline diagnostics in `rustc_trait_selection`)
 - #152118 (Convert to inline diagnostics in `rustc_codegen_ssa`)
 - #152119 (Convert to inline diagnostics in `rustc_middle`)
 - #152126 (Convert to inline diagnostics in `rustc_mir_build`)
 - #152131 (Port rustc_no_implicit_bounds attribute to parser.)
@Zalathar
Copy link
Member

Zalathar commented Feb 5, 2026

Failed in rollup in test-various: #152144 (comment)

@bors r-

@rust-bors rust-bors bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 5, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 5, 2026

Commit 7fa9d42 has been unapproved.

This PR was contained in a rollup (#152144), which was also unapproved.

@rust-bors

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Feb 5, 2026

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.

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
REPOSITORY                                   TAG       IMAGE ID       CREATED       SIZE
ghcr.io/dependabot/dependabot-updater-core   latest    bcec0b4e062b   10 days ago   783MB
=> Removing docker images...
Deleted Images:
untagged: ghcr.io/dependabot/dependabot-updater-core:latest
untagged: ghcr.io/dependabot/dependabot-updater-core@sha256:b662be51f7b8ef7e2c8464428f14e49cb79c36aa9afb7ecb9221dfe0f507050c
deleted: sha256:bcec0b4e062b5ffe11cc1c2729558c0cd96621c0271ab5e97ff3a56e0c25045a
deleted: sha256:64e147d5e54d9be8b8aa322e511cda02296eda4b8b8d063c6a314833aca50e29
deleted: sha256:5cba409bb463f4e7fa1a19f695450170422582c1bc7c0e934d893b4e5f558bc6
deleted: sha256:cddc6ebd344b0111eaab170ead1dfda24acdfe865ed8a12599a34d338fa8e28b
deleted: sha256:2412c3f334d79134573cd45e657fb6cc0abd75bef3881458b0d498d936545c8d
---
tests/ui/double_parens.rs ... ok
tests/ui/drain_collect.fixed ... ok
tests/ui/duplicate_underscore_argument.rs ... ok
tests/ui/duplicated_attributes.rs ... ok
tests/ui/duration_suboptimal_units.rs ... ok
tests/ui/duration_suboptimal_units_days_weeks.rs ... ok
tests/ui/duration_subsec.rs ... ok
tests/ui/double_parens.fixed ... ok
tests/ui/duration_suboptimal_units_days_weeks.fixed ... ok
tests/ui/duration_suboptimal_units.fixed ... ok
tests/ui/duration_subsec.fixed ... ok
tests/ui/else_if_without_else.rs ... ok
tests/ui/eager_transmute.rs ... ok
tests/ui/elidable_lifetime_names.rs ... ok
tests/ui/empty_docs.rs ... ok
---
..............................................     (146/146)

======== tests/rustdoc-gui/search-filter.goml ========

[ERROR] line 48: Error: The CSS selector "#search-tabs .count.loading" still exists: for command `wait-for-false: "#search-tabs .count.loading"`
    at <file:///checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/doc/test_docs/index.html?search=test>

======== tests/rustdoc-gui/search-result-display.goml ========

[WARNING] line 39: Delta is 0 for "x", maybe try to use `compare-elements-position` instead?

@anforowicz
Copy link
Contributor Author

The failure in the x86_64-gnu-tools job (e.g. https://github.com/rust-lang/rust/actions/runs/21730699234/job/62684356625 and https://triage.rust-lang.org/gha-logs/rust-lang/rust/62684356625) seems unrelated to this PR:

======== tests/rustdoc-gui/search-filter.goml ========
[ERROR] line 48: Error: The CSS selector "#search-tabs .count.loading" still exists: for command `wait-for-false: "#search-tabs .count.loading"`
    at <file:///checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/doc/test_docs/index.html?search=test>
======== tests/rustdoc-gui/search-result-display.goml ========
[WARNING] line 39: Delta is 0 for "x", maybe try to use `compare-elements-position` instead?
<= doc-ui tests done: 145 succeeded, 1 failed, 0 filtered out

@chenyukang
Copy link
Member

The failure in the x86_64-gnu-tools job (e.g. https://github.com/rust-lang/rust/actions/runs/21730699234/job/62684356625 and https://triage.rust-lang.org/gha-logs/rust-lang/rust/62684356625) seems unrelated to this PR:

======== tests/rustdoc-gui/search-filter.goml ========
[ERROR] line 48: Error: The CSS selector "#search-tabs .count.loading" still exists: for command `wait-for-false: "#search-tabs .count.loading"`
    at <file:///checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/doc/test_docs/index.html?search=test>
======== tests/rustdoc-gui/search-result-display.goml ========
[WARNING] line 39: Delta is 0 for "x", maybe try to use `compare-elements-position` instead?
<= doc-ui tests done: 145 succeeded, 1 failed, 0 filtered out

yes, all PR failed for this CI error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants