@@ -77,6 +77,14 @@ impl Context {
7777 }
7878 }
7979
80+ fn gate_box ( & self , span : Span ) {
81+ self . gate_feature ( "managed_boxes" , span,
82+ "The managed box syntax is being replaced by the \
83+ `std::gc::Gc` and `std::rc::Rc` types. Equivalent \
84+ functionality to managed trait objects will be \
85+ implemented but is currently missing.") ;
86+ }
87+
8088 fn has_feature ( & self , feature : & str ) -> bool {
8189 self . features . iter ( ) . any ( |n| n. as_slice ( ) == feature)
8290 }
@@ -172,17 +180,24 @@ impl Visitor<()> for Context {
172180 experimental and likely to be removed") ;
173181
174182 } ,
175- ast:: ty_box( _) => {
176- self . gate_feature ( "managed_boxes" , t. span ,
177- "The managed box syntax is being replaced by the `std::gc::Gc` \
178- and `std::rc::Rc` types. Equivalent functionality to managed \
179- trait objects will be implemented but is currently missing.") ;
180- }
183+ ast:: ty_box( _) => { self . gate_box ( t. span ) ; }
181184 _ => { }
182185 }
183186
184187 visit:: walk_ty ( self , t, ( ) ) ;
185188 }
189+
190+ fn visit_expr ( & mut self , e : @ast:: Expr , _: ( ) ) {
191+ match e. node {
192+ ast:: ExprUnary ( _, ast:: UnBox ( ..) , _) |
193+ ast:: ExprVstore ( _, ast:: ExprVstoreBox ) |
194+ ast:: ExprVstore ( _, ast:: ExprVstoreMutBox ) => {
195+ self . gate_box ( e. span ) ;
196+ }
197+ _ => { }
198+ }
199+ visit:: walk_expr ( self , e, ( ) ) ;
200+ }
186201}
187202
188203pub fn check_crate ( sess : Session , crate : & ast:: Crate ) {
0 commit comments