librustc: Implement the syntax in the RFC for unboxed closure sugar.
Part of issue #16640. I am leaving this issue open to handle parsing of higher-rank lifetimes in traits. This change breaks code that used unboxed closures: * Instead of `F:|&: int| -> int`, write `F:Fn(int) -> int`. * Instead of `F:|&mut: int| -> int`, write `F:FnMut(int) -> int`. * Instead of `F:|: int| -> int`, write `F:FnOnce(int) -> int`. [breaking-change]
This commit is contained in:
@@ -213,12 +213,19 @@ pub static DUMMY_NODE_ID: NodeId = -1;
|
||||
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
|
||||
pub enum TyParamBound {
|
||||
TraitTyParamBound(TraitRef),
|
||||
UnboxedFnTyParamBound(UnboxedFnTy),
|
||||
UnboxedFnTyParamBound(P<UnboxedFnBound>),
|
||||
RegionTyParamBound(Lifetime)
|
||||
}
|
||||
|
||||
pub type TyParamBounds = OwnedSlice<TyParamBound>;
|
||||
|
||||
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
|
||||
pub struct UnboxedFnBound {
|
||||
pub path: Path,
|
||||
pub decl: P<FnDecl>,
|
||||
pub ref_id: NodeId,
|
||||
}
|
||||
|
||||
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
|
||||
pub struct TyParam {
|
||||
pub ident: Ident,
|
||||
|
||||
Reference in New Issue
Block a user