Adding a comment next to #![feature(ptr_metadata,)] silences failing doctests · Issue #134221 · rust-lang/rust (original) (raw)

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