Commit graph

141557 commits

Author SHA1 Message Date
Wesley Norris
448d07683a Allow specifying alignment for functions 2021-04-05 17:36:51 -04:00
Yuki Okushi
d8c04b13a2
Rollup merge of #83885 - jyn514:private-links, r=Mark-Simulacrum
Document compiler/ with -Aprivate-intra-doc-links

Since compiler/ always passes --document-private-items, it's ok to link to items that are private.
2021-04-06 06:24:17 +09:00
Yuki Okushi
fb6eb4ad93
Rollup merge of #83881 - lnicola:rust-analyzer-2021-04-05, r=jonas-schievink
⬆️ rust-analyzer
2021-04-06 06:24:16 +09:00
Yuki Okushi
f93412fb53
Rollup merge of #83849 - jyn514:intra-doc-cleanup, r=bugadani
rustdoc: Cleanup handling of associated items for intra-doc links

Helps with https://github.com/rust-lang/rust/issues/83761 (right now the uses of the resolver are all intermingled with uses of the tyctxt). Best reviewed one commit at a time.

r? ```@bugadani``` maybe? Feel free to reassign :)
2021-04-06 06:24:15 +09:00
Yuki Okushi
12d007da0f
Rollup merge of #83835 - notriddle:sort-index, r=ollie27
rustdoc: sort search index items for compression

This should not affect the appearance of the docs pages themselves.

This makes the pre-compressed search index smaller, thanks to the
empty-string path duplication format, and also the gzipped version,
by giving the algorithm more structure to work with.

    rust$ wc -c search-index-old.js search-index-new.js
    2628334 search-index-old.js
    2586181 search-index-new.js
    5214515 total
    rust$ gzip search-index-*
    rust$ wc -c search-index-old.js.gz search-index-new.js.gz
    239486 search-index-old.js.gz
    237386 search-index-new.js.gz
    476872 total
2021-04-06 06:24:13 +09:00
Yuki Okushi
67ffbedada
Rollup merge of #83814 - petrochenkov:emptyexpr, r=davidtwco
expand: Do not ICE when a legacy AST-based macro attribute produces and empty expression

Fixes https://github.com/rust-lang/rust/issues/80251

The reported error is the same as for `let _ = #[cfg(FALSE)] EXPR;`
2021-04-06 06:24:12 +09:00
Yuki Okushi
76be7e2082
Rollup merge of #83734 - JohnTitor:issue-83621, r=davidtwco
Catch a bad placeholder type error for statics in `extern`s

Fixes #83621
2021-04-06 06:24:11 +09:00
Yuki Okushi
d9f123a5ae
Rollup merge of #83489 - LeSeulArtichaut:deref-else, r=davidtwco
Properly suggest deref in else block

Continues #79755, fixes #79736
r? `@davidtwco`
2021-04-06 06:24:09 +09:00
Yuki Okushi
e5eddedb80
Rollup merge of #83370 - jyn514:setup-tools, r=Mark-Simulacrum
Add `x.py setup tools` which enables `download-rustc` by default

Helps with https://github.com/rust-lang/rust/issues/81930. I know I said in that issue that I should fix that rebasing rebuilds bootstrap, but the compile time improvement is so good I think it's ok to leave that fix for later (I still plan to work on it). I think all the outright bugs have been fixed :)

This builds on https://github.com/rust-lang/rust/pull/83368 so I can set the option to `if-unchanged`.

r? ```@Mark-Simulacrum```
2021-04-06 06:24:08 +09:00
bors
d322385321 Auto merge of #83152 - guswynn:jemallocator_part2, r=Mark-Simulacrum
Use tikv-jemallocator in rustc/rustdoc in addition to jemalloc-sys when enabled.

In https://github.com/rust-lang/rust/pull/81782 it was mentioned that one reason rustc may benefit from minimalloc is it doesn't use the `sdallocx` api from jemalloc.

