Skip to content

Adding a comment next to #![feature(ptr_metadata,)] silences failing doctests #134221

Closed
@raldone01

Description

@raldone01

Reproduce

https://github.com/ink-feather-org/trait_cast_rs/tree/80a0a0994dfdbf5e8b6978879ce3205188401df1

1:

git clone https://github.com/ink-feather-org/trait_cast_rs.git
git checkout 80a0a0994dfdbf5e8b6978879ce3205188401df1
cargo test --all-features

All tests pass!

2:

Remove the comment in line 43 of the README.md:

#![feature(
  ptr_metadata, // <- Remove this comment
)]
use trait_cast_rs::{
  make_trait_castable, TraitcastableAny, TraitcastableAnyInfra, TraitcastableAnyInfraExt,
};
#[make_trait_castable(Print)]
struct Source(i32);
...

Next run the tests again:

cargo test --all-features

Oh no! The test fails with E0119.

What is going on?!? I did not expect the comment breaking anything.

Meta

rustc --version --verbose:

rustc 1.85.0-nightly (21fe748be 2024-12-11)
binary: rustc
commit-hash: 21fe748be15271ea5804e0507cd699b675efe038
commit-date: 2024-12-11
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-doctestsArea: Documentation tests, run by rustdocC-bugCategory: This is a bug.S-has-bisectionStatus: a bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions