- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
          Use ConstArgKind::Path for all single-segment paths, not just params under min_generic_const_args
          #131081
        
          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
2b73426    to
    87b1f29      
    Compare
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
c43d981    to
    883a4ba      
    Compare
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
| ☔ The latest upstream changes (presumably #131628) made this pull request unmergeable. Please resolve the merge conflicts. | 
23076d2    to
    507ada1      
    Compare
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
| ☔ The latest upstream changes (presumably #130950) made this pull request unmergeable. Please resolve the merge conflicts. | 
4494a71    to
    034661e      
    Compare
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
ConstArgKind::Path for all paths, not just paramsConstArgKind::Path for all single-segment paths, not just params
      | HIR ty lowering was modified cc @fmease | 
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
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.
✨ thanks for working on this, excited to be able to add the min_generic_const_args feature gate soon after all of these refactorings 😅
| ☔ The latest upstream changes (presumably #132371) made this pull request unmergeable. Please resolve the merge conflicts. | 
bf17503    to
    8b260ba      
    Compare
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
bf37eb4    to
    59e339f      
    Compare
  
    ConstArgKind::Path for all single-segment paths, not just paramsConstArgKind::Path for all single-segment paths, not just params under min_generic_const_params
      ConstArgKind::Path for all single-segment paths, not just params under min_generic_const_paramsConstArgKind::Path for all single-segment paths, not just params under min_generic_const_args
      
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
| rebased and squashed commits for you as well as blessing the stable mir test now that those changes have been reverted. we can follow up on everything else later. Having the feature gate will be super nice thanks :3 @bors r+ | 
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#131081 (Use `ConstArgKind::Path` for all single-segment paths, not just params under `min_generic_const_args`) - rust-lang#132577 (Report the `unexpected_cfgs` lint in external macros) - rust-lang#133023 (Merge `-Zhir-stats` into `-Zinput-stats`) - rust-lang#133200 (ignore an occasionally-failing test in Miri) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#131081 (Use `ConstArgKind::Path` for all single-segment paths, not just params under `min_generic_const_args`) - rust-lang#132577 (Report the `unexpected_cfgs` lint in external macros) - rust-lang#133023 (Merge `-Zhir-stats` into `-Zinput-stats`) - rust-lang#133200 (ignore an occasionally-failing test in Miri) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#131081 - camelid:const-path-it-all, r=BoxyUwU Use `ConstArgKind::Path` for all single-segment paths, not just params under `min_generic_const_args` r? `@BoxyUwU` edit by `@BoxyUwU:` This PR introduces a `min_generic_const_args` feature gate and implements some preliminary work for it, representing all const arguments that are single segment paths as `ConstArg::Path` instead of only those that resolve to a const generic parameter. There are a few bits of follow up work after this lands: - Figure out how to represent `Foo<{ STATIC }>` - Figure out how to evaluate `Foo<{ EnumVariantConstructor }>` - Make param env normalization handle non-anon-consts - Move `try_from_lit` and `from_anon_const` to hir ty lowering too
These operations are much more about lowering the HIR than about `Const`s themselves. They fit better in hir_ty_lowering with `lower_const_arg` (formerly `Const::from_const_arg`) and the rest. To accomplish this, `const_evaluatable_predicates_of` had to be changed to not use `from_anon_const` anymore. Instead of visiting the HIR and lowering anon consts on the fly, it now visits the `rustc_middle::ty` data structures instead and directly looks for `UnevaluatedConst`s. This approach was proposed in: rust-lang#131081 (comment)
These operations are much more about lowering the HIR than about `Const`s themselves. They fit better in hir_ty_lowering with `lower_const_arg` (formerly `Const::from_const_arg`) and the rest. To accomplish this, `const_evaluatable_predicates_of` had to be changed to not use `from_anon_const` anymore. Instead of visiting the HIR and lowering anon consts on the fly, it now visits the `rustc_middle::ty` data structures instead and directly looks for `UnevaluatedConst`s. This approach was proposed in: rust-lang#131081 (comment)
These operations are much more about lowering the HIR than about `Const`s themselves. They fit better in hir_ty_lowering with `lower_const_arg` (formerly `Const::from_const_arg`) and the rest. To accomplish this, `const_evaluatable_predicates_of` had to be changed to not use `from_anon_const` anymore. Instead of visiting the HIR and lowering anon consts on the fly, it now visits the `rustc_middle::ty` data structures instead and directly looks for `UnevaluatedConst`s. This approach was proposed in: rust-lang#131081 (comment)
Move `Const::{from_anon_const,try_from_lit}` to hir_ty_lowering
Fixes rust-lang#128176.
This accomplishes one of the followup items from rust-lang#131081.
These operations are much more about lowering the HIR than about
`Const`s themselves. They fit better in hir_ty_lowering with
`lower_const_arg` (formerly `Const::from_const_arg`) and the rest.
To accomplish this, `const_evaluatable_predicates_of` had to be changed
to not use `from_anon_const` anymore. Instead of visiting the HIR and
lowering anon consts on the fly, it now visits the `rustc_middle::ty`
data structures instead and directly looks for `UnevaluatedConst`s. This
approach was proposed in:
rust-lang#131081 (comment)
r? `@BoxyUwU`
    These operations are much more about lowering the HIR than about `Const`s themselves. They fit better in hir_ty_lowering with `lower_const_arg` (formerly `Const::from_const_arg`) and the rest. To accomplish this, `const_evaluatable_predicates_of` had to be changed to not use `from_anon_const` anymore. Instead of visiting the HIR and lowering anon consts on the fly, it now visits the `rustc_middle::ty` data structures instead and directly looks for `UnevaluatedConst`s. This approach was proposed in: rust-lang#131081 (comment)
These operations are much more about lowering the HIR than about `Const`s themselves. They fit better in hir_ty_lowering with `lower_const_arg` (formerly `Const::from_const_arg`) and the rest. To accomplish this, `const_evaluatable_predicates_of` had to be changed to not use `from_anon_const` anymore. Instead of visiting the HIR and lowering anon consts on the fly, it now visits the `rustc_middle::ty` data structures instead and directly looks for `UnevaluatedConst`s. This approach was proposed in: rust-lang#131081 (comment)
These operations are much more about lowering the HIR than about `Const`s themselves. They fit better in hir_ty_lowering with `lower_const_arg` (formerly `Const::from_const_arg`) and the rest. To accomplish this, `const_evaluatable_predicates_of` had to be changed to not use `from_anon_const` anymore. Instead of visiting the HIR and lowering anon consts on the fly, it now visits the `rustc_middle::ty` data structures instead and directly looks for `UnevaluatedConst`s. This approach was proposed in: rust-lang#131081 (comment)
…xyUwU
Move `Const::{from_anon_const,try_from_lit}` to hir_ty_lowering
Fixes rust-lang#128176.
This accomplishes one of the followup items from rust-lang#131081.
These operations are much more about lowering the HIR than about
`Const`s themselves. They fit better in hir_ty_lowering with
`lower_const_arg` (formerly `Const::from_const_arg`) and the rest.
To accomplish this, `const_evaluatable_predicates_of` had to be changed
to not use `from_anon_const` anymore. Instead of visiting the HIR and
lowering anon consts on the fly, it now visits the `rustc_middle::ty`
data structures instead and directly looks for `UnevaluatedConst`s. This
approach was proposed in:
rust-lang#131081 (comment)
r? `@BoxyUwU`
    Rollup merge of rust-lang#133610 - camelid:move-from_anon_const, r=BoxyUwU Move `Const::{from_anon_const,try_from_lit}` to hir_ty_lowering Fixes rust-lang#128176. This accomplishes one of the followup items from rust-lang#131081. These operations are much more about lowering the HIR than about `Const`s themselves. They fit better in hir_ty_lowering with `lower_const_arg` (formerly `Const::from_const_arg`) and the rest. To accomplish this, `const_evaluatable_predicates_of` had to be changed to not use `from_anon_const` anymore. Instead of visiting the HIR and lowering anon consts on the fly, it now visits the `rustc_middle::ty` data structures instead and directly looks for `UnevaluatedConst`s. This approach was proposed in: rust-lang#131081 (comment) r? `@BoxyUwU`
r? @BoxyUwU
edit by @BoxyUwU:
This PR introduces a
min_generic_const_argsfeature gate and implements some preliminary work for it, representing all const arguments that are single segment paths asConstArg::Pathinstead of only those that resolve to a const generic parameter. There are a few bits of follow up work after this lands:Foo<{ STATIC }>Foo<{ EnumVariantConstructor }>try_from_litandfrom_anon_constto hir ty lowering too