Commit graph

153806 commits

Author SHA1 Message Date
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
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
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
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
Ellen
c0e853f274 remove lazy_normalization_consts 2021-08-30 11:00:21 +02:00
Ellen
fcc2badf9b rename const_evaluatable_checked to generic_const_exprs
2021-08-30 11:00:21 +02:00
bors
13edc17f65 Auto merge of #88281 - asquared31415:asm-docs, r=Amanieu
Update unstable docs for `asm!` macro

This adds documentation that SPIR-V is supported, expands on the restrictions for labels, and has some minor cleanups or clarifications.

r? `@joshtriplett`
2021-08-30 07:54:11 +00:00
bors
dbb0fe9d80 Auto merge of #88456 - inquisitivecrystal:private-macro, r=jyn514
Fix: don't document private macros by default

As part of #88019, I made it so private macros are documented in `--document-private-items` mode. Unfortunately, it appears that I also accidentally made them be documented when *not* in `--document-private-items` mode. This PR fixes that and adds a regression test.

r? `@jyn514` (I hope you don't mind that I keep sending PRs your way)

Fixes #88453.
2021-08-30 05:23:54 +00:00
João M. Bezerra
faf59853f9 Adding examples to docs of std::time module
And adding missing link to Duration from Instant
2021-08-29 23:59:35 -03:00
bors
9556d7a09a Auto merge of #88337 - eddyb:field-failure-is-not-an-option, r=nagisa
rustc_target: `TyAndLayout::field` should never error.

This refactor (making `TyAndLayout::field` return `TyAndLayout` without any `Result` around it) is based on a simple observation, regarding `TyAndLayout::field`:

If `cx.layout_of(ty)` succeeds (for some `cx` and `ty`), then `.field(cx, i)` on the resulting `TyAndLayout` should *always* succeed in computing `cx.layout_of(field_ty)` (where `field_ty` is the type of the `i`th field of `ty`).

The reason for this is that no matter which field is chosen, `cx.layout_of(field_ty)` *will have already been computed*, as part of computing `cx.layout_of(ty)`, as we cannot determine the layout of *any* type without considering the layouts of *all* of its fields.

And so it should be fine to turn any errors into ICEs, since they likely indicate a `cx` mismatch, or some other edge case that is due to a compiler bug (as opposed to ever being an user-facing error).

<hr/>

Each commit should probably be reviewed separately, though note that there's some `where` clauses (in `rustc_target::abi::call::*`) that change in most commits.

cc `@nagisa` `@oli-obk`
2021-08-29 22:54:26 +00:00
Eduard-Mihai Burtescu
78778fc6aa rustc_target: remove LayoutOf bound from TyAbiInterface. 2021-08-30 00:44:12 +03:00
Eduard-Mihai Burtescu
8e6d126b7d rustc_target: TyAndLayout::field should never error. 2021-08-30 00:44:09 +03:00
Aman Arora
793fbc73e8 2229: Drop any deref in move closure 2021-08-29 16:28:58 -04:00
bors
2f662b1403 Auto merge of #88280 - sexxi-goose:non-exhaustive, r=nikomatsakis
Handle match statements with non exhaustive variants in closures

This PR ensures that the behavior for match statements with non exhaustive variants is the same inside and outside closures.

If we have a non-exhaustive SingleVariant which is defined in a different crate, then we should handle the case the same way we would handle a MultiVariant: borrow the match discriminant.

Closes https://github.com/rust-lang/project-rfc-2229/issues/59
r? `@nikomatsakis`
2021-08-29 20:27:14 +00:00