Commit Graph

196282 Commits

Author SHA1 Message Date
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
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
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
Nicholas Nethercote
74e9a29f6e Remove some late check_* functions.
They're not used by rustc or clippy.
2022-07-29 15:30:12 +10:00
Nicholas Nethercote
6dced80b86 Remove visit_name from the AST visitor.
Because the default is empty and it's never overridden. This means
`walk_ident` can also be removed, because it does nothing.
2022-07-29 15:28:32 +10:00
Nicholas Nethercote
ab44b5a408 Remove some early check_* functions.
They're not used by rustc or clippy.
2022-07-29 15:27:16 +10:00
Takayuki Maeda
3ae669d758 check if T is slice
fix msg
2022-07-29 14:17:26 +09:00
Takayuki Maeda
06f89b7924 implement point_at_index_if_possible 2022-07-29 14:12:17 +09:00
bors
ea6ab1bd84 Auto merge of #99660 - PrestonFrom:issue_99265, r=compiler-errors
Generate correct suggestion with named arguments used positionally

Address issue #99265 by checking each positionally used argument
to see if the argument is named and adding a lint to use the name
instead. This way, when named arguments are used positionally in a
different order than their argument order, the suggested lint is
correct.

For example:
```
println!("{b} {}", a=1, b=2);
```
This will now generate the suggestion:
```
println!("{b} {a}", a=1, b=2);
```

Additionally, this check now also correctly replaces or inserts
only where the positional argument is (or would be if implicit).
Also, width and precision are replaced with their argument names
when they exists.

Since the issues were so closely related, this fix for issue #99265
also fixes issue #99266.

Fixes #99265
Fixes #99266
2022-07-29 04:23:08 +00:00
bors
9de7474830 Auto merge of #99512 - nikic:llvm-15-fixes, r=cuviper
LLVM 15 compatibility fixes

These are LLVM 15 compatibility fixes split out from #99464. There are three changes here:

 * Emit elementtype attribtue for ldrex/strex intrinsics. This is requires as part of the opaque pointers migration.
 * Make more tests compatible with opaque pointers. These are either new or aren't run on x86.
 * Remove a test for `#[rustc_allocator]`. Since #99574 there are more requirement on the function signature. I dropped the test entirely, since we already test the effect of the attribute elsewhere.
 * The main change: When a worker thread emits an error, wait for other threads to finish before unwinding the main thread and exiting. Otherwise workers may end up using globals for which destructors have already been run. This was probably never quite correct, but became an active problem with LLVM 15, because it started using global dtors in critical places, as part of ManagedStatic removal.

Fixes #99432 (and probably also #95679).

r? `@cuviper`
2022-07-29 01:35:15 +00:00
Michael Goulet
b67ba9ba20 fix ICE when computing codegen_fn_attrs on closure with non-fn parent 2022-07-29 00:41:51 +00:00
bors
c8893cc5e5 Auto merge of #99865 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`
2022-07-28 22:02:12 +00:00
David Koloski
0fcb86b129 Add Fuchsia platform support documentation 2022-07-28 16:37:35 -04:00
Michael Howell
f5cd6b3e9b rustdoc: align invalid-html-tags lint with commonmark spec 2022-07-28 13:12:32 -07:00