Commit Graph

229161 Commits

Author SHA1 Message Date
Nilstrieb
2beabbbf6f Rename adjustment::PointerCast and variants using it to PointerCoercion
It makes it sound like the `ExprKind` and `Rvalue` are supposed to represent all pointer related
casts, when in reality their just used to share a some enum variants. Make it clear there these
are only coercion to make it clear why only some pointer related "casts" are in the enum.
2023-07-07 18:17:16 +02:00
许杰友 Jieyou Xu (Joe)
b5208b3611
Don't suggest impl Trait in path position 2023-07-08 00:04:33 +08:00
Michael Goulet
f55b046931 Normalize opaques during codegen in new solver 2023-07-07 16:02:25 +00:00
Michael Goulet
713f9bb5d1 Mark more hanging new-solver tests 2023-07-07 16:02:24 +00:00
Michael Goulet
010ee7b0e0 Remove an AFIT test that isn't an AFIT test 2023-07-07 16:02:24 +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
Ralf Jung
7a83ef82da miri: check that assignments do not self-overlap 2023-07-07 16:54:44 +02:00
bors
2323ecbd4b Auto merge of #2969 - oli-obk:run-dep, r=RalfJung
Stop parsing ui_test annotations in `run-dep` mode

fixes #2967
2023-07-07 14:05:25 +00:00
Oli Scherer
c6f5b5f557 MIRIFLAGS are already passed in the ./miri wrapper 2023-07-07 13:42:38 +00:00
Oli Scherer
48fe0dfe48 Remove a now-useless flag 2023-07-07 13:41:32 +00:00
Oli Scherer
813b56b5ab Silence all the boilerplate around ./miri run and ./miri run-dep 2023-07-07 13:41:06 +00:00
Oli Scherer
c3004a7b65 Treat closures as part of their parent 2023-07-07 13:17:00 +00:00
Oli Scherer
b549ba1bd4 Fix one layer of closures not being able to constrain opaque types 2023-07-07 13:17:00 +00:00
Oli Scherer
ef52dc7bb8 Add regression test 2023-07-07 13:17:00 +00:00
Oli Scherer
dcacfe7395 Only match on the DefKind once. 2023-07-07 13:17:00 +00:00
Oli Scherer
18f3d86588 Collect nested items immediately instead of collecting them into an intermediate Vec first 2023-07-07 13:17:00 +00:00
Oli Scherer
b07d27c81e Move some logic into a method on OpaqueTypeCollector 2023-07-07 13:17:00 +00:00
Oli Scherer
af9dcf70be Remove one layer of nested matching on the same thing 2023-07-07 13:17:00 +00:00
Oli Scherer
a3ca139def liar liar find_taits_declared_in_body on fire 2023-07-07 13:17:00 +00:00
Oli Scherer
2f89c963d3 We don't need to track binders if we aren't normalizing 2023-07-07 13:17:00 +00:00
Oli Scherer
907f97e411 Remove normalization from opaque_types_defined_by 2023-07-07 13:17:00 +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
Oli Scherer
4c99872efe Require TAITs to be mentioned in the signatures of functions that register hidden types for them 2023-07-07 13:13:18 +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
fa6cf3f0f9 Auto merge of #2970 - rust-lang:rustup2023-07-07, r=oli-obk
Automatic sync from rustc
2023-07-07 07:06:53 +00:00
The Miri Conjob Bot
536c9108b1 fmt 2023-07-07 06:37:14 +00:00
The Miri Conjob Bot
b13a9fa3dd Merge from rustc 2023-07-07 06:34:22 +00:00
The Miri Conjob Bot
a5286fc6bf Preparing for merge from rustc 2023-07-07 06:26:01 +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
Michael Goulet
ca8202d429 Remove variances_of on RPITIT gats, remove its one use-case 2023-07-07 02:29:57 +00:00
yukang
37b40e592a adjust smart_resolve_partial_mod_path_errors 2023-07-07 10:19:30 +08:00
yukang
9763472e2b smart_resolve_partial_mod_path_errors should not suggest parent 2023-07-07 10:18:20 +08:00
yukang
6f53e61887 Add filter with next segment while lookup typo for path 2023-07-07 09:00:50 +08: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