Commit Graph

172802 Commits

Author SHA1 Message Date
bjorn3
1afea1f86a Implement vtable_size and vtable_align intrinsics for cg_clif 2022-07-20 17:12:07 -04:00
Ralf Jung
b4c377e750 bless some tests 2022-07-20 17:12:07 -04:00
Ralf Jung
adf6d37d83 slightly cleaner, if more verbose, vtable handling in codegen backends 2022-07-20 17:12:07 -04:00
Ralf Jung
3dad266f40 consistently use VTable over Vtable (matching stable stdlib API RawWakerVTable) 2022-07-20 17:12:07 -04:00
Ralf Jung
114da84996 use extern type for extra opaqueness 2022-07-20 17:12:07 -04:00
Ralf Jung
5e840c5c8c incorporate some review feedback 2022-07-20 17:12:07 -04:00
Ralf Jung
8affef2ccb add intrinsic to access vtable size and align 2022-07-20 17:12:07 -04:00
Ralf Jung
b5a32d01f4 we seem to monomorphize fewer vtables by default now, so adjust some tests 2022-07-20 17:12:06 -04:00
Ralf Jung
fe00573324 make use of symbolic vtables in interpreter 2022-07-20 17:12:04 -04:00
Ralf Jung
a10d8e4581 rename get_global_alloc to try_get_global_alloc 2022-07-20 17:09:22 -04:00
Ralf Jung
da5e4d73f1 add a Vtable kind of symbolic allocations 2022-07-20 16:57:31 -04:00
bors
a7468c60f8 Auto merge of #99472 - RalfJung:provenance, r=oli-obk
interpret: rename Tag/PointerTag to Prov/Provenance

We were pretty inconsistent with calling this the "tag" vs the "provenance" of the pointer; I think we should consistently call it "provenance".

r? `@oli-obk`
2022-07-20 16:56:31 +00:00
bors
14dbfebfa2 Auto merge of #99506 - Dylan-DPC:rollup-q3msucx, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #98101 (stdlib support for Apple WatchOS)
 - #99345 (Do not allow typeck children items to constrain outer RPITs)
 - #99383 (Formalize defining_use_anchor)
 - #99436 (Add flag to configure `noalias` on `Box<T>`)
 - #99483 (Fix a numerical underflow in tuple wrap suggestion)
 - #99485 (Stop injecting `#[allow(unused_qualifications)]` in generated `derive` implementations)
 - #99486 (Refactor: remove a string comparison between types in `check_str_addition`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-20 13:36:59 +00:00
Dylan DPC
17a2832ba0
Rollup merge of #99486 - TaKO8Ki:remove-type-string-comparison-in-check-str-addition, r=compiler-errors
Refactor: remove a string comparison between types in `check_str_addition`

This patch removes remove a string of types comparison.
2022-07-20 16:17:23 +05:30
Dylan DPC
3257c3401d
Rollup merge of #99485 - mdholloway:unused-qualifications-in-derive, r=oli-obk
Stop injecting `#[allow(unused_qualifications)]` in generated `derive` implementations

Currently, the `#[derive]` attribute always injects an `#[allow(unused_qualifications)]` attribute in the generated implementation. This results in an error when a derive is used in combination with `#![forbid(unused_qualifications)]`, because the `forbid` rule by definition cannot be overridden by `allow`.

