Commit Graph

148623 Commits

Author SHA1 Message Date
mbartlett21
18b0e7bf2c
Fix must_use on Option::is_none
This fixes the `#[must_use = ...]` on `Option::is_none` to have a working suggestion.
2021-05-18 13:40:26 +10:00
Joshua Nelson
587c50452f Fix rebase conflicts 2021-05-17 23:33:04 -04:00
Joshua Nelson
28c9c04325 Don't require cmake on Windows when LLVM isn't being built
Previously, setting `download-ci-llvm = true` when cmake wasn't
installed would give the following error:

```
failed to execute command: "cmake" "--help"
error: The system cannot find the file specified. (os error 2)
```
2021-05-17 22:08:20 -04:00
Joshua Nelson
18f6922d8c Address review comments
- Simplify boolean expression
- Give an example of invalid syntax
- Remove explanation of why code block is text
2021-05-17 21:31:05 -04:00
Joshua Nelson
b885d81a4a Rename INVALID_RUST_CODEBLOCK{,S} 2021-05-17 21:31:04 -04:00
Joshua Nelson
4120f7561c Add back missing help for ignore blocks
This also gives a better error message when a span is missing.
2021-05-17 21:31:03 -04:00
Alexis Bourget
b574c67b93 New rustdoc lint to respect -Dwarnings correctly
This adds a new lint to `rustc` that is used in rustdoc when a code
block is empty or cannot be parsed as valid Rust code.

Previously this was unconditionally a warning. As such some
documentation comments were (unknowingly) abusing this to pass despite
the `-Dwarnings` used when compiling `rustc`, this should not be the
case anymore.
2021-05-17 21:31:01 -04:00
bors
5f10d310f4 Auto merge of #85402 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/85397
2021-05-18 00:32:19 +00:00
Luqman Aden
a862b1f6cc Adjust linker_is_gnu branches for cases that don't work on windows. 2021-05-17 16:14:13 -07:00
Ralf Jung
a05dd06cc0 update Miri 2021-05-18 00:48:05 +02:00
Fabian Wolff
572bb13ae5 Implement jackh726's suggestions 2021-05-17 23:13:04 +02:00
bors
3e99439f4d Auto merge of #85414 - RalfJung:rollup-ueqcik4, r=RalfJung
Rollup of 8 pull requests

Successful merges:

 - #85087 (`eval_fn_call`: check the ABI of `body.source`)
 - #85302 (Expand WASI abbreviation in docs)
 - #85355 (More tests for issue-85255)
 - #85367 (Fix invalid input:disabled CSS selector)
 - #85374 (mark internal inplace_iteration traits as hidden)
 - #85408 (remove size field from Allocation)
 - #85409 (Simplify `cfg(any(unix, target_os="redox"))` in example to just `cfg(unix)`)
 - #85412 (remove some functions that were only used by Miri)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-05-17 19:15:21 +00:00
LeSeulArtichaut
62044b2fab Remove remnants of BorrowOfPackedField 2021-05-17 19:32:58 +02:00
Augie Fackler
3035816fc1 runtest: correctly guard against LLVM version 13 2021-05-17 13:08:42 -04:00
Ralf Jung
a28be5cbe8
Rollup merge of #85412 - RalfJung:c_str, r=oli-obk
remove some functions that were only used by Miri

and Miri does not need them any more with https://github.com/rust-lang/miri/pull/1805.

r? ``@oli-obk``
2021-05-17 18:52:17 +02:00
Ralf Jung
360db9c384
Rollup merge of #85409 - CDirkx:cfg_redox, r=nagisa
Simplify `cfg(any(unix, target_os="redox"))` in example to just `cfg(unix)`

Update example for `OsString` that handled `redox` seperately from `unix`: Redox has been completely integrated under `target_family="unix"`, so `cfg(unix)` implies `target_os="redox"`

35dbef2350/compiler/rustc_target/src/spec/redox_base.rs (L26)
2021-05-17 18:52:13 +02:00
Ralf Jung
af1ac55cbf
Rollup merge of #85408 - RalfJung:alloc-size, r=oli-obk
remove size field from Allocation

This is a part of https://github.com/rust-lang/rust/pull/85376 that can be easily split out.
r? ``@oli-obk``
2021-05-17 18:52:11 +02:00
Ralf Jung
fbb0d70c2c
Rollup merge of #85374 - the8472:hide-internal-traits, r=SimonSapin
mark internal inplace_iteration traits as hidden

resolves #85373

r? ``@SimonSapin``
2021-05-17 18:52:10 +02:00
Ralf Jung
266e7afe13
Rollup merge of #85367 - GuillaumeGomez:fix-css-rule, r=jsha
Fix invalid input:disabled CSS selector

For some reason, we used "search-focus" instead of "search-input"...

