Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
kpreid opened this issue Feb 1, 2024 · 5 comments · Fixed by #120552
Closed

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

kpreid opened this issue Feb 1, 2024 · 5 comments · Fixed by #120552
Labels
C-bug Category: This is a bug. F-never_type `#![feature(never_type)]` P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@kpreid
Copy link
Contributor

kpreid commented Feb 1, 2024

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 kpreid added the C-bug Category: This is a bug. label Feb 1, 2024
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. F-never_type `#![feature(never_type)]` requires-nightly This issue requires a nightly compiler in some way. labels Feb 1, 2024
@zachs18
Copy link
Contributor

zachs18 commented Feb 1, 2024

searched nightlies: from nightly-2023-11-11 to nightly-2024-02-01
regressed nightly: nightly-2024-01-27
searched commit range: 5bd5d21...e7bbe8c
regressed commit: 0c1fb2a

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 bdc9ce0) restored the error. cc @GuillaumeGomez

@GuillaumeGomez
Copy link
Member

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

@GuillaumeGomez
Copy link
Member

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

@fmease fmease added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Feb 1, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 1, 2024
…gate, r=compiler-errors

Correctly check `never_type` feature gating

Fixes rust-lang#120542.

The feature wasn't tested on return type of a generic function type, so it got under the radar in rust-lang#120316.

r? `@compiler-errors`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 1, 2024
…gate, r=compiler-errors

Correctly check `never_type` feature gating

Fixes rust-lang#120542.

The feature wasn't tested on return type of a generic function type, so it got under the radar in rust-lang#120316.

r? ``@compiler-errors``
@Noratrieb Noratrieb added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. and removed requires-nightly This issue requires a nightly compiler in some way. labels Feb 2, 2024
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Feb 2, 2024
@apiraino
Copy link
Contributor

apiraino commented Feb 2, 2024

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-high

@rustbot rustbot added P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Feb 2, 2024
@GuillaumeGomez
Copy link
Member

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

@bors bors closed this as completed in c2ad283 Feb 5, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Feb 5, 2024
Rollup merge of rust-lang#120552 - GuillaumeGomez:never-type-feature-gate, r=compiler-errors

Correctly check `never_type` feature gating

Fixes rust-lang#120542.

The feature wasn't tested on return type of a generic function type, so it got under the radar in rust-lang#120316.

r? ```@compiler-errors```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-never_type `#![feature(never_type)]` P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants