Commit Graph

1050 Commits

Author SHA1 Message Date
Michael Goulet
349a2372ed Take RPITITs inherit the assumed_wf_types of their parent fn 2023-07-29 21:19:33 +00:00
bors
03a57254b5 Auto merge of #114156 - calebzulawski:simd-bswap, r=compiler-errors
Add simd_bswap, simd_bitreverse, simd_ctlz, and simd_cttz intrinsics

cc `@workingjubilee`
2023-07-29 18:51:45 +00:00
bors
ca1f813cc3 Auto merge of #114181 - matthiaskrgr:rollup-14m8s7f, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #114099 (privacy: no nominal visibility for assoc fns )
 - #114128 (When flushing delayed span bugs, write to the ICE dump file even if it doesn't exist)
 - #114138 (Adjust spans correctly for fn -> method suggestion)
 - #114146 (Skip reporting item name when checking RPITIT GAT's associated type bounds hold)
 - #114147 (Insert RPITITs that were shadowed by missing ADTs that resolve to [type error])
 - #114155 (Replace a lazy `RefCell<Option<T>>` with `OnceCell<T>`)
 - #114164 (Add regression test for `--cap-lints allow` and trait bounds warning)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-28 23:53:12 +00:00
León Orell Valerian Liehr
8c390286e4
Type-check generic const items 2023-07-28 22:21:41 +02:00
León Orell Valerian Liehr
9213aec762
Lower generic const items to HIR 2023-07-28 22:21:40 +02:00
Matthias Krüger
76f0a8c30c
Rollup merge of #114147 - compiler-errors:missing-rpitits, r=spastorino
Insert RPITITs that were shadowed by missing ADTs that resolve to [type error]

Comment inline explains how this can happen.

Fixes #113903
2023-07-28 19:51:16 +02:00
Caleb Zulawski
4c02b4cf4c Add SIMD bitreverse, ctlz, cttz intrinsics 2023-07-27 23:53:45 -04:00
Caleb Zulawski
3ea0e6e3fb Add simd_bswap intrinsic 2023-07-27 23:04:14 -04:00
Michael Goulet
a4ac773f62 Insert RPITITs that were shadowed by missing ADTs that resolve to type error 2023-07-27 22:32:58 +00:00
Deadbeef
e6b423aebb Remove constness from ParamEnv 2023-07-27 15:50:42 +00:00
Matthias Krüger
fa21a8c6f8
Rollup merge of #114075 - matthiaskrgr:fmt_args_rustc_3, r=wesleywiser
inline format!() args from rustc_codegen_llvm to the end (4)

r? `@WaffleLapkin`
2023-07-27 06:04:13 +02:00
Matthias Krüger
0b13deb548
Rollup merge of #113661 - oli-obk:tait_wtf, r=lcnr
Double check that hidden types match the expected hidden type

Fixes https://github.com/rust-lang/rust/issues/113278 specifically, but I left a TODO for where we should also add some hardening.

It feels a bit like papering over the issue, but at least this way we don't get unsoundness, but just surprising errors. Errors will be improved and given spans before this PR lands.

r? `@compiler-errors` `@lcnr`
2023-07-25 23:34:07 +02:00
Matthias Krüger
c64ef5e070 inline format!() args from rustc_codegen_llvm to the end (4)
r? @WaffleLapkin
2023-07-25 23:20:28 +02:00
Oli Scherer
df4bfd9e97 Try explaining where Inner is in the signature better 2023-07-25 13:40:04 +00:00
Oli Scherer
30f787800a Explain RPITs in the way they actually work 2023-07-24 15:34:36 +00:00
Oli Scherer
5b4549dd13 Some documentation nits 2023-07-24 14:20:53 +00:00
Oli Scherer
10d0ff975c Explain what the heck is going on with this lifetime remapping business 2023-07-24 13:48:06 +00:00
Matthias Krüger
b594798ae3 fix clippy::useless_format 2023-07-23 11:14:52 +02:00
Matthias Krüger
00e147543c
Rollup merge of #113950 - cjgillot:clean-resolve, r=jackh726
Remove Scope::Elision from bound-vars resolution.

This scope is a remnant of HIR-based lifetime resolution.

It's only role was to ensure that object lifetime resolution falled back to `'static`. This can be done using `ObjectLifetimeDefault` scope.
2023-07-22 19:57:37 +02:00
Camille GILLOT
b8701ff9d3 Remove Scope::Elision. 2023-07-22 08:32:53 +00:00
Oli Scherer
44e21503a8 Double check that hidden types match the expected hidden type 2023-07-21 13:19:36 +00:00
David Rheinsberg
b0dadff6de error/E0691: include alignment in error message
Include the computed alignment of the violating field when rejecting
transparent types with non-trivially aligned ZSTs.

ZST member fields in transparent types must have an alignment of 1 (to
ensure it does not raise the layout requirements of the transparent
field). The current error message looks like this:

 LL | struct Foobar(u32, [u32; 0]);
    |                    ^^^^^^^^ has alignment larger than 1

This patch changes the report to include the alignment of the violating
field:

 LL | struct Foobar(u32, [u32; 0]);
    |                    ^^^^^^^^ has alignment of 4, which is larger than 1

In case of unknown alignments, it will yield:

 LL | struct Foobar<T>(u32, [T; 0]);
    |                       ^^^^^^ may have alignment larger than 1

This allows developers to get a better grasp why a specific field is
rejected. Knowing the alignment of the violating field makes it easier
to judge where that alignment-requirement originates, and thus hopefully
provide better hints on how to mitigate the problem.

This idea was proposed in 2022 in #98071 as part of a bigger change.
This commit simply extracts this error-message change, to decouple it
from the other diagnostic improvements.
2023-07-21 11:04:16 +02:00
bors
1554942cdc Auto merge of #113546 - cjgillot:unused-query, r=compiler-errors
Querify unused trait check.

This code transitively loads information for all bodies, and from resolutions. As it does not return a value, it should be beneficial to have it as a query.
2023-07-20 18:45:09 +00:00
lcnr
fdaec57a28 XSimplifiedType to SimplifiedType::X 2023-07-20 11:05:52 +02:00
Matthias Krüger
b128750bc4
Rollup merge of #113795 - compiler-errors:doc, r=spastorino
Properly document `lifetime_mapping` in `OpaqueTy`

Also use an `Option` to signify that the value is actually present, instead of just no captured lifetimes.
2023-07-20 07:08:42 +02:00
Michael Goulet
846cc63e38 Make it clearer that edition functions are >=, not == 2023-07-19 16:38:35 +00:00
Michael Goulet
05f6890b3e Rename arg_iter to iter_instantiated 2023-07-17 21:04:12 +00:00
Michael Goulet
603fd426df Properly document lifetime_mapping in OpaqueTy 2023-07-17 14:56:33 +00:00
Camille GILLOT
a4a5e5b4ae Querify unused trait check. 2023-07-16 21:51:00 +00:00
Camille GILLOT
87233da5c2 Check entry type as part of item type checking. 2023-07-15 22:02:16 +00:00
Matthias Krüger
0baf4406da
Rollup merge of #113698 - compiler-errors:rpitit-check, r=spastorino
Make it clearer that we're just checking for an RPITIT

Tiny nit to use `is_impl_trait_in_trait` more, to make it clearer that we're just checking whether a def-id is an RPITIT, rather than doing something meaningful with the `opt_rpitit_info`.

r? `@spastorino`
2023-07-14 19:33:29 +02:00
Michael Goulet
14672eba8b Make it clearer that we're just checking for an RPITIT 2023-07-14 15:18:48 +00:00
Mahdi Dibaiee
e55583c4b8 refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
Michael Woerister
457b787a52 Introduce ExtentUnord trait for collections that can safely consume UnordItems. 2023-07-14 10:10:15 +02:00
bors
7d60819bfd Auto merge of #113519 - SparrowLii:parallel_typeck, r=cjgillot
typeck in parallel

#108118 caused `typeck` to be transferred to the serial part (`check_unused`), which made the performance of parallel rustc significantly reduced.

This pr re-parallelize this part, which increases the average performance improvement of parallel rustc in `full` and `incr-full` scenarios from [14.4%](https://github.com/rust-lang/rust/pull/110284#issuecomment-1545354608) to [23.2%](https://github.com/rust-lang/rust/pull/110284#issuecomment-1624770626).

r? `@cjgillot`
cc `@oli-obk` `@Zoxc`
2023-07-14 03:47:02 +00:00
Mark Rousskov
cc907f80b9 Re-format let-else per rustfmt update 2023-07-12 21:49:27 -04:00
SparrowLii
50896c13db typeck in parallel 2023-07-11 17:52:43 +08:00
Santiago Pastorino
20429af7a3
Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
bors
ce519c5945 Auto merge of #113474 - compiler-errors:rollup-07x1up7, r=compiler-errors
Rollup of 8 pull requests

Successful merges:

 - #113413 (Add needs-triage to all new issues)
 - #113426 (Don't ICE in `resolve_bound_vars` when associated return-type bounds are in bad positions)
 - #113427 (Remove `variances_of` on RPITIT GATs, remove its one use-case)
 - #113441 (miri: check that assignments do not self-overlap)
 - #113453 (Remove unused from_method from rustc_on_unimplemented)
 - #113456 (Avoid calling report_forbidden_specialization for RPITITs)
 - #113466 (Update cargo)
 - #113467 (Fix comment of `fn_can_unwind`)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-08 10:46:29 +00:00
Michael Goulet
cf1f8c55d5
Rollup merge of #113456 - spastorino:new-rpitit-31, r=compiler-errors
Avoid calling report_forbidden_specialization for RPITITs

Fixes #113438

r? ``@compiler-errors``
2023-07-07 22:12:18 -07:00
Michael Goulet
751dcaceb4
Rollup merge of #113427 - compiler-errors:no-variances-of-rpitit-gat, r=spastorino
Remove `variances_of` on RPITIT GATs, remove its one use-case

It doesn't make sense to implement variances on a GAT anyways, since we don't relate GATs with variance:

85bf07972a/compiler/rustc_middle/src/ty/relate.rs (L569-L579)

r? ``@spastorino``
2023-07-07 22:12:16 -07:00
bors
d4096e0412 Auto merge of #112652 - oli-obk:tait_only_in_sig, r=compiler-errors
Require TAITs to be mentioned in the signatures of functions that register hidden types for them

r? `@lcnr` `@compiler-errors`

This implements the lang team decision from [the TAIT design meeting](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/design.20meeting.202023-05-31.20TAITs/near/362518164).
2023-07-08 03:22:54 +00:00
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
Santiago Pastorino
24326ee508
Avoid calling report_forbidden_specialization for RPITITs 2023-07-07 16:24:08 -03: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
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
Michael Goulet
ca8202d429 Remove variances_of on RPITIT gats, remove its one use-case 2023-07-07 02:29:57 +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
Lukas Markeffsky
7aa5f39d3b add helper methods for accessing struct tail 2023-07-06 13:15:05 +00:00
Boxy
12138b8e5e Move TyCtxt::mk_x to Ty::new_x where applicable 2023-07-05 20:27:07 +01:00