r? ``@jsha``
2021-05-17 18:52:09 +02:00
Ralf Jung
8f9d1107b5
Rollup merge of #85355 - hi-rustin:rustin-patch-issue-85255, r=varkor
More tests for issue-85255

Add more test for `pub(crate)`.

r? ``@varkor``
2021-05-17 18:52:08 +02:00
Ralf Jung
8a1403af1e
Rollup merge of #85302 - r00ster91:patch-7, r=joshtriplett
Expand WASI abbreviation in docs

I was pretty sure this was related to something for WebAssembly but wasn't 100% sure so I checked but even on these top-level docs I couldn't find the abbreviation expanded. I'm normally used to Rust docs being detailed and explanatory and writing abbreviations like this out in full at least once so I thought it was worth the change. Feel free to close this if it's too much.
2021-05-17 18:52:04 +02:00
Ralf Jung
b93753ee21
Rollup merge of #85087 - hyd-dev:lots-of-abis, r=RalfJung
`eval_fn_call`: check the ABI of `body.source`

And stop checking `instance_ty.fn_sig(*self.tcx).abi()`, if the function is not an intrinsic.
Addresses https://github.com/rust-lang/miri/pull/1776#discussion_r615381169.
No idea how to test this without Miri...
2021-05-17 18:51:59 +02:00
bors
fa72878a61 Auto merge of #85352 - Xanewok:update-rls, r=Xanewok
Update RLS

Contains https://github.com/rust-lang/rls/pull/1736. With #82208 merged, this should now close https://github.com/rust-lang/rust/issues/85225. Tested locally with `./x.py test src/tools/rls` and seems to be working as expected.

I noticed the rustfmt merge didn't trigger toolstate upgrade (because we pruned most but not all of the related machinery?), so I'd rather get this rubber-stamped by someone more knowledgeable with infra/the merged changes in case I missed something and need to include something else here to unbreak the RLS toolstate.

r? `@Mark-Simulacrum`
2021-05-17 16:34:11 +00:00
Jack Huey
83459081ba Remove legacy for trait object mangling test and replace crate hash 2021-05-17 09:24:19 -04:00
hyd-dev
97bc0eefe7
Add a comment for check_abi() 2021-05-17 20:54:31 +08:00
Ralf Jung
cb5533cff2 remove some functions that were only used by Miri 2021-05-17 14:43:16 +02:00
bors
9964284fed Auto merge of #84571 - jedel1043:issue-49804-impl, r=petrochenkov
Parse unnamed fields of struct and union type

Added the `unnamed_fields` feature gate.

