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

[strict provenance] make compiler's Term and GenericArg conform #119217

Closed
WaffleLapkin opened this issue Dec 22, 2023 · 14 comments · Fixed by #119955
Closed

[strict provenance] make compiler's Term and GenericArg conform #119217

WaffleLapkin opened this issue Dec 22, 2023 · 14 comments · Fixed by #119955
Assignees
Labels
A-strict-provenance Area: Strict provenance for raw pointers E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@WaffleLapkin
Copy link
Member

WaffleLapkin commented Dec 22, 2023

Term and GenericArg currently store pointers as NonZeroUsize, which is not ideal:

ptr: NonZeroUsize,

They should really work with NonNull pointers and strict provenance APIs like .map_addr, .mask, etc.

See a PR fixing a similar issue for some context: #110243 (note: in that one I ended up rewriting the whole thing, I think this issue requires far less changes).

@WaffleLapkin WaffleLapkin added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 22, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 22, 2023
@WaffleLapkin
Copy link
Member Author

(I do plan to work on this, but if you want to work on this instead — feel free to @rustbot claim, I can mentor you)
cc @RalfJung

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 22, 2023
@kamalesh0406

This comment was marked as duplicate.

@Rajveer100

This comment was marked as off-topic.

@Rajveer100

This comment was marked as off-topic.

@rustbot rustbot assigned Rajveer100 and unassigned kamalesh0406 Dec 26, 2023
@fee1-dead

This comment was marked as off-topic.

@Rajveer100

This comment was marked as off-topic.

@Noratrieb

This comment was marked as off-topic.

@kamalesh0406

This comment was marked as off-topic.

@kamalesh0406
Copy link
Contributor

@rustbot claim

@fee1-dead
Copy link
Member

Hi @kamalesh0406: Just checking in :) Are you still working on this issue?

@kamalesh0406
Copy link
Contributor

Yup I am still working on this issue :)

@fee1-dead
Copy link
Member

fee1-dead commented Jan 7, 2024

Let us know on Zulip if you need any help

compiler-errors added a commit to compiler-errors/rust that referenced this issue Jan 17, 2024
Modify GenericArg and Term structs to use strict provenance rules

This is the first PR to solve issue rust-lang#119217 . In this PR, I have modified the GenericArg struct to use the `NonNull` struct as the pointer instead of `NonZeroUsize`. The change were tested by running `./x test compiler/rustc_middle`.

Resolves rust-lang#119217

r? `@WaffleLapkin`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 18, 2024
Modify GenericArg and Term structs to use strict provenance rules

This is the first PR to solve issue rust-lang#119217 . In this PR, I have modified the GenericArg struct to use the `NonNull` struct as the pointer instead of `NonZeroUsize`. The change were tested by running `./x test compiler/rustc_middle`.

Resolves rust-lang#119217

r? `@WaffleLapkin`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 18, 2024
Modify GenericArg and Term structs to use strict provenance rules

This is the first PR to solve issue rust-lang#119217 . In this PR, I have modified the GenericArg struct to use the `NonNull` struct as the pointer instead of `NonZeroUsize`. The change were tested by running `./x test compiler/rustc_middle`.

Resolves rust-lang#119217

r? ``@WaffleLapkin``
@bors bors closed this as completed in d93fecc Jan 25, 2024
@WaffleLapkin
Copy link
Member Author

@RalfJung with this resolved, I think rustc is free from "fuzzy provenance casts" :)

@WaffleLapkin WaffleLapkin added the A-strict-provenance Area: Strict provenance for raw pointers label Jan 25, 2024
@RalfJung
Copy link
Member

Awesome :-)

github-actions bot pushed a commit to rust-lang/miri that referenced this issue Jan 26, 2024
Modify GenericArg and Term structs to use strict provenance rules

This is the first PR to solve issue #119217 . In this PR, I have modified the GenericArg struct to use the `NonNull` struct as the pointer instead of `NonZeroUsize`. The change were tested by running `./x test compiler/rustc_middle`.

Resolves rust-lang/rust#119217

r? `@WaffleLapkin`
lnicola pushed a commit to lnicola/rust-analyzer that referenced this issue Apr 7, 2024
Modify GenericArg and Term structs to use strict provenance rules

This is the first PR to solve issue #119217 . In this PR, I have modified the GenericArg struct to use the `NonNull` struct as the pointer instead of `NonZeroUsize`. The change were tested by running `./x test compiler/rustc_middle`.

Resolves rust-lang/rust#119217

r? `@WaffleLapkin`
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this issue Apr 27, 2024
Modify GenericArg and Term structs to use strict provenance rules

This is the first PR to solve issue #119217 . In this PR, I have modified the GenericArg struct to use the `NonNull` struct as the pointer instead of `NonZeroUsize`. The change were tested by running `./x test compiler/rustc_middle`.

Resolves rust-lang/rust#119217

r? `@WaffleLapkin`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-strict-provenance Area: Strict provenance for raw pointers E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants