File tree Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ impl<'tcx> LateLintPass<'tcx> for NewWithoutDefault {
9494 return ;
9595 }
9696 if sig. decl . inputs . is_empty ( )
97- && cx. effective_visibilities . is_reachable ( impl_item. owner_id . def_id )
97+ && cx. effective_visibilities . is_exported ( impl_item. owner_id . def_id )
9898 && let self_ty = cx. tcx . type_of ( item. owner_id ) . instantiate_identity ( )
9999 && self_ty == return_ty ( cx, impl_item. owner_id )
100100 && let Some ( default_trait_id) = cx. tcx . get_diagnostic_item ( sym:: Default )
Original file line number Diff line number Diff line change @@ -322,3 +322,23 @@ where
322322 Self { _kv: None }
323323 }
324324}
325+
326+ mod issue15778 {
327+ pub struct Foo(Vec<i32>);
328+
329+ impl Foo {
330+ pub fn new() -> Self {
331+ Self(Vec::new())
332+ }
333+ }
334+
335+ impl<'a> IntoIterator for &'a Foo {
336+ type Item = &'a i32;
337+
338+ type IntoIter = std::slice::Iter<'a, i32>;
339+
340+ fn into_iter(self) -> Self::IntoIter {
341+ self.0.as_slice().iter()
342+ }
343+ }
344+ }
Original file line number Diff line number Diff line change @@ -265,3 +265,23 @@ where
265265 Self { _kv : None }
266266 }
267267}
268+
269+ mod issue15778 {
270+ pub struct Foo ( Vec < i32 > ) ;
271+
272+ impl Foo {
273+ pub fn new ( ) -> Self {
274+ Self ( Vec :: new ( ) )
275+ }
276+ }
277+
278+ impl < ' a > IntoIterator for & ' a Foo {
279+ type Item = & ' a i32 ;
280+
281+ type IntoIter = std:: slice:: Iter < ' a , i32 > ;
282+
283+ fn into_iter ( self ) -> Self :: IntoIter {
284+ self . 0 . as_slice ( ) . iter ( )
285+ }
286+ }
287+ }
You can’t perform that action at this time.
0 commit comments