Commit Graph

148620 Commits

Author SHA1 Message Date
bors
b439be03c9 Auto merge of #84152 - sexxi-goose:insignificant_dtor, r=nikomatsakis
Insignificant destructors rfc 2229

- Adds new attribute `rustc_insignificant_dtor` to annotate the drop method.
- Adds a query to check if a type has a significant drop.
- Updates closure analysis to check for significant drops rather than just drop.

A type marked with the attribute `rustc_insignificant_dtor` is considered to not be significant. A drop is significant if it is implemented by the user or does anything that will have any observable behavior (other than freeing up memory).

https://github.com/rust-lang/project-rfc-2229/issues/35
2021-05-15 10:00:39 +00:00
bors
c6dd87a6b4 Auto merge of #85311 - camelid:box-blanket-impl, r=jyn514
Box `Impl.blanket_impl` to reduce size

Blanket impls are probably not super common, and `Type` is a fairly
large type, so this should reduce `Impl`'s size by a lot: `Option<Type>`
is around 96 bytes, and `Option<Box<Type>>` is 8 bytes, so it's a big
difference!
2021-05-15 07:44:21 +00:00
Eduard-Mihai Burtescu
cb23a794a6 rustc_codegen_ssa: generate MSVC cleanup pads on demand, like GNU landing pads. 2021-05-15 09:17:46 +03:00
bors
428636f954 Auto merge of #84997 - pietroalbini:ci-verify-channel, r=Mark-Simulacrum
Error out if a PR is sent to the wrong channel

It happened multiple times that a PR meant to go on beta ends up being opened (and occasionally merged) to master. This PR does two things:

* Moves the definition of the channel in `src/ci/channel` so it's easier for tools to read it. I was not sure whether to move it to `src/channel` (like `src/version`): ended up with `src/ci` as it's currently only used for CI, but I'm open to moving it to `src`. We'll need to update the release process after this.
* Adds a check on **non-bors** builds that errors out if the base branch is not the expected one for the currently defined channel. This will not cause problems for promotion PRs, as those PRs are meant to also update the channel name.

r? `@Mark-Simulacrum`
2021-05-15 05:20:49 +00:00
Dhruv Jauhar
a7e1cec621 add new attribute rustc_insignificant_dtor and a query to check if a type has a significant drop 2021-05-14 22:57:33 -04:00
Caleb Cartwright
34368ec2aa ci(should-skip-this): only check commits when skip rule enabled 2021-05-14 21:55:19 -05:00
Joshua Nelson
08c7c61b9d should-skip-this: Check for changes between the master branch, not the previous commit.
The previous commit could be part of the current PR.
2021-05-14 21:55:03 -05:00
Joshua Nelson
56fa9b43c8 Run toolstate jobs when src/tools/rustfmt is modified.
Previously, this would be caught by a change for modified submodules;
now that rustfmt is no longer a submodule, the check needs to be
explicit.
2021-05-14 21:54:53 -05:00
Joshua Nelson
079d1c403f Update log to 0.4.14
This avoids the following warning:

```
warning: trailing semicolon in macro used in expression position
   --> /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/log-0.4.11/src/macros.rs:152:45
    |
147 | / macro_rules! debug {
148 | |     (target: $target:expr, $($arg:tt)+) => (
149 | |         log!(target: $target, $crate::Level::Debug, $($arg)+);
150 | |     );
151 | |     ($($arg:tt)+) => (
152 | |         log!($crate::Level::Debug, $($arg)+);
    | |                                             ^
153 | |     )
154 | | }
    | |_- in this expansion of `debug!`
    |
   ::: src/tools/rustfmt/src/modules/visitor.rs:36:23
    |
36  |               Err(e) => debug!("{}", e),
    |                         --------------- in this macro invocation
    |
    = note: requested on the command line with `-W semicolon-in-expressions-from-macros`
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
```
2021-05-14 21:54:43 -05:00
Joshua Nelson
b3494378aa Don't copy tool dependencies to the sysroot
This fixes the following error:

```
error: found crates (`serde_derive` and `serde_derive`) with colliding StableCrateId values.
   --> /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/cargo_metadata-0.8.2/src/lib.rs:162:1
    |
162 | extern crate serde_derive;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
```

