@@ -24,9 +24,9 @@ use crate::fluent_generated as fluent;
24
24
use crate :: {
25
25
errors:: BuiltinEllipsisInclusiveRangePatterns ,
26
26
lints:: {
27
- BuiltinAnonymousParams , BuiltinBoxPointers , BuiltinConstNoMangle ,
28
- BuiltinDeprecatedAttrLink , BuiltinDeprecatedAttrLinkSuggestion , BuiltinDeprecatedAttrUsed ,
29
- BuiltinDerefNullptr , BuiltinEllipsisInclusiveRangePatternsLint , BuiltinExplicitOutlives ,
27
+ BuiltinAnonymousParams , BuiltinConstNoMangle , BuiltinDeprecatedAttrLink ,
28
+ BuiltinDeprecatedAttrLinkSuggestion , BuiltinDeprecatedAttrUsed , BuiltinDerefNullptr ,
29
+ BuiltinEllipsisInclusiveRangePatternsLint , BuiltinExplicitOutlives ,
30
30
BuiltinExplicitOutlivesSuggestion , BuiltinFeatureIssueNote , BuiltinIncompleteFeatures ,
31
31
BuiltinIncompleteFeaturesHelp , BuiltinInternalFeatures , BuiltinKeywordIdents ,
32
32
BuiltinMissingCopyImpl , BuiltinMissingDebugImpl , BuiltinMissingDoc ,
@@ -56,7 +56,6 @@ use rustc_middle::bug;
56
56
use rustc_middle:: lint:: in_external_macro;
57
57
use rustc_middle:: ty:: layout:: LayoutOf ;
58
58
use rustc_middle:: ty:: print:: with_no_trimmed_paths;
59
- use rustc_middle:: ty:: GenericArgKind ;
60
59
use rustc_middle:: ty:: TypeVisitableExt ;
61
60
use rustc_middle:: ty:: Upcast ;
62
61
use rustc_middle:: ty:: { self , Ty , TyCtxt , VariantDef } ;
@@ -134,80 +133,6 @@ impl EarlyLintPass for WhileTrue {
134
133
}
135
134
}
136
135
137
- declare_lint ! {
138
- /// The `box_pointers` lints use of the Box type.
139
- ///
140
- /// ### Example
141
- ///
142
- /// ```rust,compile_fail
143
- /// #![deny(box_pointers)]
144
- /// struct Foo {
145
- /// x: Box<i32>,
146
- /// }
147
- /// ```
148
- ///
149
- /// {{produces}}
150
- ///
151
- /// ### Explanation
152
- ///
153
- /// This lint is mostly historical, and not particularly useful. `Box<T>`
154
- /// used to be built into the language, and the only way to do heap
155
- /// allocation. Today's Rust can call into other allocators, etc.
156
- BOX_POINTERS ,
157
- Allow ,
158
- "use of owned (Box type) heap memory"
159
- }
160
-
161
- declare_lint_pass ! ( BoxPointers => [ BOX_POINTERS ] ) ;
162
-
163
- impl BoxPointers {
164
- fn check_heap_type ( & self , cx : & LateContext < ' _ > , span : Span , ty : Ty < ' _ > ) {
165
- for leaf in ty. walk ( ) {
166
- if let GenericArgKind :: Type ( leaf_ty) = leaf. unpack ( )
167
- && leaf_ty. is_box ( )
168
- {
169
- cx. emit_span_lint ( BOX_POINTERS , span, BuiltinBoxPointers { ty } ) ;
170
- }
171
- }
172
- }
173
- }
174
-
175
- impl < ' tcx > LateLintPass < ' tcx > for BoxPointers {
176
- fn check_item ( & mut self , cx : & LateContext < ' _ > , it : & hir:: Item < ' _ > ) {
177
- match it. kind {
178
- hir:: ItemKind :: Fn ( ..)
179
- | hir:: ItemKind :: TyAlias ( ..)
180
- | hir:: ItemKind :: Enum ( ..)
181
- | hir:: ItemKind :: Struct ( ..)
182
- | hir:: ItemKind :: Union ( ..) => self . check_heap_type (
183
- cx,
184
- it. span ,
185
- cx. tcx . type_of ( it. owner_id ) . instantiate_identity ( ) ,
186
- ) ,
187
- _ => ( ) ,
188
- }
189
-
190
- // If it's a struct, we also have to check the fields' types
191
- match it. kind {
192
- hir:: ItemKind :: Struct ( ref struct_def, _) | hir:: ItemKind :: Union ( ref struct_def, _) => {
193
- for field in struct_def. fields ( ) {
194
- self . check_heap_type (
195
- cx,
196
- field. span ,
197
- cx. tcx . type_of ( field. def_id ) . instantiate_identity ( ) ,
198
- ) ;
199
- }
200
- }
201
- _ => ( ) ,
202
- }
203
- }
204
-
205
- fn check_expr ( & mut self , cx : & LateContext < ' _ > , e : & hir:: Expr < ' _ > ) {
206
- let ty = cx. typeck_results ( ) . node_type ( e. hir_id ) ;
207
- self . check_heap_type ( cx, e. span , ty) ;
208
- }
209
- }
210
-
211
136
declare_lint ! {
212
137
/// The `non_shorthand_field_patterns` lint detects using `Struct { x: x }`
213
138
/// instead of `Struct { x }` in a pattern.
@@ -1640,7 +1565,6 @@ declare_lint_pass!(
1640
1565
/// which are used by other parts of the compiler.
1641
1566
SoftLints => [
1642
1567
WHILE_TRUE ,
1643
- BOX_POINTERS ,
1644
1568
NON_SHORTHAND_FIELD_PATTERNS ,
1645
1569
UNSAFE_CODE ,
1646
1570
MISSING_DOCS ,
0 commit comments