Commit Graph

211046 Commits

Author SHA1 Message Date
Dylan DPC
d3e9191875
Rollup merge of #104286 - ozkanonur:fix-doc-bootstrap-recompilation, r=jyn514
copy doc output files by format

This pr provides copying doc outputs by checking output format without removing output directory on each trigger.

Resolves #103785
2022-11-23 20:32:36 +05:30
Dylan DPC
bd91c94a5d
Rollup merge of #104269 - compiler-errors:hang-in-where-clause-sugg, r=lcnr
Fix hang in where-clause suggestion with `predicate_can_apply`

Using `predicate_may_hold` during error reporting causes an evaluation overflow, which (because we use `evaluate_obligation_no_overflow`) then causes the predicate to need to be re-evaluated locally, which results in a hang.

... but since the "add a where clause" suggestion is best-effort, just throw any overflow errors. No need for 100% accuracy.

r? `@lcnr` who has been thinking about overflows... Let me know if you want more context about this issue, and as always, feel free to reassign.

Fixes #104225
2022-11-23 20:32:35 +05:30
bors
4e0d0d757e Auto merge of #102750 - the8472:opt-field-order, r=wesleywiser
optimize field ordering by grouping m*2^n-sized fields with equivalently aligned ones

```rust
use std::ptr::addr_of;
use std::mem;

struct Foo {
    word: u32,
    byte: u8,
    ary: [u8; 4]
}

fn main() {
    let foo: Foo = unsafe { mem::zeroed() };

    println!("base: {:p}\nword: {:p}\nbyte: {:p}\nary:  {:p}", &foo, addr_of!(foo.word), addr_of!(foo.byte), addr_of!(foo.ary));
}
```

prints

```
base: 0x7fffc1a8a668
word: 0x7fffc1a8a668
byte: 0x7fffc1a8a66c
ary:  0x7fffc1a8a66d
```

I.e. the `u8` in the middle causes the array to sit at an odd offset, which might prevent optimizations, especially on architectures where unaligned loads are costly.

Note that this will make field ordering niche-dependent, i.e. a `Bar<T>` with `T=char` and `T=u32` may result in different field order, this may break some code that makes invalid assumptions about `repr(Rust)` types.
2022-11-23 10:01:48 +00:00
bors
3f2b2eee8f Auto merge of #104758 - Manishearth:rollup-rh1tfum, r=Manishearth
Rollup of 6 pull requests

Successful merges:

 - #103488 (Allow opaque types in trait impl headers and rely on coherence to reject unsound cases)
 - #104359 (Refactor must_use lint into two parts)
 - #104612 (Lower return type outside async block creation)
 - #104621 (Fix --extern library finding errors)
 - #104647 (enable fuzzy_provenance_casts lint in liballoc and libstd)
 - #104750 (Bump `fd-lock` in `bootstrap` again)

Failed merges:

 - #104732 (Refactor `ty::ClosureKind` related stuff)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-23 06:48:56 +00:00
Michael Goulet
9decfff6f8 Add fatal overflow test 2022-11-23 05:35:49 +00:00
Michael Goulet
a884a9e634 Drive-by: Don't manually call evaluate_obligation_no_overflow 2022-11-23 04:42:38 +00:00
Michael Goulet
cbe9328018 Do not need to account for overflow in predicate_can_apply 2022-11-23 04:42:38 +00:00
Manish Goregaokar
42afb70f2f
Rollup merge of #104750 - mati865:bump-fd-lock-again, r=jyn514
Bump `fd-lock` in `bootstrap` again

Followup to https://github.com/rust-lang/rust/pull/103778
Sorry for the quick succession but this fixes one more building issue for Tier 3 `windows-gnullvm` that I have previously missed, and it would be nice to have it in the release.
2022-11-22 22:54:41 -05:00
Manish Goregaokar
316bda89e4
Rollup merge of #104647 - RalfJung:alloc-strict-provenance, r=thomcc
enable fuzzy_provenance_casts lint in liballoc and libstd

