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

The <*const T>::guaranteed_* methods now return an option for the unknown case #101483

Merged
merged 1 commit into from
Sep 10, 2022

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Sep 6, 2022

cc #53020 (comment)

I chose 0 for "not equal" and 1 for "equal" and left 2 for the unknown case so backends can just forward to raw pointer equality and it works ✨

r? @fee1-dead or @lcnr

cc @rust-lang/wg-const-eval

@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 6, 2022
@rustbot
Copy link
Collaborator

rustbot commented Sep 6, 2022

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 6, 2022
library/core/src/ptr/const_ptr.rs Outdated Show resolved Hide resolved
library/core/src/ptr/const_ptr.rs Outdated Show resolved Hide resolved
Copy link
Member

@fee1-dead fee1-dead left a comment

Choose a reason for hiding this comment

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

LGTM. r= me if nothing else happens

compiler/rustc_codegen_ssa/src/mir/intrinsic.rs Outdated Show resolved Hide resolved
@oli-obk
Copy link
Contributor Author

oli-obk commented Sep 7, 2022

I have decided to remove guaranteed_ne, there is no advantage to having it around anymore (as the result is now the same as eq, but with the boolean inverted).

@RalfJung
Copy link
Member

RalfJung commented Sep 7, 2022 via email

@oli-obk
Copy link
Contributor Author

oli-obk commented Sep 7, 2022

Given that we have PartialEq::eq and ne, IMO it makes sense to also have both here for CTFE ptr comparison.

I don't believe so. The reason we created ne was due to the inconsistency between equality and inequality. That is gone now. We could rename it to guaranteed_same or sth, but considering you already need to match on the option, there's little gain in having a convenience ne operation. In fact I would say it creates more confusion than it aids.

@RalfJung
Copy link
Member

RalfJung commented Sep 7, 2022

The reason we created ne was due to the inconsistency between equality and inequality.

I don't agree. We have PartialEq::ne and the != operator despite there being no inconsistency.

@oli-obk
Copy link
Contributor Author

oli-obk commented Sep 7, 2022

The reason we created ne was due to the inconsistency between equality and inequality.

I don't agree. We have PartialEq::ne and the != operator despite there being no inconsistency.

These operators are inverses of each other and return a bool. Here, they return an Option<bool>, which seems sufficiently different from the other equality ops to me. Anyway, I don't feel strongly about it, just noticed it while updating the docs which were talking about the fact that the functions aren't inverses of each other, but ignoring the None case they are now. There's no information gain from having both functions. I expect most usages will be foo.guaranteed_eq(bar) == Some(true) or == Some(false) instead of extracting the bool.

@rust-log-analyzer

This comment was marked as outdated.

@fee1-dead
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Sep 10, 2022

📌 Commit f632dbe has been approved by fee1-dead

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 Sep 10, 2022
@bors
Copy link
Contributor

bors commented Sep 10, 2022

⌛ Testing commit f632dbe with merge 5197c96...

@bors
Copy link
Contributor

bors commented Sep 10, 2022

☀️ Test successful - checks-actions
Approved by: fee1-dead
Pushing 5197c96 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 10, 2022
@bors bors merged commit 5197c96 into rust-lang:master Sep 10, 2022
@rust-highfive
Copy link
Collaborator

📣 Toolstate changed by #101483!

Tested on commit 5197c96.
Direct link to PR: #101483

💔 miri on windows: test-pass → test-fail (cc @RalfJung @oli-obk).
💔 miri on linux: test-pass → test-fail (cc @RalfJung @oli-obk).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Sep 10, 2022
Tested on commit rust-lang/rust@5197c96.
Direct link to PR: <rust-lang/rust#101483>

💔 miri on windows: test-pass → test-fail (cc @RalfJung @oli-obk).
💔 miri on linux: test-pass → test-fail (cc @RalfJung @oli-obk).
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (5197c96): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean1 range count2
Regressions ❌
(primary)
0.4% [0.2%, 0.6%] 5
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.1% [-1.4%, -0.9%] 5
Improvements ✅
(secondary)
-2.9% [-3.8%, -0.7%] 8
All ❌✅ (primary) -0.4% [-1.4%, 0.6%] 10

Max RSS (memory usage)

Results

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.

mean1 range count2
Regressions ❌
(primary)
5.1% [2.3%, 8.8%] 6
Regressions ❌
(secondary)
0.9% [0.6%, 1.1%] 3
Improvements ✅
(primary)
-4.1% [-4.1%, -4.1%] 1
Improvements ✅
(secondary)
-1.5% [-2.3%, -1.0%] 6
All ❌✅ (primary) 3.8% [-4.1%, 8.8%] 7

Cycles

Results

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.

mean1 range count2
Regressions ❌
(primary)
3.0% [3.0%, 3.0%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.3% [-2.8%, -2.0%] 7
All ❌✅ (primary) 3.0% [3.0%, 3.0%] 1

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

@rustbot rustbot added the perf-regression Performance regression. label Sep 10, 2022
@pnkfelix
Copy link
Member

The big improvements are just noise from some bimodal behavior we've been observing this week.

Its possible that there was some regression to cargo here, but I don't think the data shows it to be large enough to be worth investigating. (I admit, my attitude there might be colored by my frustration with the huge noise impact of the aforementioned bimodality on all of the perf results from the last week.)

@rustbot label: perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Sep 14, 2022
celinval added a commit to celinval/kani-dev that referenced this pull request Sep 30, 2022
Fixes model-checking#1615

Relevant changes to rustc:
  - rust-lang/rust#101483: Change to intrinsics.
  - rust-lang/rust#94075: Change to niche opt.
  - rust-lang/rust#101101: Method rename.
celinval added a commit to celinval/kani-dev that referenced this pull request Sep 30, 2022
Fixes model-checking#1615

Relevant changes to rustc:
  - rust-lang/rust#101483: Change to intrinsics.
  - rust-lang/rust#94075: Change to niche opt.
  - rust-lang/rust#101101: Method rename.

Co-authored-by: Adrian Palacios <[email protected]>
celinval added a commit to model-checking/kani that referenced this pull request Oct 3, 2022
Fixes #1615

Relevant changes to rustc:
  - rust-lang/rust#101483: Change to intrinsics.
  - rust-lang/rust#94075: Change to niche opt.
  - rust-lang/rust#101101: Method rename.

Co-authored-by: Adrian Palacios <[email protected]>
bjorn3 pushed a commit to bjorn3/rust that referenced this pull request Oct 23, 2022
The `<*const T>::guaranteed_*` methods now return an option for the unknown case

cc rust-lang#53020 (comment)

I chose `0` for "not equal" and `1` for "equal" and left `2` for the unknown case so backends can just forward to raw pointer equality and it works ✨

r? `@fee1-dead` or `@lcnr`

cc `@rust-lang/wg-const-eval`
eddyb added a commit to EmbarkStudios/rust-gpu that referenced this pull request Oct 28, 2022
eddyb added a commit to EmbarkStudios/rust-gpu that referenced this pull request Oct 28, 2022
oisyn pushed a commit to EmbarkStudios/rust-gpu that referenced this pull request Nov 3, 2022
eddyb added a commit to EmbarkStudios/rust-gpu that referenced this pull request Nov 4, 2022
yvt added a commit to r3-os/r3 that referenced this pull request Nov 10, 2022
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. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. 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-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants