1818// - For each *immutable* static item, it checks that its **value**:
1919// - doesn't own owned, managed pointers
2020// - doesn't contain a struct literal or a call to an enum variant / struct constructor where
21- // - the type of the struct/enum is not freeze
2221// - the type of the struct/enum has a dtor
22+ //
23+ // Rules Enforced Elsewhere:
24+ // - It's not possible to take the address of a static item with unsafe interior. This is enforced
25+ // by borrowck::gather_loans
2326
2427use middle:: ty;
2528
@@ -121,21 +124,6 @@ impl<'a> Visitor<bool> for CheckStaticVisitor<'a> {
121124 self . tcx . sess . span_err ( e. span ,
122125 "static items are not allowed to have owned pointers" ) ;
123126 }
124- ast:: ExprProc ( ..) => {
125- self . report_error ( e. span ,
126- Some ( ~"immutable static items must be `Freeze `") ) ;
127- return ;
128- }
129- ast:: ExprAddrOf ( mutability, _) => {
130- match mutability {
131- ast:: MutMutable => {
132- self . report_error ( e. span ,
133- Some ( ~"immutable static items must be `Freeze `") ) ;
134- return ;
135- }
136- _ => { }
137- }
138- }
139127 _ => {
140128 let node_ty = ty:: node_id_to_type ( self . tcx , e. id ) ;
141129
@@ -147,11 +135,6 @@ impl<'a> Visitor<bool> for CheckStaticVisitor<'a> {
147135 Some ( ~"static items are not allowed to have destructors") ) ;
148136 return ;
149137 }
150- if Some ( did) == self . tcx . lang_items . no_freeze_bound ( ) {
151- self . report_error ( e. span ,
152- Some ( ~"immutable static items must be `Freeze `") ) ;
153- return ;
154- }
155138 }
156139 _ => { }
157140 }
0 commit comments