It appears that the original issue that prompted the inclusion of `#[allow(unused_qualifications)]` (#19102) is no longer present in the current stable release, and the associated [test case](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-19102.rs) still passes, so the `allow` is simply removed here.

Fixes #71898.
2022-07-20 16:17:22 +05:30
Dylan DPC
d9a71c1e02
Rollup merge of #99483 - compiler-errors:issue-99482, r=jyn514
Fix a numerical underflow in tuple wrap suggestion

Fixes #99482

I'm a clown, I rewrote the arg mismatch algo to use well-typed indices to avoid things like this, but then I added my own indexing bug, lol.
2022-07-20 16:17:21 +05:30
Dylan DPC
fffc6504bc
Rollup merge of #99436 - Nilstrieb:toggle-box-noalias, r=fee1-dead
Add flag to configure `noalias` on `Box<T>`

The aliasing rules of `Box<T>` are still not decided, but currently, `Box<T>` is unique and gets `noalias`. To aid making an informed decision about the future of `Box<T>`, this PR adds a flag `-Zbox-noalias` to configure `noalias` for `Box<T>` (for example, for benchmarking). The same flag already exists for `&mut T` `noalias`, where it was added because it was the problem of various miscompilations in LLVM.

For more information, see rust-lang/unsafe-code-guidelines#326
2022-07-20 16:17:20 +05:30
Dylan DPC
eecfdfb8a1
Rollup merge of #99383 - ouz-a:issue_57961, r=oli-obk
Formalize defining_use_anchor

This tackles issue #57961

Introduces new enum called `DefiningAnchor` that replaces `Option<LocalDefId>` of `defining_use_anchor`. Now every use of it is explicit and exhaustively matched, catching errors like one in the linked issue. This is not a perfect fix but it's a step in the right direction.

r? `@oli-obk`
2022-07-20 16:17:19 +05:30
Dylan DPC
3c3c5da9ad
Rollup merge of #99345 - compiler-errors:issue-99073-redux, r=oli-obk
Do not allow typeck children items to constrain outer RPITs

Fixes #99073 in a simpler and more conservative way than #99079. Simply raise a mismatched types error if we try to constrain an RPIT in an item that isn't the RPIT's parent.

r? `@oli-obk`
2022-07-20 16:17:18 +05:30
Dylan DPC
90c59e736b
Rollup merge of #98101 - vladimir-ea:stdlib_watch_os, r=thomcc
stdlib support for Apple WatchOS

This is a follow-up to https://github.com/rust-lang/rust/pull/95243 (Add Apple WatchOS compiler targets) that adds stdlib support for Apple WatchOS.

`@deg4uss3r`
`@nagisa`
2022-07-20 16:17:17 +05:30
bors
d60d88fe5c Auto merge of #99495 - oli-obk:revert_98582, r=oli-obk
Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r…

…=estebank"

This reverts commit 6f8fb911ad, reversing
changes made to 7210e46dc6.

r? `@ghost`

rebase of https://github.com/rust-lang/rust/pull/99368
2022-07-20 10:34:42 +00:00
ouz-a
64dc377a10 use def_id 2022-07-20 12:51:07 +03:00
ouz-a
7c0fb38095 take opaq types 2022-07-20 12:43:10 +03:00
Vladimir Michael Eatwell
439d64a83c Library changes for Apple WatchOS 2022-07-20 08:57:36 +01:00
Oli Scherer
4a742a691e Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank"
This reverts commit 6f8fb911ad, reversing
changes made to 7210e46dc6.
2022-07-20 07:55:58 +00:00
bors
748cb1f01d Auto merge of #99493 - Dylan-DPC:rollup-lli4gcx, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #98784 (Suggest returning local on "expected `ty`, found `()`" due to expr-less block)
 - #98916 (Windows: Use `FindFirstFileW` for getting the metadata of locked system files)
 - #99433 (Erase regions before comparing signatures of foreign fns.)
 - #99452 (int_macros was only using to_xe_bytes_doc and not from_xe_bytes_doc)
 - #99481 (Add regression test for #71547)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-20 07:03:54 +00:00
Dylan DPC
d7a65a5558
Rollup merge of #99481 - JohnTitor:issue-71547, r=compiler-errors
Add regression test for #71547

Closes #71547
r? `@compiler-errors`

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-07-20 11:29:41 +05:30
Dylan DPC
feebc5f4d5
Rollup merge of #99452 - Stargateur:fix/typo, r=JohnTitor
int_macros was only using to_xe_bytes_doc and not from_xe_bytes_doc

typo in doc [here](https://doc.rust-lang.org/std/primitive.isize.html#method.from_ne_bytes) "returns" => "takes"

`@rustbot` label +T-rustdoc
2022-07-20 11:29:40 +05:30
Dylan DPC
f02bbbcba6
Rollup merge of #99433 - cjgillot:erase-foreign-sig, r=compiler-errors
Erase regions before comparing signatures of foreign fns.

Fixes https://github.com/rust-lang/rust/issues/99276

The version with explicit lifetimes is probably tracked in another bug, but I could not find it.
2022-07-20 11:29:39 +05:30
Dylan DPC
80395679cb
Rollup merge of #98916 - ChrisDenton:hiberfil.sys, r=thomcc
Windows: Use `FindFirstFileW` for getting the metadata of locked system files

Fixes #96980

Usually opening a file handle with access set to metadata only will always succeed, even if the file is locked. However some special system files, such as `C:\hiberfil.sys`, are locked by the system in a way that denies even that. So as a fallback we try reading the cached metadata from the directory.

Note that the test is a bit iffy. I don't know if `hiberfil.sys` actually exists in the CI.

r? rust-lang/libs
2022-07-20 11:29:38 +05:30
Dylan DPC
97c9f16a45
Rollup merge of #98784 - compiler-errors:forgot-to-return-binding, r=estebank
Suggest returning local on "expected `ty`, found `()`" due to expr-less block

Putting this up for _initial_ review. Notably, this doesn't consider if the value has possibly been moved, or whether the type is `Copy`. It also provides a structured suggestion if there's one "preferred" binding that matches the type (i.e. one binding in the block or its parent), otherwise it just points them out if there's fewer than 4 of them.

Fixes #98177

r? `@estebank`
2022-07-20 11:29:37 +05:30
bors
03d488b48a Auto merge of #98843 - Urgau:check-cfg-stage0, r=Mark-Simulacrum
Enable check-cfg in stage0

Now that the bootstrap cargo supports `rustc-check-cfg` we can now enable it with `-Zcheck-cfg=output` and use it in `rustc_llvm` to unblock `--check-cfg` support in stage0.

r? `@Mark-Simulacrum`
2022-07-20 04:23:09 +00:00
Michael Goulet
b0a81904ce Suggest returning binding from block or enclosing scope on coerce_forced_unit error 2022-07-20 03:58:33 +00:00
bors
f426146460 Auto merge of #99484 - ehuss:update-cargo, r=ehuss
Update cargo

9 commits in 8827baaa781b37872134c1ba692a6f0aeb37890e..d8d30a75376f78bb0fabe3d28ee9d87aa8035309
2022-07-14 02:56:51 +0000 to 2022-07-19 13:59:17 +0000
- docs: fixing minor error in the default timing report filename (rust-lang/cargo#10879)
- Stabilize `--crate-type` flag for `cargo rustc` (rust-lang/cargo#10838)
- Stabilize `-Zmultitarget` (rust-lang/cargo#10766)
- Clean up leftover in unstable documentation (rust-lang/cargo#10874)
- Normalize path for `cargo vendor` output (rust-lang/cargo#10668)
- add a reason to `masquerade_as_nightly_cargo` so it is searchable (rust-lang/cargo#10868)
- Allow '.' in workspace.default-members in non-virtual workspaces. (rust-lang/cargo#10784)
- remove`.masquerade_as_nightly_cargo()` from various tests the no longer need it (rust-lang/cargo#10867)
- remove `.masquerade_as_nightly_cargo()` from build_script_extra_link_arg.rs (rust-lang/cargo#10866)
2022-07-20 00:08:55 +00:00
Eric Huss
99a186868f Update cargo 2022-07-19 17:01:12 -07:00
Michael Holloway
05bb878261 Remove #[allow(unused_qualifications)] lines from derive diff test 2022-07-19 19:39:14 -04:00
Michael Goulet
43c0c63eda Fix a numerical underflow in tuple wrap suggestion 2022-07-19 22:48:40 +00:00
Takayuki Maeda
35118568a6 remove a type string comparison in check_str_addition 2022-07-20 07:07:18 +09:00
Yuki Okushi
50423aedce
Add regression test for #71547
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-07-20 06:42:35 +09:00
Ralf Jung
0ec3269db8 interpret: rename Tag/PointerTag to Prov/Provenance
Let's avoid using two different terms for the same thing -- let's just call it "provenance" everywhere.
In Miri, provenance consists of an AllocId and an SbTag (Stacked Borrows tag), which made this even more confusing.
2022-07-19 15:38:32 -04:00
bors
9a7b7d5e50 Auto merge of #98180 - notriddle:notriddle/rustdoc-fn, r=petrochenkov,GuillaumeGomez
Improve the function pointer docs

This is #97842 but for function pointers instead of tuples. The concept is basically the same.

* Reduce duplicate impls; show `fn (T₁, T₂, …, Tₙ)` and include a sentence saying that there exists up to twelve of them.
* Show `Copy` and `Clone`.
* Show auto traits like `Send` and `Sync`, and blanket impls like `Any`.

https://notriddle.com/notriddle-rustdoc-test/std/primitive.fn.html
2022-07-19 19:36:57 +00:00
Camille GILLOT
0065929599 Erase regions before comparing signatures of foreign fns. 2022-07-19 19:36:45 +02:00
bors
29c5a028b0 Auto merge of #99309 - RalfJung:no-large-copies, r=oli-obk
interpret: make some large types not Copy

Also remove some unused trait impls (mostly HashStable).

This didn't find any unnecessary copies that I managed to avoid, but it might still be better to require explicit clone for these types? Not sure.

r? `@oli-obk`
2022-07-19 16:33:45 +00:00
Michael Goulet
5a4601fea5 use opaque_ty_origin_unchecked instead of destructuring HIR 2022-07-19 16:26:16 +00:00
Michael Goulet
e8d9f38141 Do not allow typeck children items to constrain outer RPITs 2022-07-19 16:22:33 +00:00
Michael Howell
ddb5a2638a Use T for all the function primitive docs lists 2022-07-19 08:52:25 -07:00
Michael Howell
5271e32c46 Improve the function pointer docs
* Reduce duplicate impls; show only the `fn (T)` and include a sentence
  saying that there exists up to twelve of them.
* Show `Copy` and `Clone`.
* Show auto traits like `Send` and `Sync`, and blanket impls like `Any`.
2022-07-19 08:52:24 -07:00
nils
7c900c9b45 Add flag to configure noalias on Box<T>
To aid making an informed decision about the aliasing
rules of box, give users an option to remove `noalias`
from box.
2022-07-19 16:02:59 +02:00
bors
a289cfcfb3 Auto merge of #99462 - matthiaskrgr:rollup-ihhwaru, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #98028 (Add E0790 as more specific variant of E0283)
 - #99384 (use body's param-env when checking if type needs drop)
 - #99401 (Avoid `Symbol` to `&str` conversions)
 - #99419 (Stabilize `core::task::ready!`)
 - #99435 (Revert "Stabilize $$ in Rust 1.63.0")
 - #99438 (Improve suggestions for `NonZeroT` <- `T` coercion error)
 - #99441 (Update mdbook)
 - #99453 (⬆️ rust-analyzer)
 - #99457 (use `par_for_each_in` in `par_body_owners` and `collect_crate_mono_items`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-19 13:49:56 +00:00
Matthias Krüger
e6904fc5b2
Rollup merge of #99457 - SparrowLii:para_iter, r=fee1-dead
use `par_for_each_in` in `par_body_owners` and `collect_crate_mono_items`

Using `par_iter` in non-parallel mode will cause the entire process to abort when any iteration panics.  So we can use `par_for_each_in` instead to make the error message consistent with parallel mode. This means that the compiler will output more error messages in some cases. This fixes the following ui tests when set `parallel-compiler = true`:
```
    [ui] src/test\ui\privacy\privacy2.rs
    [ui] src/test\ui\privacy\privacy3.rs
    [ui] src/test\ui\type_length_limit.rs
```

This refers to #68171

Updates #75760
2022-07-19 13:30:52 +02:00