@@ -24,9 +24,9 @@ use crate::fluent_generated as fluent;
2424use crate :: {
2525 errors:: BuiltinEllipsisInclusiveRangePatterns ,
2626 lints:: {
27- BuiltinAnonymousParams , BuiltinBoxPointers , BuiltinConstNoMangle ,
28- BuiltinDeprecatedAttrLink , BuiltinDeprecatedAttrLinkSuggestion , BuiltinDeprecatedAttrUsed ,
29- BuiltinDerefNullptr , BuiltinEllipsisInclusiveRangePatternsLint , BuiltinExplicitOutlives ,
27+ BuiltinAnonymousParams , BuiltinConstNoMangle , BuiltinDeprecatedAttrLink ,
28+ BuiltinDeprecatedAttrLinkSuggestion , BuiltinDeprecatedAttrUsed , BuiltinDerefNullptr ,
29+ BuiltinEllipsisInclusiveRangePatternsLint , BuiltinExplicitOutlives ,
3030 BuiltinExplicitOutlivesSuggestion , BuiltinFeatureIssueNote , BuiltinIncompleteFeatures ,
3131 BuiltinIncompleteFeaturesHelp , BuiltinInternalFeatures , BuiltinKeywordIdents ,
3232 BuiltinMissingCopyImpl , BuiltinMissingDebugImpl , BuiltinMissingDoc ,
@@ -56,7 +56,6 @@ use rustc_middle::bug;
5656use rustc_middle:: lint:: in_external_macro;
5757use rustc_middle:: ty:: layout:: LayoutOf ;
5858use rustc_middle:: ty:: print:: with_no_trimmed_paths;
59- use rustc_middle:: ty:: GenericArgKind ;
6059use rustc_middle:: ty:: TypeVisitableExt ;
6160use rustc_middle:: ty:: Upcast ;
6261use rustc_middle:: ty:: { self , Ty , TyCtxt , VariantDef } ;
@@ -134,80 +133,6 @@ impl EarlyLintPass for WhileTrue {
134133 }
135134}
136135
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-
211136declare_lint ! {
212137 /// The `non_shorthand_field_patterns` lint detects using `Struct { x: x }`
213138 /// instead of `Struct { x }` in a pattern.
@@ -1640,7 +1565,6 @@ declare_lint_pass!(
16401565 /// which are used by other parts of the compiler.
16411566 SoftLints => [
16421567 WHILE_TRUE ,
1643- BOX_POINTERS ,
16441568 NON_SHORTHAND_FIELD_PATTERNS ,
16451569 UNSAFE_CODE ,
16461570 MISSING_DOCS ,
0 commit comments