hir_ty/lower/
diagnostics.rs

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
32
33
34
35
36
//! This files contains the declaration of diagnostics kinds for ty and path lowering.

use either::Either;
use hir_def::type_ref::TypeRefId;

type TypeSource = Either<TypeRefId, hir_def::type_ref::TypeSource>;

#[derive(Debug, PartialEq, Eq, Clone)]
pub struct TyLoweringDiagnostic {
    pub source: TypeSource,
    pub kind: TyLoweringDiagnosticKind,
}

#[derive(Debug, PartialEq, Eq, Clone)]
pub enum TyLoweringDiagnosticKind {
    PathDiagnostic(PathLoweringDiagnostic),
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum GenericArgsProhibitedReason {
    Module,
    TyParam,
    SelfTy,
    PrimitiveTy,
    Const,
    Static,
    /// When there is a generic enum, within the expression `Enum::Variant`,
    /// either `Enum` or `Variant` are allowed to have generic arguments, but not both.
    // FIXME: This is not used now but it should be.
    EnumVariant,
}

#[derive(Debug, PartialEq, Eq, Clone)]
pub enum PathLoweringDiagnostic {
    GenericArgsProhibited { segment: u32, reason: GenericArgsProhibitedReason },
}