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

Implement negative bounds for internal testing purposes #110791

Merged
merged 5 commits into from
May 3, 2023

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Apr 25, 2023

Implements partial support the ! negative polarity on trait bounds. This is incomplete, but should allow us to at least be able to play with the feature.

Not even gonna consider them as a public-facing feature, but I'm implementing them because would've been nice to have in UI tests, for example in #110671.

@rustbot rustbot added A-rustdoc-json Area: Rustdoc JSON backend 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-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Apr 25, 2023
@@ -1,16 +1,16 @@
// run-rustfix
Copy link
Member Author

Choose a reason for hiding this comment

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

I removed the logic that suggested to just remove the negative bounds :/

It was more complicated than it was worth... though I guess I could add it back if the reviewer desires.

src/tools/rustfmt/src/types.rs Outdated Show resolved Hide resolved
@compiler-errors
Copy link
Member Author

compiler-errors commented Apr 25, 2023

This is probably ready for initial review.

This is an internal-only feature (...for now), so I'm assuming that it doesn't need T-lang support (though cc @rust-lang/lang if anyone disagrees).

I wish I could've added support via a rustc_* macro instead of parser support, but we don't support macros or attributes on bounds anyways. But the feature gate error doesn't give any suggestion that nightly users should use feature(negative_bounds) anyways, so I feel like this is fine.

r? types

@compiler-errors compiler-errors marked this pull request as ready for review April 25, 2023 21:01
@rustbot
Copy link
Collaborator

rustbot commented Apr 25, 2023

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

Copy link
Member

@spastorino spastorino left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Would prefer if someone else takes a look at this too.

r? types

@rustbot rustbot assigned oli-obk and unassigned spastorino May 1, 2023
@scottmcm
Copy link
Member

scottmcm commented May 1, 2023

No concerns from me about this going in feature-gated. We have https://github.com/rust-lang/negative-impls-initiative too, so experimentation in related places seems like it can be considered approved.

@oli-obk
Copy link
Contributor

oli-obk commented May 3, 2023

@bors r+

@bors
Copy link
Contributor

bors commented May 3, 2023

📌 Commit 6fca051 has been approved by oli-obk

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 May 3, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request May 3, 2023
Rollup of 11 pull requests

Successful merges:

 - rust-lang#107978 (Correctly convert an NT path to a Win32 path in `read_link`)
 - rust-lang#110436 (Support loading version information from xz tarballs)
 - rust-lang#110791 (Implement negative bounds for internal testing purposes)
 - rust-lang#110874 (Adjust obligation cause code for `find_and_report_unsatisfied_index_impl`)
 - rust-lang#110908 (resolve: One more attempt to simplify `module_children`)
 - rust-lang#110943 (interpret: fail more gracefully on uninit unsized locals)
 - rust-lang#111062 (Don't bail out early when checking invalid `repr` attr)
 - rust-lang#111069 (remove pointless `FIXME` in `bootstrap::download`)
 - rust-lang#111086 (Remove `MemEncoder`)
 - rust-lang#111097 (Avoid ICEing miri on layout query cycles)
 - rust-lang#111112 (Add some triagebot notifications for nnethercote.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 80df4ab into rust-lang:master May 3, 2023
@rustbot rustbot added this to the 1.71.0 milestone May 3, 2023
@compiler-errors compiler-errors deleted the negative-bounds branch August 11, 2023 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-json Area: Rustdoc JSON backend 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-rustdoc Relevant to the rustdoc 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