about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/traits
AgeCommit message (Collapse)AuthorLines
2025-05-08normalization: avoid incompletely constraining GAT argslcnr-3/+4
2025-05-07Require T: TypeFoldable in Binder<T> visitMichael Goulet-2/+2
2025-05-01Set groundwork for proper const normalizationBoxy-159/+230
2025-05-01No-op split into sub functionsBoxy-164/+162
2025-04-30Rollup merge of #140468 - BoxyUwU:normalization_confusings2, r=lcnrMatthias Krüger-5/+8
Minor tweaks to make some normalization (adjacent) code less confusing r? lcnr sorry for double ping lol
2025-04-30Rollup merge of #140516 - rperier:type-ir-to-type-middle, r=lcnrMatthias Krüger-12/+9
Replace use of rustc_type_ir by rustc_middle cc #138449 I want to help on this issue. I have replaced all the rustc_type_ir uses by the equivalent type in rustc_middle. DelayedSet is also re-exposed by rustc_middle.
2025-04-30Use less rustc_type_ir in the compiler codebaseRomain Perier-12/+9
This commit does the following: - Replaces use of rustc_type_ir by rustc_middle - Removes the rustc_type_ir dependency - The DelayedSet type is exposed by rustc_middle so everything can be accessed through rustc_middle in a coherent manner.
2025-04-30Rollup merge of #140445 - oli-obk:const-manually-drop, r=fee1-deadMatthias Krüger-0/+3
Treat ManuallyDrop as ~const Destruct cc https://github.com/rust-lang/rust/issues/133214#issuecomment-2838078133 r? ```@compiler-errors``` cc ```@fee1-dead```
2025-04-29confusingsBoxy-5/+8
2025-04-29Rollup merge of #139909 - oli-obk:or-patterns, r=BoxyUwUTrevor Gross-37/+47
implement or-patterns for pattern types These are necessary to represent `NonZeroI32`, as the range for that is `..0 | 1..`. The `rustc_scalar_layout_range_*` attributes avoided this by just implementing wraparound and having a single `1..=-1` range effectively. See https://rust-lang.zulipchat.com/#narrow/channel/481660-t-lang.2Fpattern-types/topic/.60or.20pattern.60.20representation.20in.20type.20system/with/504217694 for some background discussion cc https://github.com/rust-lang/rust/issues/123646 r? `@BoxyUwU`
2025-04-29Treat `ManuallyDrop` as `~const Destruct`Oli Scherer-0/+3
2025-04-29Also match on the lang item in confirmationOli Scherer-10/+5
2025-04-29Always check the lang item firstOli Scherer-16/+8
2025-04-29Replace if/elseif chain with matchOli Scherer-62/+81
2025-04-29Adjust testsMichael Goulet-1/+3
2025-04-29Wf is not coinductiveMichael Goulet-1/+4
2025-04-28Auto merge of #140388 - GuillaumeGomez:rollup-aj9o3ch, r=GuillaumeGomezbors-9/+9
Rollup of 7 pull requests Successful merges: - #140056 (Fix a wrong error message in 2024 edition) - #140220 (Fix detection of main function if there are expressions around it) - #140249 (Remove `weak` alias terminology) - #140316 (Introduce `BoxMarker` to improve pretty-printing correctness) - #140347 (ci: clean more disk space in codebuild) - #140349 (ci: use aws codebuild for the `dist-x86_64-linux` job) - #140379 (rustc-dev-guide subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-28Rollup merge of #140249 - BoxyUwU:remove_weak_alias_terminology, r=oli-obkGuillaume Gomez-9/+9
Remove `weak` alias terminology I find the "weak" alias terminology to be quite confusing. It implies the existence of "strong" aliases (which do not exist) and I'm not really sure what about weak aliases is "weak". I much prefer "free alias" as the term. I think it's much more obvious what it means as "free function" is a well defined term that already exists in rust. It's also a little confusing given "weak alias" is already a term in linker/codegen spaces which are part of the compiler too. Though I'm not particularly worried about that as it's usually very obvious if you're talking about the type system or not lol. I'm also currently trying to write documentation about aliases and it's somewhat awkward/confusing to be talking about *weak* aliases, when I'm not really sure what the basis for that as the term actually *is*. I would also be happy to just find out there's a nice meaning behind calling them "weak" aliases :-) r? `@oli-obk` maybe we want a types MCP to decide on a specific naming here? or maybe we think its just too late to go back on this naming decision ^^'
2025-04-28AsyncDrop implementation using shim codegen of ↵Andrew Zhogin-44/+0
async_drop_in_place::{closure}, scoped async drop added.
2025-04-28Add or-patterns to pattern typesOli Scherer-0/+5
2025-04-28Split out various pattern type matches into their own functionOli Scherer-37/+42
2025-04-26convert some `GenericArg` to `Term`lcnr-65/+53
2025-04-24Auto merge of #140245 - matthiaskrgr:rollup-e0fwsfv, r=matthiaskrgrbors-33/+48
Rollup of 8 pull requests Successful merges: - #139261 (mitigate MSVC alignment issue on x86-32) - #140075 (Mention average in midpoint documentations) - #140184 (Update doc of cygwin target) - #140186 (Rename `compute_x` methods) - #140194 (minicore: Have `//@ add-core-stubs` also imply `-Cforce-unwind-tables=yes`) - #140195 (triagebot: label minicore changes w/ `A-test-infra-minicore` and ping jieyouxu on changes) - #140214 (Remove comment about handling non-global where bounds with corresponding projection) - #140228 (Revert overzealous parse recovery for single colons in paths) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-24Remove `weak` alias terminologyBoxy-9/+9
2025-04-24Rollup merge of #140214 - compiler-errors:remove-hack, r=lcnrMatthias Krüger-2/+0
Remove comment about handling non-global where bounds with corresponding projection This comment is no longer relevant since we only assemble rigid projections if no param-env candidates hold. Also remove a stray comment from the old solver. r? lcnr
2025-04-24Rollup merge of #140186 - BoxyUwU:compute_what, r=compiler-errorsMatthias Krüger-31/+48
Rename `compute_x` methods r? ```@lcnr``` I find the `compute_x` naming scheme to be overly confusing. It means `compute_wf_obligations_for_x_and_add_them_to_self` but shortens out all of the important parts of the actual operation being performed. `compute_x` sounds like its somehow performing `x`, maybe even returning it from the function, which is not true. I've had some newer contributors be confused by this naming scheme so I think it's good to change it to something more self-evident Some misc drive by niceties while I was here too.
2025-04-24Rollup merge of #140232 - nnethercote:rm-unnecessary-clones, r=SparrowLiiMatthias Krüger-2/+1
Remove unnecessary clones r? `@SparrowLii`
2025-04-24Remove some unnecessary clones.Nicholas Nethercote-2/+1
I found these by grepping for `&[a-z_\.]*\.clone()`, i.e. expressions like `&a.b.clone()`, which are sometimes unnecessary clones, and also looking at clones nearby to cases like that.
2025-04-23Auto merge of #138845 - compiler-errors:stall-generators, r=lcnrbors-2/+4
Properly stall coroutine witnesses in new solver TODO: write description r? lcnr
2025-04-23Remove hackMichael Goulet-2/+0
2025-04-23Use the new solver in the impossible_predicatesMichael Goulet-9/+5
2025-04-23MoreMichael Goulet-1/+3
2025-04-23Module docsBoxy-0/+5
2025-04-23Rename `compute_x` methodsBoxy-31/+43
2025-04-22Properly drain pending obligations for coroutinesMichael Goulet-2/+2
2025-04-22Use `is_lang_item` and `as_lang_item` instead of handrolling their logicOli Scherer-118/+122
2025-04-19Don't ICE on pending obligations from deep normalization in a loopMichael Goulet-1/+9
2025-04-15Auto merge of #139845 - Zalathar:rollup-u5u5y1v, r=Zalatharbors-34/+33
Rollup of 17 pull requests Successful merges: - #138374 (Enable contracts for const functions) - #138380 (ci: add runners for vanilla LLVM 20) - #138393 (Allow const patterns of matches to contain pattern types) - #139517 (std: sys: process: uefi: Use NULL stdin by default) - #139554 (std: add Output::exit_ok) - #139660 (compiletest: Add an experimental new executor to replace libtest) - #139669 (Overhaul `AssocItem`) - #139671 (Proc macro span API redesign: Replace proc_macro::SourceFile by Span::{file, local_file}) - #139750 (std/thread: Use default stack size from menuconfig for NuttX) - #139772 (Remove `hir::Map`) - #139785 (Let CStrings be either 1 or 2 byte aligned.) - #139789 (do not unnecessarily leak auto traits in item bounds) - #139791 (drop global where-bounds before merging candidates) - #139798 (normalize: prefer `ParamEnv` over `AliasBound` candidates) - #139822 (Fix: Map EOPNOTSUPP to ErrorKind::Unsupported on Unix) - #139833 (Fix some HIR pretty-printing problems) - #139836 (Basic tests of MPMC receiver cloning) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-15Rollup merge of #139669 - nnethercote:overhaul-AssocItem, r=oli-obkStuart Cook-34/+33
Overhaul `AssocItem` `AssocItem` has multiple fields that only make sense some of the time. E.g. the `name` can be empty if it's an RPITIT associated type. It's clearer and less error prone if these fields are moved to the relevant `kind` variants. r? ``@fee1-dead``
2025-04-15Auto merge of #139826 - matthiaskrgr:rollup-0q0qvkd, r=matthiaskrgrbors-19/+8
Rollup of 8 pull requests Successful merges: - #139745 (Avoid unused clones in `Cloned<I>` and `Copied<I>`) - #139757 (opt-dist: use executable-extension for host llvm-profdata) - #139778 (Add test for issue 34834) - #139783 (Use `compiletest-ignore-dir` for bootstrap self-tests) - #139797 (Allow (but don't require) `#[unsafe(naked)]` so that `compiler-builtins` can upgrade to it) - #139799 (Specify `--print info=file` syntax in `--help`) - #139811 (Use `newtype_index!`-generated types more idiomatically) - #139813 (Miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-15Move `name` field from `AssocItem` to `AssocKind` variants.Nicholas Nethercote-24/+27
To accurately reflect that RPITIT assoc items don't have a name. This avoids the use of `kw::Empty` to mean "no name", which is error prone. Helps with #137978.
2025-04-15Move `opt_rpitit_info` field to `hir::AssocKind::Type`.Nicholas Nethercote-5/+3
From `hir::AssocItem`.
2025-04-14Auto merge of #139577 - davidtwco:sizedness-go-vroom, r=oli-obkbors-15/+35
re-use `Sized` fast-path There's an existing fast path for the `type_op_prove_predicate` predicate, checking for trivially `Sized` types, which can be re-used when evaluating obligations within queries. This should improve performance and was found to be beneficial in #137944. r? types
2025-04-14Use `newtype_index!`-generated types more idiomaticallyYotam Ofek-19/+8
2025-04-14Move `has_self` field to `hir::AssocKind::Fn`.Nicholas Nethercote-6/+4
`hir::AssocItem` currently has a boolean `fn_has_self_parameter` field, which is misplaced, because it's only relevant for associated fns, not for associated consts or types. This commit moves it (and renames it) to the `AssocKind::Fn` variant, where it belongs. This requires introducing a new C-style enum, `AssocTag`, which is like `AssocKind` but without the fields. This is because `AssocKind` values are passed to various functions like `find_by_ident_and_kind` to indicate what kind of associated item should be searched for, and having to specify `has_self` isn't relevant there. New methods: - Predicates `AssocItem::is_fn` and `AssocItem::is_method`. - `AssocItem::as_tag` which converts `AssocItem::kind` to `AssocTag`. Removed `find_by_name_and_kinds`, which is unused. `AssocItem::descr` can now distinguish between methods and associated functions, which slightly improves some error messages.
2025-04-09Use a query rather than recomputing the tail repeatedlyMichael Goulet-15/+1
2025-04-09Rigidly project missing item due to guaranteed impossible sized predicateMichael Goulet-45/+59
2025-04-09re-use sized fast pathDavid Wood-15/+35
There's an existing fast path for the `type_op_prove_predicate` predicate, checking for trivially `Sized` types, which can be re-used when evaluating obligations within queries. This should improve performance, particularly in anticipation of new sizedness traits being added which can take advantage of this.
2025-04-09Auto merge of #139552 - matthiaskrgr:rollup-b194mk8, r=matthiaskrgrbors-3/+3
Rollup of 10 pull requests Successful merges: - #139494 (Restrict some queries by def-kind more) - #139496 (Revert r-a changes of rust-lang/rust#139455) - #139506 (add missing word in doc comment (part 2)) - #139515 (Improve presentation of closure signature mismatch from `Fn` trait goal) - #139520 (compiletest maintenance: sort deps and drop dep on `anyhow`) - #139523 (Rustc dev guide subtree update) - #139526 (Fix deprecation note for std::intrinsics) - #139528 (compiletest: Remove the `--logfile` flag) - #139541 (Instantiate higher-ranked transmute goal w/ placeholders before emitting sub-obligations) - #139547 (Update library tracking issue template to set S-tracking-unimplemented) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-08Rollup merge of #139541 - compiler-errors:transmute, r=lcnrMatthias Krüger-3/+3
Instantiate higher-ranked transmute goal w/ placeholders before emitting sub-obligations This avoids an ICE where we weren't keeping track of bound variables correctly in the `Freeze` obligations we emit for transmute goals. We could use `rebind` instead on that goal, but I think it's better just to instantiate the binder. Fixes #139538 r? `@lcnr` or reassign