This repository was archived by the owner on May 28, 2025. It is now read-only.
  
  
  
  
    
    
    
      
    
  
  
    
File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed 
compiler/rustc_middle/src/ty Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -414,6 +414,11 @@ impl<'tcx> TyCtxt<'tcx> {
414414                continue ; 
415415            } ; 
416416
417+             if  self . def_kind ( item_id)  != DefKind :: AssocFn  { 
418+                 self . dcx ( ) . span_delayed_bug ( self . def_span ( item_id) ,  "drop is not a function" ) ; 
419+                 continue ; 
420+             } 
421+ 
417422            if  let  Some ( old_item_id)  = dtor_candidate { 
418423                self . dcx ( ) 
419424                    . struct_span_err ( self . def_span ( item_id) ,  "multiple drop impls found" ) 
Original file line number Diff line number Diff line change 1+ //@ check-fail 
2+ struct  Foo ; 
3+ 
4+ impl  Drop  for  Foo  {  //~ ERROR: not all trait items implemented 
5+     const  SPLOK :  u32  = 0 ;  //~ ERROR: not a member of trait 
6+ } 
7+ 
8+ const  X :  Foo  = Foo ; 
9+ 
10+ fn  main ( )  { } 
Original file line number Diff line number Diff line change 1+ error[E0438]: const `SPLOK` is not a member of trait `Drop`
2+   --> $DIR/nonsense-drop-impl-issue-139278.rs:5:5
3+    |
4+ LL |     const SPLOK: u32 = 0;
5+    |     ^^^^^^^^^^^^^^^^^^^^^ not a member of trait `Drop`
6+ 
7+ error[E0046]: not all trait items implemented, missing: `drop`
8+   --> $DIR/nonsense-drop-impl-issue-139278.rs:4:1
9+    |
10+ LL | impl Drop for Foo {
11+    | ^^^^^^^^^^^^^^^^^ missing `drop` in implementation
12+    |
13+    = help: implement the missing item: `fn drop(&mut self) { todo!() }`
14+ 
15+ error: aborting due to 2 previous errors
16+ 
17+ Some errors have detailed explanations: E0046, E0438.
18+ For more information about an error, try `rustc --explain E0046`.
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments