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

Support ?Trait bounds in supertraits and dyn Trait under a feature gate #121676

Merged
merged 2 commits into from
Jul 26, 2024

Conversation

Bryanskiy
Copy link
Contributor

@Bryanskiy Bryanskiy commented Feb 27, 2024

This patch allows maybe polarity bounds under a feature gate. The only language change here is that corresponding hard errors are replaced by feature gates. Example:

#![feature(allow_maybe_polarity)]
...
trait Trait1 : ?Trait { ... } // ok
fn foo(_: Box<(dyn Trait2 + ?Trait)>) {} // ok
fn bar<T: ?Sized + ?Trait>(_: &T) {} // ok

Maybe bounds still don't do anything (except for Sized trait), however this patch will allow us to experiment with default auto traits.

This is a part of the MCP: Low level components for async drop

@rustbot
Copy link
Collaborator

rustbot commented Feb 27, 2024

r? @petrochenkov

rustbot has assigned @petrochenkov.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Feb 27, 2024
@Noratrieb
Copy link
Member

for reference, is there any language team shepherd for all of this default bound experimentation? I only ever see random work and don't remember seeing design documents or anything like that

@rust-log-analyzer

This comment has been minimized.

@petrochenkov
Copy link
Contributor

@Nilstrieb
I'll make a compiler team MCP for core components for async drop enabling library experimentation soon.
@traviscross is currently the Async WG liaison for this stuff (I actually assumed he was on lang team as well, but apparently not).

@Bryanskiy Bryanskiy changed the title allow_maybe_polarity feature Support ?Trait bounds in supertraits and dyn Trait under a feature gate Feb 27, 2024
@Bryanskiy
Copy link
Contributor Author

@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 Feb 27, 2024
@rustbot
Copy link
Collaborator

rustbot commented Feb 27, 2024

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@Bryanskiy
Copy link
Contributor 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 Feb 27, 2024
@rustbot
Copy link
Collaborator

rustbot commented Feb 29, 2024

Some changes occurred in diagnostic error codes

cc @GuillaumeGomez

compiler/rustc_feature/src/unstable.rs Outdated Show resolved Hide resolved
compiler/rustc_feature/src/unstable.rs Outdated Show resolved Hide resolved
compiler/rustc_hir/src/intravisit.rs Outdated Show resolved Hide resolved
compiler/rustc_ast_passes/src/feature_gate.rs Outdated Show resolved Hide resolved
compiler/rustc_ast_passes/src/feature_gate.rs Outdated Show resolved Hide resolved
compiler/rustc_hir_analysis/src/astconv/bounds.rs Outdated Show resolved Hide resolved
@petrochenkov
Copy link
Contributor

Need to link to rust-lang/compiler-team#727 from this PR description.
@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 Mar 1, 2024
@Bryanskiy Bryanskiy force-pushed the polarity branch 2 times, most recently from d84587a to 540fde9 Compare March 1, 2024 17:06
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jul 25, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 25, 2024
Support ?Trait bounds in supertraits and dyn Trait under a feature gate

This patch allows `maybe` polarity bounds under a feature gate. The only language change here is that corresponding hard errors are replaced by feature gates. Example:
```rust
#![feature(allow_maybe_polarity)]
...
trait Trait1 : ?Trait { ... } // ok
fn foo(_: Box<(dyn Trait2 + ?Trait)>) {} // ok
fn bar<T: ?Sized + ?Trait>(_: &T) {} // ok
```
Maybe bounds still don't do anything (except for `Sized` trait), however this patch will allow us to [experiment with default auto traits](rust-lang#120706 (comment)).

This is a part of the [MCP: Low level components for async drop](rust-lang/compiler-team#727)
@matthiaskrgr
Copy link
Member

@bors r-
tests need rebase/blessing I guess #128191 (comment)

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 25, 2024
@Bryanskiy
Copy link
Contributor Author

The latest commit fixes this

@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 Jul 26, 2024
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jul 26, 2024

📌 Commit fd9d0bf has been approved by petrochenkov

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 26, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 26, 2024
Support ?Trait bounds in supertraits and dyn Trait under a feature gate

This patch allows `maybe` polarity bounds under a feature gate. The only language change here is that corresponding hard errors are replaced by feature gates. Example:
```rust
#![feature(allow_maybe_polarity)]
...
trait Trait1 : ?Trait { ... } // ok
fn foo(_: Box<(dyn Trait2 + ?Trait)>) {} // ok
fn bar<T: ?Sized + ?Trait>(_: &T) {} // ok
```
Maybe bounds still don't do anything (except for `Sized` trait), however this patch will allow us to [experiment with default auto traits](rust-lang#120706 (comment)).

This is a part of the [MCP: Low level components for async drop](rust-lang/compiler-team#727)
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 26, 2024
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#121676 (Support ?Trait bounds in supertraits and dyn Trait under a feature gate)
 - rust-lang#124339 (allow overwriting the output of `rustc --version`)
 - rust-lang#128223 (Refactor complex conditions in `collect_tokens_trailing_token`)
 - rust-lang#128224 (Remove unnecessary range replacements)
 - rust-lang#128226 (Remove redundant option that was just encoding that a slice was empty)
 - rust-lang#128227 (CI: do not respect custom try jobs for unrolled perf builds)

r? `@ghost`
`@rustbot` modify labels: rollup
tgross35 added a commit to tgross35/rust that referenced this pull request Jul 26, 2024
Support ?Trait bounds in supertraits and dyn Trait under a feature gate

This patch allows `maybe` polarity bounds under a feature gate. The only language change here is that corresponding hard errors are replaced by feature gates. Example:
```rust
#![feature(allow_maybe_polarity)]
...
trait Trait1 : ?Trait { ... } // ok
fn foo(_: Box<(dyn Trait2 + ?Trait)>) {} // ok
fn bar<T: ?Sized + ?Trait>(_: &T) {} // ok
```
Maybe bounds still don't do anything (except for `Sized` trait), however this patch will allow us to [experiment with default auto traits](rust-lang#120706 (comment)).

This is a part of the [MCP: Low level components for async drop](rust-lang/compiler-team#727)
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 26, 2024
Rollup of 9 pull requests

Successful merges:

 - rust-lang#121676 (Support ?Trait bounds in supertraits and dyn Trait under a feature gate)
 - rust-lang#124941 (Stabilize const `{integer}::from_str_radix` i.e. `const_int_from_str`)
 - rust-lang#128210 (rustdoc: change title of search results)
 - rust-lang#128223 (Refactor complex conditions in `collect_tokens_trailing_token`)
 - rust-lang#128224 (Remove unnecessary range replacements)
 - rust-lang#128226 (Remove redundant option that was just encoding that a slice was empty)
 - rust-lang#128227 (CI: do not respect custom try jobs for unrolled perf builds)
 - rust-lang#128229 (Improve `extern "<abi>" unsafe fn()` error message)
 - rust-lang#128235 (Fix `Iterator::filter` docs)

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

bors commented Jul 26, 2024

⌛ Testing commit fd9d0bf with merge 7c2012d...

@bors
Copy link
Contributor

bors commented Jul 26, 2024

☀️ Test successful - checks-actions
Approved by: petrochenkov
Pushing 7c2012d to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 26, 2024
@bors bors merged commit 7c2012d into rust-lang:master Jul 26, 2024
7 checks passed
@rustbot rustbot added this to the 1.82.0 milestone Jul 26, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7c2012d): 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 (secondary -2.0%)

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)
-2.0% [-2.0%, -2.0%] 1
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 769.319s -> 770.229s (0.12%)
Artifact size: 328.91 MiB -> 328.95 MiB (0.01%)

flip1995 pushed a commit to flip1995/rust that referenced this pull request Aug 8, 2024
Support ?Trait bounds in supertraits and dyn Trait under a feature gate

This patch allows `maybe` polarity bounds under a feature gate. The only language change here is that corresponding hard errors are replaced by feature gates. Example:
```rust
#![feature(allow_maybe_polarity)]
...
trait Trait1 : ?Trait { ... } // ok
fn foo(_: Box<(dyn Trait2 + ?Trait)>) {} // ok
fn bar<T: ?Sized + ?Trait>(_: &T) {} // ok
```
Maybe bounds still don't do anything (except for `Sized` trait), however this patch will allow us to [experiment with default auto traits](rust-lang#120706 (comment)).

This is a part of the [MCP: Low level components for async drop](rust-lang/compiler-team#727)
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. T-lang Relevant to the language 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.