Commit graph

159612 commits

Author SHA1 Message Date
LegionMammal978
77a0c65264 Remove in_band_lifetimes from rustc_query_impl
See #91867 for more information.
2021-12-14 12:13:07 -05:00
bors
404c8471ab 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
2021-12-14 11:30:17 +00:00
Matthias Krüger
1dde0dbbf5
Rollup merge of #91893 - pitaj:91867-hir, r=davidtwco
Remove `in_band_lifetimes` from `rustc_hir`

#91867
2021-12-14 10:21:07 +01:00
Matthias Krüger
d0e6bb7076
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
2021-12-14 10:21:07 +01:00
Matthias Krüger
3a42dc8be1
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.
2021-12-14 10:21:06 +01:00
Matthias Krüger
b50bb65c2a
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``
2021-12-14 10:21:05 +01:00
Matthias Krüger
75e8d65ccd
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>;
}
```
2021-12-14 10:21:04 +01:00
Matthias Krüger
dfec47fe91
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
2021-12-14 10:21:03 +01:00
Matthias Krüger
7ec00cd135
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.
2021-12-14 10:21:02 +01:00
bors
83b32f27fc 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]`.
2021-12-14 08:22:31 +00:00
Michael Goulet
75729afcc0 Fix HashStable implementation on InferTy 2021-12-13 20:36:17 -08:00
Peter Jaszkowiak
7085b4e117 Remove in_band_lifetimes from rustc_hir 2021-12-13 21:33:53 -07:00
bors
7ca74ea0af 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.
2021-12-14 04:29:54 +00:00
LegionMammal978
a19eaf3542 Remove in_band_lifetimes from rustc_const_eval
See #91867 for more information.
2021-12-13 22:39:00 -05:00
bors
a2d25b4ff7 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.
2021-12-14 01:39:01 +00:00
b-naber
f3ecd64c61 use try_normalize_erasing_regions in RevealAllVisitor 2021-12-13 23:13:24 +01:00
bors
8f117a77d0 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
2021-12-13 20:12:35 +00:00
Matthias Krüger
ff214b745d
Rollup merge of #91855 - xfix:const_cstr_unchecked, r=dtolnay
Stabilize const_cstr_unchecked

Closes #90343

``@rustbot`` modify labels: +T-libs-api
2021-12-13 18:15:17 +01:00
Matthias Krüger
84878336b0
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``
2021-12-13 18:15:16 +01:00
Matthias Krüger
f8de2f56e8
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
2021-12-13 18:15:15 +01:00
Matthias Krüger
dca8ddeade
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`
2021-12-13 18:15:14 +01:00
Matthias Krüger
e354f0ce87
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
2021-12-13 18:15:13 +01:00
bors
1796de7bb1 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`
2021-12-13 17:05:40 +00:00
Jack Huey
48974158f1 Adjust wording for review 2021-12-13 10:06:57 -05:00
Alan Egerton
5920a1d948
Avoid cloning refcounted types during folding 2021-12-13 14:27:26 +00:00
bors
06a6674a7d 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
2021-12-13 13:37:53 +00:00
Lucas Kent
fae40c5070 Suggest to specify a target triple when eh_personality lang item is missing 2021-12-14 00:04:15 +11:00
bors
a737592a3d 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`
2021-12-13 10:35:28 +00:00
Konrad Borowski
23e4aeb140 Stabilize const_cstr_unchecked 2021-12-13 08:43:19 +01:00
bors
6d6d0899c8 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
2021-12-13 07:30:38 +00:00
Jack Huey
7cbd0dcf93 I wrote these functions, I should use them dang it 2021-12-13 01:10:39 -05:00
Jack Huey
8a28c172a1 Instead of checking for exact bounds, try to prove them 2021-12-13 00:48:46 -05:00
woppopo
2a5a6680fc Make MaybeUninit::zeroed const 2021-12-13 14:17:35 +09:00
Jacob Hoffman-Andrews
da472a5a84 Add -webkit-appearance: none to search input
This fixes an issue when displaying on iPad, where the search box had no
borders.
2021-12-12 20:33:18 -08:00
bors
4a7fb971c9 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: 772d51f887/compiler/rustc_middle/src/ty/vtable.rs (L68-L90) and is nonzero because [`Align::bytes()`](772d51f887/compiler/rustc_target/src/abi/mod.rs (L547-L549)) is always nonzero.
2021-12-13 04:29:20 +00:00
Ellen
6c79595134 extra test for bug i found 2021-12-13 03:33:14 +00:00
Ellen
5ab1329b58 hurray for portable simd finding a nice test for this FIXME 2021-12-13 03:16:00 +00:00
Noah Lev
9afa190c44 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.
2021-12-12 17:46:19 -08:00
Noah Lev
5e33e6affd Rename TestOptions to GlobalTestOptions
It seems to apply to all doctests in the crate.
2021-12-12 17:46:19 -08:00
Noah Lev
b345e18462 rustdoc: Coalesce some run_test args as one LangString arg 2021-12-12 17:46:18 -08:00
bors
f7fd79ac1d 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
2021-12-13 00:56:18 +00:00
Matthias Krüger
9e662d0c03
Rollup merge of #91824 - woppopo:const_ptr_write_bytes, r=oli-obk
Make `(*mut T)::write_bytes` `const`

Tracking issue: #86302
2021-12-13 00:20:10 +01:00
Matthias Krüger
3b79d4f0b7
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.
2021-12-13 00:20:09 +01:00
Matthias Krüger
87cda671e5
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`
2021-12-13 00:20:08 +01:00
Matthias Krüger
6227d42928
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
2021-12-13 00:20:07 +01:00
Matthias Krüger
42f8d4833f
Rollup merge of #91086 - rhysd:issue-91085, r=m-ou-se
Implement `TryFrom<&'_ mut [T]>` for `[T; N]`

Fixes #91085.
2021-12-13 00:20:06 +01:00
bors
22f8bde876 Auto merge of #91549 - fee1-dead:const_env, r=spastorino
Eliminate ConstnessAnd again

Closes #91489.
Closes #89432.

Reverts #91491.
Reverts #89450.

r? `@spastorino`
2021-12-12 22:15:32 +00:00
Noah Lev
1f65adfabf 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.
2021-12-12 11:10:05 -08:00
bors
6bda5b331c 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.
2021-12-12 17:28:52 +00:00
bors
753e569c9c 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 😅

r? `@lcnr`
cc `@rust-lang/project-const-generics`
2021-12-12 14:24:23 +00:00