Auto merge of #137940 - 1c3t3a:alignment-borrows-check, r=saethlin
Extend the alignment check to borrows
The current alignment check does not include checks for creating misaligned references from raw pointers, which is now added in this patch.
When inserting the check we need to be careful with references to field projections (e.g. `&(*ptr).a`), in which case the resulting reference must be aligned according to the field type and not the type of the pointer.
r? `@saethlin`
cc `@RalfJung,` after our discussion in #134424
diff --git a/.github/workflows/rustc-pull.yml b/.github/workflows/rustc-pull.yml
index b19eccf..1e430d8 100644
--- a/.github/workflows/rustc-pull.yml
+++ b/.github/workflows/rustc-pull.yml
@@ -28,7 +28,7 @@
# Cache the josh directory with checked out rustc
cache-directories: "/home/runner/.cache/rustc-dev-guide-josh"
- name: Install josh
- run: RUSTFLAGS="--cap-lints warn" cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r24.10.04
+ run: RUSTFLAGS="--cap-lints warn" cargo install josh-proxy --git https://github.com/josh-project/josh --tag r24.10.04
- name: Setup bot git name and email
run: |
git config --global user.name 'The rustc-dev-guide Cronjob Bot'
diff --git a/README.md b/README.md
index 9f468b9..0815880 100644
--- a/README.md
+++ b/README.md
@@ -77,7 +77,7 @@
You'll need to install `josh-proxy` locally via
```
-cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r24.10.04
+cargo install josh-proxy --git https://github.com/josh-project/josh --tag r24.10.04
```
Older versions of `josh-proxy` may not round trip commits losslessly so it is important to install this exact version.
@@ -106,5 +106,5 @@
To minimize the likelihood of this happening, you may wish to keep a separate *minimal* git config that *only* has `[user]` entries from global git config, then repoint system git to use the minimal git config instead. E.g.
```
-GIT_CONFIG_GLOBAL=/path/to/minimal/gitconfig GIT_CONFIG_SYSTEM='' cargo +stable run --manifest-path josh-sync/Cargo.toml -- rustc-pull
+GIT_CONFIG_GLOBAL=/path/to/minimal/gitconfig GIT_CONFIG_SYSTEM='' cargo run --manifest-path josh-sync/Cargo.toml -- rustc-pull
```
diff --git a/rust-version b/rust-version
index dc52e09..67fa25f 100644
--- a/rust-version
+++ b/rust-version
@@ -1 +1 @@
-b8005bff3248cfc6e327faf4fa631ac49bb49ba9
+deb947971c8748f5c6203548ce4af9022f21eaf0
diff --git a/src/SUMMARY.md b/src/SUMMARY.md
index 68112d0..d6ec803 100644
--- a/src/SUMMARY.md
+++ b/src/SUMMARY.md
@@ -1,6 +1,7 @@
# Summary
[Getting Started](./getting-started.md)
+
[About this guide](./about-this-guide.md)
---
@@ -231,9 +232,13 @@
---
[Appendix A: Background topics](./appendix/background.md)
+
[Appendix B: Glossary](./appendix/glossary.md)
+
[Appendix C: Code Index](./appendix/code-index.md)
+
[Appendix D: Compiler Lecture Series](./appendix/compiler-lecture.md)
+
[Appendix E: Bibliography](./appendix/bibliography.md)
[Appendix Z: HumorRust](./appendix/humorust.md)
diff --git a/src/autodiff/installation.md b/src/autodiff/installation.md
index dbea9db..f3c1139 100644
--- a/src/autodiff/installation.md
+++ b/src/autodiff/installation.md
@@ -25,9 +25,10 @@
You can then run our test cases:
```bash
-./x.py test --stage 1 library tests/ui/autodiff
-./x.py test --stage 1 library tests/codegen/autodiff
-./x.py test --stage 1 library tests/pretty/autodiff*
+./x.py test --stage 1 tests/codegen/autodiff
+./x.py test --stage 1 tests/pretty/autodiff
+./x.py test --stage 1 tests/ui/autodiff
+./x.py test --stage 1 tests/ui/feature-gates/feature-gate-autodiff.rs
```
Autodiff is still experimental, so if you want to use it in your own projects, you will need to add `lto="fat"` to your Cargo.toml
@@ -44,7 +45,7 @@
```
Then build rustc in a slightly altered way:
```bash
-git clone --depth=1 https://github.com/EnzymeAD/rust.git
+git clone --depth=1 https://github.com/rust-lang/rust.git
cd rust
./configure --enable-llvm-link-shared --enable-llvm-plugins --enable-llvm-enzyme --release-channel=nightly --enable-llvm-assertions --enable-clang --enable-lld --enable-option-checking --enable-ninja --disable-docs
./x dist
@@ -54,7 +55,8 @@
docker cp <dockerid>:/rust/build/dist/rust-nightly-x86_64-unknown-linux-gnu.tar.gz rust-nightly-x86_64-unknown-linux-gnu.tar.gz
```
Afterwards we can create a new (pre-release) tag on the EnzymeAD/rust repository and make a PR against the EnzymeAD/enzyme-explorer repository to update the tag.
-Remember to ping `tgymnich` on the PR to run his update script.
+Remember to ping `tgymnich` on the PR to run his update script. Note: We should archive EnzymeAD/rust and update the instructions here. The explorer should soon
+be able to get the rustc toolchain from the official rust servers.
## Build instruction for Enzyme itself
diff --git a/src/building/bootstrapping/what-bootstrapping-does.md b/src/building/bootstrapping/what-bootstrapping-does.md
index 1dd5402..ffcfe25 100644
--- a/src/building/bootstrapping/what-bootstrapping-does.md
+++ b/src/building/bootstrapping/what-bootstrapping-does.md
@@ -394,8 +394,8 @@
this is `compiletest`. For unit tests and doc tests this is the `libtest`
runner.
-Most test runner accept `--help`, which you can use to find out the options
-accepted by the runner.
+Most test runners accept `--help`,
+which you can use to find out the options accepted by the runner.
## Environment Variables
diff --git a/src/git.md b/src/git.md
index 177495b..8118ddf 100644
--- a/src/git.md
+++ b/src/git.md
@@ -38,13 +38,13 @@
in your local repo. It may be helpful to also set up a remote for the official
rust-lang/rust repo via
-```sh
+```console
git remote add upstream https://github.com/rust-lang/rust.git
```
if you're using HTTPS, or
-```sh
+```console
git remote add upstream git@github.com:rust-lang/rust.git
```
@@ -112,7 +112,7 @@
This is not a problem from git's perspective. If you run `git remote -v`,
it will say something like this:
-```
+```console
$ git remote -v
origin git@github.com:jyn514/rust.git (fetch)
origin git@github.com:jyn514/rust.git (push)
@@ -158,11 +158,11 @@
### I see "error: cannot rebase" when I try to rebase
These are two common errors to see when rebasing:
-```
+```console
error: cannot rebase: Your index contains uncommitted changes.
error: Please commit or stash them.
```
-```
+```console
error: cannot rebase: You have unstaged changes.
error: Please commit or stash them.
```
@@ -174,7 +174,7 @@
when you finish rebasing. You may want to configure git to make this "stash" automatically, which
will prevent the "cannot rebase" error in nearly all cases:
-```
+```console
git config --global rebase.autostash true
```
@@ -205,7 +205,7 @@
`git push` will not work properly and say something like this:
-```
+```console
! [rejected] issue-xxxxx -> issue-xxxxx (non-fast-forward)
error: failed to push some refs to 'https://github.com/username/rust.git'
hint: Updates were rejected because the tip of your current branch is behind
@@ -226,7 +226,7 @@
have a `rust-lang/rust` remote `upstream`, but ran `git rebase origin/master` instead of `git rebase
upstream/master`. The fix is to abort the rebase and use the correct branch instead:
-```
+```console
git rebase --abort
git rebase -i upstream/master
```
@@ -243,7 +243,7 @@
Git says you have modified some files that you have never edited. For example,
running `git status` gives you something like (note the `new commits` mention):
-```
+```console
On branch master
Your branch is up to date with 'origin/master'.
@@ -256,9 +256,12 @@
no changes added to commit (use "git add" and/or "git commit -a")
```
-These changes are not changes to files: they are changes to submodules (more on this
-[later](#git-submodules)). To get rid of those, run `./x --help`, which will automatically update
-the submodules.
+These changes are not changes to files: they are changes to submodules (more on this [later](#git-submodules)).
+To get rid of those:
+
+```console
+git submodule update
+```
Some submodules are not actually needed; for example, `src/llvm-project` doesn't need to be checked
out if you're using `download-ci-llvm`. To avoid having to keep fetching its history, you can use
@@ -278,12 +281,12 @@
To rebase your feature branch on top of the newest version of the master branch
of rust-lang/rust, checkout your branch, and then run this command:
-```
+```console
git pull --rebase https://github.com/rust-lang/rust.git master
```
> If you are met with the following error:
-> ```
+> ```console
> error: cannot pull with rebase: Your index contains uncommitted changes.
> error: please commit or stash them.
> ```
@@ -300,13 +303,13 @@
that have been made. You can tell that this happened because you'll see
lines in the output that look like
-```
+```console
CONFLICT (content): Merge conflict in file.rs
```
When you open these files, you'll see sections of the form
-```
+```console
<<<<<<< HEAD
Original code
=======
@@ -346,7 +349,7 @@
up-to-date as well. After pulling, you can checkout the feature branches
and rebase them:
-```
+```console
git checkout master
git pull upstream master --ff-only # to make certain there are no merge commits
git rebase master feature_branch
@@ -384,7 +387,7 @@
Alternatively, you can sacrifice the commit history like this:
-```
+```console
# squash all the changes into one commit so you only have to worry about conflicts once
git rebase -i --keep-base master # and squash all changes along the way
git rebase master
@@ -422,7 +425,7 @@
Here's an example of `git range-diff` output (taken from [Git's
docs][range-diff-example-docs]):
-```
+```console
-: ------- > 1: 0ddba11 Prepare for the inevitable!
1: c0debee = 2: cab005e Add a helpful message at the start
2: f00dbal ! 3: decafe1 Describe a bug
@@ -499,7 +502,7 @@
line as deleted and each line as added, forcing you to compare each line yourself. Git has an option
to show moved lines in a different color:
-```
+```console
git log -p --color-moved=dimmed-zebra --color-moved-ws=allow-indentation-change
```
@@ -515,7 +518,7 @@
Many large files in the repo are autogenerated. To view a diff that ignores changes to those files,
you can use the following syntax (e.g. Cargo.lock):
-```
+```console
git log -p ':!Cargo.lock'
```
@@ -545,7 +548,7 @@
from the rest of the repository. However, if you try to `cd src/llvm-project` and then
run `git status`:
-```
+```console
HEAD detached at 9567f08afc943
nothing to commit, working tree clean
```
@@ -576,7 +579,7 @@
Sometimes you might run into (when you run `git status`)
-```
+```console
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
@@ -586,7 +589,7 @@
and when you try to run `git submodule update` it breaks horribly with errors like
-```
+```console
error: RPC failed; curl 92 HTTP/2 stream 7 was not closed cleanly: CANCEL (err 8)
error: 2782 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
@@ -597,8 +600,8 @@
If you see `(new commits, modified content)` you can run
-```bash
-$ git submodule foreach git reset --hard
+```console
+git submodule foreach git reset --hard
```
and then try `git submodule update` again.
@@ -607,7 +610,7 @@
If that doesn't work, you can try to deinit all git submodules...
-```
+```console
git submodule deinit -f --all
```
@@ -618,7 +621,7 @@
Sometimes, for some forsaken reason, you might run into
-```text
+```console
fatal: not a git repository: src/gcc/../../.git/modules/src/gcc
```