Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0f6537f

Browse files
committedDec 12, 2013
Gate literal box expressions in addition to types
Closes #10920
1 parent 1b12dca commit 0f6537f

File tree

90 files changed

+187
-16
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+187
-16
lines changed
 

‎src/librustc/front/feature_gate.rs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

188203
pub fn check_crate(sess: Session, crate: &ast::Crate) {

‎src/test/compile-fail/auto-ref-slice-plus-ref.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#[feature(managed_boxes)];
12+
1113
fn main() {
1214

1315
// Testing that method lookup does not automatically borrow

0 commit comments

Comments
 (0)
Please sign in to comment.