]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #90939 - estebank:wg-af-polish, r=tmandry
Matthias Krüger [Wed, 15 Dec 2021 00:28:04 +0000 (01:28 +0100)]
Rollup merge of #90939 - estebank:wg-af-polish, r=tmandry

Tweak errors coming from `for`-loop, `?` and `.await` desugaring

 * Suggest removal of `.await` on non-`Future` expression
 * Keep track of obligations introduced by desugaring
 * Remove span pointing at method for obligation errors coming from desugaring
 * Point at called local sync `fn` and suggest making it `async`

```
error[E0277]: `()` is not a future
  --> $DIR/unnecessary-await.rs:9:10
   |
LL |     boo().await;
   |     -----^^^^^^ `()` is not a future
   |     |
   |     this call returns `()`
   |
   = help: the trait `Future` is not implemented for `()`
help: do not `.await` the expression
   |
LL -     boo().await;
LL +     boo();
   |
help: alternatively, consider making `fn boo` asynchronous
   |
LL | async fn boo () {}
   | +++++
```

Fix #66731.

2 years agoAuto merge of #91728 - Amanieu:stable_asm, r=joshtriplett
bors [Tue, 14 Dec 2021 21:15:22 +0000 (21:15 +0000)]
Auto merge of #91728 - Amanieu:stable_asm, r=joshtriplett

Stabilize asm! and global_asm!

Tracking issue: #72016

It's been almost 2 years since the original [RFC](https://github.com/rust-lang/rfcs/pull/2850) was posted and we're finally ready to stabilize this feature!

