X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibsyntax%2Fast.rs;h=496be8b3eb23e93b22b0f51c9ed9366dcf8a8242;hb=e6115af4bd5f07024e0b73139e1dbcd68c96d9f7;hp=925178f86398fbe2fa524cd54b69d7735584cec2;hpb=efceda220e92f02f7a29a15e4cf56f5a3cdf1792;p=rust.git diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 925178f8639..f445def9e03 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -538,10 +538,16 @@ pub enum BindingMode { #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum RangeEnd { - Included, + Included(RangeSyntax), Excluded, } +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum RangeSyntax { + DotDotDot, + DotDotEq, +} + #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum PatKind { /// Represents a wildcard pattern (`_`) @@ -578,7 +584,7 @@ pub enum PatKind { Ref(P, Mutability), /// A literal Lit(P), - /// A range pattern, e.g. `1...2` or `1..2` + /// A range pattern, e.g. `1...2`, `1..=2` or `1..2` Range(P, P, RangeEnd), /// `[a, b, ..i, y, z]` is represented as: /// `PatKind::Slice(box [a, b], Some(i), box [y, z])` @@ -761,9 +767,9 @@ pub enum StmtKind { /// Expr without trailing semi-colon. Expr(P), - + /// Expr with a trailing semi-colon. Semi(P), - + /// Macro. Mac(P<(Mac, MacStmtStyle, ThinVec)>), } @@ -780,8 +786,6 @@ pub enum MacStmtStyle { NoBraces, } -// FIXME (pending discussion of #1697, #2178...): local should really be -// a refinement on pat. /// Local represents a `let` statement, e.g., `let : = ;` #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Local { @@ -810,6 +814,7 @@ pub struct Arm { pub pats: Vec>, pub guard: Option>, pub body: P, + pub beginning_vert: Option, // For RFC 1925 feature gate } #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] @@ -1220,7 +1225,8 @@ pub enum ImplItemKind { Macro(Mac), } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy, + PartialOrd, Ord)] pub enum IntTy { Is, I8, @@ -1273,7 +1279,8 @@ pub fn bit_width(&self) -> Option { } } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy, + PartialOrd, Ord)] pub enum UintTy { Us, U8, @@ -1323,7 +1330,8 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { } } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy, + PartialOrd, Ord)] pub enum FloatTy { F32, F64, @@ -1411,7 +1419,7 @@ pub enum TyKind { Path(Option, Path), /// A trait object type `Bound1 + Bound2 + Bound3` /// where `Bound` is a trait or a lifetime. - TraitObject(TyParamBounds), + TraitObject(TyParamBounds, TraitObjectSyntax), /// An `impl Bound1 + Bound2 + Bound3` type /// where `Bound` is a trait or a lifetime. ImplTrait(TyParamBounds), @@ -1430,6 +1438,13 @@ pub enum TyKind { Err, } +/// Syntax used to declare a trait object. +#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum TraitObjectSyntax { + Dyn, + None, +} + /// Inline assembly dialect. /// /// E.g. `"intel"` as in `asm!("mov eax, 2" : "={eax}"(result) : : : "intel")`` @@ -1917,7 +1932,7 @@ pub enum ItemKind { /// /// E.g. `trait Foo { .. }` or `trait Foo { .. }` Trait(Unsafety, Generics, TyParamBounds, Vec), - // Default trait implementation. + /// Auto trait implementation. /// /// E.g. `impl Trait for .. {}` or `impl Trait for .. {}` DefaultImpl(Unsafety, TraitRef),