Commit Graph

197781 Commits

Author SHA1 Message Date
Matthias Krüger
d49906519b
Rollup merge of #99544 - dylni:expose-utf8lossy, r=Mark-Simulacrum
Expose `Utf8Lossy` as `Utf8Chunks`

This PR changes the feature for `Utf8Lossy` from `str_internals` to `utf8_lossy` and improves the API. This is done to eventually expose the API as stable.

Proposal: rust-lang/libs-team#54
Tracking Issue: #99543
2022-08-20 19:32:07 +02:00
Matthias Krüger
2be85b0d03
Rollup merge of #99415 - ferrocene:pa-reuse-initial, r=Mark-Simulacrum
Initial implementation of REUSE

This PR implements the first two steps of #99414 by:

* Adding some scaffolding for REUSE. The `.reuse/dep5` file now marks every file as the custom "TODO" license, which I'll remove in a future PR once Debian imports their metadata. The TODO license is needed so that `reuse lint` works.
* Runs `reuse lint` in CI, in the `mingw-check` builder. REUSE currently has a bug when parsing some files in the LLVM source code. This means REUSE will fail when running it in source tarballs of rustc, and that bug prevents us from passing the `--include-submodules` flag in CI. I opened https://github.com/fsfe/reuse-tool/pull/560 upstream with a fix, and as soon as it's merged/released I planned to bump the pinned version to include the fix we need.

r? `@Mark-Simulacrum`
2022-08-20 19:32:06 +02:00
dylni
e8ee0b7b2b Expose Utf8Lossy as Utf8Chunks 2022-08-20 12:49:20 -04:00
Mark Rousskov
d7b91c3120 Add global safe.directory for CI 2022-08-20 09:47:59 -04:00
Mark Rousskov
6c7f301145 Enable downloading prebuilt LLVM in test builders
See comment added for details on the test builder restriction. This is primarily
intended for macOS CI, but is likely to be a slight win on other builders too.
2022-08-20 09:47:59 -04:00
Guillaume Gomez
7ab8e0cbe4 Extend decoration test to detect regressions 2022-08-20 14:24:05 +02:00
Guillaume Gomez
4c89c2886d Clean up highlight <span> merge code 2022-08-20 14:01:04 +02:00
Takayuki Maeda
ebeb77e79e add TaKO8Ki to translation-related mention groups 2022-08-20 20:47:41 +09:00
Guillaume Gomez
f5b5d867d5 Update rustdoc tests 2022-08-20 13:33:41 +02:00
Guillaume Gomez
042e0d02d7 Merge "EnterSpan" events to reduce code blocks DOM size 2022-08-20 13:33:41 +02:00
Takayuki Maeda
a311b8a4c5 use more descriptive names 2022-08-20 19:35:17 +09:00
bors
dd01122b5c Auto merge of #100564 - nnethercote:box-ast-MacCall, r=spastorino
Box the `MacCall` in various types.

r? `@spastorino`
2022-08-20 10:26:54 +00:00
bors
36e530cb08 Auto merge of #100793 - matthiaskrgr:rollup-dy7rfdh, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #100186 (Mention `as_mut` alongside `as_ref` in borrowck error message)
 - #100383 (Mitigate stale data reads on SGX platform)
 - #100507 (suggest `once_cell::Lazy` for non-const statics)
 - #100617 (Suggest the right help message for as_ref)
 - #100667 (Migrate "invalid variable declaration" errors to SessionDiagnostic)
 - #100709 (Migrate typeck's `used` expected symbol diagnostic to `SessionDiagnostic`)
 - #100723 (Add the diagnostic translation lints to crates that don't emit them)
 - #100729 (Avoid zeroing a 1kb stack buffer on every call to `std::sys::windows::fill_utf16_buf`)
 - #100750 (improved diagnostic for function defined with `def`, `fun`, `func`, or `function` instead of `fn`)
 - #100763 (triagebot: Autolabel `A-rustdoc-json`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-20 07:59:48 +00:00
Takayuki Maeda
973510749d remove unnecessary string searchings
remove unnecessary string searchings for checking if function arguments have `&` and `&mut`
2022-08-20 15:54:39 +09:00
Matthias Krüger
60edec9ddf
Rollup merge of #100763 - aDotInTheVoid:triagebot-rdj, r=jyn514
triagebot: Autolabel `A-rustdoc-json`
2022-08-20 07:09:06 +02:00
Matthias Krüger
af89769c82
Rollup merge of #100750 - akabinds:akabinds/improved-invalid-function-qual-error, r=davidtwco
improved diagnostic for function defined with `def`, `fun`, `func`, or `function` instead of `fn`

Closes #99751
2022-08-20 07:09:05 +02:00
Matthias Krüger
1e47e8a9ee
Rollup merge of #100729 - thomcc:less-initialized, r=ChrisDenton
Avoid zeroing a 1kb stack buffer on every call to `std::sys::windows::fill_utf16_buf`

I've also tried to be slightly more careful about integer overflows, although in practice this is likely still not handled ideally.

r? `@ChrisDenton`
2022-08-20 07:09:04 +02:00
Matthias Krüger
84f81e7974
Rollup merge of #100723 - 5225225:the-easy-ones, r=compiler-errors
Add the diagnostic translation lints to crates that don't emit them

Some of these have a note saying that they should build on a stable compiler, does that mean they shouldn't get these lints? Or can we cfg them out on those?
2022-08-20 07:09:03 +02:00
Matthias Krüger
67f77f5a55
Rollup merge of #100709 - JhonnyBillM:port-expected-used-symbol-diagnostic, r=compiler-errors
Migrate typeck's `used` expected symbol diagnostic to `SessionDiagnostic`

r? ``@davidtwco``
2022-08-20 07:09:02 +02:00
Matthias Krüger
eacbe5437e
Rollup merge of #100667 - Xiretza:diag-structs-parser-ivd, r=davidtwco
Migrate "invalid variable declaration" errors to SessionDiagnostic

After seeing the great blog post on Inside Rust, I decided to try my hand at this. Just one diagnostic for now to get used to the workflow and to check if this is the way to do it or if there are any problems.
2022-08-20 07:09:01 +02:00
Matthias Krüger
61a529d902
Rollup merge of #100617 - chenyukang:fix-100605, r=compiler-errors
Suggest the right help message for as_ref

Fixes #100605
2022-08-20 07:09:00 +02:00
Matthias Krüger
c4b83ebe7c
Rollup merge of #100507 - cameron1024:suggest-lazy, r=compiler-errors
suggest `once_cell::Lazy` for non-const statics

Addresses https://github.com/rust-lang/rust/issues/100410

Some questions:
 - removing the `if` seems to include too many cases (e.g. calls to non-const functions inside a `const fn`), but this code excludes the following case:
```rust
const FOO: Foo = non_const_fn();
```
Should we suggest `once_cell` in this case as well?
 - The original issue mentions suggesting `AtomicI32` instead of `Mutex<i32>`, should this PR address that as well?
2022-08-20 07:08:59 +02:00
Matthias Krüger
368f08a65f
Rollup merge of #100383 - fortanix:raoul/aepic_leak_mitigation, r=cuviper
Mitigate stale data reads on SGX platform

Intel disclosed the Stale Data Read vulnerability yesterday. In order to mitigate this issue completely, reading userspace from an SGX enclave must be aligned and in 8-bytes chunks. This PR implements this mitigation

References:
 - https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00657.html
 - https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/advisory-guidance/stale-data-read-from-xapic.html

cc: ``@jethrogb``
2022-08-20 07:08:58 +02:00
Matthias Krüger
3cca14093a
Rollup merge of #100186 - compiler-errors:or-as_mut, r=fee1-dead
Mention `as_mut` alongside `as_ref` in borrowck error message

Kinda fixes #99426 but I guess that really might be better staying open to see if we could make it suggest `as_mut` in a structured way. Not sure how to change borrowck to know that info tho.
2022-08-20 07:08:57 +02:00
Chris Denton
625e7e9579
Use const instead of static 2022-08-20 04:15:47 +01:00
Chris Denton
efd305e0ec
Simplify load/store 2022-08-20 04:15:46 +01:00
yukang
3de74f7e2b Suggest the right help message for as_ref 2022-08-20 09:43:37 +08:00
ltdk
ae2b1dbc89 Tracking issue for const_reverse 2022-08-19 20:38:32 -04:00
Felix S. Klock II
f47b61d19e elaborate how revisions work with FileCheck stuff in src/test/codegen 2022-08-19 16:40:26 -04:00
bors
e1b28cd2f1 Auto merge of #100740 - Dylan-DPC:rollup-0td6yq4, r=Dylan-DPC
Rollup of 9 pull requests

Successful merges:

 - #99576 (Do not allow `Drop` impl on foreign fundamental types)
 - #100081 (never consider unsafe blocks unused if they would be required with deny(unsafe_op_in_unsafe_fn))
 - #100208 (make NOP dyn casts not require anything about the vtable)
 - #100494 (Cleanup rustdoc themes)
 - #100522 (Only check the `DefId` for the recursion check in MIR inliner.)
 - #100592 (Manually implement Debug for ImportKind.)
 - #100598 (Don't fix builtin index when Where clause is found)
 - #100721 (Add diagnostics lints to `rustc_type_ir` module)
 - #100731 (rustdoc: count deref and non-deref as same set of used methods)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-19 18:45:41 +00:00
Eric Holk
8b7b1f773a Minor syntax and formatting update to doc comment
The comment is on find_vtable_types_for_unsizing, but there is another
unrelated typo fix as well.
2022-08-19 10:53:18 -07:00
Takayuki Maeda
64b3e4af20 suggest adding a reference to a trait assoc item 2022-08-20 02:51:20 +09:00
Nixon Enraght-Moony
d35749b0f2 triagebot: Autolabel A-rustdoc-json 2022-08-19 17:31:32 +01:00
Krasimir Georgiev
07e41fb54c update test for LLVM change
LLVM commit c2a3888793
updates the PIC level version selection. This updates the rust tests to
work under both the old and new behaviors.

Detected by our experimental rust + llvm @ HEAD bot:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/12829#0182b368-a405-47a2-b3da-9c79cb907bfe/701-709
2022-08-19 15:52:43 +00:00
Thom Chiovoloni
d4cba61099
Fix comment typo 2022-08-19 08:45:21 -07:00
bors
468887ef91 Auto merge of #100209 - cjgillot:source-file-index, r=estebank
Lazily decode SourceFile from metadata

Currently, source files from foreign crates are decoded up-front from metadata.
Spans from those crates were matched with the corresponding source using binary search among those files.

This PR changes the strategy by matching spans to files during encoding. This allows to decode source files on-demand, instead of up-front. The on-disk format for spans becomes: `<tag> <position from start of file> <length> <file index> <crate (if foreign file)>`.
2022-08-19 15:31:25 +00:00
ouz-a
4b47686e10 Update issue-83150.stderr 2022-08-19 17:43:20 +03:00
lcnr
56b5ec83f2 move type_check_internal into type_check 2022-08-19 16:41:48 +02:00
lcnr
7d2083c58e small mir typeck cleanup 2022-08-19 16:38:26 +02:00
ouz-a
c198a20f7c Catch overflow early 2022-08-19 17:31:57 +03:00
Mark Rousskov
8ca14aa7ff Refactor if-available setting to work in CI
This verifies if the HEAD sha matches with the detected LLVM SHA, and if not,
permits usage of the detected LLVM. Otherwise, we fallback on regular
non-downloaded LLVM (currently still cached with sccache, though that's still
10+ minutes on macOS).
2022-08-19 09:04:47 -04:00
Mark Rousskov
2769d6b9cc Minor refactoring 2022-08-19 09:04:47 -04:00
Guillaume Gomez
934d259b8c Fix invalid comparison for Class::Decoration in is_equal_to 2022-08-19 14:35:15 +02:00
Dylan DPC
ecd2885eed
Rollup merge of #100731 - notriddle:notriddle/deref-methods-1, r=jsha
rustdoc: count deref and non-deref as same set of used methods

Fixes #100679
2022-08-19 12:26:47 +05:30
Dylan DPC
30e65cea07
Rollup merge of #100721 - JhonnyBillM:enable-diag-lint-in-type-ir, r=compiler-errors
Add diagnostics lints to `rustc_type_ir` module

Module is complete. It doesn’t have any diagnostics.
2022-08-19 12:26:46 +05:30
Dylan DPC
490d04bfbc
Rollup merge of #100598 - ouz-a:91633, r=compiler-errors
Don't fix builtin index when Where clause is found

Where clause shadows blanket impl for `Index` which causes normalization to not occur, which causes ICE to happen when we typeck.

r? `@compiler-errors`

Fixes #91633
2022-08-19 12:26:45 +05:30
Dylan DPC
769ad70129
Rollup merge of #100592 - cjgillot:debug-import-kind, r=TaKO8Ki
Manually implement Debug for ImportKind.

This avoids crashing due to an infinite loop when running with `RUSTC_LOG=rustc_resolve`.
2022-08-19 12:26:44 +05:30
Dylan DPC
d83abe8c12
Rollup merge of #100522 - cjgillot:inline-polymorphic-recursion, r=tmiasko
Only check the `DefId` for the recursion check in MIR inliner.

The current history check compares `Instance`s, so it cannot detect cases of polymorphic recursion where `Substs` change.
This PR makes it so we only compare `DefId`s, ignoring any change in `Substs`.

According to https://github.com/rust-lang/rust/pull/100522#issuecomment-1214769757, in practice only very few inlining decisions change.

Fixes https://github.com/rust-lang/rust/issues/100476
2022-08-19 12:26:43 +05:30
Dylan DPC
3cebcbaaeb
Rollup merge of #100494 - GuillaumeGomez:cleanup-themes, r=jsha
Cleanup rustdoc themes

This PR continues our work to simplify the rustdoc themes by relying more on CSS variables. Interestingly enough, this time it allowed me to realize that we were having a lot of different colors for borders even though the difference is unnoticeable. I used this opportunity to unify them.

The live demo is [here](https://rustdoc.crud.net/imperio/cleanup-themes/std/index.html).

r? `@jsha`
2022-08-19 12:26:42 +05:30
Dylan DPC
c4707ff8ef
Rollup merge of #100208 - RalfJung:dyn-upcast-nop, r=petrochenkov
make NOP dyn casts not require anything about the vtable

As suggested [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/dyn-upcasting.20stabilization/near/292151439). This matches what the codegen backends already do, and what Miri did do until https://github.com/rust-lang/rust/pull/99420 when I made it super extra paranoid.
2022-08-19 12:26:41 +05:30