@@ -35,7 +35,7 @@ use crate::{
3535        BuiltinSpecialModuleNameUsed ,  BuiltinTrivialBounds ,  BuiltinTypeAliasGenericBounds , 
3636        BuiltinTypeAliasGenericBoundsSuggestion ,  BuiltinTypeAliasWhereClause , 
3737        BuiltinUnexpectedCliConfigName ,  BuiltinUnexpectedCliConfigValue , 
38-         BuiltinUngatedAsyncFnTrackCaller ,  BuiltinUnnameableTestItems ,   BuiltinUnpermittedTypeInit , 
38+         BuiltinUngatedAsyncFnTrackCaller ,  BuiltinUnpermittedTypeInit , 
3939        BuiltinUnpermittedTypeInitSub ,  BuiltinUnreachablePub ,  BuiltinUnsafe , 
4040        BuiltinUnstableFeatures ,  BuiltinUnusedDocComment ,  BuiltinUnusedDocCommentSub , 
4141        BuiltinWhileTrue ,  SuggestChangingAssocTypes , 
@@ -1770,82 +1770,6 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns {
17701770    } 
17711771} 
17721772
1773- declare_lint !  { 
1774-     /// The `unnameable_test_items` lint detects [`#[test]`][test] functions 
1775-      /// that are not able to be run by the test harness because they are in a 
1776-      /// position where they are not nameable. 
1777-      /// 
1778-      /// [test]: https://doc.rust-lang.org/reference/attributes/testing.html#the-test-attribute 
1779-      /// 
1780-      /// ### Example 
1781-      /// 
1782-      /// ```rust,test 
1783-      /// fn main() { 
1784-      ///     #[test] 
1785-      ///     fn foo() { 
1786-      ///         // This test will not fail because it does not run. 
1787-      ///         assert_eq!(1, 2); 
1788-      ///     } 
1789-      /// } 
1790-      /// ``` 
1791-      /// 
1792-      /// {{produces}} 
1793-      /// 
1794-      /// ### Explanation 
1795-      /// 
1796-      /// In order for the test harness to run a test, the test function must be 
1797-      /// located in a position where it can be accessed from the crate root. 
1798-      /// This generally means it must be defined in a module, and not anywhere 
1799-      /// else such as inside another function. The compiler previously allowed 
1800-      /// this without an error, so a lint was added as an alert that a test is 
1801-      /// not being used. Whether or not this should be allowed has not yet been 
1802-      /// decided, see [RFC 2471] and [issue #36629]. 
1803-      /// 
1804-      /// [RFC 2471]: https://github.com/rust-lang/rfcs/pull/2471#issuecomment-397414443 
1805-      /// [issue #36629]: https://github.com/rust-lang/rust/issues/36629 
1806-      UNNAMEABLE_TEST_ITEMS , 
1807-     Warn , 
1808-     "detects an item that cannot be named being marked as `#[test_case]`" , 
1809-     report_in_external_macro
1810- } 
1811- 
1812- pub  struct  UnnameableTestItems  { 
1813-     boundary :  Option < hir:: OwnerId > ,  // Id of the item under which things are not nameable 
1814-     items_nameable :  bool , 
1815- } 
1816- 
1817- impl_lint_pass ! ( UnnameableTestItems  => [ UNNAMEABLE_TEST_ITEMS ] ) ; 
1818- 
1819- impl  UnnameableTestItems  { 
1820-     pub  fn  new ( )  -> Self  { 
1821-         Self  {  boundary :  None ,  items_nameable :  true  } 
1822-     } 
1823- } 
1824- 
1825- impl < ' tcx >  LateLintPass < ' tcx >  for  UnnameableTestItems  { 
1826-     fn  check_item ( & mut  self ,  cx :  & LateContext < ' _ > ,  it :  & hir:: Item < ' _ > )  { 
1827-         if  self . items_nameable  { 
1828-             if  let  hir:: ItemKind :: Mod ( ..)  = it. kind  { 
1829-             }  else  { 
1830-                 self . items_nameable  = false ; 
1831-                 self . boundary  = Some ( it. owner_id ) ; 
1832-             } 
1833-             return ; 
1834-         } 
1835- 
1836-         let  attrs = cx. tcx . hir ( ) . attrs ( it. hir_id ( ) ) ; 
1837-         if  let  Some ( attr)  = attr:: find_by_name ( attrs,  sym:: rustc_test_marker)  { 
1838-             cx. emit_spanned_lint ( UNNAMEABLE_TEST_ITEMS ,  attr. span ,  BuiltinUnnameableTestItems ) ; 
1839-         } 
1840-     } 
1841- 
1842-     fn  check_item_post ( & mut  self ,  _cx :  & LateContext < ' _ > ,  it :  & hir:: Item < ' _ > )  { 
1843-         if  !self . items_nameable  && self . boundary  == Some ( it. owner_id )  { 
1844-             self . items_nameable  = true ; 
1845-         } 
1846-     } 
1847- } 
1848- 
18491773declare_lint !  { 
18501774    /// The `keyword_idents` lint detects edition keywords being used as an 
18511775     /// identifier. 
0 commit comments