Currently, on unix, rust uses jemalloc by importing its symbols to use them with the default, System (libc) global allocator.
This PR switches its global alloc to `tikv-jemallocator`, which correctly uses sized deallocation (https://docs.rs/tikv-jemallocator/0.4.1/src/tikv_jemallocator/lib.rs.html#121-126). `tikv-jemallocator`, as far as I can tell, is a more up-to-date set of bindings to jemalloc than `jemallocator`

The perf results of this pr are in large part due to the version upgrade of jemalloc, but sized deallocation has a non-trivial improvement, particularly to rustdoc.

This pr also includes changes to bootstrap to correctly pass the jemalloc feature through to the rustdoc build
2021-04-05 21:14:27 +00:00
Guillaume Gomez
f4a19ca851
Fix typo in TokenStream documentation 2021-04-05 22:58:07 +02:00
Alex Crichton
6c0b98724c Update LLVM to support more wasm simd ops
Adds a commit with support for i64 simd comparisons for the wasm target
2021-04-05 13:50:49 -07:00
Vadim Petrochenkov
e7e485cf51 rustc_target: Rely on defaults more in target specs 2021-04-05 23:12:56 +03:00
bors
d203fceeb1 Auto merge of #83406 - b-naber:issue-83510, r=lcnr
Prevent very long compilation runtimes in LateBoundRegionNameCollector

Fixes https://github.com/rust-lang/rust/issues/83150

On recursive types such as in the example given in https://github.com/rust-lang/rust/issues/83150, the current implementation of `LateBoundRegionNameCollector` has very long compilation runtimes. To prevent those we store the types visited in the `middle::ty::Visitor` implementation of `LateBoundRegionNameCollector` in a `SsoHashSet`.
2021-04-05 18:50:42 +00:00
Joshua Nelson
a86a740def Use DiagnosticInfo for report_diagnostic 2021-04-05 14:32:13 -04:00
Joshua Nelson
661acbc8bc Take DiagnosticInfo in privacy_error 2021-04-05 14:32:13 -04:00
Joshua Nelson
f4c87c58a8 Take DiagnosticInfo in ambiguity_error 2021-04-05 14:32:13 -04:00
Joshua Nelson
58f9c5b74a Take DiagnosticInfo in disambiguator_error 2021-04-05 14:32:13 -04:00
Joshua Nelson
2ab1b7d8c3 Rename link_range -> disambiguator_range in disambiguator_error
It's not the range of the full link, it's only a partial range.
2021-04-05 14:32:13 -04:00
Joshua Nelson
8ed7d936f8 Take DiagnosticInfo in resolution_failure 2021-04-05 14:32:13 -04:00
Joshua Nelson
d4011e1270 Use DiagnosticInfo for anchor failure
This gets rid of a lot of parameters, as well as fixing a diagnostic
bug.
2021-04-05 14:32:05 -04:00
Joshua Nelson
6e4ef54d79 Rename path_str -> ori_link in anchor_failure
ori_link contains anchors, path_str does not. It's important that
anchor_failure be passed a link with the anchors still present.
2021-04-05 13:52:58 -04:00
Joshua Nelson
f8653c9aca Add config file for tools enabling stage1 downloads by default
Otherwise no one will be able to find the setting.
2021-04-05 13:05:43 -04:00
bors
5a7a0ac51e Auto merge of #83890 - Dylan-DPC:rollup-9fqy3fe, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #83368 (Add `download-rustc = "if-unchanged"`)
 - #83705 (Give a better error when --theme is not a CSS file)
 - #83853 (Disallow the use of high byte registes as operands on x86_64)
 - #83877 (Remove unnecessary exceptions to the platform-specific code check)
 - #83878 (Fix racing file access in tidy)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-04-05 13:50:17 +00:00
Dylan DPC
d856a26770
Rollup merge of #83878 - the8472:fix-concurrent-tidy-access, r=Mark-Simulacrum
Fix racing file access in tidy

That should fix the failure in https://github.com/rust-lang/rust/pull/83776#issuecomment-813311289

The file is only created for a brief moment during the bins checks in the source directories while other checks may also be visiting the same directory. By skipping it we avoid file not found errors.
2021-04-05 15:48:46 +02:00
Dylan DPC
770bf3169b
Rollup merge of #83877 - jyn514:exceptions, r=Mark-Simulacrum
Remove unnecessary exceptions to the platform-specific code check

Some of these were just wrong, like src/librustc. Some looked outdated,
like std::f64. Not sure what was going on with the others - maybe this
check isn't as smart as it needs to be? But in the meantime it seems
silly to ignore the check if it will pass anyway.
2021-04-05 15:48:44 +02:00
Dylan DPC
49b178e9ff
Rollup merge of #83853 - Amanieu:asm_no_high_x86_64, r=nagisa
Disallow the use of high byte registes as operands on x86_64

They are still allowed on x86 though.

Fixes #83495

r? `@nagisa`
2021-04-05 15:48:43 +02:00
Dylan DPC
a766d63b2d
Rollup merge of #83705 - jyn514:theme-error, r=GuillaumeGomez
Give a better error when --theme is not a CSS file

Before:

```
error: invalid argument: "bacon.toml"
```

After:
```
error: invalid argument: "bacon.toml"
  |
  = help: arguments to --theme must be CSS files
```

cc https://github.com/rust-lang/rust/pull/83478
2021-04-05 15:48:42 +02:00
Dylan DPC
335a3c4b7f
Rollup merge of #83368 - jyn514:download-if-unchanged, r=Mark-Simulacrum
Add `download-rustc = "if-unchanged"`

This allows keeping the setting to a fixed value without having to
toggle it when you want to work on the compiler instead of on tools.

This sets `BOOTSTRAP_DOWNLOAD_RUSTC` in bootstrap.py so rustbuild doesn't have to try and replicate its logic.

Helps with https://github.com/rust-lang/rust/issues/81930.

r? `@Mark-Simulacrum` cc `@camelid`
2021-04-05 15:48:40 +02:00
Joshua Nelson
580a740bdd Add download-rustc = "if-unchanged"
This allows keeping the setting to a fixed value without having to
toggle it when you want to work on the compiler instead of on tools.
2021-04-05 09:46:43 -04:00
Amanieu d'Antras
b1bcff0731 Disallow the use of high byte registes as operands on x86_64
They are still allowed on x86 though.

Fixes #83495
2021-04-05 13:38:24 +01:00
Joshua Nelson
0a351abf83 Document compiler/ with -Aprivate-intra-doc-links
Since compiler/ always passes --document-private-items, it's ok to link
to items that are private.
2021-04-05 08:38:09 -04:00
Joshua Nelson
3b7e654fad Use more appropriate return type for resolve_associated_item
Previously, the types looked like this:

- None means this is not an associated item (but may be a variant field)
- Some(Err) means this is known to be an error. I think the only way that can happen is if it resolved and but you had your own anchor.
- Some(Ok(_, None)) was impossible.

Now, this returns a nested Option and does the error handling and
fiddling with the side channel in the caller. As a side-effect, it also
removes duplicate error handling.

This has one small change in behavior, which is that
`resolve_primitive_associated_item` now goes through `variant_field` if
it fails to resolve something.  This is not ideal, but since it will be
quickly rejected anyway, I think the performance hit is worth the
cleanup.

This also fixes a bug where struct fields would forget to set the side
channel, adds a test for the bug, and ignores `private_intra_doc_links`
in rustc_resolve (since it's always documented with
--document-private-items).
2021-04-05 08:34:17 -04:00
Joshua Nelson
ac04dbd056 Reduce indentation in resolve_associated_item 2021-04-05 08:03:27 -04:00
Joshua Nelson
d63b3f9bbb Remove duplicate unwrap_or_else 2021-04-05 08:03:27 -04:00
Laurențiu Nicola
6ce9a028a6 ⬆️ rust-analyzer 2021-04-05 14:40:58 +03:00
bors
39eee173fb Auto merge of #83880 - Dylan-DPC:rollup-hz9ph0e, r=Dylan-DPC
Rollup of 8 pull requests

Successful merges:

 - #81922 (Let `#[allow(unstable_name_collisions)]` work for things other than function)
 - #82483 (Use FromStr trait for number option parsing)
 - #82739 (Use the beta compiler for building bootstrap tools when `download-rustc` is set)
 - #83650 (Update Source Serif to release 4.004)
 - #83826 (List trait impls before deref methods in doc's sidebar)
 - #83831 (Add `#[inline]` to IpAddr methods)
 - #83863 (Render destructured struct function param names as underscore)
 - #83865 (Don't report disambiguator error if link would have been ignored)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-04-05 11:06:20 +00:00
Dylan DPC
3ca197e89c
Rollup merge of #83865 - camelid:disamb-err-fix, r=jyn514
Don't report disambiguator error if link would have been ignored

Fixes #83859.

This prevents us from warning on links such as `<hello@example.com>`.
Note that we still warn on links such as `<hello@localhost>` because
they have no dots in them. However, the links will still work, even
though a warning is reported.

r? ````@jyn514````
2021-04-05 13:03:44 +02:00
Dylan DPC
98e7a4e784
Rollup merge of #83863 - eggyal:issue-83852, r=jyn514
Render destructured struct function param names as underscore

Fixes #83852

r? ````@GuillaumeGomez````
2021-04-05 13:03:43 +02:00
Dylan DPC
445aa40153
Rollup merge of #83831 - AngelicosPhosphoros:issue-77583-inline-for-ip, r=m-ou-se
Add `#[inline]` to IpAddr methods

Add some inlines to trivial methods of IpAddr
Closes https://github.com/rust-lang/rust/issues/77583
2021-04-05 13:03:42 +02:00
Dylan DPC
d60cf78fbe
Rollup merge of #83826 - slightlyoutofphase:rustdoc-sidebar-order-shuffle, r=jyn514
List trait impls before deref methods in doc's sidebar

This PR is acting directly on a suggestion made by ```````@jyn514``````` in #83133. I've tested the changes locally, and can confirm that it does in fact properly achieve what he thought it would. This PR also in turn closes #83133.
2021-04-05 13:03:41 +02:00
Dylan DPC
ad0a995f0b
Rollup merge of #83650 - tspiteri:source-serif-4, r=GuillaumeGomez
Update Source Serif to release 4.004

Now the family name is Source Serif 4 (upstream issue 77) instead of Source Serif Pro.
2021-04-05 13:03:40 +02:00
Dylan DPC
ca9cbea27a
Rollup merge of #82739 - jyn514:separate-stage0-stage1, r=Mark-Simulacrum
Use the beta compiler for building bootstrap tools when `download-rustc` is set

 ## Motivation

This avoids having to rebuild bootstrap and tidy each time you rebase
over master. In particular, it makes rebasing and running `x.py fmt` on
each commit in a branch significantly faster. It also avoids having to
rebuild bootstrap after setting `download-rustc = true`.

 ## Implementation

Instead of extracting the CI artifacts directly to `stage0/`, extract
them to `ci-rustc/` instead. Continue to copy them to the proper
sysroots as necessary for all stages except stage 0.

This also requires `bootstrap.py` to download both stage0 and CI
artifacts and distinguish between the two when checking stamp files.

Note that since tools have to be built by the same compiler that built
`rustc-dev` and the standard library, the downloaded artifacts can't be
reused when building with the beta compiler. To make sure this is still
a good user experience, warn when building with the beta compiler, and
default to building with stage 2.

I tested this by rebasing this PR from edeee915b1 over 1c77a1fa3c and confirming that only the bootstrap library itself had to be rebuilt, not any dependencies and not `tidy`. I also tested that a clean build with `x.py build` builds rustdoc exactly once and does no other work, and that `touch src/librustdoc/lib.rs && x.py build` works. `x.py check` still behaves as before (checks using the beta compiler, even if there are changes to `compiler/`).

Helps with https://github.com/rust-lang/rust/issues/81930.

r? `@Mark-Simulacrum`
2021-04-05 13:03:38 +02:00
Dylan DPC
e64dbb1f46
Rollup merge of #82483 - tmiasko:option-from-str, r=matthewjasper
Use FromStr trait for number option parsing

Replace `parse_uint` with generic `parse_number` based on `FromStr`.
Use it for parsing inlining threshold to avoid casting later.
2021-04-05 13:03:37 +02:00
Dylan DPC
54ea8e1b82
Rollup merge of #81922 - magurotuna:issue81522, r=matthewjasper
Let `#[allow(unstable_name_collisions)]` work for things other than function

Fixes #81522

In addition to the report in #81522, currently `#[allow(unstable_name_collisions)]` doesn't suppress the corresponding diagnostics even if this attribute is appended to an expression statement or a let statement. It seems like this is because the wrong `HirId` is passed to `struct_span_lint_hir`.
It's fixed in this PR, and a regression test for it is also added.
2021-04-05 13:03:36 +02:00
The8472
1df9d498e1 don't try to visit probe file
this file is only created for a brief moment during the bins checks
in the source directories while other checks may also be visiting
that directory. skip processing it to avoid missing file errors
2021-04-05 12:15:52 +02:00
Joshua Nelson
9eabb41ab4 Remove unnecessary exceptions to the platform-specific code check
Some of these were just wrong, like src/librustc. Some looked outdated,
like std::f64. Not sure what was going on with the others - maybe this
check isn't as smart as it needs to be? But it the meantime it seems
silly to ignore the check if it will pass anyway.
2021-04-05 06:03:53 -04:00
Trevor Spiteri
70b0874d44 change SourceSerifPro to SourceSerif4 in emit-shared-files test 2021-04-05 10:51:37 +02:00
Trevor Spiteri
29fed9aa4e Update Source Serif to release 4.004
Now the family name is Source Serif 4 (upstream issue 77) instead of
Source Serif Pro.
2021-04-05 10:48:08 +02:00
bors
58e7189650 Auto merge of #83858 - joshtriplett:unsafe-cell-always-inline, r=Mark-Simulacrum
Use `#[inline(always)]` on trivial UnsafeCell methods

UnsafeCell is the standard building block for shared mutable data
structures. UnsafeCell should add zero overhead compared to using raw
pointers directly.

Some reports suggest that debug builds, or even builds at opt-level 1,
may not always be inlining its methods. Mark the methods as
`#[inline(always)]`, since once inlined the methods should result in no
actual code other than field accesses.
2021-04-05 06:21:14 +00:00