Commit graph

192 commits

Author SHA1 Message Date
许杰友 Jieyou Xu (Joe)
257b4947ed
Rollup merge of #137728 - Darksonn:no-tuple-unsize, r=oli-obk
Remove unsizing coercions for tuples

See https://github.com/rust-lang/rust/issues/42877#issuecomment-2686010847 and below comments for justification.

Tracking issue: #42877
Fixes: #135217
2025-03-05 21:46:44 +08:00
Matthias Krüger
b6c1b635f7
Rollup merge of #137776 - nnethercote:rustc_transmute-cleanups, r=jswrenn
Some `rustc_transmute` cleanups

A number of small things that can be removed.

r? ``@jswrenn``
2025-03-01 11:34:01 +01:00
Matthias Krüger
3cd89f2718
Rollup merge of #137689 - compiler-errors:coroutine, r=lcnr
Use `Binder<Vec<Ty>>` instead of `Vec<Binder<Ty>>` in both solvers for sized/auto traits/etc.

It's more conceptually justified IMO, especially when binders get implications.

r? lcnr
2025-03-01 05:49:53 +01:00
lcnr
ef771b8450 review 2025-02-28 12:16:48 +01:00
lcnr
7eb677e7eb normalizing where-clauses is also coinductive, add tests 2025-02-28 12:16:47 +01:00
lcnr
933d45fe8f fix typo 2025-02-28 12:16:47 +01:00
lcnr
46faf4bed6 rework cycle handling
A cycle was previously coinductive if all steps were coinductive.
Change this to instead considerm cycles to be coinductive if they
step through at least one where-bound of an impl of a coinductive
trait goal.
2025-02-28 12:16:47 +01:00
Nicholas Nethercote
785e21d382 Remove allow(unused_variables) for rustc_transmute.
This was hiding some genuine sins, including unused arguments in
numerous functions/methods (incl. trait methods), and some unnecessary
computation.
2025-02-28 17:31:31 +11:00
Alice Ryhl
44cccae02a Delete tuple unsizing 2025-02-27 10:26:33 +00:00
Michael Goulet
ad74788670 Use bound_coroutine_witnesses in old solver 2025-02-26 17:32:53 +00:00
Michael Goulet
8282181e42 Use Binder<Vec<T>> instead of Vec<Binder<T>> in new solver 2025-02-26 17:32:26 +00:00
Matthias Krüger
37e0d138cf
Rollup merge of #137333 - compiler-errors:edition-2024-fresh, r=Nadrieril
Use `edition = "2024"` in the compiler (redux)

Most of this is binding mode changes, which I fixed by running `x.py fix`.

Also adds some miscellaneous `unsafe` blocks for new unsafe standard library functions (the setenv ones), and a missing `unsafe extern` block in some enzyme codegen code, and fixes some precise capturing lifetime changes (but only when they led to errors).

cc ``@ehuss`` ``@traviscross``
2025-02-22 11:36:43 +01:00
Michael Goulet
76d341fa09 Upgrade the compiler to edition 2024 2025-02-22 00:01:48 +00:00
Michael Goulet
241a602d27 Make sure we don't overrun the stack in canonicalizer 2025-02-21 18:24:05 +00:00
Michael Goulet
b78c626a95 Make fewer crates depend on rustc_ast_ir 2025-02-19 07:06:54 +00:00
bors
f44efbf9e1 Auto merge of #137235 - matthiaskrgr:rollup-2kjua2t, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #135711 (Do not ICE on default_field_value const with lifetimes)
 - #136599 (librustdoc: more usages of `Joined::joined`)
 - #136876 (Locking documentation updates)
 - #137000 (Deeply normalize item bounds in new solver)
 - #137126 (fix docs for inherent str constructors)
 - #137161 (Pattern Migration 2024: fix incorrect messages/suggestions when errors arise in macro expansions)
 - #137191 (Update mdbook and move error_index_generator)
 - #137203 (Improve MIR modification)
 - #137206 (Make E0599 a structured error)
 - #137218 (misc `layout_of` cleanup)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-02-18 21:08:58 +00:00
lcnr
f910684616 don't ICE for alias-relate goals with error term 2025-02-18 10:30:37 +01:00
Michael Goulet
2cdb7fac95 Prefer param-env candidates even when alias's trait bound isn't proven via param-env 2025-02-17 16:59:17 +00:00
lcnr
059288ed44 adjust derive_error 2025-02-13 23:49:09 +01:00
lcnr
05bd5ced2d rework pointee handling for the new rigid alias approach 2025-02-13 20:19:11 +00:00
lcnr
de273e459e normalizes-to rework rigid alias handling 2025-02-13 20:19:11 +00:00
Michael Goulet
d0564fda65 Use BikeshedGuaranteedNotDrop in unsafe binder type WF too 2025-02-13 03:45:07 +00:00
Michael Goulet
516afd557c Implement and use BikeshedGuaranteedNoDrop for union/unsafe field validity 2025-02-13 03:45:04 +00:00
bjorn3
1fcae03369 Rustfmt 2025-02-08 22:12:13 +00:00
Matthias Krüger
b4c4913abb
Rollup merge of #136664 - WaffleLapkin:un-map_or-true, r=compiler-errors
replace one `.map_or(true, ...)` with `.is_none_or(...)`

Randomly found while going through some of my old branches.
2025-02-07 18:26:29 +01:00
Waffle Lapkin
d4914a7719
replace one .map_or(true, ...) with .is_none_or(...) 2025-02-06 23:15:41 +01:00
Matthias Krüger
ae1410e2d8
Rollup merge of #136069 - yotamofek:next-solver-slice, r=compiler-errors
Simplify slice indexing in next trait solver

Unless I'm missing something:
- no need to explicitly specify the end of the slice as the end of the index range
- the `assert` is redundant since the indexing will panic for the same condition

I think this change simplifies it a bit. Also replaced the `for` loop of `push`es with a call to `extend` with an iterator. Might improve performance since it knows how many elements will be added beforehand and can pre-reserve room?

r? `@compiler-errors` , I think
2025-02-06 21:56:25 +01:00
Michael Goulet
4e763c2297 Pass spans around new solver 2025-02-05 18:32:06 +00:00
Michael Goulet
fd1110ce6a Remove span from delegate 2025-02-05 18:18:11 +00:00
Lukas Markeffsky
10fc0b159e introduce ty::Value
Co-authored-by: FedericoBruzzone <federico.bruzzone.i@gmail.com>
2025-01-30 17:47:44 +01:00
Michael Goulet
3f8ce7c973 Do not assume child bound assumptions for rigid alias 2025-01-28 19:08:50 +00:00
Yotam Ofek
e485cc5e02 Simplify slice indexing in next trait solver 2025-01-25 21:18:16 +00:00
Matthias Krüger
dafc861aa3
Rollup merge of #135766 - lcnr:candidate-assembly-3, r=compiler-errors
handle global trait bounds defining assoc types

This also fixes the compare-mode for
- tests/ui/coherence/coherent-due-to-fulfill.rs
- tests/ui/codegen/mono-impossible-2.rs
- tests/ui/trivial-bounds/trivial-bounds-inconsistent-projection.rs
- tests/ui/nll/issue-61320-normalize.rs

I first considered the alternative to always prefer where-bounds during normalization, regardless of how the trait goal has been proven by changing `fn merge_candidates` instead. ecda83b30f/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs (L785)

This approach is more restrictive than behavior of the old solver to avoid mismatches between trait and normalization goals. This may be breaking in case the where-bound adds unnecessary region constraints and we currently don't ever try to normalize an associated type. I would like to detect these cases and change the approach to exactly match the old solver if required. I want to minimize cases where attempting to normalize in more places causes code to break.

r? `@compiler-errors`
2025-01-23 19:54:25 +01:00
Boxy
513bfaa8bc Use structurally_normalize instead of manual normalizes-to goals 2025-01-22 07:04:53 +00:00
lcnr
09b784fac5 handle global trait bounds defining assoc type 2025-01-20 18:51:45 +01:00
lcnr
7171fee4ec remove unnecessary collection 2025-01-20 18:51:45 +01:00
Yotam Ofek
264fa0fc54 Run clippy --fix for unnecessary_map_or lint 2025-01-19 19:15:00 +00:00
Rémy Rakic
00844be421 new solver: prefer trivial builtin impls over where-clauses
for now, only builtin `Sized` impls are tracked as being `Trivial`
2025-01-17 18:50:29 +00:00
Michael Goulet
bf545ce2fe Prefer lower TraitUpcasting candidates 2025-01-14 17:59:54 +00:00
Michael Goulet
c64f859521 Implement const Destruct in old solver 2025-01-08 18:14:58 +00:00
Michael Goulet
ebdf19a8bb Recurse on GAT where clauses in fulfillment error proof tree visitor 2025-01-06 17:58:42 +00:00
Michael Goulet
2be9ffc1af Add derived causes for host effect predicates 2025-01-06 17:49:46 +00:00
Michael Goulet
7143ef6550 Also in the new solver 2025-01-03 05:22:14 +00:00
Michael Goulet
9a1c5eb5b3 Begin to implement type system layer of unsafe binders 2024-12-22 21:57:57 +00:00
lcnr
d5a0c5cfdb update new solver candidate assembly 2024-12-18 16:35:05 +01:00
lcnr
38ce73145c canonicalizer: keep 'static in the param_env 2024-12-18 16:18:01 +01:00
Michael Goulet
ec68498317 Rename projection_def_id to item_def_id 2024-12-11 00:59:43 +00:00
Jack Wrenn
a122dde217 do not implement unsafe auto traits for types with unsafe fields
If a type has unsafe fields, its safety invariants are not simply
the conjunction of its field types' safety invariants. Consequently,
it's invalid to reason about the safety properties of these types
in a purely structural manner — i.e., the manner in which `auto`
traits are implemented.

Makes progress towards #132922.
2024-12-05 23:52:21 +00:00
lcnr
34a8c2dbba support revealing defined opaque post borrowck 2024-11-28 10:40:58 +01:00
lcnr
a8c8ab1acd remove remaining references to Reveal 2024-11-23 13:52:56 +01:00