ctest: Check public API in modules

Open
#5,365 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
rust
Domain
testing

Research direction

Start by reading ctest's existing crate-root API checking and inspect how items such as Struct and Const are represented. Trace how paths are currently handled, then verify that nested module paths can be checked and that the proposed ItemPath behavior is covered by tests or equivalent validation.

Written by the indexing model from the issue text.

Description

ctest

Currently ctest requires everything on the Rust side to be available at the crate root. We should check nested modules too, though, since we may have more in the future when things conflict.

I think this could be implemented by adding API to ctest like the following:

// Same for `Struct`, `Const`, etc
impl Struct {
    pub fn path() -> ItemPath;
}

pub struct ItemPath(BoxStr);

impl ItemPath {
    pub fn as_str(&self) -> &str {
        &self.0
    }

    pub fn components(&self) -> impl DoubleEndedIterator<Item = &str> {
        self.0.split("::")
    }
}

Cc @mbyx

Dominant language
Rust
Stars
2.6k
Forks
1.3k
Avg merge
2d 13h
Merged PRs (30d)
27

Getting set up

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.

More from rust-lang/libc

All issues in rust-lang/libc

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.