Skip to content

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

Closed
@kpreid

Description

@kpreid

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-never_type`#![feature(never_type)]`P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions