@@ -27,7 +27,7 @@ pub trait region_scope {
2727pub enum empty_rscope { empty_rscope }
2828impl region_scope for empty_rscope {
2929 fn anon_region ( & self , _span : span ) -> Result < ty:: Region , ~str > {
30- Ok ( ty :: re_static )
30+ result :: Err ( ~"only the static region is allowed here" )
3131 }
3232 fn self_region ( & self , _span : span ) -> Result < ty:: Region , ~str > {
3333 result:: Err ( ~"only the static region is allowed here")
@@ -62,14 +62,14 @@ impl region_scope for MethodRscope {
6262pub enum type_rscope = Option < ty : : region_variance > ;
6363impl region_scope for type_rscope {
6464 fn anon_region ( & self , _span: span) -> Result <ty:: Region , ~str > {
65- // if the anon or self region is used, region parameterization should
65+ result:: Err ( ~"anonymous region types are not permitted here")
66+ }
67+ fn self_region( & self , _span: span) -> Result <ty:: Region , ~str > {
68+ // if the self region is used, region parameterization should
6669 // have inferred that this type is RP
6770 assert self. is_some ( ) ;
6871 result:: Ok ( ty:: re_bound ( ty:: br_self) )
6972 }
70- fn self_region( & self , span: span) -> Result <ty:: Region , ~str > {
71- self . anon_region ( span)
72- }
7373 fn named_region( & self , span: span, id: ast:: ident)
7474 -> Result <ty:: Region , ~str > {
7575 do empty_rscope. named_region ( span, id) . chain_err |_e| {
@@ -87,33 +87,6 @@ pub fn bound_self_region(rp: Option<ty::region_variance>)
8787 }
8888}
8989
90- pub struct anon_rscope { anon : ty:: Region , base : @region_scope }
91- pub fn in_anon_rscope < RS : region_scope + Copy + Durable > (
92- self : & RS ,
93- r : ty:: Region ) -> anon_rscope
94- {
95- let base = @( copy * self ) as @region_scope ;
96- anon_rscope { anon : r, base : base}
97- }
98- impl region_scope for anon_rscope {
99- fn anon_region ( & self ,
100- _span : span ) -> Result < ty:: Region , ~str >
101- {
102- result:: Ok ( self . anon )
103- }
104- fn self_region ( & self ,
105- span : span ) -> Result < ty:: Region , ~str >
106- {
107- self . base . self_region ( span)
108- }
109- fn named_region ( & self ,
110- span : span ,
111- id : ast:: ident ) -> Result < ty:: Region , ~str >
112- {
113- self . base . named_region ( span, id)
114- }
115- }
116-
11790pub struct binding_rscope {
11891 base : @region_scope ,
11992 anon_bindings : @mut uint ,
0 commit comments