Commit Graph

166456 Commits

Author SHA1 Message Date
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
Camille GILLOT
b796d92da3 Fix imports. 2022-04-12 19:55:47 +02:00
Camille GILLOT
abbd0b85b2 Move diagnostic methods to the dedicated module. 2022-04-12 19:54:09 +02:00
Camille GILLOT
944d852afe Simplify error reporting. 2022-04-12 19:53:46 +02:00
Camille GILLOT
d1c1bbe5f3 Move path resolution error to rustc_resolve::diagnostics. 2022-04-12 19:53:22 +02:00
Camille GILLOT
886613c916 Make the logic more explicit with let chains. 2022-04-12 19:52:58 +02:00
Camille GILLOT
3ee6f6e28a Do not record Res when builing a suggestion. 2022-04-12 19:52:34 +02:00
Camille GILLOT
55ca03c0ac Insert error after checking for binding usability. 2022-04-12 19:52:10 +02:00
Camille GILLOT
24b37a7374 Pass last_import_segment and unusable_binding as parameters. 2022-04-12 19:51:46 +02:00
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