Use infer tys for synthetic params when lowering const paths point to fns#157625
Conversation
|
HIR ty lowering was modified cc @fmease |
|
r? @JohnTitor rustbot has assigned @JohnTitor. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Use infer tys for synthetic params when lowering const paths point to fns
```rust
#![feature(min_generic_const_args)]
trait Trait {}
impl<'t> Trait for [(); N] {}
fn N(arg: impl Trait) {}
```
1. `arg: impl Trait` implies a synthetic param `<impl Trait>` and the obligation `_: Trait`;
2. when matching `impl Trait for [(); N]`, lowering const arg `N` fills in that synthetic param, so the impl header contains `<[(); N::<impl Trait>] as Trait>`;
3. then instantiating this header with the impl's args causing a param/arg mismatch and ICE.
This PR uses infer tys for synthetic params. Although this will emit the error in `ItemCtxt` because infer tys are not allowed here. I think that is reasonable, because `N` omits the synthetic parameter, though we cannot write the ty explicitly anywhere.
Fixes rust-lang#155834
Rollup of 5 pull requests Successful merges: - #158234 (Cross-referencing tuple_trait tracking issue, source and the Unstable Book) - #157625 (Use infer tys for synthetic params when lowering const paths point to fns) - #158306 (tests: modify s390x vector test to be robust to instruction scheduling) - #158431 (More lint cleanups) - #158452 (Add missing links in integer docs)
|
This is the only PR in the rollup touching const generics, so I presume this is the cause. @bors r- |
|
This pull request was unapproved. This PR was contained in a rollup (#158465), which was unapproved. |
|
Just to be sure @bors try jobs=x86_64-gnu-llvm-21 |
|
⌛ Trying commit 0805fc2 with merge 0ac3a15… To cancel the try build, run the command Workflow: https://github.com/rust-lang/rust/actions/runs/28280079330 |
Use infer tys for synthetic params when lowering const paths point to fns try-job: x86_64-gnu-llvm-21
|
This is the cause, I will rebase and update the test. |
|
@bors try cancel |
|
Try build cancelled. Cancelled workflows: |
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@bors r=JohnTitor |
Use infer tys for synthetic params when lowering const paths point to fns
```rust
#![feature(min_generic_const_args)]
trait Trait {}
impl<'t> Trait for [(); N] {}
fn N(arg: impl Trait) {}
```
1. `arg: impl Trait` implies a synthetic param `<impl Trait>` and the obligation `_: Trait`;
2. when matching `impl Trait for [(); N]`, lowering const arg `N` fills in that synthetic param, so the impl header contains `<[(); N::<impl Trait>] as Trait>`;
3. then instantiating this header with the impl's args causing a param/arg mismatch and ICE.
This PR uses infer tys for synthetic params. Although this will emit the error in `ItemCtxt` because infer tys are not allowed here. I think that is reasonable, because `N` omits the synthetic parameter, though we cannot write the ty explicitly anywhere.
Fixes rust-lang#155834
Rollup of 5 pull requests Successful merges: - #158234 (Cross-referencing tuple_trait tracking issue, source and the Unstable Book) - #157625 (Use infer tys for synthetic params when lowering const paths point to fns) - #158306 (tests: modify s390x vector test to be robust to instruction scheduling) - #158431 (More lint cleanups) - #158452 (Add missing links in integer docs)
Use infer tys for synthetic params when lowering const paths point to fns
```rust
#![feature(min_generic_const_args)]
trait Trait {}
impl<'t> Trait for [(); N] {}
fn N(arg: impl Trait) {}
```
1. `arg: impl Trait` implies a synthetic param `<impl Trait>` and the obligation `_: Trait`;
2. when matching `impl Trait for [(); N]`, lowering const arg `N` fills in that synthetic param, so the impl header contains `<[(); N::<impl Trait>] as Trait>`;
3. then instantiating this header with the impl's args causing a param/arg mismatch and ICE.
This PR uses infer tys for synthetic params. Although this will emit the error in `ItemCtxt` because infer tys are not allowed here. I think that is reasonable, because `N` omits the synthetic parameter, though we cannot write the ty explicitly anywhere.
Fixes rust-lang#155834
Rollup of 6 pull requests Successful merges: - #158234 (Cross-referencing tuple_trait tracking issue, source and the Unstable Book) - #157625 (Use infer tys for synthetic params when lowering const paths point to fns) - #158306 (tests: modify s390x vector test to be robust to instruction scheduling) - #158431 (More lint cleanups) - #158452 (Add missing links in integer docs) - #158472 (Add regression test for unexpected pointer dereference issue)
Use infer tys for synthetic params when lowering const paths point to fns
```rust
#![feature(min_generic_const_args)]
trait Trait {}
impl<'t> Trait for [(); N] {}
fn N(arg: impl Trait) {}
```
1. `arg: impl Trait` implies a synthetic param `<impl Trait>` and the obligation `_: Trait`;
2. when matching `impl Trait for [(); N]`, lowering const arg `N` fills in that synthetic param, so the impl header contains `<[(); N::<impl Trait>] as Trait>`;
3. then instantiating this header with the impl's args causing a param/arg mismatch and ICE.
This PR uses infer tys for synthetic params. Although this will emit the error in `ItemCtxt` because infer tys are not allowed here. I think that is reasonable, because `N` omits the synthetic parameter, though we cannot write the ty explicitly anywhere.
Fixes rust-lang#155834
…uwer Rollup of 13 pull requests Successful merges: - #157871 ([rustdoc] Update `doc_cfg` hide/show syntax) - #158234 (Cross-referencing tuple_trait tracking issue, source and the Unstable Book) - #158480 (add smoketest for std::net::hostname) - #157625 (Use infer tys for synthetic params when lowering const paths point to fns) - #158290 (add crashtests [1/N]) - #158306 (tests: modify s390x vector test to be robust to instruction scheduling) - #158313 (Move `check_target_feature` into the attribute parser) - #158431 (More lint cleanups) - #158452 (Add missing links in integer docs) - #158467 (Add proc macro for unused assignments and corresponding test) - #158472 (Add regression test for unexpected pointer dereference issue) - #158475 (Fix doc comment on get_debug_as_hex.) - #158476 (Fix doc comment on FormattingOptions::new().)
…uwer Rollup of 13 pull requests Successful merges: - #157871 ([rustdoc] Update `doc_cfg` hide/show syntax) - #158234 (Cross-referencing tuple_trait tracking issue, source and the Unstable Book) - #158480 (add smoketest for std::net::hostname) - #157625 (Use infer tys for synthetic params when lowering const paths point to fns) - #158290 (add crashtests [1/N]) - #158306 (tests: modify s390x vector test to be robust to instruction scheduling) - #158313 (Move `check_target_feature` into the attribute parser) - #158431 (More lint cleanups) - #158452 (Add missing links in integer docs) - #158467 (Add proc macro for unused assignments and corresponding test) - #158472 (Add regression test for unexpected pointer dereference issue) - #158475 (Fix doc comment on get_debug_as_hex.) - #158476 (Fix doc comment on FormattingOptions::new().)
…uwer Rollup of 13 pull requests Successful merges: - #157871 ([rustdoc] Update `doc_cfg` hide/show syntax) - #158234 (Cross-referencing tuple_trait tracking issue, source and the Unstable Book) - #158480 (add smoketest for std::net::hostname) - #157625 (Use infer tys for synthetic params when lowering const paths point to fns) - #158290 (add crashtests [1/N]) - #158306 (tests: modify s390x vector test to be robust to instruction scheduling) - #158313 (Move `check_target_feature` into the attribute parser) - #158431 (More lint cleanups) - #158452 (Add missing links in integer docs) - #158467 (Add proc macro for unused assignments and corresponding test) - #158472 (Add regression test for unexpected pointer dereference issue) - #158475 (Fix doc comment on get_debug_as_hex.) - #158476 (Fix doc comment on FormattingOptions::new().)
…uwer Rollup of 13 pull requests Successful merges: - #157871 ([rustdoc] Update `doc_cfg` hide/show syntax) - #158234 (Cross-referencing tuple_trait tracking issue, source and the Unstable Book) - #158480 (add smoketest for std::net::hostname) - #157625 (Use infer tys for synthetic params when lowering const paths point to fns) - #158290 (add crashtests [1/N]) - #158306 (tests: modify s390x vector test to be robust to instruction scheduling) - #158313 (Move `check_target_feature` into the attribute parser) - #158431 (More lint cleanups) - #158452 (Add missing links in integer docs) - #158467 (Add proc macro for unused assignments and corresponding test) - #158472 (Add regression test for unexpected pointer dereference issue) - #158475 (Fix doc comment on get_debug_as_hex.) - #158476 (Fix doc comment on FormattingOptions::new().)
Rollup merge of #157625 - mu001999:fix-155834, r=JohnTitor Use infer tys for synthetic params when lowering const paths point to fns ```rust #![feature(min_generic_const_args)] trait Trait {} impl<'t> Trait for [(); N] {} fn N(arg: impl Trait) {} ``` 1. `arg: impl Trait` implies a synthetic param `<impl Trait>` and the obligation `_: Trait`; 2. when matching `impl Trait for [(); N]`, lowering const arg `N` fills in that synthetic param, so the impl header contains `<[(); N::<impl Trait>] as Trait>`; 3. then instantiating this header with the impl's args causing a param/arg mismatch and ICE. This PR uses infer tys for synthetic params. Although this will emit the error in `ItemCtxt` because infer tys are not allowed here. I think that is reasonable, because `N` omits the synthetic parameter, though we cannot write the ty explicitly anywhere. Fixes #155834
|
@rust-timer build 0ce5a1c |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (0ce5a1c): comparison URL. Overall result: no relevant changes - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)Results (primary 9.4%, secondary 6.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -2.7%)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: 485.171s -> 486.984s (0.37%) |
arg: impl Traitimplies a synthetic param<impl Trait>and the obligation_: Trait;impl Trait for [(); N], lowering const argNfills in that synthetic param, so the impl header contains<[(); N::<impl Trait>] as Trait>;This PR uses infer tys for synthetic params. Although this will emit the error in
ItemCtxtbecause infer tys are not allowed here. I think that is reasonable, becauseNomits the synthetic parameter, though we cannot write the ty explicitly anywhere.Fixes #155834