Commit graph

153821 commits

Author SHA1 Message Date
Mara Bos
ab37e49611
Rollup merge of #88418 - fee1-dead:trait-assoc-tilde-const, r=oli-obk
Allow `~const` bounds on trait assoc functions

r? `@oli-obk`
2021-08-31 17:54:56 +02:00
Mara Bos
4d089088f6
Rollup merge of #88399 - nagisa:nagisa/aapcs-on-aarch, r=petrochenkov
Disallow the aapcs CC on Aarch64

This never really worked and makes LLVM assert.
2021-08-31 17:54:55 +02:00
Mara Bos
f4f5dd5186
Rollup merge of #88391 - GuillaumeGomez:fix-json-enum-variant, r=camelid,notriddle
Fix json tuple struct enum variant

Fixes #87887.

cc `@dsherret` `@camelid`

r? `@notriddle`
2021-08-31 17:54:54 +02:00
Mara Bos
175c8cb851
Rollup merge of #86362 - ptrojahn:insert_vars_and_temps, r=jackh726
Avoid cloning LocalDecls
2021-08-31 17:54:53 +02:00
Mara Bos
e7a247dba4
Rollup merge of #85017 - clarfonthey:carrying_widening, r=m-ou-se
Add carrying_add, borrowing_sub, widening_mul, carrying_mul methods to integers

