rust-lang / rust-lang/rust

[BUG] `llvm-cov` warning `mismatched data` when triple slash safety comment above `unsafe fn`

Open
#130,097 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-code-coverage A-LLVM C-bug S-has-mcve T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

bug

llvm-cov warning mismatched data when triple slash safety comment above unsafe fn

reproduce

https://github.com/loynoir/reproduce-rust-130097

pub use bar::Bar;

mod bar {
    pub struct Bar<T>(T);

    impl Bar<i32> {
        /// # Safety
        ///
        /// be careful
        pub const unsafe fn from_unchecked(value: i32) -> Self {
            Bar(value)
        }
    }
}

workaround

pub use bar::Bar;

mod bar {
    pub struct Bar<T>(T);

    impl Bar<i32> {
        pub const unsafe fn from_unchecked(value: i32) -> Self {
            Bar(value)
        }
    }
}

related

llvm-cov warning mismatched data when double slash comment above use

https://github.com/rust-lang/rust/issues/130065

Contributor guide

Open the contributing guide

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 running the linked reproduction and compare llvm-cov output for the code with and without the triple-slash safety comment; no source file or test is named in the issue. Review the related issue about a double-slash comment above use, then confirm the original example no longer produces a mismatched-data warning while retaining the safety comment.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.