about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile2
-rw-r--r--src/ci/github-actions/jobs.yml10
-rwxr-xr-xsrc/ci/scripts/free-disk-space.sh123
-rw-r--r--src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml2
-rw-r--r--src/doc/rustc-dev-guide/README.md4
-rw-r--r--src/doc/rustc-dev-guide/rust-version2
-rw-r--r--src/doc/rustc-dev-guide/src/SUMMARY.md5
-rw-r--r--src/doc/rustc-dev-guide/src/autodiff/installation.md12
-rw-r--r--src/doc/rustc-dev-guide/src/building/bootstrapping/what-bootstrapping-does.md4
-rw-r--r--src/doc/rustc-dev-guide/src/git.md59
-rw-r--r--src/librustdoc/clean/mod.rs4
-rw-r--r--src/librustdoc/clean/render_macro_matchers.rs8
-rw-r--r--src/librustdoc/doctest/make.rs27
-rw-r--r--src/tools/clippy/clippy_lints/src/dereference.rs2
-rw-r--r--src/tools/clippy/clippy_lints/src/missing_const_for_fn.rs2
-rw-r--r--src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.stderr2
16 files changed, 163 insertions, 105 deletions
diff --git a/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile
index ae5bf8946dd..bedf45c8630 100644
--- a/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile
+++ b/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile
@@ -2,7 +2,7 @@
 # CentOS 7 has headers for kernel 3.10, but that's fine as long as we don't
 # actually use newer APIs in rustc or std without a fallback. It's more
 # important that we match glibc for ELF symbol versioning.
-FROM centos:7
+FROM ghcr.io/rust-lang/centos:7
 
 WORKDIR /build
 
diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml
index 88b29d2df56..afcc092e78e 100644
--- a/src/ci/github-actions/jobs.yml
+++ b/src/ci/github-actions/jobs.yml
@@ -65,6 +65,12 @@ runners:
     os: codebuild-ubuntu-22-36c-$github.run_id-$github.run_attempt
     <<: *base-job
 
+  - &job-linux-8c-codebuild
+    free_disk: true
+    codebuild: true
+    os: codebuild-ubuntu-22-8c-$github.run_id-$github.run_attempt
+    <<: *base-job
+
 envs:
   env-x86_64-apple-tests: &env-x86_64-apple-tests
     SCRIPT: ./x.py check compiletest --set build.compiletest-use-stage0-libtest=true && ./x.py --stage 2 test --skip tests/ui --skip tests/rustdoc -- --exact
@@ -160,7 +166,7 @@ auto:
     <<: *job-linux-4c
 
   - name: dist-arm-linux
-    <<: *job-linux-36c-codebuild
+    <<: *job-linux-8c-codebuild
 
   - name: dist-armhf-linux
     <<: *job-linux-4c
@@ -213,7 +219,7 @@ auto:
   - name: dist-x86_64-linux
     env:
       CODEGEN_BACKENDS: llvm,cranelift
-    <<: *job-linux-16c
+    <<: *job-linux-36c-codebuild
 
   - name: dist-x86_64-linux-alt
     env:
diff --git a/src/ci/scripts/free-disk-space.sh b/src/ci/scripts/free-disk-space.sh
index ad7ee136e9c..173f64858b3 100755
--- a/src/ci/scripts/free-disk-space.sh
+++ b/src/ci/scripts/free-disk-space.sh
@@ -87,59 +87,80 @@ printDF() {
 
 removeUnusedFilesAndDirs() {
     local to_remove=(
-        "/usr/local/aws-sam-cli"
-        "/usr/local/doc/cmake"
-        "/usr/local/julia"*
-        "/usr/local/lib/android"
-        "/usr/local/share/chromedriver-"*
-        "/usr/local/share/chromium"
-        "/usr/local/share/cmake-"*
-        "/usr/local/share/edge_driver"
-        "/usr/local/share/gecko_driver"
-        "/usr/local/share/icons"
-        "/usr/local/share/vim"
-        "/usr/local/share/emacs"
-        "/usr/local/share/powershell"
-        "/usr/local/share/vcpkg"
-        "/usr/share/apache-maven-"*
-        "/usr/share/gradle-"*
         "/usr/share/java"
-        "/usr/share/kotlinc"
-        "/usr/share/miniconda"
-        "/usr/share/php"
-        "/usr/share/ri"
-        "/usr/share/swift"
-
-        # binaries
-        "/usr/local/bin/azcopy"
-        "/usr/local/bin/bicep"
-        "/usr/local/bin/ccmake"
-        "/usr/local/bin/cmake-"*
-        "/usr/local/bin/cmake"
-        "/usr/local/bin/cpack"
-        "/usr/local/bin/ctest"
-        "/usr/local/bin/helm"
-        "/usr/local/bin/kind"
-        "/usr/local/bin/kustomize"
-        "/usr/local/bin/minikube"
-        "/usr/local/bin/packer"
-        "/usr/local/bin/phpunit"
-        "/usr/local/bin/pulumi-"*
-        "/usr/local/bin/pulumi"
-        "/usr/local/bin/stack"
-
-        # Haskell runtime
-        "/usr/local/.ghcup"
-
-        # Azure
-        "/opt/az"
-        "/usr/share/az_"*
     )
 
-    if [ -n "${AGENT_TOOLSDIRECTORY:-}" ]; then
-        # Environment variable set by GitHub Actions
+    if isGitHubRunner; then
+        to_remove+=(
+            "/usr/local/aws-sam-cli"
+            "/usr/local/doc/cmake"
+            "/usr/local/julia"*
+            "/usr/local/lib/android"
+            "/usr/local/share/chromedriver-"*
+            "/usr/local/share/chromium"
+            "/usr/local/share/cmake-"*
+            "/usr/local/share/edge_driver"
+            "/usr/local/share/emacs"
+            "/usr/local/share/gecko_driver"
+            "/usr/local/share/icons"
+            "/usr/local/share/powershell"
+            "/usr/local/share/vcpkg"
+            "/usr/local/share/vim"
+            "/usr/share/apache-maven-"*
+            "/usr/share/gradle-"*
+            "/usr/share/kotlinc"
+            "/usr/share/miniconda"
+            "/usr/share/php"
+            "/usr/share/ri"
+            "/usr/share/swift"
+
+            # binaries
+            "/usr/local/bin/azcopy"
+            "/usr/local/bin/bicep"
+            "/usr/local/bin/ccmake"
+            "/usr/local/bin/cmake-"*
+            "/usr/local/bin/cmake"
+            "/usr/local/bin/cpack"
+            "/usr/local/bin/ctest"
+            "/usr/local/bin/helm"
+            "/usr/local/bin/kind"
+            "/usr/local/bin/kustomize"
+            "/usr/local/bin/minikube"
+            "/usr/local/bin/packer"
+            "/usr/local/bin/phpunit"
+            "/usr/local/bin/pulumi-"*
+            "/usr/local/bin/pulumi"
+            "/usr/local/bin/stack"
+
+            # Haskell runtime
+            "/usr/local/.ghcup"
+
+            # Azure
+            "/opt/az"
+            "/usr/share/az_"*
+        )
+
+        if [ -n "${AGENT_TOOLSDIRECTORY:-}" ]; then
+            # Environment variable set by GitHub Actions
+            to_remove+=(
+                "${AGENT_TOOLSDIRECTORY}"
+            )
+        else
+            echo "::warning::AGENT_TOOLSDIRECTORY is not set. Skipping removal."
+        fi
+    else
+        # Remove folders and files present in AWS CodeBuild
         to_remove+=(
-            "${AGENT_TOOLSDIRECTORY}"
+            # binaries
+            "/usr/local/bin/ecs-cli"
+            "/usr/local/bin/eksctl"
+            "/usr/local/bin/kubectl"
+
+            "${HOME}/.gradle"
+            "${HOME}/.dotnet"
+            "${HOME}/.goenv"
+            "${HOME}/.phpenv"
+
         )
     fi
 
@@ -194,6 +215,10 @@ cleanPackages() {
                 'powershell'
             )
         fi
+    else
+        packages+=(
+            'google-chrome-stable'
+        )
     fi
 
     sudo apt-get -qq remove -y --fix-missing "${packages[@]}"
diff --git a/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml b/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml
index b19eccf9eb8..1e430d8b4e6 100644
--- a/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml
+++ b/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml
@@ -28,7 +28,7 @@ jobs:
           # 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/src/doc/rustc-dev-guide/README.md b/src/doc/rustc-dev-guide/README.md
index 9f468b933d7..08158801788 100644
--- a/src/doc/rustc-dev-guide/README.md
+++ b/src/doc/rustc-dev-guide/README.md
@@ -77,7 +77,7 @@ This repository is linked to `rust-lang/rust` as a [josh](https://josh-project.g
 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 @@ You may observe "Nothing to pull" even if you *know* rustc-pull has something to
 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/src/doc/rustc-dev-guide/rust-version b/src/doc/rustc-dev-guide/rust-version
index dc52e0928cc..67fa25f2228 100644
--- a/src/doc/rustc-dev-guide/rust-version
+++ b/src/doc/rustc-dev-guide/rust-version
@@ -1 +1 @@
-b8005bff3248cfc6e327faf4fa631ac49bb49ba9
+deb947971c8748f5c6203548ce4af9022f21eaf0
diff --git a/src/doc/rustc-dev-guide/src/SUMMARY.md b/src/doc/rustc-dev-guide/src/SUMMARY.md
index 68112d06167..d6ec803a60a 100644
--- a/src/doc/rustc-dev-guide/src/SUMMARY.md
+++ b/src/doc/rustc-dev-guide/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/doc/rustc-dev-guide/src/autodiff/installation.md b/src/doc/rustc-dev-guide/src/autodiff/installation.md
index dbea9dbe144..f3c11395523 100644
--- a/src/doc/rustc-dev-guide/src/autodiff/installation.md
+++ b/src/doc/rustc-dev-guide/src/autodiff/installation.md
@@ -25,9 +25,10 @@ rustup toolchain install nightly # enables -Z unstable-options
 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 @@ apt install wget vim python3 git curl libssl-dev pkg-config lld ninja-build cmak
 ```
 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 @@ We then copy the tarball to our host. The dockerid is the newest entry under `do
 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/doc/rustc-dev-guide/src/building/bootstrapping/what-bootstrapping-does.md b/src/doc/rustc-dev-guide/src/building/bootstrapping/what-bootstrapping-does.md
index 1dd5402f4cd..ffcfe259625 100644
--- a/src/doc/rustc-dev-guide/src/building/bootstrapping/what-bootstrapping-does.md
+++ b/src/doc/rustc-dev-guide/src/building/bootstrapping/what-bootstrapping-does.md
@@ -394,8 +394,8 @@ will be rare to want to use it. Finally, `MAGIC_EXTRA_RUSTFLAGS` bypasses the
   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/doc/rustc-dev-guide/src/git.md b/src/doc/rustc-dev-guide/src/git.md
index 177495b5362..8118ddff10c 100644
--- a/src/doc/rustc-dev-guide/src/git.md
+++ b/src/doc/rustc-dev-guide/src/git.md
@@ -38,13 +38,13 @@ If you've cloned your fork, then you will be able to reference it with `origin`
 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 @@ See [Rebasing](#rebasing) for more about rebasing.
 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 @@ To fix it, do the following things:
 ### 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 @@ commit your changes, or make a temporary commit called a "stash" to have them st
 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 reset --hard master
 
 `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 @@ didn't write, it likely means you're trying to rebase over the wrong branch. For
 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 @@ When updating your local repository with `git pull`, you may notice that sometim
 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 @@ Changes not staged for commit:
 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 @@ merged. To do that, you need to rebase your work on top of rust-lang/rust.
 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 @@ reapply the changes fails because your changes conflicted with other changes
 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 @@ will keep it up-to-date. You will also want to rebase your feature branches
 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 @@ change the order in which they are applied, or "squash" them into each other.
 
 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 @@ it shows you the differences between your old diff and your new diff.
 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 @@ Git and Github's default diff view for large moves *within* a file is quite poor
 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 @@ that was force-pushed to make sure there are no unexpected changes.
 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 @@ The contents of submodules are ignored by Git: submodules are in some sense isol
 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 @@ that Git can nicely and fairly conveniently handle for us.
 
 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 @@ Changes not staged for commit:
 
 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 @@ fatal: Fetched in submodule path 'src/llvm-project', but it did not contain 5a51
 
 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 @@ and then try `git submodule update` again.
 
 If that doesn't work, you can try to deinit all git submodules...
 
-```
+```console
 git submodule deinit -f --all
 ```
 
@@ -618,7 +621,7 @@ completely messed up for some reason.
 
 Sometimes, for some forsaken reason, you might run into
 
-```text
+```console
 fatal: not a git repository: src/gcc/../../.git/modules/src/gcc
 ```
 
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 6ecb67c776c..622a410837b 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -2213,9 +2213,9 @@ pub(crate) fn clean_middle_ty<'tcx>(
             }))
         }
 
-        ty::Alias(ty::Weak, data) => {
+        ty::Alias(ty::Free, data) => {
             if cx.tcx.features().lazy_type_alias() {
-                // Weak type alias `data` represents the `type X` in `type X = Y`. If we need `Y`,
+                // Free type alias `data` represents the `type X` in `type X = Y`. If we need `Y`,
                 // we need to use `type_of`.
                 let path = clean_middle_path(
                     cx,
diff --git a/src/librustdoc/clean/render_macro_matchers.rs b/src/librustdoc/clean/render_macro_matchers.rs
index fc99dd08b78..e967fd40609 100644
--- a/src/librustdoc/clean/render_macro_matchers.rs
+++ b/src/librustdoc/clean/render_macro_matchers.rs
@@ -34,20 +34,20 @@ pub(super) fn render_macro_matcher(tcx: TyCtxt<'_>, matcher: &TokenTree) -> Stri
     //             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
     //         ) => {...};
     //     }
-    printer.cbox(8);
+    let cb = printer.cbox(8);
     printer.word("(");
     printer.zerobreak();
-    printer.ibox(0);
+    let ib = printer.ibox(0);
     match matcher {
         TokenTree::Delimited(_span, _spacing, _delim, tts) => print_tts(&mut printer, tts),
         // Matcher which is not a Delimited is unexpected and should've failed
         // to compile, but we render whatever it is wrapped in parens.
         TokenTree::Token(..) => print_tt(&mut printer, matcher),
     }
-    printer.end();
+    printer.end(ib);
     printer.break_offset_if_not_bol(0, -4);
     printer.word(")");
-    printer.end();
+    printer.end(cb);
     printer.s.eof()
 }
 
diff --git a/src/librustdoc/doctest/make.rs b/src/librustdoc/doctest/make.rs
index d5c965f7053..4194abc8d57 100644
--- a/src/librustdoc/doctest/make.rs
+++ b/src/librustdoc/doctest/make.rs
@@ -407,17 +407,27 @@ fn parse_source(source: &str, crate_name: &Option<&str>) -> Result<ParseSourceIn
                     push_to_s(&mut info.crate_attrs, source, attr.span, &mut prev_span_hi);
                 }
             }
+            let mut has_non_items = false;
             for stmt in &body.stmts {
                 let mut is_extern_crate = false;
                 match stmt.kind {
                     StmtKind::Item(ref item) => {
                         is_extern_crate = check_item(&item, &mut info, crate_name);
                     }
-                    StmtKind::Expr(ref expr) if matches!(expr.kind, ast::ExprKind::Err(_)) => {
-                        reset_error_count(&psess);
-                        return Err(());
+                    StmtKind::Expr(ref expr) => {
+                        if matches!(expr.kind, ast::ExprKind::Err(_)) {
+                            reset_error_count(&psess);
+                            return Err(());
+                        }
+                        has_non_items = true;
                     }
-                    StmtKind::MacCall(ref mac_call) if !info.has_main_fn => {
+                    // We assume that the macro calls will expand to item(s) even though they could
+                    // expand to statements and expressions. And the simple fact that we're trying
+                    // to retrieve a `main` function inside it is a terrible idea.
+                    StmtKind::MacCall(ref mac_call) => {
+                        if info.has_main_fn {
+                            continue;
+                        }
                         let mut iter = mac_call.mac.args.tokens.iter();
 
                         while let Some(token) = iter.next() {
@@ -437,7 +447,9 @@ fn parse_source(source: &str, crate_name: &Option<&str>) -> Result<ParseSourceIn
                             }
                         }
                     }
-                    _ => {}
+                    _ => {
+                        has_non_items = true;
+                    }
                 }
 
                 // Weirdly enough, the `Stmt` span doesn't include its attributes, so we need to
@@ -462,6 +474,11 @@ fn parse_source(source: &str, crate_name: &Option<&str>) -> Result<ParseSourceIn
                     push_to_s(&mut info.crates, source, span, &mut prev_span_hi);
                 }
             }
+            if has_non_items {
+                // FIXME: if `info.has_main_fn` is `true`, emit a warning here to mention that
+                // this code will not be called.
+                info.has_main_fn = false;
+            }
             Ok(info)
         }
         Err(e) => {
diff --git a/src/tools/clippy/clippy_lints/src/dereference.rs b/src/tools/clippy/clippy_lints/src/dereference.rs
index 7da5a530eaa..5edb5c23570 100644
--- a/src/tools/clippy/clippy_lints/src/dereference.rs
+++ b/src/tools/clippy/clippy_lints/src/dereference.rs
@@ -853,7 +853,7 @@ impl TyCoercionStability {
                     continue;
                 },
                 ty::Param(_) if for_return => Self::Deref,
-                ty::Alias(ty::Weak | ty::Inherent, _) => unreachable!("should have been normalized away above"),
+                ty::Alias(ty::Free | ty::Inherent, _) => unreachable!("should have been normalized away above"),
                 ty::Alias(ty::Projection, _) if !for_return && ty.has_non_region_param() => Self::Reborrow,
                 ty::Infer(_)
                 | ty::Error(_)
diff --git a/src/tools/clippy/clippy_lints/src/missing_const_for_fn.rs b/src/tools/clippy/clippy_lints/src/missing_const_for_fn.rs
index 67537a251da..1f142bc3ba6 100644
--- a/src/tools/clippy/clippy_lints/src/missing_const_for_fn.rs
+++ b/src/tools/clippy/clippy_lints/src/missing_const_for_fn.rs
@@ -197,7 +197,7 @@ fn fn_inputs_has_impl_trait_ty(cx: &LateContext<'_>, def_id: LocalDefId) -> bool
     inputs.iter().any(|input| {
         matches!(
             input.kind(),
-            ty::Alias(ty::AliasTyKind::Weak, alias_ty) if cx.tcx.type_of(alias_ty.def_id).skip_binder().is_impl_trait()
+            ty::Alias(ty::AliasTyKind::Free, alias_ty) if cx.tcx.type_of(alias_ty.def_id).skip_binder().is_impl_trait()
         )
     })
 }
diff --git a/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.stderr b/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.stderr
index bdac1e42309..ad3c420270c 100644
--- a/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.stderr
+++ b/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.stderr
@@ -236,7 +236,7 @@ LL |     if result.is_ok() {
 LL |         result.as_mut().unwrap();
    |         ^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: creating a shared reference to mutable static is discouraged
+error: creating a shared reference to mutable static
   --> tests/ui/checked_unwrap/simple_conditionals.rs:183:12
    |
 LL |         if X.is_some() {