The main changes in this PR are:
- Removing `asm!` and `global_asm!` from the prelude as per the decision in #87228.
- Stabilizing the `asm` and `global_asm` features.
- Removing the unstable book pages for `asm` and `global_asm`. The contents are moved to the [reference](https://github.com/rust-lang/reference/pull/1105) and [rust by example](https://github.com/rust-lang/rust-by-example/pull/1483).
  - All links to these pages have been removed to satisfy the link checker. In a later PR these will be replaced with links to the reference or rust by example.
- Removing the automatic suggestion for using `llvm_asm!` instead of `asm!` if you're still using the old syntax, since it doesn't work anymore with `asm!` no longer being in the prelude. This only affects code that predates the old LLVM-style `asm!` being renamed to `llvm_asm!`.
- Updating `stdarch` and `compiler-builtins`.
- Updating all the tests.

r? `@joshtriplett`

2 years agoDisable asm lint example tests since they only work on x86_64
Amanieu d'Antras [Tue, 14 Dec 2021 11:48:28 +0000 (11:48 +0000)]
Disable asm lint example tests since they only work on x86_64

2 years agoAuto merge of #91902 - matthiaskrgr:rollup-hjjyhow, r=matthiaskrgr
bors [Tue, 14 Dec 2021 11:30:17 +0000 (11:30 +0000)]
Auto merge of #91902 - matthiaskrgr:rollup-hjjyhow, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #91529 (add BinaryHeap::try_reserve and BinaryHeap::try_reserve_exact)
 - #91820 (Suggest to specify a target triple when lang item is missing)
 - #91851 (Make `MaybeUninit::zeroed` `const`)
 - #91875 (Use try_normalize_erasing_regions in RevealAllVisitor)
 - #91887 (Remove `in_band_lifetimes` from `rustc_const_eval`)
 - #91892 (Fix HashStable implementation on InferTy)
 - #91893 (Remove `in_band_lifetimes` from `rustc_hir`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoRollup merge of #91893 - pitaj:91867-hir, r=davidtwco
Matthias Krüger [Tue, 14 Dec 2021 09:21:07 +0000 (10:21 +0100)]
Rollup merge of #91893 - pitaj:91867-hir, r=davidtwco

Remove `in_band_lifetimes` from `rustc_hir`

#91867

2 years agoRollup merge of #91892 - compiler-errors:fix-inferty-hashtable, r=dtolnay
Matthias Krüger [Tue, 14 Dec 2021 09:21:07 +0000 (10:21 +0100)]
Rollup merge of #91892 - compiler-errors:fix-inferty-hashtable, r=dtolnay

Fix HashStable implementation on InferTy

HashStable impl forgot to hash the discriminant.

Fixes #91807

2 years agoRollup merge of #91887 - LegionMammal978:less-inband-const_eval, r=oli-obk
Matthias Krüger [Tue, 14 Dec 2021 09:21:06 +0000 (10:21 +0100)]
Rollup merge of #91887 - LegionMammal978:less-inband-const_eval, r=oli-obk

Remove `in_band_lifetimes` from `rustc_const_eval`

See #91867 for more information.

2 years agoRollup merge of #91875 - b-naber:mir-transform-norm-erase-reg, r=Aaron1011
Matthias Krüger [Tue, 14 Dec 2021 09:21:05 +0000 (10:21 +0100)]
Rollup merge of #91875 - b-naber:mir-transform-norm-erase-reg, r=Aaron1011

Use try_normalize_erasing_regions in RevealAllVisitor

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

Thanks to ``@Aaron1011`` for [pointing out the problem](https://github.com/rust-lang/rust/issues/91745#issuecomment-991996008).

r? ``@Aaron1011``

2 years agoRollup merge of #91851 - woppopo:const_maybeuninit_zeroed, r=yaahc
Matthias Krüger [Tue, 14 Dec 2021 09:21:04 +0000 (10:21 +0100)]
Rollup merge of #91851 - woppopo:const_maybeuninit_zeroed, r=yaahc

Make `MaybeUninit::zeroed` `const`

Tracking issue: #91850

```rust
// core::mem
impl<T> MaybeUninit<T> {
    pub const fn zeroed() -> MaybeUninit<T>;
}
```

2 years agoRollup merge of #91820 - rukai:help_with_personality_issues, r=davidtwco
Matthias Krüger [Tue, 14 Dec 2021 09:21:03 +0000 (10:21 +0100)]
Rollup merge of #91820 - rukai:help_with_personality_issues, r=davidtwco

Suggest to specify a target triple when lang item is missing

It is very common for newbies to embedded to hit this confusing error when forgetting to specify the target.
Source: me googling this error many times.

## Possible changes
* We could possibly restrict the note+help to only be included on eh_personality lang item if that helped reduce false positives, but its also possible doing so would just increase false negatives
* Open to any suggestions on rewriting the messages
* We could possibly remove the `.cargo/config` alternative to avoid the message getting too noisy but I think its valuable to have as its the correct approach for most embedded projects so that `cargo build` just works.

r? rust-lang/diagnostics

2 years agoRollup merge of #91529 - TennyZhuang:try_reserve_binary_heap, r=yaahc
Matthias Krüger [Tue, 14 Dec 2021 09:21:02 +0000 (10:21 +0100)]
Rollup merge of #91529 - TennyZhuang:try_reserve_binary_heap, r=yaahc

add BinaryHeap::try_reserve and BinaryHeap::try_reserve_exact

`try_reserve` of many collections were stablized in https://github.com/rust-lang/rust/pull/87993 in 1.57.0. Add `try_reserve` for the rest collections such as `BinaryHeap` should be not controversial.

2 years agoAuto merge of #91766 - scottmcm:more-array-raw-eq, r=yaahc
bors [Tue, 14 Dec 2021 08:22:31 +0000 (08:22 +0000)]
Auto merge of #91766 - scottmcm:more-array-raw-eq, r=yaahc

Allow `memcmp` for more array comparisons

This way comparing `[NonZeroU8; 8]` is just as fast as comparing `[u8; 8]`.

2 years agoFix HashStable implementation on InferTy
Michael Goulet [Tue, 14 Dec 2021 04:36:17 +0000 (20:36 -0800)]
Fix HashStable implementation on InferTy

2 years agoRemove `in_band_lifetimes` from `rustc_hir`
Peter Jaszkowiak [Tue, 14 Dec 2021 04:33:53 +0000 (21:33 -0700)]
Remove `in_band_lifetimes` from `rustc_hir`

2 years agoAuto merge of #91680 - saethlin:spare_capacity_mut-in-join, r=dtolnay
bors [Tue, 14 Dec 2021 04:29:54 +0000 (04:29 +0000)]
Auto merge of #91680 - saethlin:spare_capacity_mut-in-join, r=dtolnay

Use spare_capacity_mut instead of invalid unchecked indexing when joining str

This is a fix for https://github.com/rust-lang/rust/issues/91574

I think in general I'd prefer to see this code implemented with raw pointers or `MaybeUninit::write_slice`, but there's existing code in here based on copying from slice to slice, so converting everything from `&[T]` to `&[MaybeUninit<T>]` is less disruptive.

2 years agoRemove `in_band_lifetimes` from `rustc_const_eval`
LegionMammal978 [Tue, 14 Dec 2021 03:34:51 +0000 (22:34 -0500)]
Remove `in_band_lifetimes` from `rustc_const_eval`

See #91867 for more information.

2 years agoAuto merge of #91660 - llogiq:make-a-hash-of-def-ids, r=nnethercote
bors [Tue, 14 Dec 2021 01:39:01 +0000 (01:39 +0000)]
Auto merge of #91660 - llogiq:make-a-hash-of-def-ids, r=nnethercote

manually implement `Hash` for `DefId`

This might speed up hashing for hashers that can work on individual u64s. Just as an experiment, suggested in a reddit thread on `FxHasher`. cc `@nnethercote`

Note that this should not be merged as is without cfg-ing the code path for 64 bits.

2 years agoFix lint examples on non-x86_64
Amanieu d'Antras [Tue, 14 Dec 2021 00:13:27 +0000 (00:13 +0000)]
Fix lint examples on non-x86_64

2 years agouse try_normalize_erasing_regions in RevealAllVisitor
b-naber [Mon, 13 Dec 2021 21:24:08 +0000 (22:24 +0100)]
use try_normalize_erasing_regions in RevealAllVisitor

2 years agoRemove invalid doc links.
Amanieu d'Antras [Mon, 13 Dec 2021 20:40:17 +0000 (20:40 +0000)]
Remove invalid doc links.

2 years agoAuto merge of #91865 - matthiaskrgr:rollup-rai9ecq, r=matthiaskrgr
bors [Mon, 13 Dec 2021 20:12:35 +0000 (20:12 +0000)]
Auto merge of #91865 - matthiaskrgr:rollup-rai9ecq, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #91699 (Add `-webkit-appearance: none` to search input)
 - #91846 (rustdoc: Reduce number of arguments for `run_test` a bit)
 - #91847 (Fix FIXME for `generic_arg_infer` in `create_substs_for_ast_path`)
 - #91849 (GATs outlives lint: Try to prove bounds)
 - #91855 (Stabilize const_cstr_unchecked)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agofix coverage report test
Esteban Kuber [Mon, 13 Dec 2021 17:22:48 +0000 (17:22 +0000)]
fix coverage report test

2 years agoRollup merge of #91855 - xfix:const_cstr_unchecked, r=dtolnay
Matthias Krüger [Mon, 13 Dec 2021 17:15:17 +0000 (18:15 +0100)]
Rollup merge of #91855 - xfix:const_cstr_unchecked, r=dtolnay

Stabilize const_cstr_unchecked

Closes #90343

``@rustbot`` modify labels: +T-libs-api

2 years agoRollup merge of #91849 - jackh726:gats-outlives-lint-part2, r=nikomatsakis
Matthias Krüger [Mon, 13 Dec 2021 17:15:16 +0000 (18:15 +0100)]
Rollup merge of #91849 - jackh726:gats-outlives-lint-part2, r=nikomatsakis

GATs outlives lint: Try to prove bounds

Fixes #91036
Fixes #90888
Fixes #91348 (better error + documentation to be added to linked issue)

Instead of checking for bounds directly, try to prove them in the associated type environment.

Also, add a bit of extra information to the error, including a link to the relevant discussion issue (#87479). That should be edited to include a brief summary of the current state of the outlives lint, including a brief background. It also might or might not be worth it to bump this to a full error code at some point.

r? ``@nikomatsakis``

2 years agoRollup merge of #91847 - BoxyUwU:generic_arg_infer_fixme, r=lcnr
Matthias Krüger [Mon, 13 Dec 2021 17:15:15 +0000 (18:15 +0100)]
Rollup merge of #91847 - BoxyUwU:generic_arg_infer_fixme, r=lcnr

Fix FIXME for `generic_arg_infer` in `create_substs_for_ast_path`

Fixes a FIXME, does some general refactoring of this fn, and also fixes a bug where we would use a const params defaults instead of an inference var ([playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=19456f65ea5dc3fcaa9b696f842ab380))
(lot of stuff in one PR but it was all so close together...)

r? `@lcnr`

Fixes #91614

2 years agoRollup merge of #91846 - camelid:doctest-cleanup, r=GuillaumeGomez
Matthias Krüger [Mon, 13 Dec 2021 17:15:14 +0000 (18:15 +0100)]
Rollup merge of #91846 - camelid:doctest-cleanup, r=GuillaumeGomez

rustdoc: Reduce number of arguments for `run_test` a bit

- rustdoc: Coalesce some `run_test` args as one `LangString` arg
- Rename `TestOptions` to `GlobalTestOptions`
- doctest: Rename `options` to `rustdoc_options`

2 years agoRollup merge of #91699 - jsha:webkit-appearance-search-input, r=GuillaumeGomez
Matthias Krüger [Mon, 13 Dec 2021 17:15:13 +0000 (18:15 +0100)]
Rollup merge of #91699 - jsha:webkit-appearance-search-input, r=GuillaumeGomez

Add `-webkit-appearance: none` to search input

This fixes an issue when displaying on iPad, where the search box had no borders.

r? ``@GuillaumeGomez``

Demo https://rustdoc.crud.net/jsha/webkit-appearance-search-input/std/string/struct.String.html

2 years agofix clippy tests
Esteban Kuber [Fri, 10 Dec 2021 17:20:57 +0000 (17:20 +0000)]
fix clippy tests

2 years agoreview comment: change wording of suggestion
Esteban Kuber [Fri, 10 Dec 2021 03:01:37 +0000 (03:01 +0000)]
review comment: change wording of suggestion

2 years agoreview comments
Esteban Kuber [Thu, 2 Dec 2021 23:41:45 +0000 (23:41 +0000)]
review comments

2 years agoSimplify diagnostic logic
Esteban Kuber [Wed, 17 Nov 2021 17:33:15 +0000 (17:33 +0000)]
Simplify diagnostic logic

The spans no longer overlap, so we no longer need to specialize the
output depending on whether they would.

2 years agotidy fix
Esteban Kuber [Tue, 16 Nov 2021 23:04:15 +0000 (23:04 +0000)]
tidy fix

2 years agoFix rebase and clippy tests
Esteban Kuber [Tue, 16 Nov 2021 22:06:25 +0000 (22:06 +0000)]
Fix rebase and clippy tests

2 years agoFix clippy uses of QPath::LangItem
Esteban Kuber [Tue, 16 Nov 2021 20:44:25 +0000 (20:44 +0000)]
Fix clippy uses of QPath::LangItem

2 years agoKeep info on pre-desugaring expression for better "incorrect `.await`" suggestion
Esteban Kuber [Tue, 16 Nov 2021 20:07:23 +0000 (20:07 +0000)]
Keep info on pre-desugaring expression for better "incorrect `.await`" suggestion

Keep the `HirId` of `.await`ed expressions so in the case of a `fn` call
on on a sync `fn`, we can suggest maybe turning it into an `async fn`.

2 years agoFix mistake
Esteban Kuber [Tue, 16 Nov 2021 03:04:36 +0000 (03:04 +0000)]
Fix mistake

2 years agoRemove unnecessary argument
Esteban Kuber [Tue, 16 Nov 2021 03:03:00 +0000 (03:03 +0000)]
Remove unnecessary argument

2 years agoRemove yet more output from `for`-loop and `?` errors
Esteban Kuber [Tue, 16 Nov 2021 02:50:30 +0000 (02:50 +0000)]
Remove yet more output from `for`-loop and `?` errors

2 years agoFurther silence `?` errors
Esteban Kuber [Tue, 16 Nov 2021 02:27:18 +0000 (02:27 +0000)]
Further silence `?` errors

2 years agoReduce verbosity for `?` on non-`Try` expressions
Esteban Kuber [Tue, 16 Nov 2021 02:17:57 +0000 (02:17 +0000)]
Reduce verbosity for `?` on non-`Try` expressions

2 years agoReduce verbosity when calling `for`-loop on non-`Iterator` expression
Esteban Kuber [Tue, 16 Nov 2021 01:46:28 +0000 (01:46 +0000)]
Reduce verbosity when calling `for`-loop on non-`Iterator` expression

2 years agoWhen `.await` is called on a non-`Future` expression, suggest removal
Esteban Kuber [Tue, 16 Nov 2021 00:57:53 +0000 (00:57 +0000)]
When `.await` is called on a non-`Future` expression, suggest removal

Keep track of the origin of a `T: Future` obligation when caused by an
`.await` expression.

Address #66731.

2 years agoAuto merge of #91353 - eggyal:reuse-rcs-during-folding, r=lcnr
bors [Mon, 13 Dec 2021 17:05:40 +0000 (17:05 +0000)]
Auto merge of #91353 - eggyal:reuse-rcs-during-folding, r=lcnr

Avoid cloning refcounted types during folding

Addresses FIXME comment created in #78313

r? `@lcnr`

2 years agoAdjust wording for review
Jack Huey [Mon, 13 Dec 2021 15:06:57 +0000 (10:06 -0500)]
Adjust wording for review

2 years agoAvoid cloning refcounted types during folding
Alan Egerton [Mon, 29 Nov 2021 12:55:00 +0000 (12:55 +0000)]
Avoid cloning refcounted types during folding

2 years agoAuto merge of #91657 - nikic:update-llvm, r=cuviper
bors [Mon, 13 Dec 2021 13:37:53 +0000 (13:37 +0000)]
Auto merge of #91657 - nikic:update-llvm, r=cuviper

Update LLVM submodule

Update LLVM submodule with recent cherry-picks. In particular:
 * https://github.com/rust-lang/llvm-project/pull/123
 * https://github.com/rust-lang/llvm-project/pull/124

2 years agoSuggest to specify a target triple when eh_personality lang item is missing
Lucas Kent [Sun, 12 Dec 2021 02:04:00 +0000 (13:04 +1100)]
Suggest to specify a target triple when eh_personality lang item is missing

2 years agoAuto merge of #91654 - nikic:llvmbc-section-flags, r=nagisa
bors [Mon, 13 Dec 2021 10:35:28 +0000 (10:35 +0000)]
Auto merge of #91654 - nikic:llvmbc-section-flags, r=nagisa

Use module inline assembly to embed bitcode

In LLVM 14, our current method of setting section flags to avoid
embedding the `.llvmbc` section into final compilation artifacts
will no longer work, see issue #90326. The upstream recommendation
is to instead embed the entire bitcode using module-level inline
assembly, which is what this change does.

I've kept the existing code for platforms where we do not need to
set section flags, but possibly we should always be using the
inline asm approach (which would have to look a bit different for MachO).

r? `@nagisa`

2 years agoStabilize const_cstr_unchecked
Konrad Borowski [Mon, 13 Dec 2021 07:43:19 +0000 (08:43 +0100)]
Stabilize const_cstr_unchecked

2 years agoAuto merge of #91626 - klensy:json-less-alloc, r=petrochenkov
bors [Mon, 13 Dec 2021 07:30:38 +0000 (07:30 +0000)]
Auto merge of #91626 - klensy:json-less-alloc, r=petrochenkov

rustc_serialize: don't allocate `String`s as key for `BTreeMap`, when `str` is enough

2 years agoI wrote these functions, I should use them dang it
Jack Huey [Mon, 13 Dec 2021 06:10:39 +0000 (01:10 -0500)]
I wrote these functions, I should use them dang it

2 years agoInstead of checking for exact bounds, try to prove them
Jack Huey [Mon, 13 Dec 2021 04:23:55 +0000 (23:23 -0500)]
Instead of checking for exact bounds, try to prove them

2 years agoMake `MaybeUninit::zeroed` `const`
woppopo [Mon, 13 Dec 2021 05:17:35 +0000 (14:17 +0900)]
Make `MaybeUninit::zeroed` `const`

2 years agoAdd -webkit-appearance: none to search input
Jacob Hoffman-Andrews [Thu, 9 Dec 2021 07:39:42 +0000 (23:39 -0800)]
Add -webkit-appearance: none to search input

This fixes an issue when displaying on iPad, where the search box had no
borders.

2 years agoAuto merge of #91569 - erikdesjardins:vt-align, r=nikic
bors [Mon, 13 Dec 2021 04:29:20 +0000 (04:29 +0000)]
Auto merge of #91569 - erikdesjardins:vt-align, r=nikic

Attach range metadata to alignment loads from vtables

...because alignment is always nonzero[0].

This helps eliminate redundant runtime alignment checks, when a DST
is a field of a struct whose remaining fields have alignment 1.

Fixes #91438.

---
[0]:

The [reference](https://doc.rust-lang.org/reference/type-layout.html) says that alignment must be at least 1.

And in practice, the alignment field for all vtables is generated here: https://github.com/rust-lang/rust/blob/772d51f887fa407216860bf8ecf3f1a32fb795b4/compiler/rustc_middle/src/ty/vtable.rs#L68-L90 and is nonzero because [`Align::bytes()`](https://github.com/rust-lang/rust/blob/772d51f887fa407216860bf8ecf3f1a32fb795b4/compiler/rustc_target/src/abi/mod.rs#L547-L549) is always nonzero.

2 years agoextra test for bug i found
Ellen [Mon, 13 Dec 2021 03:33:14 +0000 (03:33 +0000)]
extra test for bug i found

2 years agohurray for portable simd finding a nice test for this FIXME
Ellen [Mon, 13 Dec 2021 03:16:00 +0000 (03:16 +0000)]
hurray for portable simd finding a nice test for this FIXME

2 years agodoctest: Rename `options` to `rustdoc_options`
Noah Lev [Sat, 4 Dec 2021 03:54:38 +0000 (19:54 -0800)]
doctest: Rename `options` to `rustdoc_options`

These are the rustdoc-wide options. It's easy to confuse them with
options for doctests in particular, so this change should help.

2 years agoRename `TestOptions` to `GlobalTestOptions`
Noah Lev [Sat, 4 Dec 2021 03:49:31 +0000 (19:49 -0800)]
Rename `TestOptions` to `GlobalTestOptions`

It seems to apply to all doctests in the crate.

2 years agorustdoc: Coalesce some `run_test` args as one `LangString` arg
Noah Lev [Sat, 4 Dec 2021 03:43:50 +0000 (19:43 -0800)]
rustdoc: Coalesce some `run_test` args as one `LangString` arg

2 years agoAuto merge of #91841 - matthiaskrgr:rollup-zlhsg5a, r=matthiaskrgr
bors [Mon, 13 Dec 2021 00:56:18 +0000 (00:56 +0000)]
Auto merge of #91841 - matthiaskrgr:rollup-zlhsg5a, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #91086 (Implement `TryFrom<&'_ mut [T]>` for `[T; N]`)
 - #91091 (Stabilize `ControlFlow::{is_break, is_continue}`)
 - #91749 (BTree: improve public descriptions and comments)
 - #91819 (rustbot: Add autolabeling for `T-compiler`)
 - #91824 (Make `(*mut T)::write_bytes` `const`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoFix clippy tests
Amanieu d'Antras [Mon, 13 Dec 2021 00:00:51 +0000 (00:00 +0000)]
Fix clippy tests

2 years agoRollup merge of #91824 - woppopo:const_ptr_write_bytes, r=oli-obk
Matthias Krüger [Sun, 12 Dec 2021 23:20:10 +0000 (00:20 +0100)]
Rollup merge of #91824 - woppopo:const_ptr_write_bytes, r=oli-obk

Make `(*mut T)::write_bytes` `const`

Tracking issue: #86302

2 years agoRollup merge of #91819 - rust-lang:compiler-autolabel, r=jackh726
Matthias Krüger [Sun, 12 Dec 2021 23:20:09 +0000 (00:20 +0100)]
Rollup merge of #91819 - rust-lang:compiler-autolabel, r=jackh726

rustbot: Add autolabeling for `T-compiler`

This commit adds autolabeling for the `T-compiler` label, for PRs that
modify rustc's source code or tests (currently only `src/test/ui`).

This is possible now that rust-lang/triagebot#1321 has landed.

2 years agoRollup merge of #91749 - ssomers:btree_comments, r=Mark-Simulacrum
Matthias Krüger [Sun, 12 Dec 2021 23:20:08 +0000 (00:20 +0100)]
Rollup merge of #91749 - ssomers:btree_comments, r=Mark-Simulacrum

BTree: improve public descriptions and comments

BTreeSet has always used the term "value" next to and meaning the same thing as "elements" (in the mathematical sense but also used for key-value pairs in BTreeMap), while in the BTreeMap sense these "values" are known as "keys" and definitely not "values". Today I had enough of that.

r? `@Mark-Simulacrum`

2 years agoRollup merge of #91091 - ecstatic-morse:control-flow-enum-is, r=m-ou-se
Matthias Krüger [Sun, 12 Dec 2021 23:20:07 +0000 (00:20 +0100)]
Rollup merge of #91091 - ecstatic-morse:control-flow-enum-is, r=m-ou-se

Stabilize `ControlFlow::{is_break, is_continue}`

The type itself was stabilized in 1.55, but using it is not ergonomic without these helper functions. Stabilize them.

r? rust-lang/libs-api

2 years agoRollup merge of #91086 - rhysd:issue-91085, r=m-ou-se
Matthias Krüger [Sun, 12 Dec 2021 23:20:06 +0000 (00:20 +0100)]
Rollup merge of #91086 - rhysd:issue-91085, r=m-ou-se

Implement `TryFrom<&'_ mut [T]>` for `[T; N]`

Fixes #91085.

2 years agoAuto merge of #91549 - fee1-dead:const_env, r=spastorino
bors [Sun, 12 Dec 2021 22:15:32 +0000 (22:15 +0000)]
Auto merge of #91549 - fee1-dead:const_env, r=spastorino

Eliminate ConstnessAnd again

Closes #91489.
Closes #89432.

Reverts #91491.
Reverts #89450.

r? `@spastorino`

2 years agoFix unused import in test
Amanieu d'Antras [Sun, 12 Dec 2021 21:11:15 +0000 (21:11 +0000)]
Fix unused import in test

2 years agorustbot: Add autolabeling for `T-compiler`
Noah Lev [Sun, 12 Dec 2021 02:03:52 +0000 (18:03 -0800)]
rustbot: Add autolabeling for `T-compiler`

This commit adds autolabeling for the `T-compiler` label, for PRs that
modify rustc's source code or tests (currently only `src/test/ui`).

This is possible now that rust-lang/triagebot#1321 has landed.

2 years agoAuto merge of #90716 - euclio:libloading, r=cjgillot
bors [Sun, 12 Dec 2021 17:28:52 +0000 (17:28 +0000)]
Auto merge of #90716 - euclio:libloading, r=cjgillot

replace dynamic library module with libloading

This PR deletes the `rustc_metadata::dynamic_lib` module in favor of the popular and better tested [`libloading` crate](https://github.com/nagisa/rust_libloading/).

We don't benefit from `libloading`'s symbol lifetimes since we end up leaking the loaded library in all cases, but the call-sites look much nicer by improving error handling and abstracting away some transmutes. We also can remove `rustc_metadata`'s direct dependencies on `libc` and `winapi`.

This PR also adds an exception for `libloading` (and its license) to tidy, so this will need sign-off from the compiler team.

2 years agoAuto merge of #90207 - BoxyUwU:stabilise_cg_defaults, r=lcnr
bors [Sun, 12 Dec 2021 14:24:23 +0000 (14:24 +0000)]
Auto merge of #90207 - BoxyUwU:stabilise_cg_defaults, r=lcnr

Stabilise `feature(const_generics_defaults)`

`feature(const_generics_defaults)` is complete implementation wise and has a pretty extensive test suite so I think is ready for stabilisation.

needs stabilisation report and maybe an RFC :sweat_smile:

r? `@lcnr`
cc `@rust-lang/project-const-generics`

2 years agoclippy owo
Ellen [Sun, 12 Dec 2021 12:34:21 +0000 (12:34 +0000)]
clippy owo

2 years agoAddress review feedback
Amanieu d'Antras [Sat, 11 Dec 2021 00:11:26 +0000 (00:11 +0000)]
Address review feedback

2 years agoRe-bless asm tests for aarch64
Amanieu d'Antras [Sat, 11 Dec 2021 00:11:10 +0000 (00:11 +0000)]
Re-bless asm tests for aarch64

2 years agoAuto merge of #90423 - Aaron1011:deduplicate-projection, r=jackh726
bors [Sun, 12 Dec 2021 11:24:20 +0000 (11:24 +0000)]
Auto merge of #90423 - Aaron1011:deduplicate-projection, r=jackh726

Deduplicate projection sub-obligations

2 years agoStabilize asm! and global_asm!
Amanieu d'Antras [Fri, 10 Dec 2021 00:15:33 +0000 (00:15 +0000)]
Stabilize asm! and global_asm!

They are also removed from the prelude as per the decision in
https://github.com/rust-lang/rust/issues/87228.

stdarch and compiler-builtins are updated to work with the new, stable
asm! and global_asm! macros.

2 years agoRemove automatic rustfix of asm! to llvm_asm!
Amanieu d'Antras [Thu, 9 Dec 2021 18:48:19 +0000 (18:48 +0000)]
Remove automatic rustfix of asm! to llvm_asm!

This no longer works now that asm! needs an explicit import. Also, it's
been over a year since asm! landed, everyone should have transitioned by
now.

2 years agoAuto merge of #91825 - matthiaskrgr:rollup-e4s8lwp, r=matthiaskrgr
bors [Sun, 12 Dec 2021 06:54:28 +0000 (06:54 +0000)]
Auto merge of #91825 - matthiaskrgr:rollup-e4s8lwp, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #91746 (Btree: assert more API compatibility)
 - #91748 (rustdoc: Add regression test for Iterator as notable trait on &mut T)
 - #91811 (bootstrap: Change unwrap() to expect() for WIX path)
 - #91814 (doc: fix typo in comments)
 - #91815 (better span for unexpected normalization failure in CTFE engine)
 - #91817 (rustbot: Add autolabeling for `T-rustdoc`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoRollup merge of #91817 - rust-lang:rustdoc-autolabel, r=Mark-Simulacrum
Matthias Krüger [Sun, 12 Dec 2021 06:45:32 +0000 (07:45 +0100)]
Rollup merge of #91817 - rust-lang:rustdoc-autolabel, r=Mark-Simulacrum

rustbot: Add autolabeling for `T-rustdoc`

This commit adds autolabeling for the `T-rustdoc` label, for PRs that
modify rustdoc's source code, tests, or internal tooling.

This is possible now that rust-lang/triagebot#1321 has landed.

2 years agoRollup merge of #91815 - RalfJung:span, r=oli-obk
Matthias Krüger [Sun, 12 Dec 2021 06:45:31 +0000 (07:45 +0100)]
Rollup merge of #91815 - RalfJung:span, r=oli-obk

better span for unexpected normalization failure in CTFE engine

No reason to use `DUMMY_SP` here.

2 years agoRollup merge of #91814 - japm48:spelling-fix, r=RalfJung
Matthias Krüger [Sun, 12 Dec 2021 06:45:30 +0000 (07:45 +0100)]
Rollup merge of #91814 - japm48:spelling-fix, r=RalfJung

doc: fix typo in comments

`dereferencable -> dereferenceable`

Fixes #91802.

2 years agoRollup merge of #91811 - itzurabhi:boostrap-dist-wix-unwrap-issue, r=Mark-Simulacrum
Matthias Krüger [Sun, 12 Dec 2021 06:45:29 +0000 (07:45 +0100)]
Rollup merge of #91811 - itzurabhi:boostrap-dist-wix-unwrap-issue, r=Mark-Simulacrum

bootstrap: Change unwrap() to expect() for WIX path

On Windows, `x.py dist` command panics without proper error message if `WIX` environment variable is not set. This patch changes `Option::unwrap()` to `Option::expect()`.

2 years agoRollup merge of #91748 - notriddle:notriddle/doc-notable_trait-mut_t_is_not_an_iterat...
Matthias Krüger [Sun, 12 Dec 2021 06:45:28 +0000 (07:45 +0100)]
Rollup merge of #91748 - notriddle:notriddle/doc-notable_trait-mut_t_is_not_an_iterator, r=Mark-Simulacrum

rustdoc: Add regression test for Iterator as notable trait on &mut T

Closes #80737

2 years agoRollup merge of #91746 - ssomers:btree_tests, r=Mark-Simulacrum
Matthias Krüger [Sun, 12 Dec 2021 06:45:28 +0000 (07:45 +0100)]
Rollup merge of #91746 - ssomers:btree_tests, r=Mark-Simulacrum

Btree: assert more API compatibility

Introducing a member such as `BTreeSet::min()` would silently break compatibility if no code calls the existing `BTreeSet::min(set)`. `BTreeSet` is the only btree class silently bringing in stable members, apart from many occurrences of `#[derive(Debug)]` on iterators.

r? `@Mark-Simulacrum`

2 years agoMake `(*mut T)::write_bytes` `const`
woppopo [Sun, 12 Dec 2021 05:02:53 +0000 (14:02 +0900)]
Make `(*mut T)::write_bytes` `const`

2 years agoRemove function from rebase
Deadbeef [Sun, 12 Dec 2021 04:52:30 +0000 (12:52 +0800)]
Remove function from rebase

2 years agoSmall performance tweaks
Deadbeef [Wed, 8 Dec 2021 13:08:44 +0000 (21:08 +0800)]
Small performance tweaks

2 years agoRemap more env constness for queries
Deadbeef [Tue, 7 Dec 2021 12:40:06 +0000 (20:40 +0800)]
Remap more env constness for queries

2 years agoRemap predicate/env constness before querying
Deadbeef [Tue, 7 Dec 2021 08:08:59 +0000 (16:08 +0800)]
Remap predicate/env constness before querying

2 years agoQuery modifier
Deadbeef [Mon, 6 Dec 2021 11:47:54 +0000 (19:47 +0800)]
Query modifier

2 years agoAdd trailing newline
Deadbeef [Sun, 5 Dec 2021 11:03:01 +0000 (19:03 +0800)]
Add trailing newline

2 years agoRevert "Auto merge of #89450 - usbalbin:const_try_revert, r=oli-obk"
Deadbeef [Sun, 5 Dec 2021 10:46:29 +0000 (18:46 +0800)]
Revert "Auto merge of #89450 - usbalbin:const_try_revert, r=oli-obk"

This reverts commit a8387aef8c378a771686878062e544af4d5e2245, reversing
changes made to 6e1211081239be62a5d0bb3bbcb29a9f14621c81.

2 years agoRevert "Auto merge of #91491 - spastorino:revert-91354, r=oli-obk"
Deadbeef [Sun, 12 Dec 2021 04:34:46 +0000 (12:34 +0800)]
Revert "Auto merge of #91491 - spastorino:revert-91354, r=oli-obk"

This reverts commit ff2439b7b9bafcfdff86b7847128014699df8442, reversing
changes made to 2a9e0831d6603d87220cedd1b1293e2eb82ef55c.

2 years agoadd regression test for #91489
SNCPlay42 [Fri, 3 Dec 2021 16:31:06 +0000 (16:31 +0000)]
add regression test for #91489

2 years agoFix #91489
Deadbeef [Mon, 6 Dec 2021 12:46:05 +0000 (20:46 +0800)]
Fix #91489

2 years agoAuto merge of #89404 - Kobzol:hash-stable-sort, r=Mark-Simulacrum
bors [Sun, 12 Dec 2021 03:50:30 +0000 (03:50 +0000)]
Auto merge of #89404 - Kobzol:hash-stable-sort, r=Mark-Simulacrum

Slightly optimize hash map stable hashing

I was profiling some of the `rustc-perf` benchmarks locally and noticed that quite some time is spent inside the stable hash of hashmaps. I tried to use a `SmallVec` instead of a `Vec` there, which helped very slightly.

Then I tried to remove the sorting, which was a bottleneck, and replaced it with insertion into a binary heap. Locally, it yielded nice improvements in instruction counts and RSS in several benchmarks for incremental builds. The implementation could probably be much nicer and possibly extended to other stable hashes, but first I wanted to test the perf impact properly.

Can I ask someone to do a perf run? Thank you!

2 years agoAuto merge of #91813 - matthiaskrgr:rollup-nryyeyj, r=matthiaskrgr
bors [Sun, 12 Dec 2021 00:58:30 +0000 (00:58 +0000)]
Auto merge of #91813 - matthiaskrgr:rollup-nryyeyj, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #90081 (Make `intrinsics::write_bytes` const)
 - #91643 (asm: Allow using r9 (ARM) and x18 (AArch64) if they are not reserved by the current target)
 - #91737 (Make certain panicky stdlib functions behave better under panic_immediate_abort)
 - #91750 (rustdoc: Add regression test for Iterator as notable trait on &T)
 - #91764 (Do not ICE when suggesting elided lifetimes on non-existent spans.)
 - #91780 (Remove hir::Node::hir_id.)
 - #91797 (Fix zero-sized reference to deallocated memory)
 - #91806 (Make `Unique`s methods `const`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agorustbot: Add autolabeling for `T-rustdoc`
Noah Lev [Sun, 12 Dec 2021 00:51:07 +0000 (16:51 -0800)]
rustbot: Add autolabeling for `T-rustdoc`

This commit adds autolabeling for the `T-rustdoc` label, for PRs that
modify rustdoc's source code, tests, or internal tooling.

This is possible now that rust-lang/triagebot#1321 has landed.

2 years agobetter span for unexpected normalization failure in CTFE engine
Ralf Jung [Sat, 11 Dec 2021 23:55:58 +0000 (18:55 -0500)]
better span for unexpected normalization failure in CTFE engine