Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
069cb06 to
0816e30
Compare
This comment has been minimized.
This comment has been minimized.
0816e30 to
74ba4f6
Compare
|
Requested reviewer is already assigned to this pull request. Please choose another assignee. |
|
cc @rust-lang/rustfmt This PR changes rustc_public cc @oli-obk, @celinval, @ouz-a, @makai410 The parser was modified, potentially altering the grammar of (stable) Rust cc @fmease Changes to the size of AST and/or HIR nodes. cc @nnethercote HIR ty lowering was modified cc @fmease
cc @rust-lang/clippy |
| ref ty, | ||
| span, | ||
| default, | ||
| arg_pos: _, |
There was a problem hiding this comment.
What is arg_pos, and does rustfmt need to handle formatting it in some way?
Probably good to add a #![feature(function_arg_const_generics] test case to rustfmt to make sure things are getting formatted as expected.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
I'm feeling a bit overwhelmed and struggling to review this, and haven't gotten through the parser changes yet. Still though, wanted to comment for what I've seen so far. I think I'd appreciate talking over how to deal with lowering here in zulip or something, I haven't fully thought through the theory space. If you have any direction/resources/etc. on lowering (e.g. whether we fundamentally must lower from hir instead of ast, what potential issues there are from doing so), I'd love to see.
74ba4f6 to
e0fc639
Compare
|
Some changes occurred in compiler/rustc_builtin_macros/src/autodiff.rs cc @ZuseZ4 |
9d3480a to
08a6a30
Compare
This comment has been minimized.
This comment has been minimized.
…enerics, r=<try> Support function args const generics
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (93791e6): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=never rustc-perf Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 1.4%, secondary 2.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -1.7%, secondary 12.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 490.84s -> 486.205s (-0.94%) |
| let mut is_const = false; | ||
| if fn_parse_mode.allow_const | ||
| && this.check_keyword(exp!(Const)) | ||
| && this.look_ahead(1, |token| token.is_ident()) |
There was a problem hiding this comment.
This lookahead is insufficient.
It makes Rust 2015 snippets like trait P { fn f(const dyn Trait); }, trait P { fn f(const impl Trait); } or trait P { fn f(const fn()); } syntactically legal modulo feature gating which is hardly intentional.
Moreover it alters the meaning of unstable Rust 2015 snippet trait P { fn f(const Fn()); }. On nightly, it means trait P { fn f(_: dyn const Fn()); } essentially but on your branch it now basically means trait P { fn f(_: dyn Fn()); } dropping the const trait bound modifier.
There was a problem hiding this comment.
Damn! Thanks for mentioning this. I guess explicitly checking that the first token is const, followed by a non-reserved identifier and then a colon, should do the trick, unless I'm missing something. Added this: 624858f
Make arg_pos to Option<u16> instead of Option<u32> And add a has_arg_pos_const in generics, so we can have shortcircuit
|
Lets try and check perf again: @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…enerics, r=<try> Support function args const generics
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (c48133e): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=never rustc-perf Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -1.1%, secondary -2.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.4%, secondary 1.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.0%, secondary -0.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 487.044s -> 489.815s (0.57%) |
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…enerics, r=<try> Support function args const generics
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (5415718): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=never rustc-perf Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 1.3%, secondary 2.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 4.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.1%, secondary 0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 488.311s -> 489.736s (0.29%) |
View all comments
This PR adds initial support for argument-position const generics behind the
function_arg_const_genericsfeature gate.It allows const generics to be declared directly in function arguments. The PR adds the basic plumbing across AST, HIR, and
ty, parses these parameters into the function's generics, lowers call arguments into consts. For now, we lower literals, negated literals, const parameters, const items, unit variants, and etc, This works for functions, methods and a couple of more cases.r? @BoxyUwU
cc: @khyperia