Skip to content
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

Clean up check_consts and misc fixes #119072

Merged
merged 3 commits into from
Dec 23, 2023

Conversation

fee1-dead
Copy link
Member

@fee1-dead fee1-dead commented Dec 18, 2023

  1. Remove most of the logic around erroring with trait methods. I have kept the part resolving it to a concrete impl, as that is used for const stability checks.
  2. Turning on effects causes ICE with generic args, due to ~const Tr when Tr is not #[const_trait] tripping up expectation in code that handles generic args, more specifically here:
    assert_eq!(kind, "lifetime");

We set arg_count.correct to Err to correctly signal that an error has already been reported.

  1. UI test blesses.

Edit(fmease): Fixes #117244 (UI test is in #119099 for now).

r? compiler-errors

@fee1-dead fee1-dead marked this pull request as ready for review December 18, 2023 07:51
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 18, 2023
@compiler-errors
Copy link
Member

compiler-errors commented Dec 18, 2023

Could you pull this out into several PRs, or at least several commits that can be reviewed separately? Specifically, I'd like to see:

  1. Changing all the UI tests to feature(effects), and blessing tests (even if some are broken before the next two commits are landed).
  2. Fixing the bug in (2.) above.
  3. Removing the logic around erroring with trait methods.

Thanks!! Sorry for the extra work '^^

let mut selcx = SelectionContext::new(&infcx);
selcx.select(&obligation)
};
if let Ok(Some(ImplSource::UserDefined(data))) = implsrc {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of just matching on ImplSource::UserDefined, I feel like we should just directly call Instance::resolve here:

 if let Ok(Some(func)) = instance
    && let InstanceDef::Item(def) = func.def
{
    callee = def;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also then comment that this is just necessary to select a more specific item for const stability. If the instance-resolve fails, then we'll look at the const stability of the trait item, rather than a more specific impl item.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we still using select here? I don't think it's needed with the Instance::resolve call.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps I misread your previous comment. I will fix in a moment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, no, I wasn't clear. I don't think we need implsrc (or select) at all now, since we can resolve the item here.

@compiler-errors
Copy link
Member

@rustbot author

One more nit

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 21, 2023
@rust-log-analyzer

This comment has been minimized.

@fee1-dead
Copy link
Member Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 22, 2023
@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Dec 22, 2023

📌 Commit df1a4c6 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 22, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 23, 2023
…=compiler-errors

Clean up `check_consts` and misc fixes

1. Remove most of the logic around erroring with trait methods. I have kept the part resolving it to a concrete impl, as that is used for const stability checks.
2. Turning on `effects` causes ICE with generic args, due to `~const Tr` when `Tr` is not `#[const_trait]` tripping up expectation in code that handles generic args, more specifically here:
https://github.com/rust-lang/rust/blob/8681e077b8afa99d60acf8f8470a012a3ce709a5/compiler/rustc_hir_analysis/src/astconv/generics.rs#L377

We set `arg_count.correct` to `Err` to correctly signal that an error has already been reported.

3. UI test blesses.

Edit(fmease): Fixes rust-lang#117244 (UI test is in rust-lang#119099 for now).

r? compiler-errors
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 23, 2023
…iaskrgr

Rollup of 2 pull requests

Successful merges:

 - rust-lang#119072 (Clean up `check_consts` and misc fixes)
 - rust-lang#119231 (Clairify `ast::PatKind::Struct` presese of `..` by using an enum instead of a bool)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Contributor

bors commented Dec 23, 2023

⌛ Testing commit df1a4c6 with merge edcbcc7...

@bors
Copy link
Contributor

bors commented Dec 23, 2023

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing edcbcc7 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 23, 2023
@bors bors merged commit edcbcc7 into rust-lang:master Dec 23, 2023
12 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Dec 23, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (edcbcc7): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.6% [1.6%, 1.6%] 1
Improvements ✅
(primary)
-1.2% [-1.2%, -1.2%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.2% [-1.2%, -1.2%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 668.853s -> 669.674s (0.12%)
Artifact size: 312.67 MiB -> 312.80 MiB (0.04%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ice: effects: assertion failed: constant / lifetime
6 participants