Commit Graph

196282 Commits

Author SHA1 Message Date
Joshua Nelson
775c3c0493 Add x.sh and x.ps1 shell scripts
This is a more ambitious version of https://github.com/rust-lang/rust/pull/98716.
It still changes the shebang back to python3, for compatibility with non-Unix systems,
but also adds alternative entrypoints for systems without `python3` installed.

These scripts will be necessary for the rust entrypoint (#94829), so I see
little downside in adding them early.
2022-08-08 14:48:11 -05:00
bors
e5a7d8f945 Auto merge of #99979 - Dylan-DPC:rollup-ikkejgy, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #99186 (Use LocalDefId for closures more)
 - #99741 (Use `impl`'s generics when suggesting fix on bad `impl Copy`)
 - #99844 (Introduce an ArchiveBuilderBuilder)
 - #99921 (triagebot.yml: CC Enselic when rustdoc-json-types changes)
 - #99974 (Suggest removing a semicolon and boxing the expressions for if-else)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-31 13:26:27 +00:00
Dylan DPC
990bce4da0
Rollup merge of #99974 - TaKO8Ki:suggest-removing-semicolon-and-boxing-the-expressions, r=compiler-errors
Suggest removing a semicolon and boxing the expressions for if-else

`InferCtxt::suggest_remove_semi_or_return_binding` was not working well, so I fixed it and added a ui test.
2022-07-31 17:36:44 +05:30
Dylan DPC
8b2637fd3b
Rollup merge of #99921 - Enselic:cc-enselic, r=GuillaumeGomez
triagebot.yml: CC Enselic when rustdoc-json-types changes

Being the maintainer of [cargo-public-api](https://github.com/Enselic/cargo-public-api) which relies on [rustdoc JSON](https://github.com/rust-lang/rust/issues/76578) means I have high stakes in the rustdoc JSON format itself. Would be great if I could be pinged when the format is about to change.

I hope this is OK. Big thanks in advance.
2022-07-31 17:36:43 +05:30
Dylan DPC
1d010d4382
Rollup merge of #99844 - bjorn3:archive_builder_interface_refactor, r=nagisa
Introduce an ArchiveBuilderBuilder

This avoids monomorphizing all linker code for each codegen backend and will allow passing in extra information to the archive builder from the codegen backend. I'm going to use this in https://github.com/rust-lang/rust/pull/97485 to allow passing in the right function to extract symbols from object files to a generic archive builder to be used by cg_llvm, cg_clif and cg_gcc.
2022-07-31 17:36:42 +05:30
Dylan DPC
2c14bc3b55
Rollup merge of #99741 - compiler-errors:copy-impl-impl-generics, r=fee1-dead
Use `impl`'s generics when suggesting fix on bad `impl Copy`

See the UI test for a more complicated example, but we weren't correctly suggesting to add bounds given a manual `impl` whose generics didn't match the struct generics.

```rust
#[derive(Clone)]
struct Wrapper<T>(T);

impl<S> Copy for Wrapper<S> {}
```

Coincidentally this fix didn't cause any regressions for `derive(Copy)` impls, I think because those use the same spans in the impl generics as the struct generics, so the machinery still applies the same change.
2022-07-31 17:36:41 +05:30
Dylan DPC
403c1b3802
Rollup merge of #99186 - camsteffen:closure-localdefid, r=cjgillot
Use LocalDefId for closures more
2022-07-31 17:36:40 +05:30
bors
76822a2878 Auto merge of #99553 - ChrisDenton:lazy-compat-fn, r=Mark-Simulacrum
Rewrite Windows `compat_fn` macro

This allows using most delay loaded functions before the init code initializes them. It also only preloads a select few functions, rather than all functions.

This is optimized for the common case where a function is used after already being loaded (or failed to load). The only change in codegen at the call site is to use an atomic load instead of a plain load, which should have negligible or no impact.

I've split the old `compat_fn` macro in two so as not to mix two different use cases. If/when Windows 7 support is dropped `compat_fn_optional` can be removed entirely.

r? rust-lang/libs
2022-07-31 10:44:11 +00:00
bors
482153bc20 Auto merge of #99529 - Milo123459:stage-1-test, r=jyn514
Run `x test --stage 1` in CI

Fixes #99135

r? `@jyn514`
2022-07-31 08:03:26 +00:00
Takayuki Maeda
f6908be329 add a test to check if suggest_remove_semi_or_return_binding is working well for if-else 2022-07-31 11:36:04 +09:00
Takayuki Maeda
03622552ec use appropriate HirID for finding else_span 2022-07-31 11:33:01 +09:00
bors
a2318651d4 Auto merge of #99959 - cuviper:niche-size, r=eddyb
Fix the size of niche enums with ZST alignment

For enums with an aligned ZST variant, like `[T; 0]`, the niche layout
was not computing a sufficient size to be consistent with alignment. Now
we pad that size up to the alignment, and also make sure to only use the
niche variant's ABI when the size and alignment still match.

Fixes #99836
r? `@eddyb`
2022-07-30 23:47:51 +00:00
Milo
1f7b6552bb dont run stage1 tests in pr 2022-07-30 22:10:26 +00:00
Milo
0f121d7288 add to full test-suite 2022-07-30 21:56:53 +00:00
bors
0f4bcadb46 Auto merge of #99964 - matthiaskrgr:rollup-jr836e2, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #99650 (Support `x --keep-stage 0 check`)
 - #99873 (rustdoc: align invalid-html-tags lint with commonmark spec)
 - #99889 (Remove `parent_pat` from `TopInfo`)
 - #99890 (Do not allow bad projection term to leak into the type checker)
 - #99937 (Reset directory iteration in remove_dir_all)
 - #99950 (Remove more Clean trait implementations)
 - #99956 (Also gate AllocatedPointer and AllocAlign definitions by LLVM_VERSION_GE)
 - #99962 (Discover channel for LLVM download)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-30 21:01:42 +00:00
Cameron Steffen
cf2433a74f Use LocalDefId for closures more 2022-07-30 15:59:17 -05:00
Matthias Krüger
f21a06f8fa
Rollup merge of #99962 - Mark-Simulacrum:detect-ci-artifact-channel, r=jyn514
Discover channel for LLVM download

r? `@jyn514`
cc `@RalfJung`

Reported on Zulip: https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/No.20prebuilt.20LLVM.20for.20the.20beta.20branch.3F
2022-07-30 22:51:03 +02:00
Matthias Krüger
b9ad36c387
Rollup merge of #99956 - est31:fix_llvm_wrapper_warning, r=cuviper
Also gate AllocatedPointer and AllocAlign definitions by LLVM_VERSION_GE

Fixes a warning:

```
warning: llvm-wrapper/RustWrapper.cpp:159:11: warning: enumeration values 'AllocatedPointer' and 'AllocAlign' not handled in switch [-Wswitch]
warning:   switch (Kind) {
warning:           ^
```

Which was fall out from 130a1df71e.

Fixes #99955
2022-07-30 22:51:02 +02:00
Matthias Krüger
55258de97a
Rollup merge of #99950 - GuillaumeGomez:rm-clean-impls, r=Dylan-DPC
Remove more Clean trait implementations

This time it even allowed to remove a function.

Follow-up of https://github.com/rust-lang/rust/pull/99638.

r? `@notriddle`
2022-07-30 22:51:01 +02:00
Matthias Krüger
656cd3a48f
Rollup merge of #99937 - ChrisDenton:fix-remove-dir-all-win-7, r=joshtriplett
Reset directory iteration in remove_dir_all

Fixes #99934
2022-07-30 22:51:00 +02:00
Matthias Krüger
686cb110a7
Rollup merge of #99890 - compiler-errors:issue-99828, r=lcnr
Do not allow bad projection term to leak into the type checker

Fixes #99828
2022-07-30 22:50:59 +02:00
Matthias Krüger
451349a634
Rollup merge of #99889 - compiler-errors:cleanup-ti, r=cjgillot
Remove `parent_pat` from `TopInfo`

We can get the parent pat from the hir map.
2022-07-30 22:50:58 +02:00
Matthias Krüger
852bf84c7b
Rollup merge of #99873 - notriddle:notriddle/invalid-html-tags-webcomponents, r=GuillaumeGomezp
rustdoc: align invalid-html-tags lint with commonmark spec
2022-07-30 22:50:57 +02:00
Matthias Krüger
44c4b4a0e7
Rollup merge of #99650 - jyn514:keep-stage-check, r=Mark-Simulacrum
Support `x --keep-stage 0 check`

Stage 1 check has been supported since https://github.com/rust-lang/rust/pull/81064.
 https://github.com/rust-lang/rust/pull/81064 changed the error message for this, but I don't think there's any reason we should prevent using it.
I tested locally and `keep-stage` works fine.

r? `@Mark-Simulacrum`
2022-07-30 22:50:56 +02:00
Mark Rousskov
d63e982cd9 Discover channel for artifact download
When we're downloading based on a CI commit, that can still be -beta- or even
-stable-, so we should lookup the channel it was built with.
2022-07-30 15:58:04 -04:00
Josh Stone
1e7e745572 Test another enum niche with multiple ZST alignments 2022-07-30 11:54:15 -07:00
Josh Stone
4a1e4ea32a Fix the size of niche enums with ZST alignment
For enums with an aligned ZST variant, like `[T; 0]`, the niche layout
was not computing a sufficient size to be consistent with alignment. Now
we pad that size up to the alignment, and also make sure to only use the
niche variant's ABI when the size and alignment still match.
2022-07-30 10:45:48 -07:00
bors
038f9e6bef Auto merge of #99948 - Dylan-DPC:rollup-ed5136t, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #99311 (change maybe_body_owned_by to take local def id)
 - #99862 (Improve type mismatch w/ function signatures)
 - #99895 (don't call type ascription "cast")
 - #99900 (remove some manual hash stable impls)
 - #99903 (Add diagnostic when using public instead of pub)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-30 17:30:50 +00:00
est31
eca274a1f9 Also gate AllocatedPointer and AllocAlign definitions by LLVM_VERSION_GE
Fixes a warning:

warning: llvm-wrapper/RustWrapper.cpp:159:11: warning: enumeration values 'AllocatedPointer' and 'AllocAlign' not handled in switch [-Wswitch]
warning:   switch (Kind) {
warning:           ^

Which was fall out from 130a1df71e.
2022-07-30 18:53:51 +02:00
Michael Howell
ad197e414c
Update src/librustdoc/passes/html_tags.rs
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2022-07-30 09:02:05 -07:00
Guillaume Gomez
c407ef0de0 Remove Clean trait implementation for hir::VariantData 2022-07-30 17:48:06 +02:00
Guillaume Gomez
21c812aa7a Remove Clean trait implementation for ty::VariantDef 2022-07-30 17:34:29 +02:00
Dylan DPC
df2cf97830
Rollup merge of #99903 - gimbles:pub, r=davidtwco
Add diagnostic when using public instead of pub

Forwarding from https://github.com/rust-lang/rust/pull/99706

I accidentally broke something(??) in git and the commits in that PR are absolutely not what I did in that branch

Anyways, this is the PR for this now. Adding tests again in a minute.

cc `@davidtwco`
2022-07-30 20:39:50 +05:30
Dylan DPC
79c947443f
Rollup merge of #99900 - lcnr:hash-stable-fun, r=cjgillot
remove some manual hash stable impls
2022-07-30 20:39:49 +05:30
Dylan DPC
cfd231a0cb
Rollup merge of #99895 - compiler-errors:type-ascription-aint-cast, r=davidtwco
don't call type ascription "cast"

Noticed in #99885
2022-07-30 20:39:48 +05:30
Dylan DPC
eb378d2015
Rollup merge of #99862 - WaffleLapkin:type_mismatch_fix, r=compiler-errors
Improve type mismatch w/ function signatures

This PR makes use of `note: expected/found` (instead of labeling types in labels) in type mismatch with function signatures. Pros: it's easier to compare the signatures, cons: the error is a little more verbose now.

This is especially nice when
- The signatures differ in a small subset of parameters (same parameters are elided)
- The difference is in details, for example `isize` vs `usize` (there is a better chance that the types align)

Also this PR fixes the inconsistency in variable names in the edited code (`expected` and `found`).

A zulip thread from which this pr started: [[link]](https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/Type.20error.20regression.3F.2E.2E.2E/near/289756602).

An example diagnostic:

<table>
<tr>
<th>this pr</th>
<th>nightly</th>
</tr>
<tr>
<td>

```text
error[E0631]: type mismatch in function arguments
  --> ./t.rs:4:12
   |
4  |     expect(&f);
   |     ------ ^^ expected due to this
   |     |
   |     required by a bound introduced by this call
...
10 | fn f(_: isize, _: u8, _: Vec<u32>) {}
   | ---------------------------------- found signature defined here
   |
   = note: expected function signature `fn(usize, _, Vec<u64>) -> _`
              found function signature `fn(isize, _, Vec<u32>) -> _`
note: required because of the requirements on the impl of `Trait` for `fn(isize, u8, Vec<u32>) {f}`
  --> ./t.rs:8:9
   |
8  | impl<F> Trait for F where F: Fn(usize, u8, Vec<u64>) -> u8 {}
   |         ^^^^^     ^
   = note: required for the cast from `fn(isize, u8, Vec<u32>) {f}` to the object type `dyn Trait`
```

</td>
<td>

```text
error[E0631]: type mismatch in function arguments
  --> ./t.rs:4:12
   |
4  |     expect(&f);
   |     ------ ^^ expected signature of `fn(usize, u8, Vec<u64>) -> _`
   |     |
   |     required by a bound introduced by this call
...
10 | fn f(_: isize, _: u8, _: Vec<u32>) {}
   | ---------------------------------- found signature of `fn(isize, u8, Vec<u32>) -> _`
   |
note: required because of the requirements on the impl of `Trait` for `fn(isize, u8, Vec<u32>) {f}`
  --> ./t.rs:8:9
   |
8  | impl<F> Trait for F where F: Fn(usize, u8, Vec<u64>) -> u8 {}
   |         ^^^^^     ^
   = note: required for the cast to the object type `dyn Trait`
```

</td>
</tr>
</table>

<details><summary>code</summary>
<p>

```rust
fn main() {
    fn expect(_: &dyn Trait) {}

    expect(&f);
}

trait Trait {}
impl<F> Trait for F where F: Fn(usize, u8, Vec<u64>) -> u8 {}

fn f(_: isize, _: u8, _: Vec<u32>) {}
```

</p>
</details>

r? `@compiler-errors`
2022-07-30 20:39:47 +05:30
Dylan DPC
c668820365
Rollup merge of #99311 - kckeiks:clean-up-body-owner-methods, r=cjgillot
change maybe_body_owned_by to take local def id

Issue https://github.com/rust-lang/rust/issues/96341
r? `@cjgillot`
2022-07-30 20:39:46 +05:30
bors
1202bbaf48 Auto merge of #99887 - nnethercote:rm-TreeAndSpacing, r=petrochenkov
Remove `TreeAndSpacing`.

A `TokenStream` contains a `Lrc<Vec<(TokenTree, Spacing)>>`. But this is
not quite right. `Spacing` makes sense for `TokenTree::Token`, but does
not make sense for `TokenTree::Delimited`, because a
`TokenTree::Delimited` cannot be joined with another `TokenTree`.

This commit fixes this problem, by adding `Spacing` to `TokenTree::Token`,
changing `TokenStream` to contain a `Lrc<Vec<TokenTree>>`, and removing the
`TreeAndSpacing` typedef.

The commit removes these two impls:
- `impl From<TokenTree> for TokenStream`
- `impl From<TokenTree> for TreeAndSpacing`

These were useful, but also resulted in code with many `.into()` calls
that was hard to read, particularly for anyone not highly familiar with
the relevant types. This commit makes some other changes to compensate:
- `TokenTree::token()` becomes `TokenTree::token_{alone,joint}()`.
- `TokenStream::token_{alone,joint}()` are added.
- `TokenStream::delimited` is added.

This results in things like this:
```rust
TokenTree::token(token::Semi, stmt.span).into()
```
changing to this:
```rust
TokenStream::token_alone(token::Semi, stmt.span)
```
This makes the type of the result, and its spacing, clearer.

These changes also simplifies `Cursor` and `CursorRef`, because they no longer
need to distinguish between `next` and `next_with_spacing`.

r? `@petrochenkov`
2022-07-30 14:50:05 +00:00
bors
c907b6f7e0 Auto merge of #99868 - yaahc:rustc-perf-bump, r=Mark-Simulacrum
bump rustc-perf commit

split off from https://github.com/rust-lang/rust/pull/99431

needed to access bugfix from https://github.com/rust-lang/rustc-perf/pull/1366
2022-07-30 12:21:14 +00:00
bors
110777b60c Auto merge of #99796 - compiler-errors:issue-53475, r=oli-obk
use `check_region_obligations_and_report_errors` to avoid ICEs

If we don't call `process_registered_region_obligations` before `resolve_regions_and_report_errors` then we'll ICE if we have any region obligations, and `check_region_obligations_and_report_errors` just does both of these for us in a nice convenient function.

Fixes #53475

r? types
2022-07-30 09:35:22 +00:00
bors
760d8a2cb1 Auto merge of #99768 - klensy:bump-deps-07-22, r=Mark-Simulacrum
update few deps

Updates few crates:

* openssl-src v111.18.0+1.1.1n -> v111.22.0+1.1.1q: fixes few CVE's (https://www.openssl.org/news/vulnerabilities-1.1.1.html: https://cve.org/CVERecord?id=CVE-2022-1292 https://cve.org/CVERecord?id=CVE-2022-2068 https://cve.org/CVERecord?id=CVE-2022-2097)

* openssl-probe v0.1.2 -> v0.1.5 updates ancient (2017) crate (https://github.com/alexcrichton/openssl-probe/compare/0.1.2...0.1.5). Adds support to search cert for additional platforms.

* indoc v1.0.3 -> v1.0.6 (https://github.com/dtolnay/indoc/compare/1.0.3...1.0.6) Nothing special changed, removes unindent v0.1.7

* bstr v0.2.13 -> v0.2.17 (https://github.com/BurntSushi/bstr/compare/0.2.13...0.2.17) Few speedups (8e65992131, 5fcef919ad) and bugfix (b2111b6bbf)

* crc32fast v1.2.0 -> v1.3.2 (https://github.com/srijs/rust-crc32fast/compare/v1.2.0...v1.3.2) Speedup debug (e61ce6a39b)

* diff v0.1.12 -> v0.1.13 (https://github.com/utkarshkukreti/diff.rs/compare/0.1.12...0.1.13) Few optimizations (https://github.com/utkarshkukreti/diff.rs/pull/16, 0f0aa580f1)

* ignore v0.4.17 -> v0.4.18 (it's hard to get usable diff, but most notable perf change is a28e664abd)

* globset v0.4.5 -> v0.4.9

* regex v1.5.5 -> v1.5.6 few bugfixes (https://github.com/rust-lang/regex/blob/1.5.6/CHANGELOG.md#156-2022-05-20). There exist 1.6.0 version, but it's too fresh.
2022-07-30 06:54:38 +00:00
Chris Denton
aac8a0a518
Reset directory iteration in remove_dir_all 2022-07-30 05:28:38 +01:00
bors
bd84c73ffe Auto merge of #99123 - mystor:crossbeam_bridge, r=eddyb
proc_macro: use crossbeam channels for the proc_macro cross-thread bridge

This is done by having the crossbeam dependency inserted into the `proc_macro` server code from the server side, to avoid adding a dependency to `proc_macro`.

In addition, this introduces a -Z command-line option which will switch rustc to run proc-macros using this cross-thread executor. With the changes to the bridge in #98186, #98187, #98188 and #98189, the performance of the executor should be much closer to same-thread execution.

In local testing, the crossbeam executor was substantially more performant than either of the two existing `CrossThread` strategies, so they have been removed to keep things simple.

r? `@eddyb`
2022-07-30 04:05:28 +00:00
bors
8f68c43ca6 Auto merge of #99925 - JohnTitor:rollup-4bt9ou3, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #99227 (Fix thumbv4t-none-eabi frame pointer setting)
 - #99518 (Let-else: break out scopes when a let-else pattern fails to match)
 - #99671 (Suggest dereferencing index when trying to use a reference of usize as index)
 - #99831 (Add Fuchsia platform support documentation)
 - #99881 (fix ICE when computing codegen_fn_attrs on closure with non-fn parent)
 - #99888 (Streamline lint checking)
 - #99891 (Adjust an expr span to account for macros)
 - #99904 (Cleanup html whitespace)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-30 00:26:22 +00:00
Joshua Nelson
2c70b6abf4 Don't give a hard error for x check --keep-stage 0
Stage 1 check has been supported since https://github.com/rust-lang/rust/pull/81064.
 #81064 changed the error message for this, but I don't think there's any reason we should prevent using it.
I tested locally and `keep-stage` works fine. Don't give a hard error when trying to use it.
2022-07-29 19:01:19 -05:00
Yuki Okushi
cfbf7be7d0
Rollup merge of #99904 - GuillaumeGomez:cleanup-html-whitespace, r=notriddle
Cleanup html whitespace

I realized while looking at the raw HTML that we generated some unwanted white space characters. This PR cleans up the one coming directly from rustdoc. I'll check from `pulldown-cmark` for the remaining ones.

Some numbers now: the difference is small, it goes from `63009` to `62859`. But multiplied by the number of files, it becomes quite interesting overall.

r? `@notriddle`
2022-07-30 07:39:56 +09:00
Yuki Okushi
735969eacd
Rollup merge of #99891 - compiler-errors:suggest-slicing-carefully, r=oli-obk
Adjust an expr span to account for macros

Fix this erroneous suggestion:

```
error[E0529]: expected an array or slice, found `Vec<{integer}>`
 --> /home/gh-compiler-errors/test.rs:2:9
  |
2 |     let [..] = vec![1, 2, 3];
  |         ^^^^ pattern cannot match with input type `Vec<{integer}>`
  |
help: consider slicing here
 --> /home/gh-compiler-errors/rust2/library/alloc/src/macros.rs:50:36
  |
50~         $crate::__rust_force_expr!(<[_]>::into_vec(
51+             #[rustc_box]
52+             $crate::boxed::Box::new([$($x),+])
53~         )[..])
```
2022-07-30 07:39:55 +09:00
Yuki Okushi
5c3b6d6882
Rollup merge of #99888 - nnethercote:streamline-visitors, r=cjgillot
Streamline lint checking

The early (AST) and late (HIR) lint checkers have a number of functions that aren't used by rustc or clippy. Might as well remove them -- it's not like there's a canonical API here, as shown by the ad hoc use of `check_foo`/`check_foo_post` combinations.

r? `@cjgillot`
2022-07-30 07:39:54 +09:00
Yuki Okushi
c1a5c11c57
Rollup merge of #99881 - compiler-errors:issue-99876, r=tmiasko
fix ICE when computing codegen_fn_attrs on closure with non-fn parent

Other call sites check `has_codegen_attrs` first, so let's do that too.

Fixes #99876
2022-07-30 07:39:53 +09:00
Yuki Okushi
59320d5413
Rollup merge of #99831 - djkoloski:add_fuchsia_target_documentation, r=tmandry
Add Fuchsia platform support documentation

This documentation contains instructions for building and running binaries on Fuchsia using its provided SDK.
2022-07-30 07:39:52 +09:00