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

Enforce non-lifetime-binders in supertrait preds are not object safe #108842

Merged

Conversation

compiler-errors
Copy link
Member

We can't construct vtables for these supertraits.

@rustbot
Copy link
Collaborator

rustbot commented Mar 7, 2023

r? @TaKO8Ki

(rustbot has picked a reviewer for you, use r? to override)

@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. labels Mar 7, 2023
fn super_predicates_have_non_lifetime_binders(
tcx: TyCtxt<'_>,
trait_def_id: DefId,
) -> SmallVec<[Span; 1]> {
Copy link
Member Author

Choose a reason for hiding this comment

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

Perf: I guess we could bail early here if !tcx.features().non_lifetime_binders...

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems reasonable to me.

@compiler-errors compiler-errors added the F-non_lifetime_binders `#![feature(non_lifetime_binders)]` label Mar 10, 2023
@compiler-errors
Copy link
Member Author

r? compiler

@rustbot rustbot assigned b-naber and unassigned TaKO8Ki Mar 20, 2023
Copy link
Contributor

@b-naber b-naber left a comment

Choose a reason for hiding this comment

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

r=me with or without the nit.

@@ -921,6 +924,9 @@ impl ObjectSafetyViolation {
.into()
}
}
ObjectSafetyViolation::SupertraitNonLifetimeBinder(_) => {
format!("predicate cannot reference non-lifetime `for<...>` bound variables").into()
Copy link
Contributor

Choose a reason for hiding this comment

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

Should me maybe use a more user-friendly error message here? Can we expect users to know what predicates are?

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 would hope if they're using non-lifetime binders, but I guess i can de-types-ify the message by saying "where clause" 😸

fn super_predicates_have_non_lifetime_binders(
tcx: TyCtxt<'_>,
trait_def_id: DefId,
) -> SmallVec<[Span; 1]> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems reasonable to me.

@compiler-errors compiler-errors force-pushed the non_lifetime_binders-object-safe branch from 7d28725 to 720cc40 Compare March 20, 2023 22:39
@b-naber
Copy link
Contributor

b-naber commented Mar 20, 2023

Thanks.

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 20, 2023

📌 Commit 720cc40 has been approved by b-naber

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 Mar 20, 2023
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Mar 21, 2023
…rs-object-safe, r=b-naber

Enforce non-lifetime-binders in supertrait preds are not object safe

We can't construct vtables for these supertraits.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 21, 2023
…rs-object-safe, r=b-naber

Enforce non-lifetime-binders in supertrait preds are not object safe

We can't construct vtables for these supertraits.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 21, 2023
…rs-object-safe, r=b-naber

Enforce non-lifetime-binders in supertrait preds are not object safe

We can't construct vtables for these supertraits.
Noratrieb added a commit to Noratrieb/rust that referenced this pull request Mar 21, 2023
…rs-object-safe, r=b-naber

Enforce non-lifetime-binders in supertrait preds are not object safe

We can't construct vtables for these supertraits.
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 21, 2023
Rollup of 10 pull requests

Successful merges:

 - rust-lang#106434 (Document `Iterator::sum/product` for Option/Result)
 - rust-lang#108326 (Implement read_buf for a few more types)
 - rust-lang#108842 (Enforce non-lifetime-binders in supertrait preds are not object safe)
 - rust-lang#108896 (new solver: make all goal evaluation able to be automatically rerun )
 - rust-lang#109124 (Add `dist.compression-profile` option to control compression speed)
 - rust-lang#109240 (Walk un-shifted nested `impl Trait` in trait when setting up default trait method assumptions)
 - rust-lang#109385 (fix typo)
 - rust-lang#109386 (add myself to mailmap)
 - rust-lang#109390 (Custom MIR: Support aggregate expressions)
 - rust-lang#109408 (not *all* retags might be explicit in Runtime MIR)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 0ef4da1 into rust-lang:master Mar 21, 2023
@rustbot rustbot added this to the 1.70.0 milestone Mar 21, 2023
@compiler-errors compiler-errors deleted the non_lifetime_binders-object-safe branch August 11, 2023 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-non_lifetime_binders `#![feature(non_lifetime_binders)]` 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.

5 participants