diff options
| author | varkor <github@varkor.com> | 2019-02-05 16:50:55 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2019-02-07 15:02:17 +0100 |
| commit | ea0d99829da705377b7b690062401f772f0babe8 (patch) | |
| tree | c9e0dcb2d39dc8ff020d0912ecb59e91b46f7560 /src/libsyntax | |
| parent | b4ef753e8f45a67f6756ad4c9103e0e327a1e078 (diff) | |
| download | rust-ea0d99829da705377b7b690062401f772f0babe8.tar.gz rust-ea0d99829da705377b7b690062401f772f0babe8.zip | |
Add resolution errors for const generics
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 57a3bf86b0e..ab3883d2b9b 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -307,6 +307,26 @@ impl GenericBound { pub type GenericBounds = Vec<GenericBound>; +/// Specifies the enforced ordering for generic parameters. In the future, +/// if we wanted to relax this order, we could override `PartialEq` and +/// `PartialOrd`, to allow the kinds to be unordered. +#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)] +pub enum ParamKindOrd { + Lifetime, + Type, + Const, +} + +impl fmt::Display for ParamKindOrd { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + ParamKindOrd::Lifetime => "lifetime".fmt(f), + ParamKindOrd::Type => "type".fmt(f), + ParamKindOrd::Const => "const".fmt(f), + } + } +} + #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub enum GenericParamKind { /// A lifetime definition (e.g., `'a: 'b + 'c + 'd`). |
