rust icon indicating copy to clipboard operation
rust copied to clipboard

No feature gate error for `-> !` used in a trait bound

Open kpreid opened this issue 1 year ago • 5 comments

I tried this code:

pub fn look_ma_no_feature_gate<F: FnOnce() -> !>() {}

I expected to see this happen: “error[E0658]: the ! type is experimental”

Instead, this happened: Successful compilation, as long as I'm using a nightly compiler, but the error when on stable 1.75.

This is incorrect because nightly features should always require #![feature] attributes on nightly (until they're stabilized, which hasn't happened yet for !).

Meta

rustc --version --verbose:

rustc 1.77.0-nightly (11f32b73e 2024-01-31)
binary: rustc
commit-hash: 11f32b73e0dc9287e305b5b9980d24aecdc8c17f
commit-date: 2024-01-31
host: x86_64-apple-darwin
release: 1.77.0-nightly
LLVM version: 17.0.6

@rustbot label +F-never_type +requires-nightly

kpreid avatar Feb 01 '24 02:02 kpreid

searched nightlies: from nightly-2023-11-11 to nightly-2024-02-01 regressed nightly: nightly-2024-01-27 searched commit range: https://github.com/rust-lang/rust/compare/5bd5d214effd494f4bafb29b3a7a2f6c2070ca5c...e7bbe8ce933123a8e327c79e38bcb790595e6a65 regressed commit: https://github.com/rust-lang/rust/commit/0c1fb2a1e65a57073dc62dd502319a00cf753371

bisected with cargo-bisect-rustc v0.6.5

Host triple: x86_64-unknown-linux-gnu Reproduce with:

cargo bisect-rustc --start=1.75.0 --regress success --preserve 

Then, bisecting --by-commit

cargo bisect-rustc --start=2024-01-26 --end=2024-01-28 --regress success --by-commit

// snip
Regression in https://github.com/rust-lang-ci/rust/commit/4ff2132472c2ba0d56552559c520fe9b4b8384e0
The PR introducing the regression in this rollup is #120316: Don't call `walk_` functions directly if there is an equiva…

Manually verified that reverting #120316 (as bdc9ce0d95a26eeec987d95c02c43616cf4227c1) restored the error. cc @GuillaumeGomez

zachs18 avatar Feb 01 '24 03:02 zachs18

Not sure to understand why fixing the visitor implementation introduced this bug. Maybe it highlighted a limitation? Gonna check.

GuillaumeGomez avatar Feb 01 '24 11:02 GuillaumeGomez

Ok I think I know why: implementation of the visit_* not calling the equivalent walk_ function. Checking where it is used.

GuillaumeGomez avatar Feb 01 '24 12:02 GuillaumeGomez

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-high

apiraino avatar Feb 02 '24 15:02 apiraino

Fix was already approved in #120552. Waiting for CI to be unlocked.

GuillaumeGomez avatar Feb 02 '24 15:02 GuillaumeGomez