-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Enforce non-lifetime-binders in supertrait preds are not object safe #108842
Conversation
r? @TaKO8Ki (rustbot has picked a reviewer for you, use r? to override) |
fn super_predicates_have_non_lifetime_binders( | ||
tcx: TyCtxt<'_>, | ||
trait_def_id: DefId, | ||
) -> SmallVec<[Span; 1]> { |
There was a problem hiding this comment.
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
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable to me.
r? compiler |
There was a problem hiding this 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() |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable to me.
7d28725
to
720cc40
Compare
Thanks. @bors r+ rollup |
…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.
…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.
…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.
…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.
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
We can't construct vtables for these supertraits.