This is a prototype of [RFC 2102](https://github.com/rust-lang/rust/issues/49804), so any suggestions are greatly appreciated.

r? `@petrochenkov`
2021-05-17 12:15:26 +00:00
Fabian Wolff
7b301985fa Two minor changes for readability and efficiency 2021-05-17 13:58:14 +02:00
Christiaan Dirkx
383642714a Simplify cfg(any(unix, target_os="redox")) to just cfg(unix) 2021-05-17 13:49:14 +02:00
Ralf Jung
5d71c67423 mir-opt bless for Size field being removed from Allocation 2021-05-17 13:30:25 +02:00
Ralf Jung
7962b5ae45 remove size field from Allocation 2021-05-17 13:30:16 +02:00
Pietro Albini
6bcfdd9913
backport 1.52.1 release notes 2021-05-17 12:03:49 +02:00
bors
44ec846f4e Auto merge of #85353 - jonas-schievink:async-blocks-in-ctfe, r=oli-obk
Allow `async {}` expressions in const contexts

Gated behind a new `const_async_blocks` feature.
2021-05-17 04:53:30 +00:00
Jacob Hoffman-Andrews
253cbabc39 rustdoc: restore header sizes 2021-05-16 20:48:55 -07:00
jedel1043
64acb7d921 Allow formatting Anonymous{Struct, Union} declarations 2021-05-16 22:13:38 -05:00
Aaron Hill
500503b16c
Suppress spurious errors inside async fn
Fixes #73741
2021-05-16 22:26:57 -04:00
bors
3396a383bb Auto merge of #85178 - cjgillot:local-crate, r=oli-obk
Remove CrateNum parameter for queries that only work on local crate

The pervasive `CrateNum` parameter is a remnant of the multi-crate rustc idea.

Using `()` as query key in those cases avoids having to worry about the validity of the query key.
2021-05-17 01:42:03 +00:00
bors
a55748ffe9 Auto merge of #84993 - eddyb:cg-ssa-on-demand-blocks, r=nagisa
rustc_codegen_ssa: only create backend `BasicBlock`s as-needed.

Instead of creating one backend (e.g. LLVM) block per MIR block ahead of time, and then deleting the ones that weren't visited, this PR moves to creating the blocks as they're needed (either reached via the RPO visit, or used as the target of a branch from a different block).

As deleting a block was the only `unsafe` builder method (generally we only *create* backend objects, not *remove* them), that's gone now and codegen is overall a bit safer.

The only change in output is the order of LLVM blocks (which AFAIK has no semantic meaning, other than the first block being the entry block). This happens because the blocks are now created due to control-flow edges, rather than MIR block order.

I'm making this a standalone PR because I keep getting wild perf results when I change *anything* in codegen, but if you want to read more about my plans in this area, see https://github.com/rust-lang/rust/pull/84771#issuecomment-830636256 (and https://github.com/rust-lang/rust/pull/84771#issue-628295651 - but that may be a bit outdated).

(You may notice some of the APIs in this PR, like `append_block`, don't help with the future plans - but I didn't want to include the necessary refactors that pass a build around everywhere, in this PR, so it's a small compromise)

r? `@nagisa` `@bjorn3`
2021-05-16 23:00:53 +00:00
Eduard-Mihai Burtescu
0fcaf11455 rustc_codegen_ssa: append blocks to functions w/o creating a builder. 2021-05-17 00:04:09 +03:00
Eduard-Mihai Burtescu
402e9efc56 rustc_codegen_ssa: only create backend BasicBlocks as-needed. 2021-05-17 00:04:09 +03:00
bors
fe72845f7b Auto merge of #85312 - ehuss:macro_use-unused-attr, r=petrochenkov
Fix unused attributes on macro_rules.

The `unused_attributes` lint wasn't firing on attributes of `macro_rules` definitions. The consequence is that many attributes are silently ignored on `macro_rules`. The reason is that `unused_attributes` is a late-lint pass, and only has access to the HIR, which does not have macro_rules definitions.

My solution here is to change `non_exported_macro_attrs` to be `macro_attrs` (a list of all attributes used for `macro_rules`, instead of just those for `macro_export`), and then to check this list in the `unused_attributes` lint. There are a number of alternate approaches, but this seemed the most reliable and least invasive. I am open to completely different approaches, though.

One concern is that I don't fully understand the implications of extending `non_exported_macro_attrs` to include non-exported macros. That list was originally added in #62042 to handle stability attributes, so I suspect it was just an optimization since that was all that was needed. It was later extended to be included in SVH in #83901. #80641 also added a use to check for `invalid` attributes, which seems a little odd to me (it didn't validate non-exported macros, and seems highly specific).

Overall, there doesn't seem to be a clear story of when `unused_attributes` should be used versus an error like E0518. I considered alternatively using an "allow list" of built-in attributes that can be used on macro_rules (allow, warn, deny, forbid, cfg, cfg_attr, macro_export, deprecated, doc), but I feel like that could be a pain to maintain.

Some built-in attributes already present hard-errors when used with macro_rules. These are each hard-coded in various places:
- `derive`
- `test` and `bench`
- `proc_macro` and `proc_macro_derive`
- `inline`
- `global_allocator`

The primary motivation is that I sometimes see people use `#[macro_use]` in front of `macro_rules`, which indicates there is some confusion out there (evident that there was even a case of it in rustc).
2021-05-16 20:19:45 +00:00
Jonas Schievink
014e8d46f8 Add tracking issue 2021-05-16 21:57:40 +02:00
Jacob Hoffman-Andrews
6696a60f0f Add test for trait toggle location 2021-05-16 12:50:15 -07:00
bors
7dc9ff5c62 Auto merge of #85290 - Amanieu:asm_const_int, r=nagisa
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.

cc `@rust-lang/wg-inline-asm`

r? `@nagisa`
2021-05-16 17:52:52 +00:00
The8472
39e492a2be mark internal inplace_iteration traits as hidden 2021-05-16 19:36:21 +02:00
Fabian Wolff
4efa4a5273 Implement changes suggested by varkor 2021-05-16 18:22:34 +02:00
bors
f8e1e92380 Auto merge of #84549 - tmiasko:static-initializer, r=varkor
Reachable statics have reachable initializers

Static initializer can read other statics. Initializers are evaluated at
compile time, and so their content could become inlined into another
crate. Ensure that initializers of reachable statics are also reachable.

Previously, when an item incorrectly considered to be unreachable was
reached from another crate an attempt would be made to codegen it. The
attempt could fail with an ICE (in the case MIR wasn't available to do
so) in some circumstances the attempt could also succeed resulting in
a local codegen of non-local items, including static ones.

Fixes #84455.
2021-05-16 15:11:48 +00:00
jedel1043
8a1dd6918b Add test for restriction of anonymous types on validation 2021-05-16 09:53:17 -05:00
jedel1043
d4ad050ce5 Check and deny anonymous fields on ast_validation 2021-05-16 09:51:00 -05:00
jedel1043
059b68dd67 Implement Anonymous{Struct, Union} in the AST
Add unnamed_fields feature gate and gate unnamed fields on parsing
2021-05-16 09:49:16 -05:00