Skip to content

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

Merged
bors merged 11 commits into
rust-lang:masterfrom
oli-obk:tait_only_in_sig
Jul 8, 2023
Merged

Require TAITs to be mentioned in the signatures of functions that register hidden types for them#112652
bors merged 11 commits into
rust-lang:masterfrom
oli-obk:tait_only_in_sig

Conversation

@oli-obk

@oli-obkoli-obk commented Jun 15, 2023

Copy link
Copy Markdown
Contributor

r? @lcnr@compiler-errors

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

@rustbot

Copy link
Copy Markdown
Collaborator

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

@rustbotrustbot 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
Copy Markdown
Collaborator

rustc_error_messages was changed

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

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@lcnrlcnr left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
ContributorAuthor

@rustbot author

@rustbotrustbot 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`
Fixesrust-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

bors commented Jun 22, 2023

Copy link
Copy Markdown
Collaborator

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

@rust-log-analyzer

This comment has been minimized.

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
Copy Markdown
ContributorAuthor

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
Copy Markdown
ContributorAuthor

@rustbot ready

@bors

bors commented Jul 7, 2023

Copy link
Copy Markdown
Collaborator

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

@oli-obk

Copy link
Copy Markdown
ContributorAuthor

@bors r=compiler-errors

@bors

bors commented Jul 7, 2023

Copy link
Copy Markdown
Collaborator

📌 Commit c3004a7 has been approved by compiler-errors

It is now in the queue for this repository.

@borsbors 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

bors commented Jul 8, 2023

Copy link
Copy Markdown
Collaborator

⌛ Testing commit c3004a7 with merge d4096e0...

@bors

bors commented Jul 8, 2023

Copy link
Copy Markdown
Collaborator

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

@borsbors added the merged-by-bors This PR was explicitly merged by bors. label Jul 8, 2023
@bors
bors merged commit d4096e0 into rust-lang:masterJul 8, 2023
@rustbotrustbot added this to the 1.72.0 milestone Jul 8, 2023
@rust-timer

Copy link
Copy Markdown
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.

meanrangecount
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.

meanrangecount
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.

meanrangecount
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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-systemArea: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html)A-translationArea: Translation infrastructure, and migrating existing diagnostics to SessionDiagnosticmerged-by-borsThis PR was explicitly merged by bors.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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

@oli-obk@rustbot@rust-log-analyzer@bors@rust-timer@compiler-errors@lcnr