Commit Graph

148695 Commits

Author SHA1 Message Date
Ximin Luo
9719031dd9 bootstrap: ensure host std when cross-compiling tools, fixes #85320 2021-05-15 15:05:06 +01:00
Ralf Jung
f1fdbe2b7b get rid of a bunch of unnecessary NOTE in const tests 2021-05-15 15:10:14 +02:00
Ralf Jung
a1507b80c2 handle pointers in str 2021-05-15 15:04:41 +02:00
bors
2a245f40a1 Auto merge of #85328 - GuillaumeGomez:rollup-exe9nbj, r=GuillaumeGomez
Rollup of 12 pull requests

Successful merges:

 - #84461 (rustdoc: Remove unnecessary `StripItem` wrapper)
 - #85067 (Minimize amount of fake `DefId`s used in rustdoc)
 - #85207 (Fix typo in comment)
 - #85215 (coverage bug fixes and some refactoring)
 - #85221 (dbg macro: Discuss use in tests, and slightly clarify)
 - #85246 (Miner code formatting)
 - #85253 (swap function order for better read flow)
 - #85256 (Fix display for "implementors" section)
 - #85268 (Use my real name)
 - #85278 (Improve match statements)
 - #85289 (Fix toggle position on mobile)
 - #85323 (Fix eslint errors)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-05-15 12:41:28 +00:00
Ralf Jung
c96d531a92 fix version_str comment 2021-05-15 14:22:29 +02:00
Guillaume Gomez
46bc5526db
Rollup merge of #85323 - GuillaumeGomez:fix-eslint-errors, r=jsha
Fix eslint errors

I cherry-picked the two non-CI commits from #85285.

r? ```@jsha```
2021-05-15 13:29:57 +02:00
Guillaume Gomez
2b5ef25744
Rollup merge of #85289 - GuillaumeGomez:fix-toggle-position-mobile, r=jsha
Fix toggle position on mobile

Before:

![Screenshot from 2021-05-14 14-21-27](https://user-images.githubusercontent.com/3050060/118276475-fe210300-b4c7-11eb-94f8-4e2a4e10d91e.png)
![Screenshot from 2021-05-14 14-21-30](https://user-images.githubusercontent.com/3050060/118276479-feb99980-b4c7-11eb-85db-40e9df6e9abd.png)

After:

![Screenshot from 2021-05-14 15-16-54](https://user-images.githubusercontent.com/3050060/118276494-0416e400-b4c8-11eb-9479-d447928cfa62.png)
![Screenshot from 2021-05-14 15-16-59](https://user-images.githubusercontent.com/3050060/118276498-0416e400-b4c8-11eb-99f6-894276c62dfc.png)

r? ```@jsha```
2021-05-15 13:29:56 +02:00
Guillaume Gomez
cd3d166021
Rollup merge of #85278 - ayushmishra2005:code-refactoring, r=jackh726
Improve match statements
2021-05-15 13:29:55 +02:00
Guillaume Gomez
1a926bf3c5
Rollup merge of #85268 - camelid:real-name, r=Mark-Simulacrum
Use my real name
2021-05-15 13:29:54 +02:00
Guillaume Gomez
5bfbabc892
Rollup merge of #85256 - GuillaumeGomez:fix-implementors-display, r=notriddle
Fix display for "implementors" section

Just saw this problem when going through docs:

![Screenshot from 2021-05-13 15-20-52](https://user-images.githubusercontent.com/3050060/118131978-766fc180-b3ff-11eb-86a8-7f6d22afa675.png)

This fix puts it back to normal:

![Screenshot from 2021-05-13 15-23-29](https://user-images.githubusercontent.com/3050060/118132006-7e2f6600-b3ff-11eb-9985-025a7b7c5216.png)

You can see it on the `TryFrom` page for example.

r? ```@Nemo157```
2021-05-15 13:29:53 +02:00
Guillaume Gomez
36b3c28497
Rollup merge of #85253 - RafaelKr:patch-1, r=varkor
swap function order for better read flow

I was reading this error message for the first time.

I was a little bit confused when reading that part:
```
foo.bar(); // we can now use this method since i32 implements the Foo trait
```

At the time I was reading `// we can now use this method` I wasn't sure why. It only made sense when reading on. So swapping these parts results in a better read flow.
2021-05-15 13:29:52 +02:00
Guillaume Gomez
57aa0d812a
Rollup merge of #85246 - ayushmishra2005:minor-reactoring, r=petrochenkov
Miner code formatting
2021-05-15 13:29:51 +02:00
Guillaume Gomez
5a8619b435
Rollup merge of #85221 - ijackson:dbg-doc-re-tests, r=joshtriplett
dbg macro: Discuss use in tests, and slightly clarify

As discussed in a tangent in #82778.

I chose to use [semantic newlines](https://rhodesmill.org/brandon/2012/one-sentence-per-line/) in the source text but I don't mind reformatting it.
2021-05-15 13:29:50 +02:00
Guillaume Gomez
e611e64e3a
Rollup merge of #85215 - richkadel:ice-fixes-minus-dead-blocks, r=tmandry
coverage bug fixes and some refactoring

This replaces the relevant commits (2 and 3) from PR #85082, and also corrects an error querying for coverageinfo.

1. `coverageinfo` query needs to use the same MIR as codegen

I ran into an error trying to fix dead block coverage and realized the
`coverageinfo` query is getting a different MIR compared to the
codegenned MIR, which can sometimes be a problem during mapgen.

I changed that query to use the `InstandeDef` (which includes the
generic parameter substitutions, prosibly specific to const params)
instead of the `DefId` (without unknown/default const substitutions).

2. Simplified body_span and filtered span code

  Some code cleanup extracted from future (but unfinished) commit to fix
  coverage in attr macro functions.

3. Spanview needs the relevant body_span used for coverage

The coverage body_span doesn't always match the function body_span.

r? ```@tmandry```
2021-05-15 13:29:49 +02:00
Guillaume Gomez
c4f81c12ea
Rollup merge of #85207 - andrewhalle:typo-rootseparator, r=kennytm
Fix typo in comment

missing space in "rootseparator"
2021-05-15 13:29:48 +02:00
Guillaume Gomez
b68d5433c9
Rollup merge of #85067 - Stupremee:minimize-amount-of-fake-defids, r=jyn514,GuillaumeGomez
Minimize amount of fake `DefId`s used in rustdoc

Follow up from #84707, which minimizes the amount of fake defids to the smallest amount possible. Every `FakeDefId` that is now used in the rustdoc library must be preserved and can not be replaced with a normal `DefId`.
2021-05-15 13:29:47 +02:00
Guillaume Gomez
9682fa9dc4
Rollup merge of #84461 - jyn514:remove-strip-item, r=GuillaumeGomez
rustdoc: Remove unnecessary `StripItem` wrapper
2021-05-15 13:29:47 +02:00
Justus K
67d8d18b23
Minimize amount of fake DefIds used in rustdoc 2021-05-15 13:21:35 +02:00
Guillaume Gomez
18b7c0a00e Update rustdoc-js tools 2021-05-15 13:09:55 +02:00
Guillaume Gomez
ccabd4eedf Fix eslint errors 2021-05-15 13:09:28 +02:00
Fabian Wolff
46d55d6549 Warn about unused pub fields in non-pub structs 2021-05-15 13:06:17 +02:00
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
Satyarth Agrahari
196050305c adding time complexity for partition_in_place iter method 2021-05-15 10:50:02 +05:30
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