- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13.9k
 
use correct feature flag for impl-block-level trait bounds on const fn #84556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
| 
           Maybe we don't have tests for the situation the comment was referring to? Check if we have a test where a generic impl const block can use its trait bounds in a function, if not, please add one  | 
    
| 
           I don't understand what that situation would look like, could you sketch an example? 
       | 
    
| 
           On phone, but i'll try: impl<T: Foo> const Bar for () {
    fn bar() {
        T::foo()
    } 
}Declare the Foo and Bar traits appropriately.  | 
    
a74fa38    to
    5489239      
    Compare
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
| 
           I did that, but I am not sure if that is the test the comment was referring to... the comment sounded more like a situation where a  
 #![feature(const_fn_trait_bounds)]
#![feature(const_trait_impl)]
#![feature(const_trait_bound_opt_out)]
#![allow(incomplete_features)]
mod num {
    pub trait Plus {
        fn plus(self, rhs: Self) -> Self;
    }
    struct Num<T>(T);
    impl<T: ?const Plus + Copy> const Plus for Num<T> {
        fn plus(self, rhs: Self) -> Self {
            Num(self.0.plus(rhs.0))
        }
    }
}However, the error has nothing to do with feature gating: So, I don't think what this PR does makes things any worse here.  | 
    
54202dc    to
    8ab28a3      
    Compare
  
    | 
           I think what is left here is to fix   | 
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
          
 Why are you surprised it fails to build? It should fail, you are using   | 
    
| 
           The problem is that it also fails to compile without   | 
    
          
 Ah, I forgot that things are implicitly   | 
    
          
 Okay, I guess I should remove my new test then? But it says nothing about a feature gate there, so I don't think my PR changes the situation here... it might mean some people need to add   | 
    
          
 we already have a test for this behaviour and possibly even an issue, idk where though  | 
    
281: add new const_fn_trait_bound feature gate r=Amanieu a=RalfJung This (and a subsequent release of `lock_api`) is needed to make rust-lang/rust#84556 work. Co-authored-by: Ralf Jung <[email protected]>
          
 Okay so I removed the new test again. Should I add anything else instead?  | 
    
a7b6f7f    to
    6130fbc      
    Compare
  
    
          
 idk, I don't have the time to really dig into this, so let's just merge as is. It preserves the status quo, so all is good  | 
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
6130fbc    to
    3752c6b      
    Compare
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
| 
           @bors r+  | 
    
| 
           📌 Commit 3c4c5eb has been approved by   | 
    
| 
           ☀️ Test successful - checks-actions  | 
    
I am not sure what that special hack was needed for, but it doesn't seem needed any more...
This removes the last use of the
const_fnfeature flag -- Cc #84510r? @oli-obk