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

Start a chapter about the evolving const effect system #1808

Merged
merged 2 commits into from
Oct 18, 2023
Merged

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Oct 17, 2023

src/effects.md Outdated
# Effects and effect checking

Note: all of this describes the implementation of the unstable `effects` and
`const_trait` features. None of this implementation is usable or visible from
Copy link
Member

Choose a reason for hiding this comment

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

Should this be const_trait_impl?

src/effects.md Show resolved Hide resolved
src/effects.md Outdated
hidden from users. Any `~const Trait` bounds in the generics list or `where` bounds
of a `const fn` get converted to `Trait<host> + Trait<true>` bounds. The `Trait<true>`
exists so that associated types of the generic param can be used from projections
like `<T as Trait>::Assoc`, because there are no `<T as ~Trait>` projections for now.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
like `<T as Trait>::Assoc`, because there are no `<T as ~Trait>` projections for now.
like `<T as Trait>::Assoc`, because there are no `<T as ~const Trait>` projections for now.

src/effects.md Outdated
## `typeck` performing method and function call checks.

When generic parameters are instantiated for any items, the `host` generic parameter
is always instantiated as an inference variable. These variables fall back to `true` at
Copy link
Member

Choose a reason for hiding this comment

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

We should probably mention that it is a special kind of const infer var just so that the fallback works

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, should link or mention fallback_effects

src/effects.md Outdated
have the `enforce_context_effects` method invoked.
It trivially returns if the function being called has no `host` generic parameter.

TODO: how do we bail out if a non-const function is called in a const context?
Copy link
Member

Choose a reason for hiding this comment

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

AFAIK that is still in the Mir check_consts pass

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!

@fee1-dead fee1-dead merged commit 99157af into master Oct 18, 2023
1 check passed
@fee1-dead fee1-dead deleted the effects branch October 18, 2023 11:37
@fee1-dead
Copy link
Member

Also make sure to open a PR from a branch on your fork instead 😅

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 24, 2023
Update books

## rust-lang/book

1 commits in 72187f5cd0beaaa9c6f584156bcd88f921871e83..3dca2fc50b922a8efb94903b9fee8bb42ab48f38
2023-10-19 18:01:47 UTC to 2023-10-19 18:01:47 UTC

- Fix cargo doc links (rust-lang/book#3751)

## rust-embedded/book

1 commits in eac173690b8cc99094e1d88bd49dd61127fbd285..22bca3d0f6e9b9b556689b54ce96f25b46ecd1b3
2023-10-16 22:47:38 UTC to 2023-10-16 22:47:38 UTC

- Improved hardware.md chapter. (rust-embedded/book#361)

## rust-lang/nomicon

1 commits in ddfa4214487686e91b21aa29afb972c08a8f0d5b..1842257814919fa62e81bdecd5e8f95be2839dbb
2023-10-17 15:11:58 UTC to 2023-10-17 15:11:58 UTC

- Fixed `Hole::get` marked as unsafe in `exception-safety.md` (rust-lang/nomicon#427)

## rust-lang/reference

2 commits in 142b2ed77d33f37a9973772bd95e6144ed9dce43..16fd3c06d9e558dae2d52000818274ae70c9e90a
2023-10-14 22:31:04 UTC to 2023-10-11 15:35:55 UTC

- Adjust reference for return-position `impl Trait` in trait and `async fn` in trait (rust-lang/reference#1409)
- Fix temporary drop scope for last expression. (rust-lang/reference#1416)

## rust-lang/rust-by-example

1 commits in 8eb3a01ab74c567b7174784892fb807f2c632d6b..6709beeb7d0fbc5ffc91ac4893a24434123b9bfa
2023-10-20 19:11:21 UTC to 2023-10-20 19:11:21 UTC

- docs: fix a typo (rust-lang/rust-by-example#1752)

## rust-lang/rustc-dev-guide

5 commits in b98af7d661e4744baab81fb8dc7a049e44a4a998..b0ee9ec8fa59a6c7620165e061f4747202377a62
2023-10-22 03:18:44 UTC to 2023-10-11 06:30:26 UTC

- Add WF to glossary (rust-lang/rustc-dev-guide#1810)
- recommend `unpretty=hir` alongside `unpretty=hir-tree` (rust-lang/rustc-dev-guide#1804)
- Start a chapter about the evolving const effect system (rust-lang/rustc-dev-guide#1808)
- Document subtle implied bounds issue in RPITIT inference (rust-lang/rustc-dev-guide#1807)
- [suggested.md]  `changelog-seen` -> `change-id` in `shell.nix` (rust-lang/rustc-dev-guide#1806)
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 24, 2023
Rollup merge of rust-lang#117093 - rustbot:docs-update, r=ehuss

Update books

## rust-lang/book

1 commits in 72187f5cd0beaaa9c6f584156bcd88f921871e83..3dca2fc50b922a8efb94903b9fee8bb42ab48f38
2023-10-19 18:01:47 UTC to 2023-10-19 18:01:47 UTC

- Fix cargo doc links (rust-lang/book#3751)

## rust-embedded/book

1 commits in eac173690b8cc99094e1d88bd49dd61127fbd285..22bca3d0f6e9b9b556689b54ce96f25b46ecd1b3
2023-10-16 22:47:38 UTC to 2023-10-16 22:47:38 UTC

- Improved hardware.md chapter. (rust-embedded/book#361)

## rust-lang/nomicon

1 commits in ddfa4214487686e91b21aa29afb972c08a8f0d5b..1842257814919fa62e81bdecd5e8f95be2839dbb
2023-10-17 15:11:58 UTC to 2023-10-17 15:11:58 UTC

- Fixed `Hole::get` marked as unsafe in `exception-safety.md` (rust-lang/nomicon#427)

## rust-lang/reference

2 commits in 142b2ed77d33f37a9973772bd95e6144ed9dce43..16fd3c06d9e558dae2d52000818274ae70c9e90a
2023-10-14 22:31:04 UTC to 2023-10-11 15:35:55 UTC

- Adjust reference for return-position `impl Trait` in trait and `async fn` in trait (rust-lang/reference#1409)
- Fix temporary drop scope for last expression. (rust-lang/reference#1416)

## rust-lang/rust-by-example

1 commits in 8eb3a01ab74c567b7174784892fb807f2c632d6b..6709beeb7d0fbc5ffc91ac4893a24434123b9bfa
2023-10-20 19:11:21 UTC to 2023-10-20 19:11:21 UTC

- docs: fix a typo (rust-lang/rust-by-example#1752)

## rust-lang/rustc-dev-guide

5 commits in b98af7d661e4744baab81fb8dc7a049e44a4a998..b0ee9ec8fa59a6c7620165e061f4747202377a62
2023-10-22 03:18:44 UTC to 2023-10-11 06:30:26 UTC

- Add WF to glossary (rust-lang/rustc-dev-guide#1810)
- recommend `unpretty=hir` alongside `unpretty=hir-tree` (rust-lang/rustc-dev-guide#1804)
- Start a chapter about the evolving const effect system (rust-lang/rustc-dev-guide#1808)
- Document subtle implied bounds issue in RPITIT inference (rust-lang/rustc-dev-guide#1807)
- [suggested.md]  `changelog-seen` -> `change-id` in `shell.nix` (rust-lang/rustc-dev-guide#1806)
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.

3 participants