Commit Graph

166356 Commits

Author SHA1 Message Date
David Wood
9bfe0e39e4 errors: lazily load fallback fluent bundle
Loading the fallback bundle in compilation sessions that won't go on to
emit any errors unnecessarily degrades compile time performance, so
lazily create the Fluent bundle when it is first required.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-13 02:44:59 +01:00
bors
f6cef572d6 Auto merge of #95905 - vacuus:markdown-render, r=GuillaumeGomez
rustdoc: Reduce allocations in a `markdown` function

Not `html::markdown` this time, just `markdown`, haha.
2022-04-12 22:56:06 +00:00
bors
52ca603da7 Auto merge of #95987 - m-ou-se:rollup-sdevd9b, r=m-ou-se
Rollup of 4 pull requests

Successful merges:

 - #95783 (rustdoc doctest: include signal number in exit status)
 - #95794 (`parse_tt`: a few more tweaks)
 - #95963 ([bootstrap] Grab the right FileCheck binary for dist when cross-compiling.)
 - #95975 (Don't test -Cdefault-linker-libraries=yes when cross compiling.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-04-12 18:44:05 +00:00
Mara Bos
550a510431
Rollup merge of #95975 - m-ou-se:test-70093-no-cross, r=joshtriplett
Don't test -Cdefault-linker-libraries=yes when cross compiling.

See https://github.com/rust-lang/rust/pull/95727#issuecomment-1096603163 and the five comments below that.

Unblocks #95727.
2022-04-12 19:58:18 +02:00
Mara Bos
911da62586
Rollup merge of #95963 - luqmana:llvm-dist-cross-filecheck, r=Mark-Simulacrum
[bootstrap] Grab the right FileCheck binary for dist when cross-compiling.

Fixes #95862

We were using the target dir for all the other LLVM tools (`llvm-config`, `llvm-ar`, etc) but the build target dir for `FileCheck`. This meant for targets which are cross-compiled, we were copying the wrong binary.
2022-04-12 19:58:17 +02:00
Mara Bos
d6843448f1
Rollup merge of #95794 - nnethercote:parse_tt-a-few-more-tweaks, r=petrochenkov
`parse_tt`: a few more tweaks

r? `@petrochenkov`
2022-04-12 19:58:16 +02:00
Mara Bos
7644de5eda
Rollup merge of #95783 - notriddle:notriddle/doctest-signal, r=GuillaumeGomez
rustdoc doctest: include signal number in exit status

Related to #95601
2022-04-12 19:58:15 +02:00
bors
de56c295c3 Auto merge of #95867 - cjgillot:fixed-size, r=oli-obk
Skip `Lazy` for some metadata tables

Some metadata tables encode their entries indirectly, through the Lazy construct. This is useful when dealing with variable length encoding, but incurs the extra cost of one u32.

Meanwhile, some fields can be encoded in a single u8, or can use a short fixed-length encoding. This PR proposes to do so, and avoid the overhead.
2022-04-12 16:12:48 +00:00
Roc Yu
ab3ab4de0b
Remove a format invocation 2022-04-12 11:04:37 -04:00
Michael Howell
2af843c57d
Update src/test/rustdoc-ui/failed-doctest-output-windows.rs
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2022-04-12 06:37:00 -07:00
bors
327caac4d0 Auto merge of #95974 - fee1-dead:rollup-2fr55cs, r=fee1-dead
Rollup of 5 pull requests

Successful merges:

 - #95671 (feat: Allow usage of sudo [while not accessing root] in x.py)
 - #95716 (sess: warn w/out fluent bundle w/ user sysroot)
 - #95820 (simplify const params diagnostic on stable)
 - #95900 (Fix documentation for wasm32-unknown-unknown)
 - #95947 (`impl const Default for Box<[T]>` and `Box<str>`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-04-12 13:06:49 +00:00
Mara Bos
284255add5 Don't test -Cdefault-linker-libraries=yes when cross compiling. 2022-04-12 15:00:44 +02:00
fee1-dead
1d76dd9ee7
Rollup merge of #95947 - cuviper:default-box, r=dtolnay
`impl const Default for Box<[T]>` and `Box<str>`

