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

add an unstable #[rustc_coinductive] attribute #108033

Merged
merged 3 commits into from
Feb 15, 2023

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Feb 14, 2023

useful to test coinduction, especially in the new solver.

as this attribute should remain permanently unstable I don't think this needs any official approval. cc @rust-lang/types

had to weaken the check for stable query results in the solver to prevent an ICE if there's a coinductive cycle with constraints.

r? @compiler-errors

@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. T-libs Relevant to the library team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative labels Feb 14, 2023
@rustbot
Copy link
Collaborator

rustbot commented Feb 14, 2023

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

@lcnr lcnr force-pushed the coinductive-attr branch 2 times, most recently from 588ac14 to b39861f Compare February 14, 2023 10:49
@lcnr lcnr force-pushed the coinductive-attr branch 2 times, most recently from 49d3ec5 to de6cf80 Compare February 14, 2023 11:12
Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

IDK about the test, which we can talk about later, but this implemenntation looks good.

@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Feb 14, 2023

📌 Commit a2f0303 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 Feb 14, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 14, 2023
…errors

add an unstable `#[rustc_coinductive]` attribute

useful to test coinduction, especially in the new solver.

as this attribute should remain permanently unstable I don't think this needs any official approval. cc `@rust-lang/types`

had to weaken the check for stable query results in the solver to prevent an ICE if there's a coinductive cycle with constraints.

r? `@compiler-errors`
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 14, 2023
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#107573 (Update the minimum external LLVM to 14)
 - rust-lang#107626 (Fix `x fix` on the standard library itself)
 - rust-lang#107673 (update ICU4X to 1.1.0)
 - rust-lang#107733 (Store metrics from `metrics.json` to CI PGO timer)
 - rust-lang#108007 (Use `is_str` instead of string kind comparison)
 - rust-lang#108033 (add an unstable `#[rustc_coinductive]` attribute)
 - rust-lang#108039 (Refactor refcounted structural_impls via functors)
 - rust-lang#108040 (Use derive attributes for uninteresting traversals)
 - rust-lang#108044 (interpret: rename Pointer::from_addr → from_addr_invalid)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit edcdab0 into rust-lang:master Feb 15, 2023
@rustbot rustbot added this to the 1.69.0 milestone Feb 15, 2023
@lcnr lcnr deleted the coinductive-attr branch February 15, 2023 05:49
Jarcho pushed a commit to Jarcho/rust that referenced this pull request Feb 26, 2023
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#107573 (Update the minimum external LLVM to 14)
 - rust-lang#107626 (Fix `x fix` on the standard library itself)
 - rust-lang#107673 (update ICU4X to 1.1.0)
 - rust-lang#107733 (Store metrics from `metrics.json` to CI PGO timer)
 - rust-lang#108007 (Use `is_str` instead of string kind comparison)
 - rust-lang#108033 (add an unstable `#[rustc_coinductive]` attribute)
 - rust-lang#108039 (Refactor refcounted structural_impls via functors)
 - rust-lang#108040 (Use derive attributes for uninteresting traversals)
 - rust-lang#108044 (interpret: rename Pointer::from_addr → from_addr_invalid)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang/rust-analyzer that referenced this pull request Jun 28, 2023
internal: support `#[rustc_coinductive]`

rust-lang/rust#100386 changed the trait solver so that `Sized` is treated as coinductive trait, just like auto traits. This is now controlled by the perma-unstable `#[rustc_coinductive]` attribute (rust-lang/rust#108033), which this PR adds support for.

In practice, I don't think this matters much if at all. Currently we don't give chalk enough information so chalk cannot precisely (dis)prove `Sized` bounds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. T-libs Relevant to the library team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants