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

Require TAITs to be mentioned in the signatures of functions that register hidden types for them #112652

Merged
merged 11 commits into from
Jul 8, 2023

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jun 15, 2023

r? @lcnr @compiler-errors

This implements the lang team decision from the TAIT design meeting.

@rustbot
Copy link
Collaborator

rustbot commented Jun 15, 2023

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @lcnr (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic 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 Jun 15, 2023
@rustbot
Copy link
Collaborator

rustbot commented Jun 15, 2023

rustc_error_messages was changed

cc @davidtwco, @compiler-errors, @JohnTitor, @TaKO8Ki

@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk force-pushed the tait_only_in_sig branch from 9f5c836 to ca8ff0e Compare June 15, 2023 13:54
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk force-pushed the tait_only_in_sig branch from abbc6da to a078624 Compare June 19, 2023 09:38
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

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

not sure if this is ready yet and it might be nice to move the cleanup into a separate PR which can be approved separately.

My understanding was that we want to only allow defining uses for things in signatures, but make other uses in the same module ambiguous. This is not what's implemented in 9523613a1dcadfcd1105da1ee86c18879640976b afaict. I would expect us to implement this by keep the current logic for trait solving and checking in type_of whether any defining use was outside of the "currently stable" defining uses, if not error and suggest moving the function out of the defining module or whatever.

@oli-obk
Copy link
Contributor Author

oli-obk commented Jun 21, 2023

@rustbot author

@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 Jun 21, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 22, 2023
…-in-OpaqueTypeCollector, r=oli-obk

Don't substitute a GAT that has mismatched generics in `OpaqueTypeCollector`

Fixes rust-lang#111828

I didn't put up minimized UI tests for rust-lang#112510 or rust-lang#112873 because they'd minimize to literally the same code, but with different substs on the trait/impl. I don't think that warrants duplicate tests given the nature of the fix.

r? `@oli-obk`

----

Side-note: I checked, and this isn't fixed by rust-lang#112652 -- I think we discussed whether or not that PR fixed it either intentionally or by accident. The code here isn't really touched by that PR either as far as I can tell?

Also, sorry, did some other drive-bys. Hope it doesn't make rebasing rust-lang#112652 too difficult 😅
@bors
Copy link
Contributor

bors commented Jun 22, 2023

☔ The latest upstream changes (presumably #112914) made this pull request unmergeable. Please resolve the merge conflicts.

@oli-obk oli-obk force-pushed the tait_only_in_sig branch from 78f41ed to b8345ac Compare June 26, 2023 15:26
@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk force-pushed the tait_only_in_sig branch from b8345ac to 5bdadf5 Compare June 26, 2023 15:53
Comment on lines +141 to +150
if !self.tcx.opaque_types_defined_by(item_def_id).contains(&self.def_id) {
self.tcx.sess.emit_err(TaitForwardCompat {
span: hidden_type.span,
item_span: self
.tcx
.def_ident_span(item_def_id)
.unwrap_or_else(|| self.tcx.def_span(item_def_id)),
});
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the main change of this PR. We double check that any item that produces hidden types also has the corresponding opaque type in its signature

@oli-obk
Copy link
Contributor Author

oli-obk commented Jun 26, 2023

@rustbot ready

@bors
Copy link
Contributor

bors commented Jul 7, 2023

☔ The latest upstream changes (presumably #113429) made this pull request unmergeable. Please resolve the merge conflicts.

@oli-obk oli-obk force-pushed the tait_only_in_sig branch from 5872bed to 6edda79 Compare July 7, 2023 13:16
@oli-obk oli-obk force-pushed the tait_only_in_sig branch from 6edda79 to c3004a7 Compare July 7, 2023 13:17
@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 7, 2023

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Jul 7, 2023

📌 Commit c3004a7 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 Jul 7, 2023
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jul 7, 2023
…er-errors

Require TAITs to be mentioned in the signatures of functions that register hidden types for them

r? `@lcnr` `@compiler-errors`

This implements the lang team decision from [the TAIT design meeting](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/design.20meeting.202023-05-31.20TAITs/near/362518164).
@bors
Copy link
Contributor

bors commented Jul 8, 2023

⌛ Testing commit c3004a7 with merge d4096e0...

@bors
Copy link
Contributor

bors commented Jul 8, 2023

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 8, 2023
@bors bors merged commit d4096e0 into rust-lang:master Jul 8, 2023
@rustbot rustbot added this to the 1.72.0 milestone Jul 8, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (d4096e0): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was 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)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

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)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.0% [-5.0%, -1.0%] 2
All ❌✅ (primary) - - 0

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.8% [0.8%, 0.8%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.8% [0.8%, 0.8%] 1

Binary size

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

Bootstrap: 655.621s -> 656.508s (0.14%)

@oli-obk oli-obk deleted the tait_only_in_sig branch July 8, 2023 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic 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.

7 participants