Commit Graph

228895 Commits

Author SHA1 Message Date
Michael Goulet b7191d8388 Don't ICE in resolve_bound_vars when associated return-type bounds are in bad positions 2023-07-07 19:43:23 +00:00
bors cb80ff132a Auto merge of #113245 - lukas-code:unsizing-sanity-check, r=the8472
sanity check field offsets in unsizeable structs

As promised in https://github.com/rust-lang/rust/pull/112062#issuecomment-1567494994, this PR extends the layout sanity checks to ensure that structs fields don't move around when unsizing and prevent issues like https://github.com/rust-lang/rust/issues/112048 in the future. Like most other layout sanity checks, this only runs on compilers with debug assertions enabled.

Here is how it looks when it fails:
```text
error: internal compiler error: compiler/rustc_ty_utils/src/layout.rs:533:21: unsizing GcNode<std::boxed::Box<i32>> changed field order!
                                Layout { size: Size(32 bytes), align: AbiAndPrefAlign { abi: Align(8 bytes), pref: Align(8 bytes) }, abi: Aggregate { sized: true }, fields: Arbitrary { offsets: [Size(0 bytes), Size(8 bytes), Size(24 bytes)], memory_index: [0, 1, 2] }, largest_niche: Some(Niche { offset: Size(24 bytes), value: Pointer(AddressSpace(0)), valid_range: 1..=18446744073709551615 }), variants: Single { index: 0 } }
                                Layout { size: Size(24 bytes), align: AbiAndPrefAlign { abi: Align(8 bytes), pref: Align(8 bytes) }, abi: Aggregate { sized: false }, fields: Arbitrary { offsets: [Size(16 bytes), Size(0 bytes), Size(24 bytes)], memory_index: [1, 0, 2] }, largest_niche: None, variants: Single { index: 0 } }
```

r? `@the8472`
2023-07-07 15:42:29 +00:00
bors fd68a6ded9 Auto merge of #113437 - workingjubilee:sync-simd-2023-july-07, r=workingjubilee
Sync portable-simd to 2023 July 07

r? `@ghost`
2023-07-07 13:15:11 +00:00
Jubilee Young 37fea342ea Use new std::simd fn in miri tests
Old fn were slightly divergent.
2023-07-07 04:33:37 -07:00
Jubilee Young 8765f91727 Sync portable-simd to 2023 July 07
Sync up to rust-lang/portable-simd@7c7dbe0c50
2023-07-07 04:07:00 -07:00
Jubilee Young 7c7dbe0c50 Remove unused import 2023-07-07 04:03:54 -07:00
Jubilee 789c38fae2
Fixed cast imports in doctest (rust-lang/portable-simd#355) 2023-07-07 03:49:42 -07:00
Jubilee Young f2f9bd7eb1 Disable MIPS jobs in CI 2023-07-07 03:47:53 -07:00
bors 1a449dcfd2 Auto merge of #113308 - compiler-errors:poly-select, r=lcnr
Split `SelectionContext::select` into fns that take a binder and don't

*most* usages of `SelectionContext::select` don't need to use a binder, but wrap them in a dummy because of the signature. Let's split this out into `SelectionContext::{select,poly_select}` and limit the usages of the latter.

Right now, we only have 3 places where we're calling `poly_select` -- fulfillment, internally within the old solver, and the auto-trait finder.

r? `@lcnr`
2023-07-07 10:32:42 +00:00
Jubilee 2b55e03436
Merge pull request #353 from rust-lang/sync-upstream-2023-06-07
Sync upstream
2023-07-07 03:21:10 -07:00
bors 921f669749 Auto merge of #113270 - the8472:opt-macro-tts, r=nnethercote
perform TokenStream replacement in-place when possible in expand_macro
2023-07-07 08:04:48 +00:00
bors 7cc3da05f9 Auto merge of #113429 - compiler-errors:rollup-wkv4w9a, r=compiler-errors
Rollup of 8 pull requests

Successful merges:

 - #111917 (Simplify duplicate checks for mir validator)
 - #112008 (Fix incorrect documented default bufsize in bufreader/writer)
 - #112825 (Don't call `type_of` on TAIT in defining scope in new solver)
 - #113164 (Add a regression test for #109054)
 - #113318 (Revert "alloc: Allow comparing Boxs over different allocators", add regression test)
 - #113397 (Prefer object candidates in new selection)
 - #113419 (Avoid calling item_name for RPITIT)
 - #113421 (Do not assert >1 RPITITs on collect_return_position_impl_trait_in_trait_tys)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-07 05:28:17 +00:00
Michael Goulet 45cb1ba9d3
Rollup merge of #113421 - spastorino:new-rpitit-29, r=compiler-errors
Do not assert >1 RPITITs on collect_return_position_impl_trait_in_trait_tys

Fixes #113403

Assert on collect_return_position_impl_trait_in_trait_tys is not correct when we call it from type_of(GAT). The included test is an example of a situation that collector collects 0 types.

r? `@compiler-errors`
2023-07-06 20:11:41 -07:00
Michael Goulet 901c863644
Rollup merge of #113419 - spastorino:new-rpitit-28, r=compiler-errors
Avoid calling item_name for RPITIT

Fixes #113405

r? `@compiler-errors`
2023-07-06 20:11:41 -07:00
Michael Goulet f1c90985e8
Rollup merge of #113397 - compiler-errors:new-select-prefer-obj, r=lcnr
Prefer object candidates in new selection

`dyn Any` shouldn't be using [this implementation](https://doc.rust-lang.org/std/any/trait.Any.html#impl-Any-for-T) during codegen.

Prefer object candidates over other candidates, except for other object candidates.
2023-07-06 20:11:40 -07:00
Michael Goulet 7913d76cb9
Rollup merge of #113318 - tgross35:113283-allocator-trait-eq, r=m-ou-se
Revert "alloc: Allow comparing Boxs over different allocators", add regression test

Temporary fix for #113283

Adds a test to fix the regression introduced in 001b081cc1 and revert that commit. The test fails without the revert.
2023-07-06 20:11:40 -07:00
Michael Goulet 1cb31e71d6
Rollup merge of #113164 - JohnTitor:issue-109054, r=compiler-errors
Add a regression test for #109054

Closes #109054
r? ``@compiler-errors``
2023-07-06 20:11:39 -07:00
Michael Goulet de49a9f2f5
Rollup merge of #112825 - compiler-errors:tait-defining-cycle, r=lcnr
Don't call `type_of` on TAIT in defining scope in new solver

It's *never* productive to call `consider_auto_trait_candidate` on a TAIT in the defining scope, since it will always lead to a query cycle since we call `type_of` on the TAIT. So let's just don't.

I've reserved this behavior just to `SolverMode::Normal` just to avoid any future problems, since this is *technically* incomplete since we're discarding a candidate that could *theoretically* apply. But given such candidate assembly *always* leads to a query cycle, I think it's relatively low risk, and I could be convinced otherwise and make this apply to both solver mode. I assume it's far less likely to be encountered in coherence, though.

This is much more likely to encounter in the new solver, though it can also be encountered in the old solver too, so I'm happy to discuss whether this new behavior we even want in the first place...

I encountered this in a couple of failing UI tests:
* `tests/ui/type-alias-impl-trait/issue-62000-associate-impl-trait-lifetimes.rs`
* `tests/ui/type-alias-impl-trait/issue-93411.rs`

r? `@lcnr`
2023-07-06 20:11:39 -07:00
Michael Goulet 75febc6ed6
Rollup merge of #112008 - intruder-kat:master, r=Nilstrieb
Fix incorrect documented default bufsize in bufreader/writer
2023-07-06 20:11:38 -07:00
Michael Goulet 3aa4561923
Rollup merge of #111917 - WaffleLapkin:validate_unalloc, r=oli-obk
Simplify duplicate checks for mir validator

This removes unnecessary allocations & is less code.
2023-07-06 20:11:38 -07:00
bors bb548f9645 Auto merge of #112816 - Amanieu:llvm-riscv-arch, r=cuviper
Update LLVM submodule

This adds https://github.com/rust-lang/llvm-project/pull/147.
2023-07-07 03:02:54 +00:00
bors 06082086b4 Auto merge of #112796 - Kobzol:ci-merge-msvc-cargo-tools, r=pietroalbini
CI: merge msvc cargo and tools jobs

The `x86_64-msvc-cargo` and `x86_64-msvc-tools` jobs both run for ~1 hour, but most of that time is actually spent in building LLVM and `rustc`, so I want to try merging them.
![image](https://github.com/rust-lang/rust/assets/4539057/8652fa2a-b8b7-41d0-8f16-555d31acd9a5)
2023-07-07 00:39:47 +00:00
Michael Goulet 388c230cf7 Don't call type_of on TAIT in defining scope in new solver 2023-07-06 20:13:22 +00:00
Santiago Pastorino 07a230b5a5
Do not assert >1 RPITITs on collect_return_position_impl_trait_in_trait_tys 2023-07-06 17:07:11 -03:00
Santiago Pastorino c0c155137b
Avoid calling item_name for RPITIT 2023-07-06 16:18:24 -03:00
bors 85bf07972a Auto merge of #113269 - jyn514:update-compiler-builtins, r=Amanieu
Update compiler builtins

cc https://github.com/rust-lang/compiler-builtins/pull/532#discussion_r1249354225

in particular this pulls in https://github.com/rust-lang/compiler-builtins/pull/532 and https://github.com/rust-lang/compiler-builtins/pull/535.

Fixes https://github.com/rust-lang/rust/issues/93166. Fixes https://github.com/rust-lang/git2-rs/issues/706. Fixes https://github.com/rust-lang/rust/issues/109064. Fixes https://github.com/rust-lang/wg-cargo-std-aware/issues/74.
2023-07-06 18:58:54 +00:00
Michael Goulet 3f8919c09b get rid of a bit more calls to poly_select 2023-07-06 16:50:12 +00:00
Michael Goulet 018c3e2c09 Coercion doesn't need binders either 2023-07-06 16:50:12 +00:00
Michael Goulet 52f7384995 Separate select calls that don't need a binder 2023-07-06 16:50:12 +00:00
Michael Goulet 36453456cb TraitObligation -> PolyTraitObligation 2023-07-06 16:30:11 +00:00
bors 87c8c83ec7 Auto merge of #112779 - Kobzol:ci-merge-llvm-14, r=pietroalbini
CI: merge x86_64-gnu-llvm-14 and x86_64-gnu-llvm-14-stage1 CI jobs

Another attempt to shorten CI job times. Suggested by `@the8472` [here](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/CI.20usage/near/367172221).
2023-07-06 16:14:50 +00:00
Lukas Markeffsky 7aa5f39d3b add helper methods for accessing struct tail 2023-07-06 13:15:05 +00:00
Lukas Markeffsky e3de14e463 sanity check field offsets in unsizeable structs 2023-07-06 13:15:05 +00:00
Lukas Markeffsky 478071ba9d clean up struct layout code 2023-07-06 13:04:13 +00:00
bors c4c84df3b3 Auto merge of #113323 - Kobzol:pgo-script-llvm-ci, r=jyn514
Use `llvm-config` instead of `download-ci-llvm` in PGO script

This should avoid CI breakage when the LLVM stamp is updated, and also it will avoid an unnecessary LLVM download from CI.

r? `@jyn514`
2023-07-06 13:01:13 +00:00
bors 4b6749b21e Auto merge of #113406 - matthiaskrgr:rollup-0rprs5k, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #112295 (Fix the tests-listing-format-json test on Windows)
 - #113246 (fix compiletest crash)
 - #113395 (Dont ICE for `dyn* Trait: Trait` (built-in object) goals during selection in new trait solver)
 - #113402 (Diagnose unsorted CGUs.)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-06 10:29:49 +00:00
Matthias Krüger a7532d9278
Rollup merge of #113402 - nnethercote:diagnose-unsorted-CGUs, r=lqd
Diagnose unsorted CGUs.

An assertion failure was reported in #112946. This extra information will help diagnose the problem.

r? `@lqd`
2023-07-06 12:12:12 +02:00
Matthias Krüger 72e0e177d5
Rollup merge of #113395 - compiler-errors:new-solver-dyn-star-selection, r=oli-obk
Dont ICE for `dyn* Trait: Trait` (built-in object) goals during selection in new trait solver

We were ICEing too eagerly during selection for `dyn*` goals -- both for dyn unsizing candidates and for built-in object candidates. The former should only be performed on `dyn` objects, but the latter are totally fine.
2023-07-06 12:12:12 +02:00
Matthias Krüger 1bb5dd6575
Rollup merge of #113246 - mirkootter:fix-compiletest-crash, r=pietroalbini
fix compiletest crash

### Motivation
When running compiler-tests locally for the `wasm32` platform, one test repeatedly crashed. It does not crash on the CI, only locally. Investigation shows that the `compiletest` itself crashes

> panicked-at-attempt-to-subtract-with-overflow

```rust
let mut head = replace(bytes, Vec::new());
let mut middle = head.split_off(HEAD_LEN);

// The following line will panic
let tail = middle.split_off(middle.len() - TAIL_LEN).into_boxed_slice();
let skipped = new_len - HEAD_LEN - TAIL_LEN;
```

### Background
The code in question collects the output of a process. Small output is kept completely, but larger output is kept only partially: the first 160 kB and the last 256 kB.

The code that performs this split crashes if the data size is less than 416 kB. There is an early out based on the "filtered" length, but it is possible that the filtered length is greater than the real length. It seems that this code was written with the assumption that the filtered length is larger than the real length, which is not true in general.

When running CI tests locally using `src/ci/docker/run.sh`, the filtered folder is `/checkout`, which is shorter than the placeholder length of 32 bytes.

### Note
This PR should not change any behaviour. It only adds an early our for a case which will definitely crash (at least if compiletest is build with integer checks).

Note that an early out makes sense here: If the real data is too small, it does not sense to split it.
2023-07-06 12:12:11 +02:00
Matthias Krüger f94a0c91cd
Rollup merge of #112295 - ForrestOfBarnes:tests-listing-format-json-windows-fix, r=pietroalbini
Fix the tests-listing-format-json test on Windows

tests/ui/test-attrs/tests-listing-json-format.rs was failing on Windows because each path in the json-formatted output contained "\\\\" instead of "\\". `runtest::TestCx::normalize_output` already checks the compile flags for json-related arguments to handle this case, so I added an equivalent check for the new run flag.
2023-07-06 12:12:10 +02:00
Nicholas Nethercote fc8536669c Diagnose unsorted CGUs.
An assertion failure was reported in #112946. This extra information
will help diagnose the problem.
2023-07-06 18:27:25 +10:00
bors 4dd1719b34 Auto merge of #113377 - BoxyUwU:move_ty_ctors_to_ty, r=compiler-errors
Move `TyCtxt::mk_x` to `Ty::new_x` where applicable

Part of rust-lang/compiler-team#616

turns out there's a lot of places we construct `Ty` this is a ridiculously huge PR :S

r? `@oli-obk`
2023-07-06 08:10:42 +00:00
Oli Scherer deda49e7b7 Fix up doc links 2023-07-06 07:32:08 +00:00
bors b112bc5529 Auto merge of #113348 - saethlin:metadata-module-not-compiled, r=Nilstrieb
Remove some unnecessary(?) normalization

https://github.com/rust-lang/rust/issues/59774#issuecomment-1550966711
2023-07-06 05:33:54 +00:00
Michael Goulet 3acaa568c2 Prefer object candidates over impl candidates in new selection 2023-07-06 04:57:17 +00:00
Michael Goulet cd26d10edf Dont ICE for `dyn* Trait: Trait` goals during selection in new trait solver 2023-07-06 03:10:11 +00:00
bors 0d50ab7739 Auto merge of #113391 - fee1-dead-contrib:rollup-9bqlw9z, r=fee1-dead
Rollup of 9 pull requests

Successful merges:

 - #111119 (style-guide: Add chapter about formatting for nightly-only syntax)
 - #112791 (llvm ffi: Expose `CallInst->setTailCallKind`)
 - #113145 (style-guide: Document newline rules for assignment operators)
 - #113163 (Add a regression test for #112895)
 - #113332 (resolve: Use `Interned` for some interned structures)
 - #113334 (Revert the lexing of `c"…"` string literals)
 - #113350 (Fix the issue of wrong diagnosis for extern pub fn)
 - #113371 (Fix submodule handling when the current branch is named after a tag)
 - #113384 (style-guide: Clarify grammar for small patterns (not a semantic change))

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-06 02:34:11 +00:00
fee1-dead c668eb086e
Rollup merge of #113384 - joshtriplett:style-guide-grammar, r=compiler-errors
style-guide: Clarify grammar for small patterns (not a semantic change)

The grammar as written feels ambiguous and confusing, in large part
because it uses square brackets and commas in the names of
non-terminals. Rewrite it to avoid symbols in the names of
non-terminals, and to instead wrap terminals in backquotes.

Also rename "smallntp" to "small_no_tuple" to make it self-describing.
2023-07-06 09:20:35 +08:00
fee1-dead 70e8f9d4c0
Rollup merge of #113371 - jyn514:submodule-with-tags, r=albertlarsan68
Fix submodule handling when the current branch is named after a tag

If:
1. The current branch has the same name as git tag, and
2. The current branch is set to track a remote other than `origin`, and
3. We try to update a submodule

then we'll get the following error:
```
; x c
Updating submodule src/doc/reference
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
fatal: 'personal' does not appear to be a git repository
fatal: Could not read from remote repository.
```

The problem is that 1. causes `git symbolic-ref --short HEAD` to try and disambiguate the branch from the tag using `heads/branch-name`, which breaks a previous workaround for a bug in `git submodule update` that uses the wrong remote.

Adapt the workaround to strip `heads/` from the output.
2023-07-06 09:20:34 +08:00
fee1-dead 2bc0ae3f33
Rollup merge of #113350 - chenyukang:yukang-fix-113342-parser, r=compiler-errors
Fix the issue of wrong diagnosis for extern pub fn

Fixes #113342
2023-07-06 09:20:34 +08:00