Commit Graph

196361 Commits

Author SHA1 Message Date
Mads Marquart
15b7a08747 Fix unwinding when debug assertions are enabled
This came up on armv7-apple-ios when using -Zbuild-std
2022-07-30 05:14:54 +02:00
Linus Färnstrand
73bb371ad3 Remove socklen_t from platforms where it's no longer used 2022-07-30 02:42:02 +02: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
Yuki Okushi
4a44efae14
Rollup merge of #99671 - TaKO8Ki:suggest-dereferencing-index, r=compiler-errors
Suggest dereferencing index when trying to use a reference of usize as index

fixes #96678
2022-07-30 07:39:50 +09:00
Yuki Okushi
955091be8f
Rollup merge of #99518 - dingxiangfei2009:let-else-additional-tests, r=oli-obk
Let-else: break out scopes when a let-else pattern fails to match

This PR will commit to a new behavior so that values from initializer expressions are dropped earlier when a let-else pattern fails to match.

Fix #98672.
Close #93951.
cc `@camsteffen` `@est31`
2022-07-30 07:39:49 +09:00
Yuki Okushi
36ab4ec2dc
Rollup merge of #99227 - Lokathor:fix-thumbv4t-none-eabi-frame-pointer, r=davidtwco
Fix thumbv4t-none-eabi frame pointer setting

The `thumb_base` profile has changed since I last remember seeing it, and now it sets the frame pointer to "always keep", which is not desired for this target. Hooking a debugger to the running program is not really done, it's preferable to have the register available for actual program use, so the default "may omit" is now set.

I thought that the target was already using "may omit" when I checked on it last month, because I forgot that the target was previously based on `thumb_base` rather than `Default::default()`. I only noticed the issue just now when creating the `armv4t-none-eabi` target (https://github.com/rust-lang/rust/pull/99226), though this PR is not in any way conditional on that one.
2022-07-30 07:39:48 +09:00
Miguel Guarniz
94611b81c7 Avoid ICE when fetching LocalDefId
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-29 18:26:10 -04:00
Miguel Guarniz
0c609a4c1f Change enclosing_body_owner to return LocalDefId
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-29 18:26:10 -04:00
Miguel Guarniz
16513d689e Rename local_did to def_id
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-29 18:26:10 -04:00
Miguel Guarniz
25bdc8965e Change maybe_body_owned_by to take local def id
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-29 18:25:58 -04:00
bors
211637d080 Auto merge of #99730 - lcnr:bound-vars-anon, r=jackh726
anonymize all bound vars, not just regions

fixes #98702

r? types
2022-07-29 21:38:36 +00:00
Nika Layzell
6d1650fe45 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.
2022-07-29 17:38:12 -04:00
Camille GILLOT
2134dd3b48 Remove useless closure. 2022-07-29 22:11:23 +02:00
Martin Nordholts
6f194d70d2 triagebot.yml: CC Enselic when rustdoc-json-types changes 2022-07-29 22:04:06 +02:00
bors
3924dac7bb Auto merge of #99577 - est31:remove_box_librustdoc, r=jsha
Remove remaining uses of box syntax from librustdoc

Remove the remaining uses of box syntax from librustdoc. Followup of #99066 where these changes were split out because they were responsible for a small but noticeable regression. This PR avoids the regression by boxing some large variants of `ItemKind` to reduce the enum's size by half from 224 bytes to 112 bytes (on x86-64). This should also help with reducing memory usage.
2022-07-29 18:44:53 +00:00
est31
fabb4b0661 Statically ensure the size of ItemKind 2022-07-29 19:30:25 +02:00
est31
1116fc164f Box FunctionItem, TyMethodItem, MethodItem, ForeignFunctionItem
This reduces ItemKind size from 160 bytes to 112 bytes
2022-07-29 19:30:25 +02:00
est31
96c051fd07 Box TypedefItem, ImplItem, AssocTypeItem variants of ItemKind
This reduces ItemKind size from 224 bytes to 160 bytes.
2022-07-29 19:30:25 +02:00
est31
0bf65c7c92 Remove box_syntax feature gate from librustdoc 2022-07-29 19:30:25 +02:00
est31
79246e8e9a Remove box syntax from doctest.rs 2022-07-29 19:30:25 +02:00
est31
e62f6a0e87 Remove box syntax from Box<rustdoc::clean::types::ItemKind> construction
The type has 240 bytes according to compiler internal rustdoc.
2022-07-29 19:30:23 +02:00
Camille GILLOT
a09b7ebfd3 Use DefKind instead of FnKind for recursion lint. 2022-07-29 18:10:43 +02:00
bors
5dda74a48c Auto merge of #99467 - BelovDV:add_option_link_arg, r=petrochenkov
flag '-l link-arg=___ was added

#99427
2022-07-29 15:36:52 +00:00
Gimgim
d0e881eefe Add diagnostic when using public instead of pub 2022-07-29 19:21:30 +05:30
bors
9fa62f2d85 Auto merge of #99715 - tmiasko:coverage-run-make, r=Mark-Simulacrum
Move coverage tests from run-make-fulldeps to run-make
2022-07-29 12:45:47 +00:00
Guillaume Gomez
6149cf982c Remove unwanted extra white space characters from HTML 2022-07-29 14:38:15 +02:00
lcnr
d3ad264a91 remove some manual hash stable impls 2022-07-29 12:48:28 +02:00
bors
2f847b81a0 Auto merge of #99892 - JohnTitor:rollup-qi4fem8, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #99686 (add suggestion when there is a impl of external trait on pointer with wrong coherence rules)
 - #99760 (doc/rustc: describe the uefi target platforms)
 - #99766 (Htmldocck: Substitute the doc channel when blessing)
 - #99781 (Use String::from_utf8_lossy in CStr demo)
 - #99803 (Update mentions to `rustc_metadata::rmeta::Lazy`)
 - #99845 (Remove `$` prefix for bash scripts in doc)
 - #99850 (rustdoc: Remove more Clean trait implementations)
 - #99872 (Clone the `src/llvm-project` submodule if profiling is enabled)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-29 09:57:44 +00:00
bors
7dfdd64433 Auto merge of #99667 - ouz-a:some_branch, r=oli-obk
Optimize `UnDerefer`

Addresses the performance [issues](https://github.com/rust-lang/rust/pull/98145#issuecomment-1183548597) faced here.

r? `@oli-obk`
2022-07-29 07:11:50 +00:00
Michael Goulet
7cdd937bb8 dont call type ascription 'cast' 2022-07-29 07:02:52 +00:00
lcnr
1436fa9e90 optimize bound vars replacement :3 2022-07-29 08:45:06 +02:00
Yuki Okushi
a8f77ade97
Rollup merge of #99872 - Nilstrieb:bootstrap-llvm, r=jyn514
Clone the `src/llvm-project` submodule if profiling is enabled

To compile rustc with profiling information, `compiler-rt` from LLVM is required. Building it requires the `src/llvm-project` submodule to be initialized and updated.

Fixes #99869
2022-07-29 15:40:04 +09:00
Yuki Okushi
51dda5067c
Rollup merge of #99850 - GuillaumeGomez:clean-more-items, r=notriddle
rustdoc: Remove more Clean trait implementations

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

r? `@notriddle`
2022-07-29 15:40:03 +09:00
Yuki Okushi
da3f951bb0
Rollup merge of #99845 - xtexChooser:patch-1, r=GuillaumeGomez
Remove `$` prefix for bash scripts in doc
2022-07-29 15:40:02 +09:00
Yuki Okushi
fd3610ed2e
Rollup merge of #99803 - JohnTitor:update-lazy-docs, r=compiler-errors
Update mentions to `rustc_metadata::rmeta::Lazy`

While working on https://github.com/rust-lang/rustc-dev-guide/pull/1411, I noticed there are still some mentions of `Lazy`. This updates them to `LazyValue`, `LazyArray`, or `LazyTable`.

r? ````@compiler-errors````

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-07-29 15:40:01 +09:00
Yuki Okushi
9b3f49f1bd
Rollup merge of #99781 - workingjubilee:demo-string-from-cstr, r=thomcc
Use String::from_utf8_lossy in CStr demo

Fixes rust-lang/rust#99755.
2022-07-29 15:40:00 +09:00
Yuki Okushi
55296c47f4
Rollup merge of #99766 - fmease:htmldocck-subst-channel-when-blessing, r=Mark-Simulacrum
Htmldocck: Substitute the doc channel when blessing

Since #84942, the snippet `{{channel}}` gets substituted with the concrete “doc channel” (e.g. `https://doc.rust-lang.org/nightly`) when snapshot files are checked against the actual rustdoc output.

However, when you `--bless` rustdoc tests, htmldocck just dumps the concrete channel into the snapshot file and
you have to manually do a find-and-replace after blessing to uphold what #84942 set out to fix.

I admit it's a bit fragile to blindly replace URLs like this but I guess it's not too bad in practice.
Feel free to close this PR if you don't think that this is a good idea.

`@rustbot` label T-rustdoc A-testsuite
2022-07-29 15:39:59 +09:00
Yuki Okushi
b7beec9677
Rollup merge of #99760 - dvdhrm:rw/uefiplat, r=ehuss
doc/rustc: describe the uefi target platforms

Add a `platform-support` entry to the rustc-docs for the different `*-unknown-uefi` targets. This describes in detail how this platform works, a few basic examples, and how to compile for the platform.

Red Hat is sponsoring my work on this platform, so I am putting myself down as target maintainer. Co-maintainers are more than welcome to join me in the effort. Communication is going on off-list to coordinate the different efforts.

Note that the ultimate goal is to move the UEFI targets to Tier-2 so bootloaders can be more easily supported in commercial products. This documentation is the first step towards that goal, but should be a viable documentation even for the current Tier-3 status of the targets.

I also want to point out that there is an ongoing GSoC-effort to port the rust standard library to UEFI (by Ayush Singh). While this work is not necessarily required to get to Tier-2, we definitely should coordinate the efforts and update the documentation as soon as any such ports are merged.

Note that the targets are already used by multiple commercial and non commercial production systems, including, but not limited to:

 * Tianocore-EDK2 (Official UEFI SDK by Intel) comes with rust support
   in its staging repository (not part of any release, yet).
   (https://github.com/tianocore/edk2-staging/tree)
 * Intel's research program "Project Mu" uses the rust UEFI targets to
   show possible future replacements for Tianocore-EDK2.
 * The Rust OS "Redox" uses the UEFI targets for its bootloader.
   (https://www.redox-os.org/)
 * The hugely popular in-depth documentation of OS development in Rust
   by Philipp Oppermann uses the UEFI targets.
   (https://os.phil-opp.com/)
2022-07-29 15:39:58 +09:00
Yuki Okushi
a573adf3cb
Rollup merge of #99686 - vincenzopalazzo:macros/impl_on_ptr, r=compiler-errors
add suggestion when there is a impl of external trait on pointer with wrong coherence rules

Closes https://github.com/rust-lang/rust/issues/99572

This will try to improve the node in the error message by suggesting a general solution because the solution, in this case, is application depended.

I'm not super happy regarding the code quality, but I'm happy to have feedback on it.

`@rustbot` r? `@compiler-errors`
2022-07-29 15:39:57 +09:00
Michael Goulet
16f49800db Document check_region_obligations_and_report_errors, simplify a call to resolve_regions 2022-07-29 06:17:17 +00:00
Michael Goulet
dec29b1582 Adjust an expr span to account for macros 2022-07-29 06:02:11 +00:00
Nicholas Nethercote
332dffb1f9 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`.
2022-07-29 15:52:15 +10:00
Michael Goulet
77f7a833dd Do not allow bad projection term to leak into the type checker 2022-07-29 05:48:40 +00:00
Michael Goulet
940ec1e517 Remove parent_pat from TopInfo 2022-07-29 05:44:05 +00:00