The unstable `const_default_impls` (#87864) already include empty `Vec<T>` and `String`. Now we extend that concept to `Box<[T]>` and `Box<str>` as well.

This obviates a hack in `rustc_ast`'s `P::<[T]>::new`.
2022-04-12 22:44:45 +10:00
fee1-dead
cdbdf1ef2e
Rollup merge of #95900 - o01eg:fix-wasm-doc, r=Mark-Simulacrum
Fix documentation for wasm32-unknown-unknown

Fixes https://github.com/rust-lang/rust/issues/76526#issuecomment-1094208720
2022-04-12 22:44:44 +10:00
fee1-dead
93e6020ed9
Rollup merge of #95820 - OliverMD:95150, r=lcnr
simplify const params diagnostic on stable

Resolves #95150
2022-04-12 22:44:43 +10:00
fee1-dead
305763ea60
Rollup merge of #95716 - davidtwco:translation-custom-sysroot-only-warn, r=oli-obk
sess: warn w/out fluent bundle w/ user sysroot

Addresses https://github.com/rust-lang/rust/pull/95512#issuecomment-1088467139.

When a custom sysroot is requested, then don't error when translation resources are not found, only warn.

r? `@bjorn3`
2022-04-12 22:44:42 +10:00
fee1-dead
ae068e78c0
Rollup merge of #95671 - gimbles:master, r=Mark-Simulacrum
feat: Allow usage of sudo [while not accessing root] in x.py

# Fixes
This PR should fix #93344
# Info
Allows usage of sudo (while not accessing root) in x.py
2022-04-12 22:44:41 +10:00
bors
2a83fbc42a Auto merge of #95966 - matthiaskrgr:rollup-hhy4nod, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #95320 (Document the current MIR semantics that are clear from existing code)
 - #95722 (pre-push.sh: Use python3 if python is not found)
 - #95881 (Use `to_string` instead of `format!`)
 - #95909 (rustdoc: Reduce allocations in a `theme` function)
 - #95910 (Fix crate_type attribute to not warn on duplicates)
 - #95920 (use `Span::find_ancestor_inside` to get right span in CastCheck)
 - #95936 (Fix a bad error message for `relative paths are not supported in visibilities` error)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-04-12 10:25:49 +00:00
David Wood
fc3cca24f1 sess: try sysroot candidates for fluent bundle
Instead of checking only the user provided sysroot or the default (when
no sysroot is provided), search user provided sysroot and then check
default sysroots for locale requested by the user.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-12 10:15:37 +01:00
Matthias Krüger
c3d6082e9b
Rollup merge of #95936 - TaKO8Ki:fix-relative-paths-error-message, r=Dylan-DPC
Fix a bad error message for `relative paths are not supported in visibilities` error

closes #95638
2022-04-12 08:47:01 +02:00
Matthias Krüger
8d46f9cb57
Rollup merge of #95920 - compiler-errors:cast-suggestion-span, r=oli-obk
use `Span::find_ancestor_inside` to get right span in CastCheck

This is a quick fix. This bad suggestion likely lives in other places... but thought it would be useful to fix all of the CastCheck ones first.

Let me know if reviewer would prefer I add more tests for each of the diagnostics in CastCheck, or would like to do a more thorough review of other suggestions that use spans in typeck. I would also be open to further suggestions on how to better expose an API that gives us the "best" span for a diagnostic suggestion.

Fixed #95919
2022-04-12 08:47:00 +02:00
Matthias Krüger
1b364ae5d6
Rollup merge of #95910 - ehuss:fix-crate-type-duplicate, r=Dylan-DPC
Fix crate_type attribute to not warn on duplicates

In #88681 I accidentally marked the `crate_type` attribute as only allowing a single attribute. However, multiple attributes are allowed (they are joined together [here](027a232755/compiler/rustc_interface/src/util.rs (L530-L542))). This fixes it to not report a warning if duplicates are found.

Closes #95902
2022-04-12 08:46:59 +02:00
Matthias Krüger
2836143380
Rollup merge of #95909 - vacuus:theme-build-rule, r=GuillaumeGomez
rustdoc: Reduce allocations in a `theme` function

`str::replace` allocates a new `String`...

This could probably be made more efficient, but I think it'd have to be clunky imperative code to achieve that.
2022-04-12 08:46:58 +02:00
Matthias Krüger
3ff5cb20b6
Rollup merge of #95881 - TaKO8Ki:use-to-string-instead-of-format, r=compiler-errors
Use `to_string` instead of `format!`
2022-04-12 08:46:57 +02:00
Matthias Krüger
a899ebd102
Rollup merge of #95722 - xu-cheng:pre-push, r=Mark-Simulacrum
pre-push.sh: Use python3 if python is not found

Since Python 2 has reached EOL, `python` may not be available in certain systems (e.g., recent macOS). We should use `python3` in this case to avoid error like `python: No such file or directory`.
2022-04-12 08:46:56 +02:00
Matthias Krüger
1d35179077
Rollup merge of #95320 - JakobDegen:mir-docs, r=oli-obk
Document the current MIR semantics that are clear from existing code

This PR adds documentation to places, operands, rvalues, statementkinds, and terminatorkinds that describes their existing semantics and requirements. In many places the semantics depend on the Rust memory model or other T-Lang decisions - when this is the case, it is just noted as such with links to UCG issues where possible. I'm hopeful that none of the documentation added here can be used to justify optimizations that depend on the memory model. The documentation for places and operands probably comes closest to running afoul of this - if people think that it cannot be merged as is, it can definitely also be taken out.

The goal here is to only document parts of MIR that seem to be decided already, or are at least depended on by existing code. That leaves quite a number of open questions - those are marked as "needs clarification." I'm not sure what to do with those in this PR - we obviously can't decide all these questions here. Should I just leave them in as is? Take them out? Keep them in but as `//` instead of `///` comments?

If this is too big to review at once, I can split this up.

r? rust-lang/mir-opt
2022-04-12 08:46:56 +02:00
bors
4e1927db3c Auto merge of #95399 - gilescope:plan_b, r=scottmcm
Faster parsing for lower numbers for radix up to 16 (cont.)

( Continuation of https://github.com/rust-lang/rust/pull/83371 )

With LingMan's change I think this is potentially ready.
2022-04-12 05:54:50 +00:00
bors
b8f4cb6231 Auto merge of #95893 - luqmana:no-prepopulate-passes-tweaks, r=nikic
Respect -Z verify-llvm-ir and other flags that add extra passes when combined with -C no-prepopulate-passes in the new LLVM Pass Manager.

As part of the switch to the new LLVM Pass Manager the behaviour of flags such as `-Z verify-llvm-ir` (e.g. sanitizer, instrumentation) was modified when combined with `-C no-prepopulate-passes`. With the old PM, rustc was the one manually constructing the pipeline and respected those flags but in the new pass manager, those flags are used to build a list of callbacks that get invoked at certain extension points in the pipeline. Unfortunately, `-C no-prepopulate-passes` would skip building the pipeline altogether meaning we'd never add the corresponding passes. The fix here is to just manually invoke those callbacks as needed.

Fixes #95874

Demonstrating the current vs fixed behaviour using the bug in #95864
```console
$ rustc +nightly asm-miscompile.rs --edition 2021 --emit=llvm-ir -C no-prepopulate-passes -Z verify-llvm-ir
$ echo $?
0
$ rustc +stage1 asm-miscompile.rs --edition 2021 --emit=llvm-ir -C no-prepopulate-passes -Z verify-llvm-ir
Basic Block in function '_ZN14asm_miscompile3foo28_$u7b$$u7b$closure$u7d$$u7d$17h360e2f7eee1275c5E' does not have terminator!
label %bb1
LLVM ERROR: Broken module found, compilation aborted!
```
2022-04-12 03:26:53 +00:00
Luqman Aden
03bcbbf928 [bootstrap] Grab the right FileCheck binary for dist when cross-compiling. 2022-04-11 21:32:45 -04:00
bors
36f4ded69e Auto merge of #93408 - liangyongrui:master, r=scottmcm
fix Layout struct member naming style
2022-04-12 00:18:51 +00:00
Takayuki Maeda
29c41280a1 use to_string instead of format! 2022-04-12 07:51:23 +09:00
bors
de392c7d31 Auto merge of #95944 - Dylan-DPC:rollup-idggkrh, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #95008 ([`let_chains`] Forbid `let` inside parentheses)
 - #95801 (Replace RwLock by a futex based one on Linux)
 - #95864 (Fix miscompilation of inline assembly with outputs in cases where we emit an invoke instead of call instruction.)
 - #95894 (Fix formatting error in pin.rs docs)
 - #95895 (Clarify str::from_utf8_unchecked's invariants)
 - #95901 (Remove duplicate aliases for `check codegen_{cranelift,gcc}` and fix `build codegen_gcc`)
 - #95927 (CI: do not compile libcore twice when performing LLVM PGO)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-04-11 21:55:58 +00:00
Michael Howell
daa903c462 Fix line numbers 2022-04-11 13:02:50 -07:00
Oliver Downard
3b4589a309 simplify const params diagnostic on stable 2022-04-11 21:01:18 +01:00
Jakob Degen
8732bf5db3 Remove rule that place loads may not happen with variant index set 2022-04-11 15:56:04 -04:00
Jakob Degen
4bce639c3b Add more clarifications in response to Ralf's comments 2022-04-11 15:56:04 -04:00
Jakob Degen
411ae6f5ad Address various comments and change some details around place to value conversions 2022-04-11 15:22:32 -04:00
Jakob Degen
1d318e42e7 Improve MIR phases documentation with summaries of changes 2022-04-11 15:22:32 -04:00
Jakob Degen
f2d7908ff7 Adjust MIR validator to check a few more things for terminators 2022-04-11 15:22:32 -04:00
Jakob Degen
f1f25c0f81 Improve documentation for MIR terminators 2022-04-11 15:22:32 -04:00
Jakob Degen
8e01cd6127 Improve documentation for MIR statement kinds. 2022-04-11 15:22:29 -04:00
Jakob Degen
9ac5e986ed Extend the MIR validator to check many more things around rvalues. 2022-04-11 15:18:54 -04:00
Jakob Degen
634369170a Add documentation for the semantics of MIR rvalues 2022-04-11 15:18:54 -04:00
Jakob Degen
2f4a7a0742 Adjust computation of place types to detect more invalid places 2022-04-11 15:18:53 -04:00
Jakob Degen
dae5c842fc Improve documentation of Place and Operand 2022-04-11 15:18:53 -04:00
Josh Stone
2d5eda8fb0 Use const Box::default in P::<[T]>::new 2022-04-11 12:14:18 -07:00
Josh Stone
a2902ebe57 impl const Default for Box<[T]> and Box<str> 2022-04-11 12:14:18 -07:00
Cheng XU
365d4f4fd0
pre-push.sh: Use python3 if python is not found
Since Python 2 has reached EOL, `python` may not be available in certain
systems (e.g., recent macOS). We should use `python3` in this case to
avoid error like `python: No such file or directory`.
2022-04-11 12:02:40 -07:00
bors
90ca44752a Auto merge of #95796 - bzEq:bzEq/curl-redirect, r=Dylan-DPC
[bootstrap.py] Instruct curl to follow redirect

Some mirror RUSTUP_DIST_SERVER (like https://mirrors.sjtug.sjtu.edu.cn/rust-static) perform redirection when downloading
stage0 compiler. Curl should be able to follow that.
2022-04-11 18:59:40 +00:00
Dylan DPC
070e8ed18d
Rollup merge of #95927 - Kobzol:ci-pgo-libcore, r=lqd
CI: do not compile libcore twice when performing LLVM PGO

I forgot the delete the first compilation when modifying this file in a previous PR.

r? ```@lqd```
2022-04-11 20:00:46 +02:00