Skip to content

Warning: target filter specified, but no targets matched; this is a no-op #15155

Open
@dtolnay

Description

Problem

In a crate that contains no examples, or for which every example has [[example]] doc-scrape-examples = false in Cargo.toml, running cargo +nightly rustdoc -Zrustdoc-scrape-examples --lib prints this mysterious warning.

Steps

# Cargo.toml

[package]
name = "repro"
edition = "2021"
// src/lib.rs (empty)

cargo +nightly rustdoc -Zrustdoc-scrape-examples --lib

warning: target filter specified, but no targets matched; this is a no-op
 Documenting repro v0.0.0
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.04s
   Generated target/doc/repro/index.html

Possible Solution(s)

A clearer warning that explains example scraping is enabled but the package contains no targets to scrape examples from.

Notes

No response

Version

cargo 1.86.0-nightly (0e3d73849 2025-02-01)
release: 1.86.0-nightly
commit-hash: 0e3d73849ab8cbbab3ec5c65cbd555586cb21339
commit-date: 2025-02-01
host: x86_64-unknown-linux-gnu
libgit2: 1.9.0 (sys:0.20.0 vendored)
libcurl: 8.9.0-DEV (sys:0.4.74+curl-8.9.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Ubuntu 24.4.0 (noble) [64-bit]

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugS-triageStatus: This issue is waiting on initial triage.Z-scrape-examplesNightly: rustdoc scrape examples

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions