about summary refs log tree commit diff
path: root/tests/ui-fulldeps/internal-lints/ty_tykind_usage.rs
blob: 91998a8ec450724bb6a788e9516c49e372e8d4ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//@ compile-flags: -Z unstable-options

#![feature(rustc_private)]

extern crate rustc_middle;
extern crate rustc_type_ir;

use rustc_middle::ty::{self, Ty, TyKind};
use rustc_type_ir::{Interner, TyKind as IrTyKind};

#[deny(rustc::usage_of_ty_tykind)]
fn main() {
    let kind = TyKind::Bool; //~ ERROR usage of `ty::TyKind::<kind>`

    match kind {
        TyKind::Bool => {},                 //~ ERROR usage of `ty::TyKind::<kind>`
        _ => {}
    }

    if let ty::Int(int_ty) = kind {}

    if let TyKind::Int(int_ty) = kind {} //~ ERROR usage of `ty::TyKind::<kind>`

    fn ty_kind(ty_bad: TyKind<'_>, ty_good: Ty<'_>) {} //~ ERROR usage of `ty::TyKind`

    fn ir_ty_kind<I: Interner>(bad: IrTyKind<I>) -> IrTyKind<I> {
        //~^ ERROR usage of `ty::TyKind`
        //~| ERROR usage of `ty::TyKind`
        IrTyKind::Bool //~ ERROR usage of `ty::TyKind::<kind>`
    }
}