Commit Graph

166786 Commits

Author SHA1 Message Date
Bert Peters
02d41b8f0d Remove DebbugerScripts from bootstrap CLI 2022-05-02 08:03:48 +02:00
bors
7be1da0319 Auto merge of #96263 - Dylan-DPC:rollup-0eofl13, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #90630 (Create real parser for search queries)
 - #96193 ([fuchsia] Add implementation for `current_exe`)
 - #96196 (Remove assertion that all paths in `ShouldRun` exist)
 - #96228 (Fix locations for intrinsics impls and change to links)
 - #96236 (Add an explicit `Span` field to `OutlivesConstraint`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-04-21 02:16:32 +00:00
bors
09ccb6c59d Auto merge of #96254 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/96239
r? `@ghost`
2022-04-20 23:51:40 +00:00
Dylan DPC
463c94a780
Rollup merge of #96236 - Aaron1011:constraint-debug, r=jackh726
Add an explicit `Span` field to `OutlivesConstraint`

Previously, we would retrieve the span from the `Body` using
the `locations` field. However, we may end up changing the
`locations` field when moving a constraint from a promoted
to a different body.

We now store the original `Span` in a dedication field, so that
changes to the `locations` do not affect the quality of our
diagnostics.
2022-04-21 01:14:17 +02:00
Dylan DPC
e2543d7a4e
Rollup merge of #96228 - mbartlett21:patch-4, r=thomcc
Fix locations for intrinsics impls and change to links

These still referred to `rustc_mir`.
2022-04-21 01:14:16 +02:00
Dylan DPC
0179aacfc1
Rollup merge of #96196 - jyn514:no-assertion, r=Mark-Simulacrum
Remove assertion that all paths in `ShouldRun` exist

