- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13.9k
 
When encountering an Item in a pat context, point at the item def #67741
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.
| 
           r? @Centril  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks promising, but needs some changes.
Also, I'd like for #67730 to land first cause that one will be harder to rebase.
| 
           I'm away for a week. I'll incorporate the feedback once I'm back.  | 
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
1c1142d    to
    7251e3f      
    Compare
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
7251e3f    to
    7a37d08      
    Compare
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
7a37d08    to
    bd3b2b2      
    Compare
  
    bd3b2b2    to
    1176e45      
    Compare
  
    1176e45    to
    f7332bf      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me with these comments addressed
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
| 
           Ping @estebank :)  | 
    
f7332bf    to
    125159f      
    Compare
  
    | 
           Rebased and addressed all coments, I believe.  | 
    
| 
           Excellent! I'll follow up with a PR on my own to polish a bit, but this is great. @bors r+  | 
    
| 
           📌 Commit 125159f has been approved by   | 
    
| 
           🌲 The tree is currently closed for pull requests below priority 1000, this pull request will be tested once the tree is reopened  | 
    
When encountering an Item in a pat context, point at the item def
```
error[E0308]: mismatched types
  --> $DIR/const-in-struct-pat.rs:8:17
   |
LL | struct foo;
   | ----------- `foo` defined here
...
LL |     let Thing { foo } = t;
   |                 ^^^ expected struct `std::string::String`, found struct `foo`
   |
   = note: `foo` is interpreted as a unit struct, not a new binding
help: you can bind the struct field to a different name
   |
LL |     let Thing { foo: other_foo } = t;
   |                 ^^^^^^^^^^^^^^
```
```
error[E0308]: mismatched types
  --> $DIR/const.rs:14:9
   |
LL | const FOO: Foo = Foo{bar: 5};
   | ----------------------------- constant defined here
...
LL |         FOO => {},
   |         ^^^
   |         |
   |         expected `&Foo`, found struct `Foo`
   |         `FOO` is interpreted as a constant, not a new binding
   |         help: use different name to introduce a new binding: `other_foo`
```
Fix rust-lang#55631, fix rust-lang#48062, cc rust-lang#42876.
    Rollup of 9 pull requests Successful merges: - #67741 (When encountering an Item in a pat context, point at the item def) - #68985 (Parse & reject postfix operators after casts) - #69656 (Use .next() instead of .nth(0) on iterators.) - #69680 (rustc_expand: Factor out `Annotatable::into_tokens` to a separate method) - #69690 (test(pattern): add tests for combinations of pattern features) - #69706 (Use subslice patterns in slice methods) - #69727 (Avoid using `unwrap()` in suggestions) - #69754 (Update deprecation version to 1.42 for Error::description) - #69782 (Don't redundantly repeat field names (clippy::redundant_field_names)) Failed merges: r? @ghost
Fix #55631, fix #48062, cc #42876.