rust-lang / rust-lang/rfcs

Conditional visibility: for integration testing purpose.

Open
#3,656 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Markdown
Stars
6.6k
Forks
1.7k
Avg merge
16h 14m
Merged PRs (30d)
1

Description

For integration testing purpose, it might be necessary to expose more API surface than usual. While it might be possible to directly add integration testing related support, it might be easier to add general purpose mechanism for this.

Strawman proposal:

#[cfg_vis(feature = "internals", pub)]
pub(crate) mod internal_api {
     #[cfg_vis(feature = "internals", pub)]
     pub(crate) fn foo() {
          todo!()
     }
}

or

pub (crate if cfg!(not(feature = "internals"))) mod internal_api {
     pub (crate if cfg!(not(feature = "internals"))) fn foo() {
          todo!()
     }
}

or even

#[cfg(feature = "internals")]
vis internals = pub;

#[cfg(not(feature = "internals"))]
vis internals = pub(crate);

pub(internals) mod internal_api {
     pub(internals) fn foo() {
          todo!()
     }
}

Related existing macro-based crates.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the proposed mechanisms with the existing visibility and cfg-vis crates linked in the issue. Determine whether conditional visibility belongs in Rust's language or compiler design, and document one agreed direction with its syntax, semantics, and integration-testing use case. Done means the proposal has a settled scope suitable for an RFC or follow-up implementation issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.