Commit Graph

167414 Commits

Author SHA1 Message Date
Dylan DPC
cd5dc49379
Rollup merge of #96492 - joshtriplett:revert-std-ffi-re-export, r=yaahc
Revert "Re-export core::ffi types from std::ffi"

This reverts commit 9aed829fe6.

Fixes https://github.com/rust-lang/rust/issues/96435 , a regression
in crates doing `use std::ffi::*;` and `use std::os::raw::*;`.

We can re-add this re-export once the `core::ffi` types
are stable, and thus the `std::os::raw` types can become re-exports as
well, which will avoid the conflict. (Type aliases to the same type
still conflict, but re-exports of the same type don't.)
2022-04-29 11:23:14 +02:00
Dylan DPC
db1ec25224
Rollup merge of #96481 - aDotInTheVoid:hashmap-docs-monospace, r=joshtriplett
HashMap doc: Don't use monospace font for 'Entry Api'
2022-04-29 11:23:13 +02:00
Dylan DPC
31693cbef7
Rollup merge of #96477 - alexcrichton:update-wasm64-data-layout, r=wesleywiser
Update data layout string for wasm64-unknown-unknown

Looks like this changed in a recent LLVM update but wasm64 isn't built
on CI so it wasn't caught until now.

Closes #96463
2022-04-29 11:23:12 +02:00
Nicholas Nethercote
ae5f67f9e8 Remove the T::VISIT_TOKENS test in visit_mac_args.
The two paths are equivalent -- they both end up calling `visit_expr()`.
I have kept the more restrictive path, the one that requires that
`token` be an expression nonterminal. (The next commit will simplify this
function further.)
2022-04-29 17:47:52 +10:00
bors
5560c51738 Auto merge of #96444 - nbdd0121:used2, r=petrochenkov
Use decorated names for linked_symbols on Windows

Fix #96423

r? `@petrochenkov`
2022-04-29 05:34:29 +00:00
Nicholas Nethercote
cde25f8dbe Simplify lower_mac_args.
The `token` is always an interpolated non-terminal expression, and
always a literal in valid code. This commit simplifies the processing
accordingly, by directly extracting and using the literal.
2022-04-29 15:14:31 +10:00
Nicholas Nethercote
481a4461ae Rename visit_interpolated as visit_nonterminal.
Because `Nonterminal` is the type it visits.
2022-04-29 15:00:32 +10:00
Nicholas Nethercote
5a05b614bf Tweak print_attr_item.
This commit rearranges the `match`. The new code avoids testing for
`MacArgs::Eq` twice, at the cost of repeating the `self.print_path()`
call. I think this is worthwhile because it puts the `match` in a more
standard and readable form.
2022-04-29 15:00:32 +10:00
bors
ddb7fbe843 Auto merge of #96441 - ChrisDenton:sync-pipes, r=m-ou-se
Windows: Make stdin pipes synchronous

Stdin pipes do not need to be used asynchronously within the standard library. This is a first step in making pipes mostly synchronous.

r? `@m-ou-se`
2022-04-29 03:06:45 +00:00
David Wood
dca88612b9 macros: add interop between diagnostic derives
Add `#[subdiagnostic]` field attribute to the diagnostic derive which
is applied to fields that have types which use the subdiagnostic derive.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-29 02:12:10 +01:00
David Wood
e5d9371b30 macros: allow setting applicability in attribute
In the initial implementation of the `SessionSubdiagnostic`, the
`Applicability` of a suggestion can be set both as a field and as part
of the attribute, this commit adds the same support to the original
`SessionDiagnostic` derive.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-29 02:12:10 +01:00
David Wood
e8ee0d7a20 macros: add more documentation comments
Documentation comments are always good.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-29 02:12:10 +01:00
David Wood
2647a4812c macros: reuse SetOnce trait in diagnostic derive
`SetOnce` trait was introduced in the subdiagnostic derive to simplify
the code a little bit, re-use it in the diagnostic derive too.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-29 02:12:10 +01:00
David Wood
36a396ce51 macros: add helper functions for invalid attrs
Remove some duplicated code between both diagnostic derives by
introducing helper functions for reporting an error in case of a invalid
attribute.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-29 02:12:10 +01:00
David Wood
071f07274b macros: split diagnostic derives into modules
Split `SessionDiagnostic` and `SessionSubdiagnostic` derives and the
various helper functions into multiple modules.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-29 02:12:08 +01:00
David Wood
49ec909ca7 macros: subdiagnostic derive
Add a new derive, `#[derive(SessionSubdiagnostic)]`, which enables
deriving structs for labels, notes, helps and suggestions.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-29 02:05:20 +01:00
David Wood
aa2abc9d12 tests: move diagnostic derive test to directory
Move existing test for session diagnostic derive to a subdirectory.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-29 02:05:20 +01:00
David Wood
73fa217bc1 errors: span_suggestion takes impl ToString
Change `span_suggestion` (and variants) to take `impl ToString` rather
than `String` for the suggested code, as this simplifies the
requirements on the diagnostic derive.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-29 02:05:20 +01:00
Michael Howell
346065f621 rustdoc: fix missing method list for primitive deref target
This change makes it so that local impls count when listing primitives that
need retained.
2022-04-28 16:45:05 -07:00
Camille GILLOT
a87ab48099 Ban non-static in const generics in AST. 2022-04-29 00:02:49 +02:00
bors
baaa3b6829 Auto merge of #96393 - joboet:pthread_parker, r=thomcc
std: directly use pthread in UNIX parker implementation

`Mutex` and `Condvar` are being replaced by more efficient implementations, which need thread parking themselves (see #93740). Therefore we should use the `pthread` synchronization primitives directly. Also, we can avoid allocating the mutex and condition variable because the `Parker` struct is being placed in an `Arc` anyways.

This basically is just a copy of the current `Mutex` and `Condvar` code, which will however be removed (again, see #93740). An alternative implementation could be to use dedicated private `OsMutex` and `OsCondvar` types, but all the other platforms supported by std actually have their own thread parking primitives.

I used `Pin` to guarantee a stable address for the `Parker` struct, while the current implementation does not, rather using extra unsafe declaration. Since the thread struct is shared anyways, I assumed this would not add too much clutter while being clearer.
2022-04-28 21:58:08 +00:00
Gary Guo
0fce0db96f Add @feat.00 symbol to symbols.o for COFF 2022-04-28 21:33:23 +01:00
bors
e85edd9a84 Auto merge of #96528 - Dylan-DPC:rollup-iedbjli, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #95312 (Ensure that `'_` and GAT yields errors)
 - #96405 (Migrate ambiguous plus diagnostic to the new derive macro)
 - #96409 (Recover suggestions to introduce named lifetime under NLL)
 - #96433 (rustc_ast: Harmonize delimiter naming with `proc_macro::Delimiter`)
 - #96480 (Fixed grammatical error in example comment)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-04-28 19:32:59 +00:00
Dylan DPC
2c1d58b8cc
Rollup merge of #96480 - user-simon:patch-1, r=Dylan-DPC
Fixed grammatical error in example comment

Added missing "we" in sentence.
2022-04-28 20:13:03 +02:00
Dylan DPC
0cbf3b2b30
Rollup merge of #96433 - petrochenkov:delim, r=nnethercote
rustc_ast: Harmonize delimiter naming with `proc_macro::Delimiter`

Compiler cannot reuse `proc_macro::Delimiter` directly due to extra impls, but can at least use the same naming.

After this PR the only difference between these two enums is that `proc_macro::Delimiter::None` is turned into `token::Delimiter::Invisible`.
It's my mistake that the invisible delimiter is called `None` on stable, during the stabilization I audited the naming and wrote the docs, but missed the fact that the `None` naming gives a wrong and confusing impression about what this thing is.

cc https://github.com/rust-lang/rust/pull/96421
r? ``@nnethercote``
2022-04-28 20:13:02 +02:00
Dylan DPC
cbfbc3be7d
Rollup merge of #96409 - marmeladema:fix-nll-introduce-named-lifetime-suggestion, r=jackh726
Recover suggestions to introduce named lifetime under NLL

Fixes #96157

r? ```@jackh726```

Built on top of #96385 so only the second commit is relevant
2022-04-28 20:13:01 +02:00
Dylan DPC
b3329f84f4
Rollup merge of #96405 - pvdrz:ambiguous-plus-diagnostic, r=davidtwco
Migrate ambiguous plus diagnostic to the new derive macro

r? ````@davidtwco```` ````@jyn514````
2022-04-28 20:12:59 +02:00
Dylan DPC
d665a5ea4a
Rollup merge of #95312 - marmeladema:tests-for-issue-95305, r=jackh726
Ensure that `'_` and GAT yields errors

Fixes #95305

```@bors``` r? ```@jackh726```
2022-04-28 20:12:57 +02:00
Augie Fackler
e8ae06a31b RustWrapper: explicitly don't handle DXILPointerTyID
This new enum entry was introduced in https://reviews.llvm.org/D122268,
and if I'm reading correctly there's no case where we'd ever encounter
it in our uses of LLVM. To preserve the ability to compile this file
with -Werror -Wswitch we add an explicit case for this entry.
2022-04-28 13:53:52 -04:00
bors
1388b38c52 Auto merge of #95171 - Kobzol:llvm-ci-update, r=nikic
Update LLVM used for building rustc in CI for x64

LLVM 14 was tagged. It is needed for building [BOLT](https://github.com/rust-lang/rust/pull/94381), and it also improves max RSS quite [a lot](https://perf.rust-lang.org/compare.html?start=6970f88db3ac2a9cefa9c585228291ae1f18fb04&end=67acb7e3ffcc11d67abfd29c390aac629f3c0e97&stat=max-rss).

GCC was bumped to allow building the new LLVM version. The changes in building LLVM were done to speed up the build a bit by ignoring unused parts and to turn off parts that were problematic to compile even with the bumped GCC.
2022-04-28 16:27:18 +00:00
Jakub Beránek
4472d4c575
Update LLVM submodule 2022-04-28 16:04:15 +02:00
Jakub Beránek
278fdf6c82
Update LLVM used for building rustc in CI for x64 to LLVM 14.0.2 2022-04-28 16:04:15 +02:00
joboet
1285fb7466
std: update debuginfo check to match type definition 2022-04-28 15:48:21 +02:00
Pietro Albini
62f984423c
extract code to detect files related to a test into a different function 2022-04-28 15:36:07 +02:00
Oli Scherer
d22c439989 Revert diagnostic duplication and accidental stabilization 2022-04-28 13:25:36 +00:00
bors
b2c2a32870 Auto merge of #95976 - b-naber:valtree-constval-conversion, r=oli-obk
Implement Valtree to ConstValue conversion

Once we start to use `ValTree`s in the type system we will need to be able to convert them into `ConstValue` instances, which we want to continue to use after MIR construction.

r? `@oli-obk`

cc `@RalfJung`
2022-04-28 13:18:22 +00:00
SparrowLii
cf00142b4d use tcx.require_lang_item() instead 2022-04-28 20:18:01 +08:00
joboet
550273361d
std: simplify UNIX parker timeouts 2022-04-28 12:31:19 +02:00
Oli Scherer
018f9347fc Update the diagnostic message to match the new span 2022-04-28 09:40:42 +00:00
bors
3bfeffd55b Auto merge of #95904 - paolobarbolini:vecdeque-specextend, r=the8472
Add VecDeque::extend from vec::IntoIter and slice::Iter specializations

Inspired from the [`Vec` `SpecExtend` implementation](027a232755/library/alloc/src/vec/spec_extend.rs), but without the specialization for `TrustedLen` which I'll look into in the future.

Should help #95632 and https://github.com/KillingSpark/zstd-rs/pull/17

## Benchmarks

Before

```
test vec_deque::bench_extend_bytes    ... bench:         862 ns/iter (+/- 10)
test vec_deque::bench_extend_vec      ... bench:         883 ns/iter (+/- 19)
```

After

```
test vec_deque::bench_extend_bytes    ... bench:           8 ns/iter (+/- 0)
test vec_deque::bench_extend_vec      ... bench:          24 ns/iter (+/- 1)

```
2022-04-28 09:27:21 +00:00
Oli Scherer
bc14b6bea6 Add new repeat expr test.
Also add repeat expr test folder and move all related tests to it
2022-04-28 09:20:27 +00:00
Oli Scherer
4e6e68e27a Check that repeat expression elements are Copy (ignoring lifetimes) in typeck and that they are Copy (with proper lifetime checks) in borrowck 2022-04-28 09:19:42 +00:00
Vadim Petrochenkov
2733ec1be3 rustc_ast: Harmonize delimiter naming with proc_macro::Delimiter 2022-04-28 10:04:29 +03:00
bors
71cd460616 Auto merge of #96503 - ehuss:update-cargo, r=ehuss
Update cargo

8 commits in edffc4ada3d77799e5a04eeafd9b2f843d29fc23..f63f23ff1f1a12ede8585bbd1bbf0c536e50293d
2022-04-19 17:38:29 +0000 to 2022-04-28 03:15:50 +0000
- move workspace inheritance untable docs to the correct place (rust-lang/cargo#10609)
- Cargo add support for workspace inheritance (rust-lang/cargo#10606)
- chore: Upgrade toml_edit (rust-lang/cargo#10603)
- Mark .cargo/git and .cargo/registry as cache dirs (rust-lang/cargo#10553)
- fix(yank): Use '--version' like install (rust-lang/cargo#10575)
- Disallow setting registry tokens with --config (rust-lang/cargo#10580)
- Set cargo --version git hash length to 9 (rust-lang/cargo#10579)
- Prefer `key.workspace = true` to `key = { workspace = true }` (rust-lang/cargo#10584)
2022-04-28 06:58:54 +00:00
Eric Huss
7758eaf16e Update cargo 2022-04-27 22:42:54 -07:00
bors
0e7915d11f Auto merge of #96085 - jsgf:deny-unused-deps, r=compiler-errors
Make sure `-Dunused-crate-dependencies --json unused-externs` makes rustc exit with error status

This PR:
- fixes compiletest to understand unused extern notifications
- adds tests for `--json unused-externs`
- makes sure that deny-level unused externs notifications are treated as compile errors
  - refactors the `emit_unused_externs` callstack to plumb through the level as an enum as a string, and adds `Level::is_error`

Update: adds `--json unused-externs-silent` with the original behaviour since Cargo needs it. Should address `@est31's` concerns.

Fixes: https://github.com/rust-lang/rust/issues/96068
2022-04-28 04:17:52 +00:00
Paolo Barbolini
c126f7fc8b Add VecDeque::extend from vec::IntoIter and slice::Iter specializations 2022-04-28 06:13:54 +02:00
Joshua Nelson
2f287d6a3e Make it possible to write doctests for bootstrap
This probably isn't super useful in practice, but it was easy to fix
and avoids confusing errors about mismatched versions between beta and the default toolchain.
2022-04-27 21:47:58 -05:00
bors
81799cd8fd Auto merge of #96495 - Dylan-DPC:rollup-9lm4tpp, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #96377 (make `fn() -> _ { .. }` suggestion MachineApplicable)
 - #96397 (Make EncodeWide implement FusedIterator)
 - #96421 (Less `NoDelim`)
 - #96432 (not need `Option` for `dbg_scope`)
 - #96466 (Better error messages when collecting into `[T; n]`)
 - #96471 (replace let else with `?`)
 - #96483 (Add missing `target_feature` to the list of well known cfg names)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-04-28 01:37:03 +00:00
Dylan DPC
89db345859
Rollup merge of #96483 - Urgau:check-cfg-target_feature, r=petrochenkov
Add missing `target_feature` to the list of well known cfg names

This PR adds the missing `target_feature` cfg name to the list of well known cfg names.

It was notice missing in https://github.com/rust-lang/rust/issues/96472 thanks to `@bjorn3,` the reason being that `--check-cfg=names()` automatically inherit the names passed by `--cfg` (or internal to `rustc`) and is seems that the vast majority of targets have at least one target feature leading to `target_feature` being a well known name in most target but it should always be a well known name so this PR add it unconditionally to list.

r? `@petrochenkov`
2022-04-28 02:40:37 +02:00