-
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
Ban references to Self
in trait object substs for projection predicates too.
#100500
Conversation
// Like for trait refs, verify that `dummy_self` did not leak inside default type | ||
// parameters. | ||
let references_self = b.projection_ty.substs.iter().skip(1).any(|arg| { | ||
if let ty::GenericArgKind::Type(ty) = arg.unpack() { |
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.
this feels incorrect for const generics. What happens if you have a generic constant referencing self? (using feature(generic_const_exprs)
)
a generic constant not using self would be even worse 😅 because it still has Self
in its generic arguments even if unused.
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.
were there any problems with using arg.walk
instead of ty.walk
. Also, the generic arg itself should get returned as the first item of walk
, so the explicit ty == dummy_self
check shouldn't be necessary
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.
Do you have a test in mind for this?
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.
use feature(generic_const_exprs)
and have a Trait<{ N + 1 }
in it, or even Trait<{ 1 + 2 }>
.
can look into making a full example if you want, am done for today 😅
@bors r+ |
…lcnr Ban references to `Self` in trait object substs for projection predicates too. Fixes rust-lang#100484 Fixes rust-lang#100485 r? `@lcnr`
…lcnr Ban references to `Self` in trait object substs for projection predicates too. Fixes rust-lang#100484 Fixes rust-lang#100485 r? ``@lcnr``
…lcnr Ban references to `Self` in trait object substs for projection predicates too. Fixes rust-lang#100484 Fixes rust-lang#100485 r? ```@lcnr```
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#97963 (net listen backlog set to negative on Linux.) - rust-lang#99935 (Reenable disabled early syntax gates as future-incompatibility lints) - rust-lang#100129 (add miri-test-libstd support to libstd) - rust-lang#100500 (Ban references to `Self` in trait object substs for projection predicates too.) - rust-lang#100636 (Revert "Revert "Allow dynamic linking for iOS/tvOS targets."") - rust-lang#100718 ([rustdoc] Fix item info display) - rust-lang#100769 (Suggest adding a reference to a trait assoc item) - rust-lang#100777 (elaborate how revisions work with FileCheck stuff in src/test/codegen) - rust-lang#100796 (Refactor: remove unnecessary string searchings) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #100484
Fixes #100485
r? @lcnr