about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2023-08-04Use similar color scheme to make it obvious they are linkedGuillaume Gomez-2/+2
2023-08-04update rust bookkadiwa-0/+0
2023-08-04unstable book: update lang_items page and split itkadiwa-252/+118
2023-08-04Add comment for rustdoc overrides.Camille GILLOT-0/+1
2023-08-04Make MissingDoc a module lint.Camille GILLOT-4/+3
2023-08-04interpret: add mplace_to_ref helper methodRalf Jung-6/+4
2023-08-04Improve spans for indexing expressionsNilstrieb-5/+5
Indexing is similar to method calls in having an arbitrary left-hand-side and then something on the right, which is the main part of the expression. Method calls already have a span for that right part, but indexing does not. This means that long method chains that use indexing have really bad spans, especially when the indexing panics and that span in coverted into a panic location. This does the same thing as method calls for the AST and HIR, storing an extra span which is then put into the `fn_span` field in THIR.
2023-08-04Improve spans for indexing expressionsNilstrieb-48/+48
Indexing is similar to method calls in having an arbitrary left-hand-side and then something on the right, which is the main part of the expression. Method calls already have a span for that right part, but indexing does not. This means that long method chains that use indexing have really bad spans, especially when the indexing panics and that span in coverted into a panic location. This does the same thing as method calls for the AST and HIR, storing an extra span which is then put into the `fn_span` field in THIR.
2023-08-04Print GHA log groups to stdout instead of stderrJakub Beránek-3/+3
In all other places (e.g. `bootstrap.py`, `opt-dist`), we use stdout instead of stderr. I think that using stderr might be causing some discrepancies in the log, where sometimes the contents of a group "leak" outside the group. Let's see what happens if we use stdout instead. It's possible that it will be worse, since we print most stuff to stderr (?).
2023-08-04style-guide: Expand documentation on `as` casts (mostly like a binary operator)Josh Triplett-8/+20
`as` casts currently get formatted like a binary operator, except that the second line can stack several `as` casts rather than breaking them each onto their own line. Merge `as` into a subsection of the binary operators section, and then go into detail on the one difference between `as` formatting and binary operator formatting.
2023-08-04Rollup merge of #114440 - kaniini:fix/bootstrap-version-compare, r=ozkanonurMatthias Krüger-1/+2
bootstrap: config: fix version comparison bug Rust requires a previous version of Rust to build, such as the current version, or the previous version. However, the version comparison logic did not take patch releases into consideration when doing the version comparison for the current branch, e.g. Rust 1.71.1 could not be built by Rust 1.71.0 because it is neither an exact version match, or the previous version. Adjust the version comparison logic to tolerate mismatches in the patch version.
2023-08-04Rollup merge of #114022 - oli-obk:tait_ice_alias_field_projection, r=cjgillotMatthias Krüger-0/+2
Perform OpaqueCast field projection on HIR, too. fixes #105819 This is necessary for closure captures in 2021 edition, as they capture individual fields, not the full mentioned variables. So it may try to capture a field of an opaque (because the hidden type is known to be something with a field). See https://github.com/rust-lang/rust/pull/99806 for when and why we added OpaqueCast to MIR.
2023-08-04Auto merge of #3011 - saethlin:spellck, r=RalfJungbors-7/+7
A bit of spell-checking I noticed the one error in miri-script and took care of a few more shallow ones.
2023-08-04Merge from rustcThe Miri Conjob Bot-48/+121
2023-08-04Preparing for merge from rustcThe Miri Conjob Bot-1/+1
2023-08-04Rollup merge of #114429 - Enselic:compiletest-fix, r=est31Matthias Krüger-10/+14
compiletest: Handle non-utf8 paths (fix FIXME) Removes the last FIXME in the code for #9639 🎉 (which was closed 8 years ago) Part of #44366 which is E-help-wanted. (The other two PRs that does this are #114377 and #114427)
2023-08-04Auto merge of #114305 - lqd:bootstrap-strip, r=ozkanonurbors-11/+63
Strip unexpected debuginfo from `libLLVM.so` and `librustc_driver.so` when not requesting any debuginfo As seen in #114175 and in [this zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/Artifact.20sizes/near/379302655), there's still some small amount of debuginfo in LLVM's shared library on linux, even when not requesting it (nightly CI), coming from `libstdc++`. ``` $ readelf --debug-dump=info ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM-16-rust-1.73.0-nightly.so | grep DW_TAG_compile_unit -A5 | grep DW_AT_comp_dir | cut -d ":" -f 2- | counts 101 counts ( 1) 39 (38.6%, 38.6%): (indirect string, offset: 0x7): /tmp/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/libsupc++ ( 2) 38 (37.6%, 76.2%): (indirect string, offset: 0x43fb2): /tmp/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src/c++11 ( 3) 23 (22.8%, 99.0%): (indirect string, offset: 0x18ed8): /tmp/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src/c++98 ( 4) 1 ( 1.0%,100.0%): (indirect string, offset: 0x53f04): /tmp/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src ``` Similarly, here's `librustc_driver.so` when not requesting debuginfo from either rustc or the tools (nightly CI), coming e.g. from our LLVM wrapper: ``` $ readelf --debug-dump=info ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e534b3a316089f5f.so | grep DW_TAG_compile_unit -A5 | grep DW_AT_comp_dir | cut -d ":" -f 2- | counts 116 counts ( 1) 34 (29.3%, 29.3%): (indirect string, offset: 0x3c11): /tmp/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/libsupc++ ( 2) 32 (27.6%, 56.9%): (indirect string, offset: 0x9753c): /tmp/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src/c++11 ( 3) 25 (21.6%, 78.4%): (indirect string, offset: 0x393bd): /tmp/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src/c++98 ( 4) 23 (19.8%, 98.3%): (indirect string, offset: 0x33ed3): /cargo/registry/src/index.crates.io-6f17d22bba15001f/compiler_builtins-0.1.98 ( 5) 1 ( 0.9%, 99.1%): (indirect string, offset: 0xaffff): /rustc/0d95f9132909ae7c5f2456748d0ffd1c3ba4a8e8 ( 6) 1 ( 0.9%,100.0%): (indirect string, offset: 0xb604a): /tmp/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src ``` To reduce the size of distributed artifacts, this PR strips debuginfo from the LLVM and `rustc_driver` shared libraries, when: - no debuginfo is requested when building LLVM: `link-shared` is true, `optimize` is true and `release-debuginfo` is false - no debuginfo is requested when building the rustc driver: - `debuginfo-level-rustc` and `debuginfo-level-tools` are off. - when building with a stage != 0 compiler: since this is about the distributed artifacts, there's no need to do this at other stages. - for both: on a x64 linux host and target where `strip -g` is available and fixes the issue (I don't know how to strip debuginfo from a `.dylib` on mac). The LLVM BOLTed .so, and `librustc_driver.so` are big there, and this will help a little. Other targets/hosts can be added in the future if we want to. #114175 did the same thing unconditionally in `opt-dist`, prior to BOLTing LLVM. But this should only be used in conjunction with the other config options mentioned above, and which `opt-dist` doesn't know about. Therefore, it makes more sense as in bootstrap when building LLVM and rustc when applicable and no debuginfo is requested. This shouldn't interact badly with CI caching builds and artifacts, right? --- From the other PR, `libLLVM-16-rust-1.73.0-nightly.so` prior to #114141: - master: 173.13 MiB - stripped debuginfo: 165.12 MiB (-8 MiB, -4.6%) `libLLVM-16-rust-1.73.0-nightly.so` after #114141: - master: 121.13 MiB - stripped debuginfo: 113.12 MiB (still -8 MiB, -6.6%) `librustc_driver.so`: - master: 118.58 MiB - stripped debuginfo: 106.46 MiB (-12 MiB, -10.2%) (Results are also available in this most recent [perf run's artifact sizes](https://perf.rust-lang.org/compare.html?start=b321edd1b2d4bd00c7b4611e8f20a03ee7b77023&end=810ab570d5d27facb91806e5d9847815d9dac22a&stat=instructions%3Au&tab=artifact-size))
2023-08-03Auto merge of #108955 - Nilstrieb:dont-use-me-pls, r=oli-obkbors-1/+18
Add `internal_features` lint Implements https://github.com/rust-lang/compiler-team/issues/596 Also requires some more test blessing for codegen tests etc `@jyn514` had the idea of just `allow`ing the lint by default in the test suite. I'm not sure whether this is a good idea, but it's definitely one worth considering. Additional input encouraged.
2023-08-03bootstrap: config: fix version comparison bugAriadne Conill-1/+2
Rust requires a previous version of Rust to build, such as the current version, or the previous version. However, the version comparison logic did not take patch releases into consideration when doing the version comparison for the current branch, e.g. Rust 1.71.1 could not be built by Rust 1.71.0 because it is neither an exact version match, or the previous version. Adjust the version comparison logic to tolerate mismatches in the patch version. Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2023-08-03A bit of spell-checkingBen Kimock-7/+7
2023-08-03Auto merge of #114424 - matthiaskrgr:rollup-cegblvo, r=matthiaskrgrbors-12/+20
Rollup of 8 pull requests Successful merges: - #113657 (Expand, rename and improve `incorrect_fn_null_checks` lint) - #114237 (parser: more friendly hints for handling `async move` in the 2015 edition) - #114300 (Suggests turbofish in patterns) - #114372 (const validation: point at where we found a pointer but expected an integer) - #114395 ([rustc_span][perf] Hoist lookup sorted by words out of the loop.) - #114403 (fix the span in the suggestion of remove question mark) - #114408 (Temporary remove myself from review rotation) - #114415 (Skip checking of `rustc_codegen_gcc` with vendoring enabled) r? `@ghost` `@rustbot` modify labels: rollup
2023-08-03compiletest: Handle non-utf8 paths (fix FIXME)Martin Nordholts-10/+14
2023-08-03Rollup merge of #114415 - Kobzol:bootstrap-check-vendor-gcc, r=ozkanonurMatthias Krüger-0/+6
Skip checking of `rustc_codegen_gcc` with vendoring enabled `rustc_codegen_gcc` currently cannot be vendored, which [breaks](https://github.com/rust-lang/rust/issues/112393) `x.py check` with vendoring enabled. Until the vendoring issue is resolved, it would be nice if `x.py check` could succeed (and just skip `gcc`) with `vendor = true`. With this PR, it does. Related issue: https://github.com/rust-lang/rust/issues/112393 r? bootstrap
2023-08-03Rollup merge of #114372 - RalfJung:const-pointer-as-int, r=oli-obkMatthias Krüger-5/+7
const validation: point at where we found a pointer but expected an integer Instead of validation just printing "unable to turn pointer into bytes", make this a regular validation error that says where in the value the bad pointer was found. Also distinguish "expected integer, got pointer" from "expected pointer, got partial pointer or mix of pointers". To avoid duplicating things too much I refactored the diagnostics for validity a bit, so that "got uninit, expected X" and "got pointer, expected X" can share the "X" part. Also all the errors emitted for validation are now grouped under `const_eval_validation` so that they are in a single group in the ftl file. r? `@oli-obk`
2023-08-03Rollup merge of #114300 - MU001999:fix/turbofish-pat, r=estebankMatthias Krüger-1/+1
Suggests turbofish in patterns Fixes #114112 r? ```@estebank```
2023-08-03Rollup merge of #114300 - MU001999:fix/turbofish-pat, r=estebankMatthias Krüger-1/+1
Suggests turbofish in patterns Fixes #114112 r? ```@estebank```
2023-08-03Rollup merge of #113657 - Urgau:expand-incorrect_fn_null_check-lint, r=cjgillotMatthias Krüger-6/+6
Expand, rename and improve `incorrect_fn_null_checks` lint This PR, - firstly, expand the lint by now linting on references - secondly, it renames the lint `incorrect_fn_null_checks` -> `useless_ptr_null_checks` - and thirdly it improves the lint by catching `ptr::from_mut`, `ptr::from_ref`, as well as `<*mut _>::cast` and `<*const _>::cast_mut` Fixes https://github.com/rust-lang/rust/issues/113601 cc ```@est31```
2023-08-03strip librustc_driver.so even at stage 1Rémy Rakic-4/+2
2023-08-03Update cargoWeihang Lo-0/+0
2023-08-03Skip checking of `rustc_codegen_gcc` with vendoring enabledJakub Beránek-0/+6
2023-08-03Add `internal_features` lintNilstrieb-1/+18
It lints against features that are inteded to be internal to the compiler and standard library. Implements MCP #596. We allow `internal_features` in the standard library and compiler as those use many features and this _is_ the standard library from the "internal to the compiler and standard library" after all. Marking some features as internal wasn't exactly the most scientific approach, I just marked some mostly obvious features. While there is a categorization in the macro, it's not very well upheld (should probably be fixed in another PR). We always pass `-Ainternal_features` in the testsuite About 400 UI tests and several other tests use internal features. Instead of throwing the attribute on each one, just always allow them. There's nothing wrong with testing internal features^^
2023-08-03Auto merge of #3009 - oli-obk:auto_actions, r=oli-obkbors-9/+16
Avoid infinite recursion for auto-fmt and auto-clippy I got stack overflows after I fixed the `-`/`_` typo 😆
2023-08-03add test checking that overlapping assignments workRalf Jung-0/+9
2023-08-03Avoid infinite recursion for auto-fmt and auto-clippyOli Scherer-9/+16
2023-08-03fmtThe Miri Conjob Bot-2/+7
2023-08-03Merge from rustcThe Miri Conjob Bot-227/+230
2023-08-03Preparing for merge from rustcThe Miri Conjob Bot-1/+1
2023-08-03Auto merge of #114353 - nnethercote:parser-ast-cleanups, r=petrochenkovbors-15/+7
Some parser and AST cleanups Things I found while looking closely at this code. r? `@petrochenkov`
2023-08-02Auto merge of #107254 - chenyukang:yukang/fix-107113-wrong-sugg-in-macro, ↵bors-3/+13
r=estebank Avoid wrong code suggesting for attribute macro Fixes #107113 r? `@estebank`
2023-08-03Remove `MacDelimiter`.Nicholas Nethercote-6/+2
It's the same as `Delimiter`, minus the `Invisible` variant. I'm generally in favour of using types to make impossible states unrepresentable, but this one feels very low-value, and the conversions between the two types are annoying and confusing. Look at the change in `src/tools/rustfmt/src/expr.rs` for an example: the old code converted from `MacDelimiter` to `Delimiter` and back again, for no good reason. This suggests the author was confused about the types.
2023-08-03Remove `MacDelimiter`.Nicholas Nethercote-6/+2
It's the same as `Delimiter`, minus the `Invisible` variant. I'm generally in favour of using types to make impossible states unrepresentable, but this one feels very low-value, and the conversions between the two types are annoying and confusing. Look at the change in `src/tools/rustfmt/src/expr.rs` for an example: the old code converted from `MacDelimiter` to `Delimiter` and back again, for no good reason. This suggests the author was confused about the types.
2023-08-02Auto merge of #114364 - weihanglo:update-cargo, r=weihanglobors-0/+0
Update cargo 10 commits in c91a693e7977e33a1064b63a5daf5fb689f01651..020651c52257052d28f6fd83fbecf5cfa1ed516c 2023-07-31 00:26:46 +0000 to 2023-08-02 16:00:37 +0000 - Update rustix to 0.38.6 (rust-lang/cargo#12436) - replace `master` branch by default branch in documentation (rust-lang/cargo#12435) - `#[allow(internal_features)]` in RUSTC_BOOTSTRAP test (rust-lang/cargo#12429) - ci: rewrite bump check and respect semver (rust-lang/cargo#12395) - fix(update): Tweak CLI behavior (rust-lang/cargo#12428) - chore(deps): update compatible (rust-lang/cargo#12426) - Display crate version on timings graph (rust-lang/cargo#12420) - chore(deps): update alpine docker tag to v3.18 (rust-lang/cargo#12427) - Use thiserror for credential provider errors (rust-lang/cargo#12424) - Clarify in `--help` that `cargo test --all-targets` excludes doctests (rust-lang/cargo#12422) r? `@ghost`
2023-08-02Auto merge of #114345 - lqd:revert-113588, r=RalfJungbors-28/+19
Revert #113588 to fix bootstrap timings This reverts #113588 which seems to have broken perf's bootstrap timings via some git issue https://github.com/rust-lang/rust/pull/114318#issuecomment-1660807886 show a newly broken benchmark, the error at the time was ``` fatal: Path 'src/ci/channel' exists on disk, but not in 'e62323df22ecf9c163023132d17b7114f68b72e8'. thread 'main' panicked at 'command did not execute successfully: cd "/home/collector/rustc-perf/rust" && "git" "show" "e62323df22ecf9c163023132d17b7114f68b72e8:src/ci/channel" expected success, got: exit status: 128', config.rs:1786:27 ``` If this lands, it will reopen #101907 and annoy miri, but it could actually be an issue that would appear during the next bootstrap bump, not just rustc-perf today. r? `@ghost`
2023-08-02cargo-miri: avoid set_envRalf Jung-7/+18
2023-08-02Command debug printing prints the environment these days, we can kill some ↵Ralf Jung-39/+1
custom debugging code
2023-08-02fix miri-script being silent when running './miri test'Ralf Jung-8/+14
2023-08-02no need to forward all env varsRalf Jung-17/+8
2023-08-02Update cargoWeihang Lo-0/+0
2023-08-02Auto merge of #3004 - RalfJung:borrow-tests, r=RalfJungbors-11/+77
add some SB and TB tests Also I realized the `direct_mut_to_const_raw` test can be enabled in TB, so let's do that.
2023-08-02const validation: point at where we found a pointer but expected an integerRalf Jung-5/+7