This breaks on submodules (see #96188). Disable the assertion for now until I can think of a proper
fix.

This doesn't revert any of the changes in `Step`s themselves, only what
`ShouldRun::paths` does.
2022-04-21 01:14:15 +02:00
Dylan DPC
1e43aae0ef
Rollup merge of #96193 - djkoloski:fuchsia_current_exe, r=tmandry
[fuchsia] Add implementation for `current_exe`

This implementation returns a best attempt at the current exe path. On
fuchsia, fdio will always use `argv[0]` as the process name and if it is
not set then an error will be returned. Because this is not guaranteed
to be the case, this implementation returns an error if `argv` does not
contain any elements.
2022-04-21 01:14:14 +02:00
Dylan DPC
976c6b2d19
Rollup merge of #90630 - GuillaumeGomez:improve-rustdoc-search, r=notriddle
Create real parser for search queries

You can test it [here](https://rustdoc.crud.net/imperio/improve-rustdoc-search/std/index.html).

This PR adds a real parser for the query engine in rustdoc. The parser is quite simple but it allows to makes query handling much easier. I added a new testsuite to ensure it works as expected and ran fuzzing checks on it for a few hours without problems.

So about the parser: as you can see in the screenshot, it handles recursive generics parsing. It also allows to set which item should use exact matching by adding double-quotes around it (look for `exact_search` in the screenshot).

Now about the query engine itself: I simplified it a lot thanks to the parsed query. It behaves mostly the same when there is only one argument, but is much more powerful when there are more than one.

When making this change, we also removed the support for multi-query.

PS: A big part of the PR is tests and test-related code. :)

r? `@camelid`
2022-04-21 01:14:13 +02:00
Ralf Jung
1b01d65d6f update Miri 2022-04-20 18:25:23 -04:00
bors
879aff385a Auto merge of #96187 - GuillaumeGomez:potential-intra-doc-links-filtering, r=notriddle
Prevent `<>` links to be interpreted for intra-doc links

As discussed in [this thread](https://github.com/rust-lang/rust/pull/96135#discussion_r852107956). As mentioned, the intra-doc RFC states that `<>` links shouldn't be potential intra-doc links:  https://rust-lang.github.io/rfcs/1946-intra-rustdoc-links.html#no-autolinks-style.

I renamed `markdown_links` into `potential_intra_doc_markdown_links` to make it more obvious what it's doing.

cc `@petrochenkov`
r? `@notriddle`
2022-04-20 21:32:01 +00:00
Guillaume Gomez
4d26bde4f0 Extend handleSingleArg documentation 2022-04-20 21:11:39 +02:00
bors
51ea9bb29b Auto merge of #96253 - Dylan-DPC:rollup-87hpds5, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #93313 (Check if call return type is visibly uninhabited when building MIR)
 - #96160 (Miri/interpreter debugging tweaks)
 - #96167 (Replace sys/unix/weak AtomicUsize with AtomicPtr)
 - #96168 (Improve AddrParseError description)
 - #96206 (Use sys::unix::locks::futex* on wasm+atomics.)
 - #96234 (remove_dir_all_recursive: treat ELOOP the same as ENOTDIR)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-04-20 18:40:13 +00:00
Guillaume Gomez
f988f86cdc Remove <> links to be potential intra-doc links 2022-04-20 20:28:15 +02:00
Dylan DPC
2443cf2c6a
Rollup merge of #96234 - goffrie:eloop, r=thomcc
remove_dir_all_recursive: treat ELOOP the same as ENOTDIR

On older Linux kernels (I tested on 4.4, corresponding to Ubuntu 16.04), opening a symlink using `O_DIRECTORY | O_NOFOLLOW` returns `ELOOP` instead of `ENOTDIR`. We should handle it the same, since a symlink is still not a directory and needs to be `unlink`ed.
2022-04-20 18:26:06 +02:00
Dylan DPC
41235ef98a
Rollup merge of #96206 - m-ou-se:wasm-futex-locks, r=alexcrichton
Use sys::unix::locks::futex* on wasm+atomics.

This removes the wasm-specific lock implementations and instead re-uses the implementations from sys::unix.

Tracking issue: https://github.com/rust-lang/rust/issues/93740

cc ``@alexcrichton``
2022-04-20 18:26:05 +02:00
Dylan DPC
01d4731735
Rollup merge of #96168 - chris-morgan:AddrParseError-description-improvements, r=joshtriplett
Improve AddrParseError description

The existing description was incorrect for socket addresses, and misleading: users would see “invalid IP address syntax” and suppose they were supposed to provide an IP address rather than a socket address.

I contemplated making it two variants (IP, socket), but realised we can do still better for the IPv4 and IPv6 types, so here it is as six.

I contemplated more precise error descriptions (e.g. “invalid IPv6 socket address syntax: expected a decimal scope ID after %”), but that’s a more invasive change, and probably not worthwhile anyway.
2022-04-20 18:26:04 +02:00
Dylan DPC
53f028d790
Rollup merge of #96167 - CAD97:weak-dlsym-less-ptr-crime, r=thomcc
Replace sys/unix/weak AtomicUsize with AtomicPtr

Should fix #96163. Can't easily test on Windows though...
2022-04-20 18:26:03 +02:00
Dylan DPC
72cb094611
Rollup merge of #96160 - RalfJung:interpret-debug, r=oli-obk
Miri/interpreter debugging tweaks

Some changes I made to make debugging Miri with trace logging less terrible.

r? ``@oli-obk``
2022-04-20 18:26:02 +02:00
Dylan DPC
38e3f523c0
Rollup merge of #93313 - tmiasko:uninhabited, r=tmandry
Check if call return type is visibly uninhabited when building MIR

The main motivation behind the change is to expose information about diverging
calls to the generator transform and match the precision of drop range tracking
which already understands that call expressions with visibly uninhabited types
diverges.

This change should also accept strictly more programs than before. That is
programs that were previously rejected due to errors raised by control-flow
sensitive checks in a code that is no longer considered reachable.

Fixes #93161.
2022-04-20 18:26:01 +02:00
bors
3e69bda8ce Auto merge of #96250 - ehuss:update-cargo, r=ehuss
Update cargo

7 commits in dba5baf4345858c591517b24801902a062c399f8..edffc4ada3d77799e5a04eeafd9b2f843d29fc23
2022-04-13 21:58:27 +0000 to 2022-04-19 17:38:29 +0000
- Document cargo-add (rust-lang/cargo#10578)
- feat: Support '-F' as an alias for '--features' (rust-lang/cargo#10576)
- Completion support for `cargo-add` (rust-lang/cargo#10577)
- Add a link to the document in the timings report (rust-lang/cargo#10492)
- feat: Import cargo-add into cargo (rust-lang/cargo#10472)
- Part 8 of RFC2906 - Keep `InheritableFields` in a `LazyCell` inside `… (rust-lang/cargo#10568)
- Part 7 of RFC2906 - Add support for inheriting `exclude` and `include` (rust-lang/cargo#10565)
2022-04-20 16:15:54 +00:00
Eric Huss
3a6fc80445 Update cargo 2022-04-20 06:50:39 -07:00
bors
d39864d64e Auto merge of #96135 - petrochenkov:doclink6, r=GuillaumeGomez
rustdoc: Optimize and refactor doc link resolution

One more subset of https://github.com/rust-lang/rust/pull/94857 that should bring perf improvements rather than regressions + a couple more optimizations on top of it.
It's better to read individual commits and their descriptions to understand the changes.
The `may_have_doc_links` optimization is not *very* useful here, but it's much more important for https://github.com/rust-lang/rust/pull/94857.

Closes https://github.com/rust-lang/rust/issues/96079
2022-04-20 13:34:48 +00:00
bors
0034bbca26 Auto merge of #96022 - martingms:inline-const-getters, r=nnethercote
Inline `ty::Const::ty()` and `ty::Const::val()` getters

These were not inlined into `super_relate_consts`, which is one of the hottest functions in a callgrind profile of compiling `bitmaps-3.1.0`.

Yields some small speedups across various benchmarks locally:

#### Primary benchmarks

Benchmark | Profile | Scenario | % Change | Significance Factor?
-- | -- | -- | -- | --
unicode-normalization-0.1.19 | check | full | -0.56% | 2.78x
unicode-normalization-0.1.19 | check | incr-full | -0.43% | 2.15x
unicode-normalization-0.1.19 | opt | full | -0.35% | 1.77x
unicode-normalization-0.1.19 | debug | incr-full | -0.31% | 1.56x
unicode-normalization-0.1.19 | debug | full | -0.30% | 1.51x

#### Secondary benchmarks

Benchmark | Profile | Scenario | % Change | Significance Factor?
-- | -- | -- | -- | --
bitmaps-3.1.0 | check | full | -1.88% | 9.39x
bitmaps-3.1.0 | debug | full | -1.79% | 8.96x
bitmaps-3.1.0 | opt | full | -1.69% | 8.43x
bitmaps-3.1.0 | check | incr-full | -1.54% | 7.68x
bitmaps-3.1.0 | debug | incr-full | -1.45% | 7.27x
bitmaps-3.1.0 | opt | incr-full | -1.39% | 6.96x
tt-muncher | opt | full | 1.28% | 6.38x
nalgebra-0.30.1 | check | full | -0.96% | 4.81x
nalgebra-0.30.1 | debug | full | -0.91% | 4.54x
nalgebra-0.30.1 | opt | full | -0.90% | 4.52x
nalgebra-0.30.1 | check | incr-full | -0.77% | 3.86x
nalgebra-0.30.1 | opt | incr-full | -0.76% | 3.79x
nalgebra-0.30.1 | debug | incr-full | -0.74% | 3.72x
hex-0.4.3 | check | full | -0.70% | 3.50x
hex-0.4.3 | debug | full | -0.59% | 2.95x
hex-0.4.3 | check | incr-full | -0.56% | 2.80x
hex-0.4.3 | opt | full | -0.56% | 2.78x
wf-projection-stress-65510 | opt | full | -0.48% | 2.42x
hex-0.4.3 | opt | incr-full | -0.48% | 2.40x
hex-0.4.3 | debug | incr-full | -0.45% | 2.24x
wf-projection-stress-65510 | check | full | -0.44% | 2.18x
wf-projection-stress-65510 | debug | full | -0.42% | 2.08x
wf-projection-stress-65510 | check | incr-full | -0.40% | 2.01x
deep-vector | debug | incr-patched: add vec item | -0.38% | 1.88x
wf-projection-stress-65510 | debug | incr-full | -0.37% | 1.86x
wf-projection-stress-65510 | opt | incr-full | -0.36% | 1.81x
deep-vector | debug | incr-patched: println | 0.33% | 1.63x

r? `@nnethercote`
2022-04-20 11:12:55 +00:00
bors
27af517549 Auto merge of #96082 - michaelwoerister:less_impl_stable_hash_via_hash, r=compiler-errors
incr. comp.: Don't export impl_stable_hash_via_hash!() and warn about using it.

Fixes https://github.com/rust-lang/rust/issues/96013.
2022-04-20 03:51:09 +00:00
Aaron Hill
611a06a375
Add an explicit Span field to OutlivesConstraint
Previously, we would retrieve the span from the `Body` using
the `locations` field. However, we may end up changing the
`locations` field when moving a constraint from a promoted
to a different body.

We now store the original `Span` in a dedication field, so that
changes to the `locations` do not affect the quality of our
diagnostics.
2022-04-19 23:42:20 -04:00
mbartlett21
4879875c76
Change file locations to be links to GitHub 2022-04-20 13:14:32 +10:00
bors
a2df8baea6 Auto merge of #96224 - Dylan-DPC:rollup-h2h3j93, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #95740 (asm: Add a kreg0 register class on x86 which includes k0)
 - #95813 (Remove extra space before a where clause)
 - #96029 (Refactor loop into iterator; simplify negation logic.)
 - #96162 (interpret: Fix writing uninit to an allocation)
 - #96165 (Miri provenance cleanup)
 - #96205 (Use futex locks on emscripten.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-04-20 01:34:43 +00:00
Geoffry Song
cff3f1e8d5 remove_dir_all_recursive: treat ELOOP the same as ENOTDIR 2022-04-20 00:50:03 +00:00
mbartlett21
671a8723c6
Fix locations for intrinsics impls 2022-04-20 09:28:07 +10:00
Dylan DPC
da1ddf371c
Rollup merge of #96205 - m-ou-se:emscripten-futex-locks, r=thomcc
Use futex locks on emscripten.

This switches Emscripten to the futex-based lock implementations, away from pthread.

Tracking issue: https://github.com/rust-lang/rust/issues/93740
2022-04-19 22:57:44 +02:00
Dylan DPC
9d9d5910af
Rollup merge of #96165 - RalfJung:miri-provenance-cleanup, r=oli-obk
Miri provenance cleanup

Reviewing https://github.com/rust-lang/rust/pull/95826 by ``@carbotaniuman`` made me realize that we could clean things up a little here.

``@carbotaniuman`` please let me know if you're okay with landing this (it will create a lot of conflicts with your PR), or if you'd prefer incorporating the ideas from this PR into yours. I think we want to end up in a situation where the function you called `ptr_reify_alloc` returns just two things, a concrete tag and an offset. Getting an `AllocId` from a concrete tag should be infallible like now. However a concrete tag and `Tag` don't have to be the same type.

r? ``@oli-obk``
2022-04-19 22:57:43 +02:00
Dylan DPC
f7d8f5b1e1
Rollup merge of #96162 - RalfJung:mark-uninit, r=oli-obk
interpret: Fix writing uninit to an allocation

When calling `mark_init`, we need to also be mindful of what happens with the relocations! Specifically, when we de-init memory, we need to clear relocations in that range as well or else strange things will happen (and printing will not show the de-init, since relocations take precedence there).

Fixes https://github.com/rust-lang/miri/issues/2068.

Here's the Miri testcase that this fixes (requires `-Zmiri-disable-validation`):
```rust
use std::mem::MaybeUninit;

fn main() { unsafe {
    let mut x = MaybeUninit::<i64>::uninit();
    // Put in a ptr.
    x.as_mut_ptr().cast::<&i32>().write_unaligned(&0);
    // Overwrite parts of that pointer with 'uninit' through a Scalar.
    let ptr = x.as_mut_ptr().cast::<i32>();
    *ptr = MaybeUninit::uninit().assume_init();
    // Reading this back should hence work fine.
    let _c = *ptr;
} }
```
Previously this failed with
```
error: unsupported operation: unable to turn pointer into raw bytes
  --> ../miri/uninit.rs:11:14
   |
11 |     let _c = *ptr;
   |              ^^^^ unable to turn pointer into raw bytes
   |
   = help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support

   = note: inside `main` at ../miri/uninit.rs:11:14
```
2022-04-19 22:57:42 +02:00
Dylan DPC
113f079a97
Rollup merge of #96029 - IsakNyberg:error-messages-fix, r=Dylan-DPC
Refactor loop into iterator; simplify negation logic.

is_dummy should return when a non-dummy is found, but instead is iterated until completion. With some inspiration from line 323 this was refactored to a single line that returns once a single counterexample is found.
2022-04-19 22:57:41 +02:00
Dylan DPC
a0ba15bfab
Rollup merge of #95813 - Urgau:rustdoc-where-clause-space, r=GuillaumeGomez
Remove extra space before a where clause

Remove extra space before where clause in the generated documentation.

The fix is to move the space before the break-line so that it doesn't appear visually but is still here. Removing it completely would create things like this `impl<D> Delta<D>where D: MyTrait` (missing a space before the where) which I don't think we want.

Added two regression test, first one test that the `<br>` is after the space and the second check that the `<br>` is before the spaces.

Before:
![image](https://user-images.githubusercontent.com/3616612/162475212-d4bb6727-ed66-4a55-a4a2-4f55189bf8bd.png)

After:
![image](https://user-images.githubusercontent.com/3616612/162475467-508fd082-60a7-4a8c-b693-8b188e8843e6.png)

r? ``@GuillaumeGomez``
2022-04-19 22:57:40 +02:00
Dylan DPC
69e45d73b9
Rollup merge of #95740 - Amanieu:kreg0, r=nagisa
asm: Add a kreg0 register class on x86 which includes k0

Previously we only exposed a kreg register class which excludes the k0
register since it can't be used in many instructions. However k0 is a
valid register and we need to have a way of marking it as clobbered for
clobber_abi.

Fixes #94977
2022-04-19 22:57:39 +02:00
David Koloski
eb6b6a877e [fuchsia] Add implementation for current_exe
This implementation returns a best attempt at the current exe path. On
fuchsia, fdio will always use `argv[0]` as the process name and if it is
not set then an error will be returned. Because this is not guaranteed
to be the case, this implementation returns an error if `argv` does not
contain any elements.
2022-04-19 16:50:24 -04:00
Guillaume Gomez
ca5c752a7a Add regression test for #96079 2022-04-19 22:57:04 +03:00
Vadim Petrochenkov
5cce8cb4ec rustdoc: Sligthly optimize Attributes construction and processing before doc link resolution 2022-04-19 22:53:50 +03:00
Vadim Petrochenkov
de287df862 rustdoc: Cache preprocessed markdown links 2022-04-19 22:53:50 +03:00
Vadim Petrochenkov
72ed101428 rustdoc: Optimize and refactor doc link resolution
- Cache doc link resolutions obtained early
- Cache markdown links retrieved from doc strings early
- Rename and restructure the code in early doc link resolution to be closer to #94857
2022-04-19 22:53:50 +03:00
Vadim Petrochenkov
e2d3a4f631 rustc_metadata: Store a flag telling whether an item may have doc links in its attributes
This should be cheap on rustc side, but it's significant optimization for rustdoc that won't need to decode and process attributes unnecessarily
2022-04-19 22:53:46 +03:00
Vadim Petrochenkov
f5ca02c334 proc_macro: Add a workaround for rustdoc 2022-04-19 22:49:27 +03:00
Amanieu d'Antras
b2bc46938c asm: Add a kreg0 register class on x86 which includes k0
Previously we only exposed a kreg register class which excludes the k0
register since it can't be used in many instructions. However k0 is a
valid register and we need to have a way of marking it as clobbered for
clobber_abi.

Fixes #94977
2022-04-19 17:14:23 +02:00
bors
4ca19e09d3 Auto merge of #96214 - Dylan-DPC:rollup-a5b4fow, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #94493 (Improved diagnostic on failure to meet send bound on future in a foreign crate)
 - #95809 (Fix typo in bootstrap.py)
 - #96086 (Remove `--extern-location` and all associated code)
 - #96089 (`alloc`: make `vec!` unavailable under `no_global_oom_handling`)
 - #96122 (Fix an invalid error for a suggestion to add a slice in pattern-matching)
 - #96142 (Stop using CRATE_DEF_INDEX outside of metadata encoding.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-04-19 13:10:12 +00:00
Dylan DPC
9fad214593
Rollup merge of #96142 - cjgillot:no-crate-def-index, r=petrochenkov
Stop using CRATE_DEF_INDEX outside of metadata encoding.

`CRATE_DEF_ID` and `CrateNum::as_def_id` are almost always what we want.  We should not manipulate raw `DefIndex` outside of metadata encoding.
2022-04-19 14:43:21 +02:00
Dylan DPC
036d200d1c
Rollup merge of #96122 - TaKO8Ki:fix-invalid-error-for-suggestion-to-add-slice-in-pattern-matching, r=nagisa
Fix an invalid error for a suggestion to add a slice in pattern-matching

closes #96103
2022-04-19 14:43:20 +02:00
Dylan DPC
35188440b5
Rollup merge of #96089 - ojeda:no-vec-no_global_oom_handling, r=Mark-Simulacrum
`alloc`: make `vec!` unavailable under `no_global_oom_handling`

`alloc`: make `vec!` unavailable under `no_global_oom_handling`

The `vec!` macro has 3 rules, but two are not usable under
`no_global_oom_handling` builds of the standard library
(even with a zero size):

```rust
let _ = vec![42];    // Error: requires `exchange_malloc` lang_item.
let _ = vec![42; 0]; // Error: cannot find function `from_elem`.
```

Thus those two rules should not be available to begin with.

The remaining one, with an empty matcher, is just a shorthand for
`new()` and may not make as much sense to have alone, since the
idea behind `vec!` is to enable `Vec`s to be defined with the same
syntax as array expressions. Furthermore, the documentation can be
confusing since it shows the other rules.

Thus perhaps it is better and simpler to disable `vec!` entirely
under `no_global_oom_handling` environments, and let users call
`new()` instead:

```rust
let _: Vec<i32> = vec![];
let _: Vec<i32> = Vec::new();
```

Notwithstanding this, a `try_vec!` macro would be useful, such as
the one introduced in https://github.com/rust-lang/rust/pull/95051.

If the shorthand for `new()` is deemed worth keeping on its own,
then it may be interesting to have a separate `vec!` macro with
a single rule and different, simpler documentation.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2022-04-19 14:43:19 +02:00
Dylan DPC
5f10d1312d
Rollup merge of #96086 - jsgf:remove-extern-location, r=davidtwco
Remove `--extern-location` and all associated code

`--extern-location` was an experiment to investigate the best way to
generate useful diagnostics for unused dependency warnings by enabling a
build system to identify the corresponding build config.

While I did successfully use this, I've since been convinced the
alternative `--json unused-externs` mechanism is the way to go, and
there's no point in having two mechanisms with basically the same
functionality.

This effectively reverts https://github.com/rust-lang/rust/pull/72603
2022-04-19 14:43:17 +02:00
Dylan DPC
9a2d14c39a
Rollup merge of #95809 - ytmimi:llvm_stamp_typo, r=Mark-Simulacrum
Fix typo in bootstrap.py
2022-04-19 14:43:15 +02:00
Dylan DPC
ab59516dfd
Rollup merge of #94493 - oribenshir:feature/ISSUE-78543_async_fn_in_foreign_crate_diag_2, r=davidtwco
Improved diagnostic on failure to meet send bound on future in a foreign crate

Provide a better diagnostic on failure to meet send bound on futures in a foreign crate.

fixes #78543
2022-04-19 14:43:15 +02:00