This comes in part from my own attempts to make (crude) big integer implementations, and also due to the stalled discussion in [RFC 2417](https://github.com/rust-lang/rfcs/pull/2417). My understanding is that changes like these are best offered directly as code and then an RFC can be opened if there needs to be more discussion before stabilisation. Since all of these methods are unstable from the start, I figured I might as well offer them now.

I tried looking into intrinsics, messed around with a few different implementations, and ultimately concluded that these are "good enough" implementations for now to at least put up some code and maybe start bikeshedding on a proper API for these.

For the `carrying_add` and `borrowing_sub`, I tried looking into potential architecture-specific code and realised that even using the LLVM intrinsics for `addcarry` and `subborrow` on x86 specifically, I was getting exactly the same assembly as the naive implementation using `overflowing_add` and `overflowing_sub`, although the LLVM IR did differ because of the architecture-specific code. Longer-term I think that they would be best suited to specific intrinsics as that would make optimisations easier (instructions like add-carry tend to use implicit flags, and thus can only be optimised if they're done one-after-another, and thus it would make the most sense to have compact intrinsics that can be merged together easily).

For `widening_mul` and `carrying_mul`, for now at least, I simply cast to the larger type and perform arithmetic that way, since we currently have no intrinsic that would work better for 128-bit integers. In the future, I also think that some form of intrinsic would work best to cover that case, but for now at least, I think that they're "good enough" for now.

The main reasoning for offering these directly to the standard library even though they're relatively niche optimisations is to help ensure that the code generated for them is optimal. Plus, these operations alone aren't enough to create big integer implementations, although they could help simplify the code required to do so and make it a bit more accessible for the average implementor.

That said, I 100% understand if any or all of these methods are not desired simply because of how niche they are. Up to you. 🤷🏻
2021-08-31 17:54:52 +02:00
Paul Trojahn
7bcc9ae422 Avoid cloning LocalDecls 2021-08-31 14:51:16 +02:00
bors
76d18cfb89 Auto merge of #88527 - m-ou-se:rollup-az6xtc5, r=m-ou-se
Rollup of 14 pull requests

Successful merges:

 - #88394 (Document `std::env::current_exe` possible rename behaviour)
 - #88406 (Tait nest infer test)
 - #88408 (Add inference cycle TAIT test)
 - #88409 (Add auto trait leakage TAIT test)
 - #88413 (Add weird return types TAIT test)
 - #88450 (fix(rustc_parse): correct span in `maybe_whole_expr!`)
 - #88462 (rustdoc: Stop using resolver for macro loading)
 - #88465 (Adding examples to docs of `std::time` module)
 - #88486 (Remove unused arena macro args)
 - #88492 (Use MaybeUninit::write in functor.rs)
 - #88496 (Fix prelude collision lint suggestion for generics with lifetimes)
 - #88497 (Fix prelude collision suggestions for glob imported traits. )
 - #88503 (Warn when [T; N].into_iter() is ambiguous in the new edition. )
 - #88509 (Don't suggest extra <> in dyn suggestion.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-08-31 11:20:32 +00:00
Mara Bos
feafda8cd3
Rollup merge of #88509 - m-ou-se:dyn-no-left-shift-right-shift-just-single-angle-brackets-please-thanks, r=petrochenkov
Don't suggest extra <> in dyn suggestion.

Fixes https://github.com/rust-lang/rust/issues/88508
2021-08-31 10:41:30 +02:00
Mara Bos
caca256b52
Rollup merge of #88503 - m-ou-se:array-into-inter-ambiguous, r=cjgillot
Warn when [T; N].into_iter() is ambiguous in the new edition.

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

In https://github.com/rust-lang/rust/issues/88475, a situation was found where `[T; N].into_iter()` becomes *ambiguous* in the new edition. This is different than the case where `(&[T; N]).into_iter()` resolves differently, which was the only case handled by the `array_into_iter` lint. This is almost identical to the new-traits-in-the-prelude problem. Effectively, due to the array-into-iter hack disappearing in Rust 2021, we effectively added `IntoIterator` to the 'prelude' in Rust 2021 specifically for arrays.

This modifies the prelude collisions lint to detect that case and emit a `array_into_iter` lint in that case.
2021-08-31 10:41:29 +02:00
Mara Bos
db44069482
Rollup merge of #88497 - m-ou-se:prelude-collision-glob, r=nikomatsakis
Fix prelude collision suggestions for glob imported traits.

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

cc `@nikomatsakis`
2021-08-31 10:41:28 +02:00
Mara Bos
fdf9c09c50
Rollup merge of #88496 - m-ou-se:prelude-collision-lifetime-generics, r=petrochenkov
Fix prelude collision lint suggestion for generics with lifetimes

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

cc `@nikomatsakis`
2021-08-31 10:41:27 +02:00
Mara Bos
4adacfd43e
Rollup merge of #88492 - est31:maybe_uninit_write, r=wesleywiser
Use MaybeUninit::write in functor.rs

MaybeUninit::write is stable as of 1.55.0.
2021-08-31 10:41:26 +02:00
Mara Bos
e094380025
Rollup merge of #88486 - bjorn3:better_arena_macro, r=jackh726
Remove unused arena macro args
2021-08-31 10:41:25 +02:00
Mara Bos
497267a961
Rollup merge of #88465 - marcospb19:master, r=joshtriplett
Adding examples to docs of `std::time` module

And adding missing link to `Duration` from `Instant`.
2021-08-31 10:41:24 +02:00
Mara Bos
d47b7d77a4
Rollup merge of #88462 - petrochenkov:macstore, r=jyn514
rustdoc: Stop using resolver for macro loading

r? `@jyn514`
2021-08-31 10:41:23 +02:00
Mara Bos
7696aca55f
Rollup merge of #88450 - notriddle:notriddle/maybe_whole_expr, r=cjgillot
fix(rustc_parse): correct span in `maybe_whole_expr!`

Fixes #87812
2021-08-31 10:41:22 +02:00
Mara Bos
2013792641
Rollup merge of #88413 - spastorino:weird-return-types-tait-test, r=oli-obk
Add weird return types TAIT test

r? `@oli-obk`

Related to #86727
2021-08-31 10:41:21 +02:00
Mara Bos
0e49feb1e5
Rollup merge of #88409 - spastorino:autoleakage-tait-test, r=oli-obk
Add auto trait leakage TAIT test

r? `@oli-obk`

Related to #86727
2021-08-31 10:41:20 +02:00
Mara Bos
b490f3580b
Rollup merge of #88408 - spastorino:inference-cycle-tait-test, r=oli-obk
Add inference cycle TAIT test

r? `@oli-obk`

Related to #86727
2021-08-31 10:41:19 +02:00
Mara Bos
5eeeb0bf3b
Rollup merge of #88406 - spastorino:tait-nest-infer-test, r=oli-obk
Tait nest infer test

r? `@oli-obk`

Related to #86727
2021-08-31 10:41:18 +02:00
Mara Bos
cd20fbdf82
Rollup merge of #88394 - ChrisDenton:patch-1, r=joshtriplett
Document `std::env::current_exe` possible rename behaviour

It might not be obvious that the "path of the current running executable" may (or may not) imply "at the time it was loaded".

This came up recently in chat so I thought it might be worth documenting.
2021-08-31 10:41:17 +02:00
bors
fe37929e4c Auto merge of #88491 - RalfJung:miri, r=RalfJung
update miri

Fixes https://github.com/rust-lang/rust/issues/88473
2021-08-31 08:32:31 +00:00
bors
d4f263a558 Auto merge of #88467 - sexxi-goose:issue-88431, r=nikomatsakis
2229: Drop any deref in move closure

Fixes: #88431

r? `@nikomatsakis`
2021-08-31 06:01:52 +00:00
bors
1e37e83dc0 Auto merge of #88414 - Aaron1011:guess-foreign-head-span, r=estebank
Don't use `guess_head_span` in `predicates_of` for foreign span

Previously, the result of `predicates_of` for a foreign trait
would depend on the *current* state of the corresponding source
file in the foreign crate. This could lead to ICEs during incremental
compilation, since the on-disk contents of the upstream source file
could potentially change without the upstream crate being recompiled.

Additionally, this ensure that that the metadata we produce for a crate
only depends on its *compiled* upstream dependencies (e.g an rlib or
rmeta file), *not* the current on-disk state of the upstream crate
source files.
2021-08-31 03:34:22 +00:00
bors
56ea5e0ee9 Auto merge of #88100 - HTG-YT:edition2021-compopt-stabilization, r=m-ou-se
Make Edition 2021 Stable

An item of #87959.

This is an "on-demand" pull request, which means it will be merged when it is the right time to.
2021-08-31 01:03:55 +00:00
bors
6f388bb369 Auto merge of #88369 - lcnr:cec-rename, r=oli-obk
update const generics feature gates

**tl;dr: split const generics into three features: `adt_const_params`, `const_generics_defaults` and `generic_const_exprs`**

continuing the work of `@BoxyUwU` in #88324, this PR
- renames `feature(const_evaluatable_checked)` to `feature(generic_const_exprs)` which now doesn't need any other feature gate to work. Previously `feature(const_evaluatable_checked)` was only useful in combination with `feature(const_generics)`.
- completely removes `feature(lazy_normalization_consts)`. This feature only supplied the parents generics to anonymous constants, which is pretty useless as generic anon consts are only allowed with `feature(generic_const_exprs)` anyways.
- moves the ability to use additional const param types from `feature(const_generics)` into `feature(adt_const_params)`. As `feature(const_generics)` is now mostly useless without `feature(generic_const_exprs)` we also remove that feature flag.
- updates tests, removing duplicates and unnecessary revisions in some cases and also deletes all unused `*.stderr` files.

I not also remove the ordering restriction for const and type parameters if any of the three const generics features is active.
This ordering restriction feels like the only "real" use of the current `feature(const_generics)` right now so this change isn't a perfect solution, but as I intend to stabilize the ordering - and `feature(const_generics_defaults)` -  in the very near future, I think this is acceptable for now.

---

cc `@rust-lang/project-const-generics` about the new feature names and this change in general.

I don't think we need any external approval for this change but I do intend to publish an update to the const generics tracking issue the day this PR lands, so I don't want this merged yet.

Apologies to whoever ends up reviewing this PR 😅 ❤️

r? rust-lang/project-const-generics
2021-08-30 22:21:01 +00:00
Mara Bos
ac93ca3b94 Turn to ifs into a match. 2021-08-30 23:57:16 +02:00
Mara Bos
f8beb8f7f7 Add test for extra <> in dyn suggestion. 2021-08-30 22:34:46 +02:00
Mara Bos
23d2cb8435 Don't suggest extra <> in dyn suggestion. 2021-08-30 22:34:34 +02:00
Mara Bos
756ef3bff6 Add test for 2021 ambiguous [T; N].into_iter(). 2021-08-30 21:27:31 +02:00
Mara Bos
336f31432d Warn when [T; N].into_iter() is ambiguous in the new edition. 2021-08-30 21:27:31 +02:00
Mara Bos
10eed8f0c5 No longer pass -Z unstable-options for edition 2021 in test. 2021-08-30 20:41:02 +02:00
Mara Bos
ab369274d6 Update test output for stable Rust 2021. 2021-08-30 20:41:01 +02:00
bors
5d6804469d Auto merge of #88466 - sexxi-goose:issue-88372, r=nikomatsakis
2229: Handle update to capture kind properly

Fixes: #88372

r? `@nikomatsakis`
2021-08-30 18:27:54 +00:00
Mara Bos
89a98675aa Add test for glob imported prelude collision trait. 2021-08-30 19:21:40 +02:00
Mara Bos
51e4fbaed1 Fix prelude collision suggestions for glob imported traits. 2021-08-30 19:21:22 +02:00
Mara Bos
78a7d1c652 Add and update tests. 2021-08-30 19:02:29 +02:00
Mara Bos
e2abf06890 Fix lifetime generics in <T<..> as Trait>::try_from suggestion. 2021-08-30 19:02:06 +02:00
Mara Bos
a4f6d3e5c2 Fix lifetime generics in <T as Trait<..>>::try_from suggestion. 2021-08-30 19:01:34 +02:00
est31
403b80d32e Use MaybeUninit::write in functor.rs
MaybeUninit::write is stable as of 1.55.0.
2021-08-30 17:23:49 +02:00
Ralf Jung
3e61c53917 update miri 2021-08-30 11:12:39 -04:00
Mara Bos
6adbbb6be7 Update LATEST_STABLE_EDITION to 2021. 2021-08-30 15:33:09 +02:00
HTG-YT
4bed11a109 update rustc cmdargs markdown section 2021-08-30 15:27:00 +02:00
HTG-YT
388d90ac4c make edition 2021 stable 2021-08-30 15:27:00 +02:00
bjorn3
1a2fe87b09 Remove unused arena macro args 2021-08-30 13:09:38 +02:00
Simonas Kazlauskas
748a089acd Disallow the aapcs CC on Aarch64
This never really worked and makes LLVM assert.
2021-08-30 13:46:07 +03:00
bors
6cfa773583 Auto merge of #87680 - mati865:stacker-psm-update, r=Mark-Simulacrum,nagisa
Update stacker and psm crates

Primarily to include https://github.com/rust-lang/stacker/pull/54
2021-08-30 10:42:53 +00:00
lcnr
87e781799a feature(const_param_types) -> feature(adt_const_params) 2021-08-30 12:07:36 +02:00
lcnr
4747cbb3bb allow unordered const/ty params if any cg feature is active 2021-08-30 11:00:21 +02:00
lcnr
0c28e028b6 feature(const_generics) -> feature(const_param_types) 2021-08-30 11:00:21 +02:00