|
| 1 | +//@ revisions: normal force |
| 2 | +//@ edition: 2024 |
| 3 | +//@ aux-crate: force_unstable=force_unstable.rs |
| 4 | +//@[force] compile-flags: -Zforce-unstable-if-unmarked |
| 5 | + |
| 6 | +#![feature(rustc_private)] |
| 7 | + |
| 8 | +// Regression test for <https://github.com/rust-lang/rust/issues/152692>. |
| 9 | +// |
| 10 | +// When building a crate with `-Zforce-unstable-if-unmarked` (e.g. the compiler or stdlib), |
| 11 | +// it's unhelpful to mention that a not-implemented trait is unstable, because that will |
| 12 | +// be true of every local and foreign trait that isn't explicitly marked stable. |
| 13 | + |
| 14 | +trait LocalTrait {} |
| 15 | + |
| 16 | +fn use_local_trait(_: impl LocalTrait) {} |
| 17 | +//~^ NOTE required by a bound in `use_local_trait` |
| 18 | +//~| NOTE required by this bound in `use_local_trait` |
| 19 | + |
| 20 | +fn use_foreign_trait(_: impl force_unstable::ForeignTrait) {} |
| 21 | +//~^ NOTE required by a bound in `use_foreign_trait` |
| 22 | +//~| NOTE required by this bound in `use_foreign_trait` |
| 23 | + |
| 24 | +fn main() { |
| 25 | + use_local_trait(()); |
| 26 | + //~^ ERROR the trait bound `(): LocalTrait` is not satisfied |
| 27 | + //[normal]~| NOTE the trait `LocalTrait` is not implemented for `()` |
| 28 | + //[force]~| NOTE the nightly-only, unstable trait `LocalTrait` is not implemented for `()` |
| 29 | + //~| NOTE required by a bound introduced by this call |
| 30 | + |
| 31 | + use_foreign_trait(()); |
| 32 | + //~^ ERROR the trait bound `(): ForeignTrait` is not satisfied |
| 33 | + //[normal]~| NOTE the nightly-only, unstable trait `ForeignTrait` is not implemented for `()` |
| 34 | + //[force]~| NOTE the nightly-only, unstable trait `ForeignTrait` is not implemented for `()` |
| 35 | + //~| NOTE required by a bound introduced by this call |
| 36 | +} |
0 commit comments