r? ````@thomcc````
2022-11-22 22:54:41 -05:00
Manish Goregaokar
54b6292855
Rollup merge of #104621 - YC:master, r=davidtwco
Fix --extern library finding errors

- `crate_name` is not specified/passed to `metadata_crate_location_unknown_type`
c493bae0d8/compiler/rustc_error_messages/locales/en-US/metadata.ftl (L274-L275)
- `metadata_lib_filename_form` is missing `$`
- Add additional check to ensure that library is file

Testing
1. Create file `a.rs`
```rust
extern crate t;
fn main() {}
```
1. Create empty file `x`
1. Create empty directory `y`
1. Run
```sh
$ rustc -o a a.rs --extern t=x
$ rustc -o a a.rs --extern t=y
```
Both currently panic with stable.
2022-11-22 22:54:40 -05:00
Manish Goregaokar
36815c6e3b
Rollup merge of #104612 - Swatinem:async-ret-y, r=estebank
Lower return type outside async block creation

This allows feeding a different output type to async blocks with a different `ImplTraitContext`. Spotted this while working on #104321
2022-11-22 22:54:39 -05:00
Manish Goregaokar
a673364c54
Rollup merge of #104359 - Nilstrieb:plus-one, r=fee1-dead
Refactor must_use lint into two parts

Before, the lint did the checking for `must_use` and pretty printing the types in a special format in one pass, causing quite complex and untranslatable code.
Now the collection and printing is split in two. That should also make it easier to translate or extract the type pretty printing in the future.

Also fixes an integer overflow in the array length pluralization
calculation.

fixes #104352
2022-11-22 22:54:39 -05:00
Manish Goregaokar
53eab246db
Rollup merge of #103488 - oli-obk:impl_trait_for_tait, r=lcnr
Allow opaque types in trait impl headers and rely on coherence to reject unsound cases

r? ````@lcnr````

fixes #99840
2022-11-22 22:54:38 -05:00
bors
008bc1d587 Auto merge of #104752 - weihanglo:update-cargo, r=weihanglo
Update cargo

7 commits in eb5d35917b2395194593c9ca70c3778f60c1573b..ba607b23db8398723d659249d9abf5536bc322e5 2022-11-17 22:08:43 +0000 to 2022-11-22 20:52:39 +0000

- Fix failure to parse rustc's JSON output if it is too nested (rust-lang/cargo#11368)
- Add suggestions when `cargo add` multiple packages (rust-lang/cargo#11186)
- Update mod.rs (rust-lang/cargo#11395)
- Fix typo `try use` -> `try to use` (rust-lang/cargo#11394)
- Add warning when `cargo tree -i <spec>` can not find packages (rust-lang/cargo#11377)
- Clean profile, patch, and replace in cargo remove (rust-lang/cargo#11194)
- chore: Upgrade miow (rust-lang/cargo#11391)
2022-11-23 03:17:56 +00:00
Weihang Lo
8a808dc5b4
Update cargo
7 commits in eb5d35917b2395194593c9ca70c3778f60c1573b..ba607b23db8398723d659249d9abf5536bc322e5
2022-11-17 22:08:43 +0000 to 2022-11-22 20:52:39 +0000

- Fix failure to parse rustc's JSON output if it is too nested (rust-lang/cargo#11368)
- Add suggestions when `cargo add` multiple packages (rust-lang/cargo#11186)
- Update mod.rs (rust-lang/cargo#11395)
- Fix typo `try use` -> `try to use` (rust-lang/cargo#11394)
- Add warning when `cargo tree -i <spec>` can not find packages (rust-lang/cargo#11377)
- Clean profile, patch, and replace in cargo remove (rust-lang/cargo#11194)
- chore: Upgrade miow (rust-lang/cargo#11391)
2022-11-23 01:02:04 +00:00
bors
604d52108e Auto merge of #104743 - JohnTitor:rollup-9z9u7yd, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #101368 (Forbid inlining `thread_local!`'s `__getit` function on Windows)
 - #102293 (Add powerpc64-ibm-aix as Tier-3 target)
 - #104717 (Add failing test for projections used as const generic)
 - #104720 (rustdoc: remove no-op CSS `.popover::before / a.test-arrow { display: inline-block }`)
 - #104722 (Speed up mpsc_stress test)
 - #104724 (Fix `ClosureKind::to_def_id`)
 - #104728 (Use `tcx.require_lang_item` instead of unwrapping lang items)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-22 23:43:13 +00:00
Mateusz Mikuła
cd22ce6bd9 Bump fd-lock in bootstrap again
Followup to https://github.com/rust-lang/rust/pull/103778
Sorry for the quick succession but this fixes one more building issue for Tier 3 `windows-gnullvm` that I have previously missed, and it would be nice to have it in the release.
2022-11-23 00:12:57 +01:00
The 8472
c1f392dbc0 add tests for field ordering optimization 2022-11-22 23:12:26 +01:00
The 8472
a9128d8927 fix tests, update size asserts 2022-11-22 23:12:26 +01:00
The 8472
97d8a9bdd3 also sort fields by niche sizes to retain optimizations 2022-11-22 23:12:26 +01:00
The 8472
a3450d060d group fields based on largest power of two dividing its size 2022-11-22 23:12:26 +01:00
The 8472
9f0cb566ea optimize field ordering by grouping power-of-two arrays with larger types 2022-11-22 23:12:26 +01:00
Yuki Okushi
3ec1ca0516
Rollup merge of #104728 - WaffleLapkin:require-lang-items-politely, r=compiler-errors
Use `tcx.require_lang_item` instead of unwrapping lang items

I clearly remember esteban telling me that there is `require_lang_item` but he was from a phone atm and I couldn't find it, so I didn't use it. Stumbled on it today, so here we are :)
2022-11-23 06:40:24 +09:00
Yuki Okushi
dcbfb9776d
Rollup merge of #104724 - WaffleLapkin:to_def_idn't, r=compiler-errors
Fix `ClosureKind::to_def_id`

`Fn` and `FnOnce` were mixed up in https://github.com/rust-lang/rust/pull/99131.
2022-11-23 06:40:24 +09:00
Yuki Okushi
0115969dd3
Rollup merge of #104722 - mejrs:stress, r=ChrisDenton
Speed up mpsc_stress test

See https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/mpsc_stress for context

r? windows
2022-11-23 06:40:23 +09:00
Yuki Okushi
708f7c5ae1
Rollup merge of #104720 - notriddle:notriddle/popover-before-display-inline, r=GuillaumeGomez
rustdoc: remove no-op CSS `.popover::before / a.test-arrow { display: inline-block }`

Since this box is absolutely positioned, its display type is [blockified] anyway. We just need to make sure it isn't `display: none`.

[blockified]: https://www.w3.org/TR/css-display-3/#transformations
2022-11-23 06:40:23 +09:00
Yuki Okushi
ecf2536b03
Rollup merge of #104717 - GuillaumeGomez:test-projection-used-as-const-generic, r=oli-obk
Add failing test for projections used as const generic

Based on the experiment done in https://github.com/rust-lang/rust/pull/104443, we realized it's currently not possible to support projections in const generics. More information about it in https://github.com/rust-lang/rust/pull/104443#discussion_r1029375633.

This PR adds the UI test in any case so we can gather data in order to work towards adding `TyAlias` into the ABI in the future.

r? ``@oli-obk``
2022-11-23 06:40:22 +09:00
Yuki Okushi
b162bb4270
Rollup merge of #102293 - ecnelises:aix.initial, r=davidtwco
Add powerpc64-ibm-aix as Tier-3 target

This is part of the effort mentioned in https://github.com/rust-lang/compiler-team/issues/553.

A reference to these options are definitions from [clang](ad6fe32032/clang/lib/Basic/Targets/PPC.h (L414-L448)) and [llvm](https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp).

AIX has a system `ld` but [its options and behaviors](https://www.ibm.com/docs/en/aix/7.3?topic=l-ld-command) are different from GNU ld. Thanks to ``@bzEq`` for contributing the linking args.
2022-11-23 06:40:22 +09:00
Yuki Okushi
2f506e6dd4
Rollup merge of #101368 - thomcc:wintls-noinline, r=ChrisDenton
Forbid inlining `thread_local!`'s `__getit` function on Windows

Sadly, this will make things slower to avoid UB in an edge case, but it seems hard to avoid... and really whenever I look at this code I can't help but think we're asking for trouble.

It's pretty dodgy for us to leave this as a normal function rather than `#[inline(never)]`, given that if it *does* get inlined into a dynamically linked component, it's extremely unsafe (you get some other thread local, or if you're lucky, crash). Given that it's pretty rare for people to use dylibs on Windows, the fact that we haven't gotten bug reports about it isn't really that convincing. Ideally we'd come up with some kind of compiler solution (that avoids paying for this cost when static linking, or *at least* for use within the same crate...), but it's not clear what that looks like.

Oh, and because all this is only needed when we're implementing `thread_local!` with `#[thread_local]`, this patch adjusts the `cfg_attr` to be `all(windows, target_thread_local)` as well.

r? ``@ChrisDenton``

See also #84933, which is about improving the situation.
2022-11-23 06:40:21 +09:00
bors
ff8c8dfbe6 Auto merge of #104735 - the8472:simd-contains-fix, r=thomcc
Simd contains fix

Fixes #104726

The bug was introduced by an improvement late in the original PR (#103779) which added the backtracking when the last and first byte of the needle were the same. That changed the meaning of the variable for the last probe offset, which I should have split into the last byte offset and last probe offset. Not doing so lead to incorrect loop conditions.
2022-11-22 20:47:17 +00:00
The 8472
3ed8fccff5 fix OOB access in SIMD impl of str.contains() 2022-11-22 20:59:19 +01:00
The 8472
d576a9b241 add test for issue 104726 2022-11-22 20:58:43 +01:00
mejrs
f2830f2c88 Speed up mpsc_stress test 2022-11-22 19:11:12 +01:00
Maybe Waffle
b80356a5ab Use tcx.require_lang_item instead of unwrapping 2022-11-22 17:19:19 +00:00
bors
e221616639 Auto merge of #104688 - flip1995:clippyup, r=Manishearth,flip1995
Update Clippy

r? `@Manishearth`

Sorry for taking so long. There were so many blockers and so little time. This situation should be mitigated with #104007 in the future.
2022-11-22 17:09:06 +00:00
Maybe Waffle
04610ad129 Fix ClosureKind::to_def_id 2022-11-22 16:45:06 +00:00
Michael Howell
d632ca79ac rustdoc: remove no-op CSS a.test-arrow { display: inline-block }
Since this box is absolutely positioned, its display type is [blockified]
anyway. We just need to make sure it isn't `display: none`.

[blockified]: https://www.w3.org/TR/css-display-3/#transformations
2022-11-22 09:06:24 -07:00
Michael Howell
5fe6599db2 rustdoc: remove no-op CSS .popover::before { display: inline-block }
Since this box is absolutely positioned, its display type is [blockified]
anyway. We just need to make sure it isn't `display: none`.

[blockified]: https://www.w3.org/TR/css-display-3/#transformations
2022-11-22 08:21:10 -07:00
Guillaume Gomez
2d5d692053 Add failing test for projections used as const generic 2022-11-22 16:02:37 +01:00
Philipp Krones
5e6a9a40a9
Clippy: Workaround for let_chains issue 2022-11-22 14:30:29 +01:00
bors
66ccf36f16 Auto merge of #104711 - Dylan-DPC:rollup-gkw1qr8, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #104295 (Check generics parity before collecting return-position `impl Trait`s in trait)
 - #104464 (Reduce exceptions overallocation on non Windows x86_64)
 - #104615 (Create def_id for async fns during lowering)
 - #104669 (Only declare bindings for if-let guards once per arm)
 - #104701 (Remove a lifetime resolution hack from `compare_predicate_entailment`)
 - #104710 (disable strict-provenance-violating doctests in Miri)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-22 13:18:45 +00:00
Dylan DPC
a40659ded3
Rollup merge of #104710 - RalfJung:doc-strict-provenance, r=thomcc
disable strict-provenance-violating doctests in Miri

Most of these are on deprecated unstable functions anyway. This lets us run the remaining doctests with `-Zmiri-strict-provenance`, which I think is a win.

r? `@thomcc`
2022-11-22 16:36:39 +05:30
Dylan DPC
b12d31f166
Rollup merge of #104701 - compiler-errors:rpitit-remove-reempty-hack, r=TaKO8Ki
Remove a lifetime resolution hack from `compare_predicate_entailment`

This is not needed anymore, probably due to #102334 equating the function signatures fully in `collect_trait_impl_trait_tys`. Also, the assertion in in #102903 makes sure that this is actually fixed, so I'm pretty confident this isn't needed.
2022-11-22 16:36:38 +05:30
Dylan DPC
d29491aba0
Rollup merge of #104669 - LeSeulArtichaut:88015-if-let-guard-bindings, r=cjgillot
Only declare bindings for if-let guards once per arm

Currently, each candidate for a match arm uses separate locals for the bindings in the if-let guard, causing problems (#88015) when those branches converge in the arm body.

Fixes #88015 (🤞)
2022-11-22 16:36:38 +05:30
Dylan DPC
88542a3150
Rollup merge of #104615 - spastorino:create-async-def-id-in-lowering, r=compiler-errors
Create def_id for async fns during lowering

r? `@compiler-errors`
2022-11-22 16:36:37 +05:30
Dylan DPC
20d6a44334
Rollup merge of #104464 - mati865:reduce-eh-overallocation-amd64, r=thomcc
Reduce exceptions overallocation on non Windows x86_64

Addressing https://github.com/rust-lang/rust/pull/103894#discussion_r1020950196
2022-11-22 16:36:37 +05:30
Dylan DPC
680ba90f96
Rollup merge of #104295 - compiler-errors:rpitit-generics-parity, r=eholk
Check generics parity before collecting return-position `impl Trait`s in trait

The only thing is that this duplicates the error message for number of generics mismatch, but we already deduplicate that error message in Cargo. I could add a flag to delay the error if the reviewer cares.

Fixes #104281

Also drive-by adds a few comments to the `collect_trait_impl_trait_tys` method, and removes an unused argument from `compare_number_of_generics`.
2022-11-22 16:36:36 +05:30
Ralf Jung
3a95e12c9b disable strict-provenance-violating doctests in Miri 2022-11-22 11:49:02 +01:00
bors
b7463e8bdb Auto merge of #103578 - petrochenkov:nofict, r=nagisa
Unreserve braced enum variants in value namespace

With this PR braced enum variants (`enum E { V { /*...*/ } }`) no longer take a slot in value namespace, so the special case mentioned in the note in https://github.com/rust-lang/rfcs/blob/master/text/1506-adt-kinds.md#braced-structs is removed.

Report - https://github.com/rust-lang/rust/pull/103578#issuecomment-1292594900.
2022-11-22 10:17:09 +00:00
Thom Chiovoloni
3099dfdd9f
Forbid inlining thread_local!'s __getit function on Windows 2022-11-22 02:09:47 -08:00