This is a bug in resolve (https://github.com/rust-lang/rust/issues/56935)
but it will be difficult to fix in the near future. This works around it
in the meantime by not copying serde_derive and other dependencies to
the sysroot when they're built for other tools. This rebuilds the
dependencies slightly more often than necessary, but avoids the crate
conflicts.

This can be reverted once #56935 is fixed.
2021-05-14 21:54:06 -05:00
Joshua Nelson
956e0bae58 Update bootstrap for in-tree rustfmt
- Add rustfmt to `x.py check`
- Update Cargo.lock
- Remove rustfmt from the toolstate list
- Make rustfmt an in-tree tool
- Give an error on `x.py test rustfmt` if rustfmt fails to build or if tests fail
- Don't call `save_toolstate` when testing rustfmt
2021-05-14 21:53:54 -05:00
Caleb Cartwright
b2d45c0d4b Add 'src/tools/rustfmt/' from commit '7872306edf2e11a69aaffb9434088fd66b46a863'
git-subtree-dir: src/tools/rustfmt
git-subtree-mainline: e659b6de91
git-subtree-split: 7872306edf
2021-05-14 21:53:36 -05:00
Joshua Nelson
e659b6de91 Delete rustfmt submodule 2021-05-14 21:52:54 -05:00
Caleb Cartwright
0e61f62bb5 add rustfmt crlf files to root gitattributes 2021-05-14 21:52:28 -05:00
Jack Huey
61157b341e Store Option<Region> as value for RegionVid 2021-05-14 21:48:32 -04:00
Noah Lev
f57537e5f3 Box Impl.blanket_impl to reduce size
Blanket impls are probably not super common, and `Type` is a fairly
large type, so this should reduce `Impl`'s size by a lot: `Option<Type>`
is around 96 bytes, and `Option<Box<Type>>` is 8 bytes, so it's a big
difference!
2021-05-14 17:45:41 -07:00
Caleb Cartwright
7872306edf chore: update gitattributes for files with windows style line endings 2021-05-14 18:50:25 -05:00
Jack Huey
e8c284ff28 Make the UnifyValue for RegionVid () 2021-05-14 18:17:13 -04:00
Guillaume Gomez
dfc8b6094e Add test for toggle on mobile size 2021-05-14 22:25:50 +02:00
Guillaume Gomez
7eb95cd8e4 Unify toggle rules on smaller resolutions 2021-05-14 22:25:50 +02:00
Guillaume Gomez
0c02338a60 Move @media rules at the end so they override the other rules 2021-05-14 22:25:50 +02:00
r00ster
4f66337df2
Expand WASI abbreviation in docs 2021-05-14 22:03:00 +02:00
Ximin Luo
15aad5fcdb bootstrap: build cargo only if requested in tools 2021-05-14 19:22:41 +01:00
bors
1025db84a6 Auto merge of #85211 - Aaron1011:metadata-invalid-span, r=michaelwoerister
Preserve `SyntaxContext` for invalid/dummy spans in crate metadata

Fixes #85197

We already preserved the `SyntaxContext` for invalid/dummy spans in the
incremental cache, but we weren't doing the same for crate metadata.
If an invalid (lo/hi from different files) span is written to the
incremental cache, we will decode it with a 'dummy' location, but keep
the original `SyntaxContext`. Since the crate metadata encoder was only
checking for `DUMMY_SP` (dummy location + root `SyntaxContext`),
the metadata encoder would treat it as a normal span, encoding the
`SyntaxContext`. As a result, the final span encoded to the metadata
would change across sessions, even if the crate itself was unchanged.

This could lead to an 'unstable fingerprint' ICE under the following conditions:
1. We compile a crate with an invalid span using incremental compilation. The metadata encoder discards the `SyntaxContext` since the span is invalid, while the incremental cache encoder preserves the `SyntaxContext`
2. From another crate, we execute a foreign query, decoding the invalid span from the metadata as `DUMMY_SP` (e.g. with `SyntaxContext::root()`). This span gets hashed into the query fingerprint. So far, this has always happened through the `optimized_mir` query.
3. We recompile the first crate using our populated incremental cache, without changing anything. We load the (previously) invalid span from our incremental cache - it gets converted to a span with a dummy (but valid) location, along with the original `SyntaxContext`. This span gets written out to the crate metadata - since it now has a valid location, we preserve its `SyntaxContext`.
4. We recompile the second crate, again using a populated incremental cache. We now re-run the foreign query `optimized_mir` - the foreign crate hash is unchanged, but we end up decoding a different span (it now ha a non-root `SyntaxContext`). This results in the fingerprint changing, resulting in an ICE.

This PR updates our encoding of spans in the crate metadata to mirror
the encoding of spans into the incremental cache. We now always encode a
`SyntaxContext`, and encode location information for spans with a
non-dummy location.
2021-05-14 16:58:30 +00:00
Amanieu d'Antras
f1b11939e2 Remove support for floating-point constants in asm!
Floating-point constants aren't very useful anyways and this simplifies
the code since the type check can now be done in typeck.
2021-05-14 14:58:21 +01:00
Smitty
f23d231c50 Add tests where asm! is properly in unsafe block 2021-05-14 09:22:30 -04:00
Guillaume Gomez
766de3a5e2 Fix toggle position on mobile 2021-05-14 15:16:29 +02:00
Smitty
116bc6dd76 Check for inline assembly in THIR unsafeck 2021-05-14 09:03:30 -04:00
bors
75da570d78 Auto merge of #83640 - bjorn3:shared_metadata_reader, r=nagisa
Use the object crate for metadata reading

This allows sharing the metadata reader between cg_llvm, cg_clif and other codegen backends.

This is not currently useful for rlib reading with cg_spirv ([rust-gpu](https://github.com/EmbarkStudios/rust-gpu/)) as it uses tar rather than ar as .rlib format, but it is useful for dylib reading required for loading proc macros. (cc `@eddyb)`

The object crate is already trusted as dependency of libstd through backtrace. As far as I know it supports reading all object file formats used by targets for which we support rust dylibs with crate metadata, but I am not certain. If this happens to not be the case, I could keep using LLVM for reading dylib metadata.

Marked as WIP for a perf run and as it is based on #83637.
2021-05-14 12:58:58 +00:00
ayushmishra2005
27defcd14f Addressed PR coments 2021-05-14 17:30:26 +05:30
Ian Jackson
88ccaa77f1 panic abort after fork test: Disable on android
And link to the issue.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-05-14 11:39:51 +01:00
bors
36a4d14c7e Auto merge of #85236 - nikic:update-llvm-submodule, r=cuviper
Update LLVM submodule

This merges recent changes from the upstream LLVM 12 branch. One of them is intended to address #84958.
2021-05-14 09:10:11 +00:00
bors
69b352ef77 Auto merge of #85233 - FabianWolff:issue-85227, r=petrochenkov
Improve error message for non-exhaustive matches on non-exhaustive enums

This pull request fixes #85227. For an enum marked with `#[non_exhaustive]` and not defined in the current crate, the error message for non-exhaustive matches now mentions the fact that the enum is marked as non-exhaustive:
```
error[E0004]: non-exhaustive patterns: `_` not covered
  --> main.rs:12:11
   |
12 |     match e {
   |           ^ pattern `_` not covered
   |
   = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
   = note: the matched value is of type `E`, which is marked as non-exhaustive
```
2021-05-14 06:53:45 +00:00
Jacob Hoffman-Andrews
73a5c1f944 Toggle-wrap items differently than top-doc.
This makes sure things like trait methods get wrapped at the
`<h3><code>` level rather than at the `.docblock` level. Also it ensures
that only the actual top documentation gets the `.top-doc` class.
2021-05-13 23:09:24 -07:00
bors
91f2e2d218 Auto merge of #85190 - mati865:update-cc, r=Mark-Simulacrum
Update cc crate

To pull in this fix: 801a87bf2f
2021-05-14 04:12:40 +00:00
Dr. Chat
69acee3ffe Add asm!() support for PowerPC64 2021-05-13 22:31:47 -05:00
ayushmishra2005
34055a932b Improve match statements 2021-05-14 08:57:33 +05:30
bors
754d17121d Auto merge of #85195 - Mark-Simulacrum:variant-by-idx, r=petrochenkov
Store VariantIdx to distinguish enum variants

This saves ~24% of the instructions on the match-stress-enum benchmark, but I'm not 100% sure that this is OK - if we ever compare two constructors across enums (e.g., a Result and an Option), then this is obviously insufficient; I can experiment with continuing to store the DefId for comparison purposes in that case.
2021-05-14 00:59:01 +00:00
Luqman Aden
3fe1d7f789 Only pass --[no-]gc-sections if linker is GNU ld.
LinkerFlavor::Gcc does not always mean GNU ld specifically. And in the
case of at least the solaris ld in illumos, that flag is unrecognized
and will cause the linking step to fail.
2021-05-13 16:55:33 -07:00
bors
17f30e5451 Auto merge of #84107 - Amanieu:global_asm2, r=nagisa
Add support for const operands and options to global_asm!

On x86, the default syntax is also switched to Intel to match asm!.

Currently `global_asm!` only supports `const` operands and the `att_syntax` option. In the future, `sym` operands will also be supported. However there is no plan to support any of the other operand types or options since they don't make sense in the context of `global_asm!`.

r? `@nagisa`
2021-05-13 22:17:43 +00:00
Amanieu d'Antras
a7ed6a5196 Fix tests 2021-05-13 23:09:54 +01:00
Amanieu d'Antras
d9cf2ce28f Update compiler_builtins to 0.1.43 2021-05-13 22:32:44 +01:00
Amanieu d'Antras
40d9da4d8c global_asm! consts do not depend on other items 2021-05-13 22:31:58 +01:00
Amanieu d'Antras
bb6bec1d55 Clarify error message when both asm! and global_asm! are unsupported 2021-05-13 22:31:58 +01:00
Amanieu d'Antras
0df83f8e5e Update global_asm! documentation 2021-05-13 22:31:58 +01:00
Amanieu d'Antras
5a229e0e20 Add tests for global_asm! 2021-05-13 22:31:58 +01:00
Amanieu d'Antras
5918ee4317 Add support for const operands and options to global_asm!
On x86, the default syntax is also switched to Intel to match asm!
2021-05-13 22:31:57 +01:00
Camelid
c34e7c60f5 Fix v0 symbol mangling bug 2021-05-13 13:11:38 -07:00
Jacob Hoffman-Andrews
b615c0c854 rustdoc: use focus for search navigation
Rather than keeping track of highlighted element inside the JS, take
advantage of `.focus()` and the :focus CSS pseudo-class.

This required wrapping each row of results in one big <a> tag (because
anchors can be focused, but table rows cannot). That in turn required
moving from a table layout to a div layout with float.

This makes it so Ctrl+Enter opens links in new tabs, and using the arrow
keys to navigate off the bottom of the page scrolls the rest of the page
into view. It also simplifies the keyboard event handling. It eliminates
the need for click handlers on the search results, and for tracking
mouse movements.

This changes the UI treatment of mouse hovering. A hovered element now
gets a light grey background, but does not change the focused element.
It's possible to have two highlighted search results: one that is
focused (via keyboard) and one that is hovered (via mouse). Pressing
enter will activate the focused link; clicking will activate the hovered
link. This matches up with how Firefox and Chrome handle suggestions in
their URL bar, and avoids stray mouse movements changing the focus.

Selecting tabs is now done with left/right arrows while any search
result is focused. The visibility of results on each search tab is
controlled with the "active" class, rather than by setting display: none
directly. Note that the old code kept track of highlighted search
element when tabbing back and forth. The new code doesn't.
2021-05-13 12:49:14 -07:00
bors
6d395a1c29 Auto merge of #85186 - nikomatsakis:issue-83538-polluted-cache, r=jackh726
have on_completion record subcycles

have on_completion record subcycles

Rework `on_completion` method so that it removes all
provisional cache entries that are "below" a completed
node (while leaving those entries that are not below
the node).

This corrects an imprecise result that could in turn lead
to an incremental compilation failure. Under the old
scheme, if you had:

* A depends on...
   * B depends on A
   * C depends on...
       * D depends on C
 * T: 'static

then the provisional results for A, B, C, and D would all
be entangled. Thus, if A was `EvaluatedToOkModuloRegions`
(because of that final condition), then the result for C and
D would also be demoted to "ok modulo regions".

In reality, though, the result for C depends only on C and itself,
and is not dependent on regions. If we happen to evaluate the
cycle starting from C, we would never reach A, and hence the
result would be "ok".

Under the new scheme, the provisional results for C and D
are moved to the permanent cache immediately and are not affected
by the result of A.

Fixes #83538

r? `@Aaron1011`
2021-05-13 19:36:46 +00:00