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

some asm block flags also mean there can be no fences #1413

Merged
merged 2 commits into from
Nov 4, 2023

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Oct 9, 2023

@Amanieu I wasn't sure about the readonly part of this. An acquire read is not entirely a read-only operation in terms of how it affects the machine state, e.g. it cannot be arbitrarily reordered with other reads. So I assume readonly blocks cannot really have "acquire" effects?

@RalfJung RalfJung changed the title nomem also means no fences some asm block flags also mean there can be no fences Oct 9, 2023
@Amanieu
Copy link
Member

Amanieu commented Oct 10, 2023

This is correct. Only "write" asm has the effects of a compiler fence.

@RalfJung
Copy link
Member Author

I realized pure probably also needs this comment about not having fences.

Are there any others? Or can everything else still do synchronization?

@Amanieu
Copy link
Member

Amanieu commented Oct 10, 2023

pure must be used with either readonly or nomem, otherwise the compiler emits an error. There is no need to mention pure separately.

@RalfJung
Copy link
Member Author

Oh I see. That's not mentioned in the docs either, so I added it.

@josephlr
Copy link

I like this! It definitely cleared some stuff up for me.

Oh I see. That's not mentioned in the docs either, so I added it.

It seems like it's mentioned further down:

The pure option must be combined with either the nomem or readonly options, otherwise a compile-time error is emitted.

But I think also having it in the pure section makes the options easier to understand.

@RalfJung
Copy link
Member Author

Oh I see, so now it's redundant.

I'm fine either way, @ehuss @Amanieu let me know which way you prefer. :)

@Amanieu
Copy link
Member

Amanieu commented Oct 17, 2023

I think it's probably better to move it next to the definition of pure.

@RalfJung
Copy link
Member Author

All right, done that.

@RalfJung
Copy link
Member Author

RalfJung commented Nov 4, 2023

@ehuss as far as I can see, this is ready to land.

Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

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

Thanks! I was waiting for @Amanieu, but it seems like they are ok with it. If there are any changes needed, someone can follow up with another PR.

@ehuss ehuss added this pull request to the merge queue Nov 4, 2023
Merged via the queue into rust-lang:master with commit b8a39d3 Nov 4, 2023
1 check passed
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 7, 2023
Update books

## rust-lang/reference

4 commits in 16fd3c06d9e558dae2d52000818274ae70c9e90a..cd8193e972f61b92117095fc73b67af767b4d6bc
2023-11-04 17:19:39 UTC to 2023-10-30 16:04:52 UTC

- Guarantee that raw pointer conversions preserve slice element count (rust-lang/reference#1417)
- some asm block flags also mean there can be no fences (rust-lang/reference#1413)
- Guarantee `char` layout (rust-lang/reference#1401)
- Doc: Add the RISC-V stabilized target features (rust-lang/reference#1415)

## rust-lang/rust-by-example

3 commits in 6709beeb7d0fbc5ffc91ac4893a24434123b9bfa..311b84962016b28c75525c86e7b3f49fd9101a39
2023-10-31 18:32:09 UTC to 2023-10-31 18:30:39 UTC

- Fixed explanation mistake in comment (rust-lang/rust-by-example#1761)
- Fix typos (rust-lang/rust-by-example#1759)
- docs(9.2): fix typo (rust-lang/rust-by-example#1754)

## rust-lang/rustc-dev-guide

6 commits in b0ee9ec8fa59a6c7620165e061f4747202377a62..77dbe5782b2488af3bb489ad702eaff438f465bf
2023-11-06 16:14:34 UTC to 2023-10-29 17:16:02 UTC

- add a new type system invariant (rust-lang/rustc-dev-guide#1822)
- Update some outdated descriptions of coverage instrumentation (rust-lang/rustc-dev-guide#1809)
- Add some documentation for unsizing (rust-lang/rustc-dev-guide#1817)
- Bibliography: fixing author of "You Can't Spell Trust Without Rust" (rust-lang/rustc-dev-guide#1815)
- remove change-id from sample build configuration (rust-lang/rustc-dev-guide#1813)
- Update name of "active" features to "unstable" (rust-lang/rustc-dev-guide#1814)
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 7, 2023
Rollup merge of rust-lang#117639 - rustbot:docs-update, r=ehuss

Update books

## rust-lang/reference

4 commits in 16fd3c06d9e558dae2d52000818274ae70c9e90a..cd8193e972f61b92117095fc73b67af767b4d6bc
2023-11-04 17:19:39 UTC to 2023-10-30 16:04:52 UTC

- Guarantee that raw pointer conversions preserve slice element count (rust-lang/reference#1417)
- some asm block flags also mean there can be no fences (rust-lang/reference#1413)
- Guarantee `char` layout (rust-lang/reference#1401)
- Doc: Add the RISC-V stabilized target features (rust-lang/reference#1415)

## rust-lang/rust-by-example

3 commits in 6709beeb7d0fbc5ffc91ac4893a24434123b9bfa..311b84962016b28c75525c86e7b3f49fd9101a39
2023-10-31 18:32:09 UTC to 2023-10-31 18:30:39 UTC

- Fixed explanation mistake in comment (rust-lang/rust-by-example#1761)
- Fix typos (rust-lang/rust-by-example#1759)
- docs(9.2): fix typo (rust-lang/rust-by-example#1754)

## rust-lang/rustc-dev-guide

6 commits in b0ee9ec8fa59a6c7620165e061f4747202377a62..77dbe5782b2488af3bb489ad702eaff438f465bf
2023-11-06 16:14:34 UTC to 2023-10-29 17:16:02 UTC

- add a new type system invariant (rust-lang/rustc-dev-guide#1822)
- Update some outdated descriptions of coverage instrumentation (rust-lang/rustc-dev-guide#1809)
- Add some documentation for unsizing (rust-lang/rustc-dev-guide#1817)
- Bibliography: fixing author of "You Can't Spell Trust Without Rust" (rust-lang/rustc-dev-guide#1815)
- remove change-id from sample build configuration (rust-lang/rustc-dev-guide#1813)
- Update name of "active" features to "unstable" (rust-lang/rustc-dev-guide#1814)
@RalfJung RalfJung deleted the nofence branch December 26, 2023 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants