Commit Graph

198539 Commits

Author SHA1 Message Date
Ralf Jung
2e52fe01cf remove some now-unnecessary parameters from check_bytes 2022-08-26 13:20:56 -04:00
Ralf Jung
da13935ecc remove enforce_number_init machine hook that Miri no longer needs 2022-08-26 13:20:56 -04:00
Ralf Jung
9d604f301b fix an outdated machine hook name 2022-08-26 13:20:56 -04:00
Daniel Paoliello
cc49c3e582 Implementation of import_name_type 2022-08-26 09:15:35 -07:00
Michael Howell
25eb52ff69 rustdoc: remove incorrect CSS selector .impl-items table td
Fixes #100994

This selector was added in c7312fbae4.
The bug can be seen at <https://doc.rust-lang.org/1.27.0/alloc/slice/trait.SliceIndex.html#foreign-impls>.

This rule was added to help with a `<table>` that was used for displaying the
function signature [src] lockup. That lockup was changed in
34bd2b845b to use flexbox instead, leaving this
selector unused (at least, for its original purpose).
2022-08-26 08:48:50 -07:00
bors
450e99f937 Auto merge of #98051 - davidtwco:split-dwarf-stabilization, r=wesleywiser
session: stabilize split debuginfo on linux

Stabilize the `-Csplit-debuginfo` flag...

- ...on Linux for all values of the flag. Split DWARF has been implemented for a few months, hasn't had any bug reports and has had some promising benchmarking for incremental debug build performance.
- ..on other platforms for the default value. It doesn't make any sense that `-Csplit-debuginfo=packed` is unstable on Windows MSVC when that's the default behaviour, but keep the other values unstable.
2022-08-26 15:47:26 +00:00
Ralf Jung
468c617c21 add a test 2022-08-26 11:04:13 -04:00
Michael Howell
832fd237d1 rustdoc: remove unused CSS for hidden-by-*-hider
This CSS seems to have become obsolete with the move to `<details>` tags,
and its corresponding JavaScript was removed in aee054d05d
2022-08-26 07:46:53 -07:00
Peter Medus
01c1616b25 Migrate rustc_ty_utils to use SessionDiagnostic 2022-08-26 14:36:51 +01:00
bors
42fa8ac723 Auto merge of #101037 - GuillaumeGomez:rollup-opn6kj1, r=GuillaumeGomez
Rollup of 8 pull requests

Successful merges:

 - #95005 (BTree: evaluate static type-related check at compile time)
 - #99742 (Add comments about stdout locking)
 - #100128 (Document that `RawWakerVTable` functions must be thread-safe.)
 - #100956 (Reduce right-side DOM size)
 - #101006 (Fix doc cfg on reexports)
 - #101012 (rustdoc: remove unused CSS for `.variants_table`)
 - #101023 (rustdoc: remove `type="text/css"` from stylesheet links)
 - #101031 (Remove unused build dependency)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-26 13:05:57 +00:00
Tomasz Miąsko
b48870b451 Replace Body::basic_blocks() with field access 2022-08-26 14:27:08 +02:00
marmeladema
8bb4b5f44c Support parsing IP addresses from a byte string 2022-08-26 14:16:53 +02:00
Ralf Jung
b85178a5fc no alignment check during interning 2022-08-26 08:15:29 -04:00
Guillaume Gomez
c391ba0b10
Rollup merge of #101031 - rust-lang:remove-unused-build-dep, r=bjorn3
Remove unused build dependency

There is no more `build.rs` so this dependency is unused.

r? `@Dylan-DPC`
2022-08-26 14:08:51 +02:00
Guillaume Gomez
4d259f6ef3
Rollup merge of #101023 - notriddle:notriddle/head-shrink, r=Dylan-DPC
rustdoc: remove `type="text/css"` from stylesheet links

MDN directly recommends this in <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link>, since "CSS is the only stylesheet language used on the web."
2022-08-26 14:08:50 +02:00
Guillaume Gomez
6ada6c5eb0
Rollup merge of #101012 - notriddle:notriddle/variants_table, r=jsha
rustdoc: remove unused CSS for `.variants_table`

Continuation of #100938 and #101010. This rule was added to support the old, table-based style for displaying enum variants, which are now displayed using headers and paragraphs.
2022-08-26 14:08:49 +02:00
Guillaume Gomez
7cffb4ca63
Rollup merge of #101006 - GuillaumeGomez:doc-cfg-reexport, r=notriddle
Fix doc cfg on reexports

Fixes #83428.

The problem was that the newly inlined item cfg propagation was not working since its real parent is different than its current one.

For the implementation, I decided to put it directly into `CfgPropagation` instead of inside `inline.rs` because I thought it would be simpler to maintain and to not forget if new kind of items are added if it's all done in one place.

r? `@notriddle`
2022-08-26 14:08:48 +02:00
Guillaume Gomez
378f851e95
Rollup merge of #100956 - GuillaumeGomez:reduce-rightside-dom-size, r=notriddle
Reduce right-side DOM size

This is another follow-up of https://github.com/rust-lang/rust/pull/100429 but not in code blocks this time.

So the idea is: if there is only one element in the `.rightside` element, there is no need to wrap it, we can just create one node.

On each page, I run this JS: `document.getElementsByTagName('*').length`. Important to note: the bigger the number of elements inside the page, the greater the gain. It also doesn't work very nicely on std docs because there are a lot of version annotations. So with this PR, It allows to get the following results:

| file name | before this PR | with this PR | diff |
|-|-|-|-|
| std/default/trait.Default.html | 2189 | 1331 | 39.2% |
| std/vec/struct.Vec.html | 14073 | 13842 | 1.7% |
| std/fmt/trait.Debug.html | 5313 | 4907 | 7.7% |
| std/ops/trait.Index.html | 642 | 630 | 1.9% |
| gtk4/WidgetExt | 3269 | 3061 | 6.4% |

You can test it [here](https://rustdoc.crud.net/imperio/reduce-rightsize-dom-size/gtk4/prelude/trait.WidgetExt.html).

r? `@notriddle`
2022-08-26 14:08:47 +02:00
Guillaume Gomez
7881e0576b
Rollup merge of #100128 - kpreid:waker-doc, r=thomcc
Document that `RawWakerVTable` functions must be thread-safe.

Also add some intra-doc links and more high-level explanation of how `Waker` is used, while I'm here.

Context: https://internals.rust-lang.org/t/thread-safety-of-rawwakervtables/17126
2022-08-26 14:08:45 +02:00
Guillaume Gomez
ae838f7645
Rollup merge of #99742 - sigaloid:master, r=thomcc
Add comments about stdout locking

This is the source of some confusion regarding the `println!` macro:
* https://llogiq.github.io/2017/06/01/perf-pitfalls.html#unbuffered-io
* https://news.ycombinator.com/item?id=18794930
* https://reddit.com/r/rust/comments/5puyx2/why_is_println_so_slow/dcua5g5/
* https://reddit.com/r/rust/comments/ab7hsi/comparing_pythagorean_triples_in_c_d_and_rust/ecy7ql8/

In some of these cases it's not the locking behavior where the bottleneck lies, but it's still mentioned as a surprise when, eg, benchmarking a million `println!`'s in a very tight loop.

If there's any stylistic problems please feel free to correct me! This is my first contribution and I want to get it right 🦀
2022-08-26 14:08:44 +02:00
Guillaume Gomez
e3148dc7c4
Rollup merge of #95005 - ssomers:btree_static_assert, r=thomcc
BTree: evaluate static type-related check at compile time

`assert`s like the ones replaced here would only go off when you run the right test cases, if the code were ever incorrectly changed such that rhey would trigger. But [inspired on a nice forum question](https://users.rust-lang.org/t/compile-time-const-generic-parameter-check/69202), they can be checked at compile time.
2022-08-26 14:08:43 +02:00
bors
8a13871b69 Auto merge of #100944 - nnethercote:shrink-thir-Expr, r=cjgillot
Shrink `thir::Expr`

r? `@cjgillot`
2022-08-26 10:00:27 +00:00
Guillaume Gomez
fb33dd8b6d Remove unused build dependency 2022-08-26 11:29:23 +02:00
bors
983f4daddf Auto merge of #100705 - compiler-errors:issue-100620, r=oli-obk
Avoid reporting overflow in `is_impossible_method`

Fixes #100620

We're evaluating a new predicate in a different param-env than it was checked during typeck, so be more careful about handling overflow errors. Instead of using `FulfillmentCtxt`, using `InferCtxt::evaluate_obligation` by itself will give us back the overflow error, so we can throw it away properly.

This may give us more false-positives, but it doesn't regress the `<HashMap as Iterator>::rev` example that originally motivated adding `is_impossible_method` in the first place.
2022-08-26 06:05:06 +00:00
Michael Goulet
48b3d8aa82 Drive-by: same_type_modulo_infer should handle ReVar == ReVar 2022-08-26 04:42:53 +00:00
Michael Goulet
cfd47afa19 Erase late bound regions before comparing types in suggest_dereferences 2022-08-26 04:42:36 +00:00
Michael Howell
07a243b2a4 rustdoc: remove `type="text/css" from stylesheet links
MDN directly recommends this in <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link>,
since "CSS is the only stylesheet language used on the web."
2022-08-25 21:34:17 -07:00
Michael Howell
e7b7f8855f rustdoc: omit start/end tags for empty item description blocks
Related to #100952

This is definitely not a complete solution, but it does shrink
keysyms/index.html on smithay from 620K to 516K.
2022-08-25 20:30:23 -07:00
bors
13a6aaffdf Auto merge of #101017 - JohnTitor:rollup-73f2fhb, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #99064 (distinguish the method and associated function diagnostic information)
 - #99920 (Custom allocator support in `rustc_serialize`)
 - #100034 ( Elaborate all box dereferences in `ElaborateBoxDerefs`)
 - #100076 (make slice::{split_at,split_at_unchecked} const functions)
 - #100604 (Remove unstable Result::into_ok_or_err)
 - #100933 (Reduce code size of `assert_matches_failed`)
 - #100978 (Handle `Err` in `ast::LitKind::to_token_lit`.)
 - #101010 (rustdoc: remove unused CSS for `.multi-column`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-26 03:23:54 +00:00
AndyJado
622217da59 diag-mig 2022-08-26 10:32:59 +08:00
Michael Goulet
448c6a4db7 Suggest returning closure as impl Fn 2022-08-26 01:25:56 +00:00
Nicholas Nethercote
f974617bda Move ArgAbi::pad_i32 into PassMode::Cast.
Because it's only needed for that variant. This shrinks the types and
clarifies the logic.
2022-08-26 11:12:36 +10:00
Nicholas Nethercote
b853e8a619 Turn ArgAbi::pad into a bool.
Because it's only ever set to `None` or `Some(Reg::i32())`.
2022-08-26 10:53:41 +10:00
Yuki Okushi
b4d5f48e43
Rollup merge of #101010 - notriddle:notriddle/multi-column, r=jsha
rustdoc: remove unused CSS for `.multi-column`

As a sanity check, [this tool] can be used to run a CSS query across an HTML tree to detect if a selector ever matches (I use compiler-docs and std docs). This isn't good enough, because I also need to account for JavaScript, but this class is never mentioned in any of the JS files, either.

According to [blame], this class was added when rustdoc was first written, and, as far as I can tell, was never actually used.

[this tool]: https://gitlab.com/notriddle/html-scanner
[blame]: 4d45b0745a/src/librustdoc/html/static/css/rustdoc.css (L753-L761)
2022-08-26 09:51:47 +09:00
Yuki Okushi
d4a5ec17a7
Rollup merge of #100978 - nnethercote:fix-100948, r=petrochenkov
Handle `Err` in `ast::LitKind::to_token_lit`.

Fixes #100948.

r? ``@petrochenkov``
2022-08-26 09:51:46 +09:00
Yuki Okushi
684955591c
Rollup merge of #100933 - a1phyr:cheap_assert_match_failed, r=JoshTriplett
Reduce code size of `assert_matches_failed`

Using `write_str` instead of `<str as Display>::fmt` avoids the `pad` function which is very expensive to have in size-constrained code.
2022-08-26 09:51:45 +09:00
Yuki Okushi
ba31a9b505
Rollup merge of #100604 - dtolnay:okorerr, r=m-ou-se
Remove unstable Result::into_ok_or_err

Pending FCP: https://github.com/rust-lang/rust/issues/82223#issuecomment-1214920203

```@rustbot``` label +waiting-on-fcp
2022-08-26 09:51:44 +09:00
Yuki Okushi
e193f4697f
Rollup merge of #100076 - tspiteri:const_slice_split_at, r=oli-obk
make slice::{split_at,split_at_unchecked} const functions

Now that `slice::from_raw_parts` is const in stable 1.64, it makes sense to have `split_at` const as well, otherwise unsafe code is required to achieve a const equivalent.
2022-08-26 09:51:43 +09:00
Yuki Okushi
55562c7ddc
Rollup merge of #100034 - tmiasko:elaborate-box-derefs, r=oli-obk
Elaborate all box dereferences in `ElaborateBoxDerefs`

so that it is the only pass responsible for elaboration, instead of
splitting this responsibility between the `StateTransform` and
`ElaborateBoxDerefs`.
2022-08-26 09:51:42 +09:00
Yuki Okushi
28457e10f5
Rollup merge of #99920 - emarteca:custom-allocator-support, r=oli-obk
Custom allocator support in `rustc_serialize`

Adding support for `rustc_serialize` encode/decode for `Box` and `Vec` that use a custom allocator.
2022-08-26 09:51:41 +09:00
Yuki Okushi
f7f80c27f2
Rollup merge of #99064 - lyming2007:issue-97687-fix, r=estebank
distinguish the method and associated function diagnostic information

Methods are defined within the context of a struct and their first parameter is always self
Associated functions don’t take self as a parameter
```
	modified:   compiler/rustc_typeck/src/check/method/suggest.rs
	modified:   src/test/ui/auto-ref-slice-plus-ref.stderr
	modified:   src/test/ui/block-result/issue-3563.stderr
	modified:   src/test/ui/issues/issue-28344.stderr
	modified:   src/test/ui/suggestions/dont-suggest-pin-array-dot-set.stderr
	modified:   src/test/ui/suggestions/suggest-methods.stderr
	modified:   src/test/ui/traits/trait-upcasting/subtrait-method.stderr
```
2022-08-26 09:51:40 +09:00
Nicholas Nethercote
feeaa4db3c Simplify arg capacity calculations.
Currently they try to be very precise. But they are wrong, i.e. they
don't match what's happening in the loop below. This code isn't hot
enough for it to matter that much.
2022-08-26 10:45:45 +10:00
bors
76f3b891a0 Auto merge of #99487 - bmacnaughton:is_whitespace_updates, r=thomcc
is_whitespace() performance improvements

This is my first rust PR, so if I miss anything obvious please let me know and I'll do my best to fix it.

This was a bit more of a challenge than I realized because, while I made working code locally and tested it against the native `is_whitespace()`, this PR required changing `src/tools/unicode-table-generator`, the code that generated the code.

I have benchmarked this locally, using criterion, and have seen meaningful performance improvements. I can add those outputs to this if you'd like, but am guessing that the perf run that `@fmease` recommended is what's needed.

I have run ` ./x.py test --stage 0 library/std` after building it locally after executing `./x.py build library`. I didn't try to build the whole compiler, but maybe I should have - any guidance would be appreciated.

If this general approach makes sense, I'll take a look at some other candidate categories, e.g., `Cc`, in the future.

Oh, and I wasn't sure whether the generated code should be included in this PR or not. I did include it.
2022-08-26 00:42:40 +00:00
Nicholas Nethercote
b75b3b3afe Change FnAbi::args to a boxed slice. 2022-08-26 10:30:36 +10:00
Nicholas Nethercote
4df7bffa95 Change FnAbi::fixed_count to a u32. 2022-08-26 10:29:40 +10:00
Nicholas Nethercote
e4bf113027 Box CastTarget within PassMode.
Because `PassMode::Cast` is by far the largest variant, but is
relatively rare.

This requires making `PassMode` not impl `Copy`, and `Clone` is no
longer necessary. This causes lots of sigil adjusting, but nothing very
notable.
2022-08-26 09:35:28 +10:00
Nicholas Nethercote
263c426bfd Add size assertions for FnAbi and ArgAbi. 2022-08-26 09:30:30 +10:00
Michael Howell
8c65478c51 rustdoc: remove unused CSS for .variants_table
Continuation of #100938 and #101010. This rule was added to support the old,
table-based style for displaying enum variants, which are now displayed using
headers and paragraphs.
2022-08-25 14:27:40 -07:00
bors
cfb5ae26a4 Auto merge of #100748 - SparrowLii:query_depth, r=cjgillot
add `depth_limit` in `QueryVTable` to avoid entering a new tcx in `layout_of`

Fixes #49735
Updates #48685

The `layout_of` query needs to check whether it overflows the depth limit, and the current implementation needs to create a new `ImplicitCtxt` inside `layout_of`. However, `start_query` will already create a new `ImplicitCtxt`, so we can check the depth limit in `start_query`.

We can tell whether we need to check the depth limit simply by whether the return value of `to_debug_str` of the query is `layout_of`. But I think adding the `depth_limit` field in `QueryVTable` may be more elegant and more scalable.
2022-08-25 21:27:38 +00:00
Ellen Arteca
258d3672f0 Adding support for rustc_serialize encode and decode for Box and Vec that use a custom allocator 2022-08-25 20:19:49 +00:00