Commit Graph

166505 Commits

Author SHA1 Message Date
Camille GILLOT
eb7f5673d9 Simplify binding finalization. 2022-04-12 19:51:22 +02:00
Camille GILLOT
e9a52c27d2 Move ident resolution to a dedicated module. 2022-04-12 19:49:02 +02:00
Jane Lusby
a21238cc29 Autotag library PRs with T-libs 2022-04-12 10:48:56 -07:00
wcampbell
9ea89e1d3d Fix spelling in docs for can_not_overflow 2022-04-12 13:29:56 -04: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
Martin Gammelsæter
2b14529a7c Optimize line offset parsing in <SourceFile as Decodable>::decode
By inverting parsing loop, avoiding continually re-checking bytes_per_diff.
2022-04-12 17:29:22 +02:00
Roc Yu
ab3ab4de0b
Remove a format invocation 2022-04-12 11:04:37 -04:00
León Orell Valerian Liehr
8de453a8c6 rustdoc: discr. required+provided assoc consts+tys 2022-04-12 15:38:39 +02: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
Oli Scherer
93a3cfb748 Explain the span search logic 2022-04-12 12:31:00 +00:00
Oli Scherer
08ef70bd13 Compute a more precise span for opaque type impls 2022-04-12 12:28:31 +00: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
Maybe Waffle
e4710fe221 Add test for T: suggestions 2022-04-12 12:14:43 +04:00
Maybe Waffle
de2edb226b Fix wrong suggestions for T:
This commit fixes a corner case in `suggest_constraining_type_params`
that was causing incorrect suggestions.

For the following functions:
```rust
fn a<T:>(t: T) { [t, t]; }
fn b<T>(t: T) where T: { [t, t]; }
```
We previously suggested the following:
```text
...
help: consider restricting type parameter `T`
  |
1 | fn a<T: Copy:>(t: T) { [t, t]; }
  |       ++++++
...
help: consider further restricting this bound
  |
2 | fn b<T>(t: T) where T: + Copy { [t, t]; }
  |                        ++++++
```
Note that neither `T: Copy:` not `where T: + Copy` is a correct bound.

With this commit the suggestions are correct:
```text
...
help: consider restricting type parameter `T`
  |
1 | fn a<T: Copy>(t: T) { [t, t]; }
  |         ++++
...
help: consider further restricting this bound
  |
2 | fn b<T>(t: T) where T: Copy { [t, t]; }
  |                        ++++
```
2022-04-12 11:29:23 +04: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
Mara Bos
d4e44a6391 Add missing unsafe marker.
This is now necessary because of deny(unsafe_op_in_unsafe_fn).
2022-04-12 08:44:39 +02:00
Mara Bos
8a2c9a9615 Allow cvt_nz to be unused on some platforms. 2022-04-12 08:44:39 +02:00
Mara Bos
5b2591299a Add #[deny(unsafe_op_in_unsafe_fn)] to thread_local!(const).
This avoids 'unused unsafe' warnings when using this feature inside std.
2022-04-12 08:44:39 +02:00
Mara Bos
83e8b9e4dd Add debug asserts to futex ReentrantMutex impl. 2022-04-12 08:44:39 +02:00
Mara Bos
43651aa34f Initialize thread local with const{}. 2022-04-12 08:44:39 +02:00
Mara Bos
319a9b0f71 Move current_thread_unique_ptr to the only module that uses it. 2022-04-12 08:44:39 +02:00
Mara Bos
ebebe6f837 Make current_thread_unique_ptr work during thread destruction.
Otherwise we can't use println!() within atexit handlers etc.
2022-04-12 08:44:38 +02:00
Mara Bos
bd61bec67d Add futex-based ReentrantMutex on Linux. 2022-04-12 08:44:38 +02:00
Mara Bos
c62c8cb82d Add current_thread_unique_ptr() in std::sys_common. 2022-04-12 08:41:42 +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
Martin Pool
7cdef0876d Document that DirEntry holds the directory open 2022-04-11 19:00:29 -07:00
Jacob Pratt
2638e969c8
Bump stdarch 2022-04-11 21:40:31 -04: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
AnthonyMikh
39e83c1e2a
fix broken link in coverage tools docs 2022-04-12 02:46:53 +03: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