about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/traits
AgeCommit message (Collapse)AuthorLines
2024-09-25Compiler: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-62/+58
2024-09-23Rollup merge of #130714 - compiler-errors:try-structurally-resolve-const, ↵Matthias Krüger-0/+40
r=BoxyUwU Introduce `structurally_normalize_const`, use it in `rustc_hir_typeck` Introduces `structurally_normalize_const` to typecking to separate the "eval a const" step from the "try to turn a valtree into a target usize" in HIR typeck, where we may still have infer vars and stuff around. I also changed `check_expr_repeat` to move a double evaluation of a const into a single one. I'll leave inline comments. r? ```@BoxyUwU``` I hesitated to really test this on the new solver where it probably matters for unevaluated consts. If you're worried about the side-effects, I'd be happy to craft some more tests 😄
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-212/+171
2024-09-22Introduce structurally_normalize_const, use it in hir_typeckMichael Goulet-0/+40
2024-09-19skip normalizing param env if it is already normalizedLukas Markeffsky-0/+3
2024-09-13Rename and reorder lots of lifetimes.Nicholas Nethercote-17/+17
- Replace non-standard names like 's, 'p, 'rg, 'ck, 'parent, 'this, and 'me with vanilla 'a. These are cases where the original name isn't really any more informative than 'a. - Replace names like 'cx, 'mir, and 'body with vanilla 'a when the lifetime applies to multiple fields and so the original lifetime name isn't really accurate. - Put 'tcx last in lifetime lists, and 'a before 'b.
2024-09-12Auto merge of #130269 - Zalathar:rollup-coxzt2t, r=Zalatharbors-32/+25
Rollup of 8 pull requests Successful merges: - #125060 (Expand documentation of PathBuf, discussing lack of sanitization) - #129367 (Fix default/minimum deployment target for Aarch64 simulator targets) - #130156 (Add test for S_OBJNAME & update test for LF_BUILDINFO cl and cmd) - #130160 (Fix `slice::first_mut` docs) - #130235 (Simplify some nested `if` statements) - #130250 (Fix `clippy::useless_conversion`) - #130252 (Properly report error on `const gen fn`) - #130256 (Re-run coverage tests if `coverage-dump` was modified) r? `@ghost` `@rustbot` modify labels: rollup
2024-09-12Rollup merge of #130250 - compiler-errors:useless-conversion, r=jieyouxuStuart Cook-2/+2
Fix `clippy::useless_conversion` Self-explanatory. Probably the last clippy change I'll actually put up since this is the only other one I've actually seen in the wild.
2024-09-11Revert 'Stabilize -Znext-solver=coherence'Michael Goulet-1/+3
2024-09-11clippy::useless_conversionMichael Goulet-2/+2
2024-09-11Also fix if in elseMichael Goulet-6/+4
2024-09-11Simplify some nested if statementsMichael Goulet-24/+19
2024-09-06Auto merge of #128776 - Bryanskiy:deep-reject-ctxt, r=lcnrbors-8/+22
Use `DeepRejectCtxt` to quickly reject `ParamEnv` candidates The description is on the [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/.5Basking.20for.20help.5D.20.60DeepRejectCtxt.60.20for.20param.20env.20candidates) r? `@lcnr`
2024-09-05stabilize `-Znext-solver=coherence`lcnr-3/+1
2024-09-03do not attempt to prove unknowable goalslcnr-72/+66
2024-09-03Auto merge of #129777 - nnethercote:unreachable_pub-4, r=Urgaubors-16/+16
Add `unreachable_pub`, round 4 A follow-up to #129732. r? `@Urgau`
2024-09-03Add `warn(unreachable_pub)` to `rustc_trait_selection`.Nicholas Nethercote-16/+16
2024-09-02Rollup merge of #129878 - Sajjon:sajjon_fix_typos_batch_3, r=jieyouxuMatthias Krüger-3/+3
chore: Fix typos in 'compiler' (batch 3) Batch 3/3: Fixes typos in `compiler` (See [issue](https://github.com/rust-lang/rust/issues/129874) tracking all PRs with typos fixes)
2024-09-02Use `DeepRejectCtxt` to quickly reject `ParamEnv` candidatesBryanskiy-8/+22
2024-09-02chore: Fix typos in 'compiler' (batch 3)Alexander Cyon-3/+3
2024-09-01Revert "Auto merge of #127537 - veluca93:struct_tf, r=BoxyUwU"Jakub Beránek-2/+0
This reverts commit acb4e8b6251f1d8da36f08e7a70fa23fc581839e, reversing changes made to 100fde5246bf56f22fb5cc85374dd841296fce0e.
2024-08-31Rollup merge of #129767 - nnethercote:rm-extern-crate-tracing-4, r=jieyouxuMatthias Krüger-0/+23
Remove `#[macro_use] extern crate tracing`, round 4 Because explicit importing of macros via use items is nicer (more standard and readable) than implicit importing via #[macro_use]. Continuing the work from #124511, #124914, and #125434. After this PR no `rustc_*` crates use `#[macro_use] extern crate tracing` except for `rustc_codegen_gcc` which is a special case and I will do separately. r? ```@jieyouxu```
2024-08-31Rollup merge of #129725 - compiler-errors:predicates-of, r=fmeaseMatthias Krüger-16/+11
Stop using `ty::GenericPredicates` for non-predicates_of queries `GenericPredicates` is a struct of several parts: A list of of an item's own predicates, and a parent def id (and some effects related stuff, but ignore that since it's kinda irrelevant). When instantiating these generic predicates, it calls `predicates_of` on the parent and instantiates its predicates, and appends the item's own instantiated predicates too: https://github.com/rust-lang/rust/blob/acb4e8b6251f1d8da36f08e7a70fa23fc581839e/compiler/rustc_middle/src/ty/generics.rs#L407-L413 Notice how this should result in a recursive set of calls to `predicates_of`... However, `GenericPredicates` is *also* misused by a bunch of *other* queries as a convenient way of passing around a list of predicates. For these queries, we don't ever set the parent def id of the `GenericPredicates`, but if we did, then this would be very easy to mistakenly call `predicates_of` instead of some other intended parent query. Given that footgun, and the fact that we don't ever even *use* the parent def id in the `GenericPredicates` returned from queries like `explicit_super_predicates_of`, It really has no benefit over just returning `&'tcx [(Clause<'tcx>, Span)]`. This PR additionally opts to wrap the results of `EarlyBinder`, as we've tended to use that in the return type of these kinds of queries to properly convey that the user has params to deal with, and it also gives a convenient way of iterating over a slice of things after instantiating.
2024-08-30Remove `#[macro_use] extern crate tracing` from `rustc_trait_selection`.Nicholas Nethercote-0/+23
2024-08-29Stop using ty::GenericPredicates for non-predicates_of queriesMichael Goulet-16/+11
2024-08-28Implement RFC 3525.Luca Versari-0/+2
2024-08-21Simplify some redundant field namesMichael Goulet-1/+1
2024-08-19Rollup merge of #129217 - jswrenn:transmute-lifetimes, r=compiler-errorsMatthias Krüger-73/+103
safe transmute: check lifetimes Modifies `BikeshedIntrinsicFrom` to forbid lifetime extensions on references. This static check can be opted out of with the `Assume::lifetimes` flag. Fixes #129097 Tracking Issue: https://github.com/rust-lang/rust/issues/99571 r​? `@compiler-errors`
2024-08-18safe transmute: forbid reference lifetime extensionJack Wrenn-73/+103
Modifies `BikeshedIntrinsicFrom` to forbid lifetime extensions on references. This static check can be opted out of with the `Assume::lifetimes` flag. Fixes #129097
2024-08-18Fix order of normalization and recursion in const folding.Luca Versari-4/+4
Fixes #126831. Without this patch, type normalization is not always idempotent, which leads to all sorts of bugs in places that assume that normalizing a normalized type does nothing.
2024-08-15Rollup merge of #129078 - lcnr:scrape_region_constraints-use-ocx, ↵Jubilee-35/+3
r=compiler-errors `ParamEnvAnd::fully_perform`: we have an `ocx`, use it cc #123669 r? ``@compiler-errors``
2024-08-15Rollup merge of #129106 - compiler-errors:unused-type-ops, r=jieyouxuMatthias Krüger-65/+0
Remove redundant type ops: `Eq`/`Subtype` r? lcnr or anyone really
2024-08-14Remove redundant type opsMichael Goulet-65/+0
2024-08-14if we have an `ocx`, use itlcnr-35/+3
2024-08-14Auto merge of #129076 - matthiaskrgr:rollup-rg8mi2x, r=matthiaskrgrbors-2/+2
Rollup of 6 pull requests Successful merges: - #128410 (Migrate `remap-path-prefix-dwarf` `run-make` test to rmake) - #128759 (alloc: add ToString specialization for `&&str`) - #128873 (Add windows-targets crate to std's sysroot) - #129001 (chore(lib): Enhance documentation for core::fmt::Formatter's write_fm…) - #129061 (Use `is_lang_item` more) - #129062 (Remove a no-longer-true assert) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-14Rollup merge of #129061 - compiler-errors:lang-item, r=UrgauMatthias Krüger-2/+2
Use `is_lang_item` more Few places that I missed since introducing `TyCtxt::is_lang_item`.
2024-08-14Auto merge of #128812 - nnethercote:shrink-TyKind-FnPtr, r=compiler-errorsbors-16/+16
Shrink `TyKind::FnPtr`. By splitting the `FnSig` within `TyKind::FnPtr` into `FnSigTys` and `FnHeader`, which can be packed more efficiently. This reduces the size of the hot `TyKind` type from 32 bytes to 24 bytes on 64-bit platforms. This reduces peak memory usage by a few percent on some benchmarks. It also reduces cache misses and page faults similarly, though this doesn't translate to clear cycles or wall-time improvements on CI. r? `@compiler-errors`
2024-08-13Use is_lang_item moreMichael Goulet-2/+2
2024-08-12Rollup merge of #128712 - compiler-errors:normalize-borrowck, r=lcnrMatthias Krüger-3/+3
Normalize struct tail properly for `dyn` ptr-to-ptr casting in new solver Realized that the new solver didn't handle ptr-to-ptr casting correctly. r? lcnr Built on #128694
2024-08-12Rollup merge of #128978 - compiler-errors:assert-matches, r=jieyouxuGuillaume Gomez-1/+3
Use `assert_matches` around the compiler more It's a useful assertion, especially since it actually prints out the LHS.
2024-08-11Remove struct_tail_no_normalizationMichael Goulet-2/+2
2024-08-11Rename normalization functions to rawMichael Goulet-1/+1
2024-08-11Use assert_matches around the compilerMichael Goulet-1/+3
2024-08-10Auto merge of #128746 - compiler-errors:cache-super-outlives, r=lcnrbors-26/+16
Cache supertrait outlives of impl header for soundness check This caches the results of computing the transitive supertraits of an impl and filtering it to its outlives obligations. This is purely an optimization to improve https://github.com/rust-lang/rust/pull/124336.
2024-08-09Shrink `TyKind::FnPtr`.Nicholas Nethercote-16/+16
By splitting the `FnSig` within `TyKind::FnPtr` into `FnSigTys` and `FnHeader`, which can be packed more efficiently. This reduces the size of the hot `TyKind` type from 32 bytes to 24 bytes on 64-bit platforms. This reduces peak memory usage by a few percent on some benchmarks. It also reduces cache misses and page faults similarly, though this doesn't translate to clear cycles or wall-time improvements on CI.
2024-08-08Don't implement AsyncFn for FnDef/FnPtr that wouldnt implement FnMichael Goulet-2/+14
2024-08-06Cache supertrait outlives of impl header for soundness checkMichael Goulet-26/+16
2024-08-05Auto merge of #128689 - matthiaskrgr:rollup-ukyn8wq, r=matthiaskrgrbors-1/+1
Rollup of 5 pull requests Successful merges: - #128385 (rustdoc-json: discard non-local inherent impls for primitives) - #128559 (Don't re-elaborated already elaborated caller bounds in method probe) - #128631 (handle crates when they are not specified for std docs) - #128664 (Add `Debug` impls to API types in `rustc_codegen_ssa`) - #128686 (fix the invalid argument type) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-05Don't re-elaborated already elaborated caller bounds in method probeMichael Goulet-1/+1
2024-08-05Elaborate supertraits in dyn candidatesMichael Goulet-0/+1