about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2023-07-21Add missing code fencecherryblossom000-0/+2
2023-07-21Rollup merge of #113780 - dtolnay:printkindpath, r=b-naberMatthias Krüger-0/+4
Support `--print KIND=PATH` command line syntax As is already done for `--emit KIND=PATH` and `-L KIND=PATH`. In the discussion of #110785, it was pointed out that `--print KIND=PATH` is nicer than trying to apply the single global `-o` path to `--print`'s output, because in general there can be multiple print requests within a single rustc invocation, and anyway `-o` would already be used for a different meaning in the case of `link-args` and `native-static-libs`. I am interested in using `--print cfg=PATH` in Buck2. Currently Buck2 works around the lack of support for `--print KIND=PATH` by [indirecting through a Python wrapper script](https://github.com/facebook/buck2/blob/d43cf3a51a31f00be2c2248e78271b0fef0452b4/prelude/rust/tools/get_rustc_cfg.py) to redirect rustc's stdout into the location dictated by the build system. From skimming Cargo's usages of `--print`, it definitely seems like it would benefit from `--print KIND=PATH` too. Currently it is working around the lack of this by inserting `--crate-name=___ --print=crate-name` so that it can look for a line containing `___` as a delimiter between the 2 other `--print` informations it actually cares about. This is commented as a "HACK" and "abuse". https://github.com/rust-lang/cargo/blob/31eda6f7c360d9911f853b3014e057db61238f3e/src/cargo/core/compiler/build_context/target_info.rs#L242 (FYI `@weihanglo` as you dealt with this recently in https://github.com/rust-lang/cargo/pull/11633.) Mentioning reviewers active in #110785: `@fee1-dead` `@jyn514` `@bjorn3`
2023-07-21CTFE: move `target_{i, u}size_{min, max)` to `rustc_abi::TargetDataLayout`Moulins-5/+7
2023-07-21add `naive_layout_of` queryMoulins-4/+5
2023-07-20Clarify wording on breaking arrays across linesJosh Triplett-1/+1
Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>
2023-07-20style-guide: Fix example to match the rule it exemplifies (and match rustfmt)Josh Triplett-1/+2
An example immediately following "Put each bound on its own line." did not put each bound on its own line.
2023-07-20style-guide: Fix typo: s/right-hand side/left-hand side/Josh Triplett-1/+1
2023-07-20style-guide: Add an additional chaining exampleJosh Triplett-1/+4
Make it clear the rule for stacking the second line on the first applies recursively, as long as the condition holds.
2023-07-20style-guide: Avoid using "should" or "may" for required parts of the default ↵Josh Triplett-220/+252
style The style guide inconsistently used language like "there should be a space" or "it should be on its own line", or "may be written on a single line", for things that are required components of the default Rust style. "should" and especially "may" come across as optional. While the style guide overall now has a statement at the top that the default style itself is a *recommendation*, the *definition* of the default style should not be ambiguous about what's part of the default style. Rewrite language in the style guide to only use "should" and "may" and similar for truly optional components of the style (e.g. things a tool cannot or should not enforce in its default configuration). In their place, either use "must", or rewrite in imperative style ("put a space", "start it on the same line"). The latter also substantially reduces the use of passive voice. This is a purely editorial change, and does not affect the semantic definition of the Rust style.
2023-07-20style-guide: Simplify the structure of a recommendation (no semantic change)Josh Triplett-3/+1
Avoid putting a sentence fragment after a list; integrate it with the sentence before the list.
2023-07-20style-guide: Fix an example to match the styleJosh Triplett-1/+1
The style guide requires a trailing comma on where clause components, but then gives an example that doesn't include one. Add the missing trailing comma.
2023-07-20style-guide: Fix typo: s/forth/fourth/gJosh Triplett-2/+2
2023-07-20style-guide: Remove material about tool configurabilityJosh Triplett-46/+2
The style guide discusses the default Rust style. Configurability of Rust formatting tools are not the domain of the style guide.
2023-07-20etc: add `RUSTC_BOOTSTRAP` to rust-analyzer configMichael Howell-1/+5
Fixes the problem reported in https://github.com/rust-lang/rust/issues/112391#issuecomment-1597224941
2023-07-20Document --print KIND=PATH in Command-line Arguments documentationDavid Tolnay-0/+4
2023-07-20Rollup merge of #113883 - steffahn:rustdoc-search-crate-selector-padding, ↵Matthias Krüger-9/+0
r=GuillaumeGomez Remove outdated Firefox-specific CSS for search's crate selector appearance Remove adjustments that used to be necessary for search's crate selector appearance (padding) to look identical on Firefox. New versions of Firefox appear to have changed behavior to agree with Chrome. As briefly discussed in https://github.com/rust-lang/rust/pull/98855#issuecomment-1624098112 r? ``@GuillaumeGomez``
2023-07-20Rollup merge of #113835 - lcnr:assemble-candidates-considering-self-ty, ↵Matthias Krüger-57/+53
r=compiler-errors new solver: don't consider blanket impls multiple times only consider candidates which rely on the self type in `assemble_candidates_after_normalizing_self_ty`. r? ``@compiler-errors``
2023-07-20Rollup merge of #113800 - oli-obk:gha_ci_cycle, r=jyn514Matthias Krüger-1/+2
Avoid another gha group nesting fixes https://github.com/rust-lang/rust/issues/113798 (`x test error_index_generator` did not work locally anymore) r? ``@jyn514``
2023-07-20Rollup merge of #110765 - wackbyte:fix-defaultness-position, ↵Matthias Krüger-4/+4
r=fmease,GuillaumeGomez rustdoc: fix position of `default` in method rendering With the following code: ```rs #![feature(specialization)] pub trait A { unsafe fn a(); } impl A for () { default unsafe fn a() {} } ``` rustdoc would render the `impl` of `a` as ```rs unsafe default fn a() ``` which is inconsistent with the actual position of `default`. This PR fixes this issue.
2023-07-20Avoid another gha group nestingOli Scherer-1/+2
2023-07-20XSimplifiedType to SimplifiedType::Xlcnr-57/+53
2023-07-20Remove adjustments that used to be necessary for search's crate selector ↵Frank Steffahn-9/+0
appearance (padding) to look identical on Firefox. New versions of Firefox appear to have changed behavior to agree with Chrome.
2023-07-20Merge from rustcThe Miri Conjob Bot-58/+97
2023-07-20Preparing for merge from rustcThe Miri Conjob Bot-1/+1
2023-07-20Rollup merge of #113857 - GuillaumeGomez:document-hidden-items-test, r=notriddleMatthias Krüger-0/+2
Add tests for `--document-hidden-items` option Since `--document-hidden-items` was greatly fixed/improved in https://github.com/rust-lang/rust/pull/113574, thought it might be worth adding some more tests for it to prevent new regressions. As for the first commit, it allows to go from: ``` Traceback (most recent call last): File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 706, in <module> check(sys.argv[1], get_commands(rust_test_path)) File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 689, in check for c in commands: File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 274, in get_commands args = shlex.split(args) File "/usr/lib/python3.10/shlex.py", line 315, in split return list(lex) File "/usr/lib/python3.10/shlex.py", line 300, in __next__ token = self.get_token() File "/usr/lib/python3.10/shlex.py", line 109, in get_token raw = self.read_token() File "/usr/lib/python3.10/shlex.py", line 191, in read_token raise ValueError("No closing quotation") ValueError: No closing quotation ``` to: ``` Traceback (most recent call last): File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 708, in <module> check(sys.argv[1], get_commands(rust_test_path)) File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 691, in check for c in commands: File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 278, in get_commands raise Exception("line {}: {}".format(lineno + 1, exc)) from None Exception: line 57: No closing quotation ``` Having the line where the error occurred is quite useful. r? `@notriddle`
2023-07-20Rollup merge of #113710 - loongarch-rs:fix-rpath, r=clubby789Matthias Krüger-2/+3
Fix rpath for libdir is specified ## What does this PR try to resolve? When building the Rust toolchain with `--libdir=lib64`, the executable tools such as `rustc` cannot find shared libraries. ```bash ./configure --prefix=/ --libdir=lib64 DESTDIR=/tmp/rust ./x.py install ``` ``` $ /tmp/rust/bin/rustc rustc: error while loading shared libraries: librustc_driver-13f1fd1bc7f7000d.so: cannot open shared object file: No such file or directory ``` This issue is caused by the link args `-Wl,rpath` being different from `--libdir`. ``` $ readelf -d /tmp/rust/bin/rustc | grep RUNPATH 0x000000000000001d (RUNPATH) Library runpath: [$ORIGIN/../lib] ``` ## How to resolve? When setting the rpath, get it from sysroot libdir relative path. After this patch: ``` $ readelf -d /tmp/rust/bin/rustc | grep RUNPATH 0x000000000000001d (RUNPATH) Library runpath: [$ORIGIN/../lib64] ```
2023-07-19misc code cleanupDeadbeef-156/+154
2023-07-19Support non-lifetime bindersMichael Goulet-13/+10
2023-07-20Auto merge of #113622 - RickleAndMortimer:issue-113184-fix, r=oli-obkbors-0/+1
add links to query documentation for E0391 This PR adds links to https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for the rustc --explain E0391 and within the compiler error itself. Fixes: #113184
2023-07-20Auto merge of #108714 - estebank:ice_dump, r=oli-obkbors-6/+13
On nightly, dump ICE backtraces to disk Implement rust-lang/compiler-team#578. When an ICE is encountered on nightly releases, the new rustc panic handler will also write the contents of the backtrace to disk. If any `delay_span_bug`s are encountered, their backtrace is also added to the file. The platform and rustc version will also be collected. <img width="1032" alt="Screenshot 2023-03-03 at 2 13 25 PM" src="https://user-images.githubusercontent.com/1606434/222842420-8e039740-4042-4563-b31d-599677171acf.png"> The current behavior will *always* write to disk on nightly builds, regardless of whether the backtrace is printed to the terminal, unless the environment variable `RUSTC_ICE_DISK_DUMP` is set to `0`. This is a compromise and can be changed.
2023-07-19Rollup merge of #113785 - GuillaumeGomez:tests/rustdoc/issue-105735-fix, ↵Dylan DPC-17/+41
r=notriddle,aDotInTheVoid Fix invalid display of inlined re-export when both local and foreign items are inlined Fixes #105735. The bug is actually quite interesting: at the `clean` pass, local inlined items have their `use` item removed, however foreign items don't have their `use` item removed because it's in the `clean` pass that we handle them. So when a `use` inlines both a local and a foreign item, it will work as expected for the foreign one, but not for the local as its `use` should not be around anymore. To prevent this, I created a new `inlined_foreigns` field into the `Module` struct to allow to remove the `use` item early on for foreign items as well. Then we iterate it in the `clean` pass directly. r? ``@notriddle``
2023-07-19On nightly, dump ICE backtraces to diskEsteban Küber-1/+2
Implement rust-lang/compiler-team#578. When an ICE is encountered on nightly releases, the new rustc panic handler will also write the contents of the backtrace to disk. If any `delay_span_bug`s are encountered, their backtrace is also added to the file. The platform and rustc version will also be collected.
2023-07-19On nightly, dump ICE backtraces to diskEsteban Küber-6/+13
Implement rust-lang/compiler-team#578. When an ICE is encountered on nightly releases, the new rustc panic handler will also write the contents of the backtrace to disk. If any `delay_span_bug`s are encountered, their backtrace is also added to the file. The platform and rustc version will also be collected.
2023-07-19Improve htmldocck error a bit by providing line where error occurredGuillaume Gomez-0/+2
2023-07-19remove hack, now CI uses (currently latest) SDK 10.0.22621.0klensy-8/+0
See https://github.com/rust-lang-ci/rust/actions/runs/5596259246/jobs/10233070602#step:24:929 C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt_io.h
2023-07-18moved note as unspanned note, moved note to the bottom of the msgnxya-1/+1
2023-07-18Prevent ICE when formatting an empty-ish macro arm (#5833)tdanniels-1/+8
Fixes 5730 Previously rustfmt was attempting to slice a string with an invalid range (`start > end`), leading to the ICE. When formatting a macro transcriber snippet consisting of a lone semicolon, the snippet was being formatted into the empty string, leading the enclosing `fn main() {\n}` added by `format_code_block` to be formatted into `fn main() {}`. However, rustfmt was assuming that the enclosing function string's length had been left unchanged. This was leading to an invalid range being constructed when attempting to trim off the enclosing function. The fix is to just clamp the range's start to be less than or equal to the range's end, since if `end < start` there's nothing to iterate over anyway.
2023-07-18Auto merge of #113841 - weihanglo:update-cargo, r=weihanglobors-0/+0
Update cargo 11 commits in 694a579566a9a1482b20aff8a68f0e4edd99bd28..1b15556767f4b78a64e868eedf4073c423f02b93 2023-07-11 22:28:29 +0000 to 2023-07-18 14:44:47 +0000 - Fix "cargo doc --open" crash on WSL2 (rust-lang/cargo#12373) - fix(git): respect scp-like URL for nested submodules (rust-lang/cargo#12359) - Upgrade to indexmap v2 (rust-lang/cargo#12368) - refactor: Clean up package metadata (rust-lang/cargo#12352) - Correct unspecifiead to unspecified (rust-lang/cargo#12363) - Replace invalid `panic_unwind` std feature with `panic-unwind` (rust-lang/cargo#12364) - Bump to 0.74.0; update changelog (rust-lang/cargo#12361) - Bump version of crates-io due to unintentional semver-breaking change (rust-lang/cargo#12357) - chore: Automatically update dependencies monthly (rust-lang/cargo#12341) - docs: Use heading attributes to control the fragment. (rust-lang/cargo#12339) - Rustfmt with latest nightly. (rust-lang/cargo#12351) r? ghost
2023-07-18Update cargoWeihang Lo-0/+0
2023-07-18Rollup merge of #113823 - GuillaumeGomez:fix-results-search-alias-display, ↵Matthias Krüger-19/+15
r=notriddle Fix results search alias display Currently it's displayed like this: ![Screenshot from 2023-07-18 14-23-35](https://github.com/rust-lang/rust/assets/3050060/119d8f18-b298-4e6f-9571-9f678fc19126) With this fix: ![Screenshot from 2023-07-18 14-23-29](https://github.com/rust-lang/rust/assets/3050060/679d6241-420e-4f13-be78-dc061cbc488a) r? `@notriddle`
2023-07-18Auto merge of #112374 - chenx97:better-mips64r6, r=jackh726bors-3/+11
add mips64r6 and mips32r6 as target_arch values This PR introduces `"mips32r6"` and `"mips64r6"` as valid `target_arch` values, and would be the arch value used by Tier-3 targets `mipsisa32r6-unknown-linux-gnu`, `mipsisa32r6el-unknown-linux-gnu`, `mipsisa64r6-unknown-linux-gnuabi64` and `mipsisa64r6el-unknown-linux-gnuabi64`. This PR was inspired by `rustix` attempting to link traditional mips64el objects with mips64r6el objects when building for mips64r6, even though `rustix` recently removed outline assembly support. This is because currently this target's `target_arch` is `"mips64"` and rustix has its respective assembly implementation as well as a pre-compiled little-endian static library prepared for mips64el, a tier-2 target with the same `target_arch`. After some [discussions on zulip](https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Add.20New.20Values.20To.20MIPS_ALLOWED_FEATURES.20compiler-team.23595), I decided to treat mips64r6 as an independent architecture from Rust's POV, since these two architectures are incompatible anyway. This PR is now waiting for `libc` to release a new version with [support](https://github.com/rust-lang/libc/pull/3268) for these `target_arch` values. It is not expected to introduce changes to any other target, especially Tier-1 and Tier-2 targets. This PR has its corresponding [MCP](https://github.com/rust-lang/compiler-team/issues/632) approved.
2023-07-18fix miri test with links to query documentationnxya-0/+1
2023-07-18Fix display of aliases in rustdoc search resultsGuillaume Gomez-19/+15
2023-07-18Auto merge of #113706 - Alexendoo:compiletest-backslash-re, r=oli-obkbors-6/+6
Fix compiletest windows path finding with spaces With `(?x)` enabled spaces are ignored unless you escape them, so the space wasn't being added to the character class I don't think this makes any difference to the current test suite, but it could save someone a headache in the future
2023-07-18support for mips32r6 as a target_arch valuechenx97-4/+10
2023-07-18support for mips64r6 as a target_arch valuechenx97-2/+4
2023-07-18ignore test on appleRalf Jung-0/+1
2023-07-18fix clippy warningsRalf Jung-7/+7
2023-07-18make './miri toolchain' work even if we cannot write to rustup dirRalf Jung-1/+3
2023-07-18Remove unneeded `Option<Symbol>` in `foreign_items`Guillaume Gomez-4/+3