about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty
AgeCommit message (Collapse)AuthorLines
2024-02-22`DefId` to `LocalDefId`lcnr-2/+3
2024-02-22Remove dead `expect_error_or_delayed_bug` method.Nicholas Nethercote-5/+0
2024-02-21Rollup merge of #121328 - ffmancera:ff/verbose_long_type, r=compiler-errorsDylan DPC-1/+1
Make --verbose imply -Z write-long-types-to-disk=no When shortening the type it is necessary to take into account the `--verbose` flag, if it is activated, we must always show the entire type and not write it in a file. Fixes: https://github.com/rust-lang/rust/issues/119130
2024-02-21Rollup merge of #121208 - nnethercote:delayed_bug-to-bug, r=lcnrDylan DPC-2/+1
Convert `delayed_bug`s to `bug`s. I have a suspicion that quite a few delayed bug paths are impossible to reach, so I did an experiment. I converted every `delayed_bug` to a `bug`, ran the full test suite, then converted back every `bug` that was hit. A surprising number were never hit. This is too dangerous to merge. Increased coverage (fuzzing or a crater run) would likely hit more cases. But it might be useful for people to look at and think about which paths are genuinely unreachable. r? `@ghost`
2024-02-21Convert `bug`s back to `delayed_bug`s.Nicholas Nethercote-1/+3
This commit undoes some of the previous commit's mechanical changes, based on human judgment.
2024-02-21Convert `delayed_bug`s to `bug`s.Nicholas Nethercote-5/+2
I have a suspicion that quite a few delayed bug paths are impossible to reach, so I did an experiment. I converted every `delayed_bug` to a `bug`, ran the full test suite, then converted back every `bug` that was hit. A surprising number were never hit. The next commit will convert some more back, based on human judgment.
2024-02-20Rollup merge of #121344 - fmease:lta-constr-by-input, r=oli-obkMatthias Krüger-21/+119
Expand weak alias types before collecting constrained/referenced late bound regions + refactorings Fixes #114220. Follow-up to #120780. r? `@oli-obk`
2024-02-20Move the peeling function for weak alias typesLeón Orell Valerian Liehr-0/+33
2024-02-20Expand weak alias types before collecting constrained and referenced late ↵León Orell Valerian Liehr-8/+10
bound regions
2024-02-20Introduce expand_weak_alias_tysLeón Orell Valerian Liehr-14/+77
2024-02-20Make --verbose imply -Z write-long-types-to-disk=noFernando Fernandez Mancera-1/+1
When shortening the type it is necessary to take into account the `--verbose` flag, if it is activated, we must always show the entire type and not write it in a file. Fixes: https://github.com/rust-lang/rust/issues/119130
2024-02-19Prefer `DiagnosticBuilder` over `Diagnostic` in diagnostic modifiers.Nicholas Nethercote-4/+4
There are lots of functions that modify a diagnostic. This can be via a `&mut Diagnostic` or a `&mut DiagnosticBuilder`, because the latter type wraps the former and impls `DerefMut`. This commit converts all the `&mut Diagnostic` occurrences to `&mut DiagnosticBuilder`. This is a step towards greatly simplifying `Diagnostic`. Some of the relevant function are made generic, because they deal with both errors and warnings. No function bodies are changed, because all the modifier methods are available on both `Diagnostic` and `DiagnosticBuilder`.
2024-02-16Move trait into attr so it's greppableMichael Goulet-6/+6
2024-02-16Use extension trait deriveMichael Goulet-27/+6
2024-02-16Auto merge of #120500 - oli-obk:intrinsics2.0, r=WaffleLapkinbors-5/+11
Implement intrinsics with fallback bodies fixes #93145 (though we can port many more intrinsics) cc #63585 The way this works is that the backend logic for generating custom code for intrinsics has been made fallible. The only failure path is "this intrinsic is unknown". The `Instance` (that was `InstanceDef::Intrinsic`) then gets converted to `InstanceDef::Item`, which represents the fallback body. A regular function call to that body is then codegenned. This is currently implemented for * codegen_ssa (so llvm and gcc) * codegen_cranelift other backends will need to adjust, but they can just keep doing what they were doing if they prefer (though adding new intrinsics to the compiler will then require them to implement them, instead of getting the fallback body). cc `@scottmcm` `@WaffleLapkin` ### todo * [ ] miri support * [x] default intrinsic name to name of function instead of requiring it to be specified in attribute * [x] make sure that the bodies are always available (must be collected for metadata)
2024-02-16Auto merge of #120486 - reitermarkus:use-generic-nonzero, r=dtolnaybors-22/+20
Use generic `NonZero` internally. Tracking issue: https://github.com/rust-lang/rust/issues/120257
2024-02-15Fix closure kind docsMichael Goulet-11/+26
2024-02-15Auto merge of #116564 - oli-obk:evaluated_static_in_metadata, ↵bors-0/+1
r=RalfJung,cjgillot Store static initializers in metadata instead of the MIR of statics. This means that adding generic statics would be even more difficult, as we can't evaluate statics from other crates anymore, but the subtle issue I have encountered make me think that having this be an explicit problem is better. The issue is that ```rust static mut FOO: &mut u32 = &mut 42; static mut BAR = unsafe { FOO }; ``` gets different allocations, instead of referring to the same one. This is also true for non-static mut, but promotion makes `static FOO: &u32 = &42;` annoying to demo. Fixes https://github.com/rust-lang/rust/issues/61345 ## Why is this being done? In order to ensure all crates see the same nested allocations (which is the last issue that needs fixing before we can stabilize [`const_mut_refs`](https://github.com/rust-lang/rust/issues/57349)), I am working on creating anonymous (from the Rust side, to LLVM it's like a regular static item) static items for the nested allocations in a static. If we evaluate the static item in a downstream crate again, we will end up duplicating its nested allocations (and in some cases, like the `match` case, even duplicate the main allocation).
2024-02-15Return ConstAllocation from eval_static_initializer query directlyOli Scherer-1/+1
2024-02-15Store static initializers in metadata instead of the MIR of statics.Oli Scherer-0/+1
2024-02-15Rollup merge of #121084 - oli-obk:create_def_forever_red2, r=WaffleLapkinMatthias Krüger-13/+17
Make sure `tcx.create_def` also depends on the forever red node, instead of just `tcx.at(span).create_def` oversight from https://github.com/rust-lang/rust/pull/119136 Not actually an issue, because all uses of `tcx.create_def` were in the resolver, which is `eval_always`, but still good to harden against future uses of `create_def` cc `@petrochenkov` `@WaffleLapkin`
2024-02-15Replace `NonZero::<_>::new` with `NonZero::new`.Markus Reiter-20/+15
2024-02-15Use generic `NonZero` internally.Markus Reiter-18/+21
2024-02-14Move all the heavy lifting from `TyCtxtAt::create_def` into `TyCtxt::create_def`Oli Scherer-13/+17
2024-02-14Rollup merge of #121084 - oli-obk:create_def_forever_red2, r=WaffleLapkinGuillaume Gomez-6/+6
Make sure `tcx.create_def` also depends on the forever red node, instead of just `tcx.at(span).create_def` oversight from https://github.com/rust-lang/rust/pull/119136 Not actually an issue, because all uses of `tcx.create_def` were in the resolver, which is `eval_always`, but still good to harden against future uses of `create_def` cc `@petrochenkov` `@WaffleLapkin`
2024-02-14Rollup merge of #121083 - GuillaumeGomez:doc-to_opt_closure_kind, ↵Guillaume Gomez-0/+14
r=compiler-errors Extend documentation for `Ty::to_opt_closure_kind` method This API was... surprising to use. With a little extra documentation, the weirdness can be reduced quite a lot. :) r? `@compiler-errors`
2024-02-14Extend documentation for `Ty::to_opt_closure_kind` methodGuillaume Gomez-0/+14
2024-02-14Make sure `tcx.create_def` also depends on the forever red node, instead of ↵Oli Scherer-6/+6
just `tcx.at(span).create_def`
2024-02-14Rollup merge of #120498 - compiler-errors:type-flags, r=lcnrOli Scherer-312/+69
Uplift `TypeVisitableExt` into `rustc_type_ir` This uplifts `TypeVisitableExt` into `rustc_type_ir` so it can be used in an interner-agnostic way. It also moves some `TypeSuperVisitable` bounds onto `Interner` since we don't expect to support libraries that have types which aren't foldable by default. This restores a couple of asserts in the canonicalizer code we uplifted, and also makes it so that we can use type-flags-based helpers in the solver code, which I'm interested in uplifting. r? lcnr
2024-02-14Auto merge of #121018 - oli-obk:impl_unsafety, r=TaKO8Kibors-0/+1
Fully stop using the HIR in trait impl checks At least I hope I found all happy path usages. I'll need to check if I can figure out a way to make queries declare that they don't access the HIR except in error paths
2024-02-13Rollup merge of #120959 - nnethercote:rm-good_path, r=oli-obkMatthias Krüger-6/+5
Remove good path delayed bugs Because they're not that useful, and kind of annoying. Details in the individual commits. r? ```@compiler-errors```
2024-02-13Move visitable bounds up into internerMichael Goulet-2/+2
2024-02-13Uplift TypeVisitableExt into rustc_type_irMichael Goulet-310/+67
2024-02-13Store impl unsafety in impl trait headerOli Scherer-0/+1
2024-02-13Auto merge of #120919 - oli-obk:impl_polarity, r=compiler-errorsbors-10/+29
Merge `impl_polarity` and `impl_trait_ref` queries Hopefully this is perf neutral. I want to finish https://github.com/rust-lang/rust/pull/120835 and stop using the HIR in `coherent_trait`, which should then give us a perf improvement.
2024-02-13Remove `good_path_delayed_bug`.Nicholas Nethercote-6/+5
It's only has a single remaining purpose: to ensure that a diagnostic is printed when `trimmed_def_paths` is used. It's an annoying mechanism: weak, with odd semantics, badly named, and gets in the way of other changes. This commit replaces it with a simpler `must_produce_diag` mechanism, getting rid of a diagnostic `Level` along the way.
2024-02-12Rollup merge of #120958 - ShoyuVanilla:remove-subst, r=oli-obkMatthias Krüger-80/+80
Dejargonize `subst` In favor of #110793, replace almost every occurence of `subst` and `substitution` from rustc codes, but they still remains in subtrees under `src/tools/` like clippy and test codes (I'd like to replace them after this)
2024-02-12Rollup merge of #120950 - compiler-errors:miri-async-closurs, r=RalfJung,oli-obkMatthias Krüger-14/+13
Fix async closures in CTFE First commit renames `is_coroutine_or_closure` into `is_closure_like`, because `is_coroutine_or_closure_or_coroutine_closure` seems confusing and long. Second commit fixes some forgotten cases where we want to handle `TyKind::CoroutineClosure` the same as closures and coroutines. The test exercises the change to `ValidityVisitor::aggregate_field_path_elem` which is the source of #120946, but not the change to `UsedParamsNeedSubstVisitor`, though I feel like it's not that big of a deal. Let me know if you'd like for me to look into constructing a test for the latter, though I have no idea what it'd look like (we can't assert against `TooGeneric` anywhere?). Fixes #120946 r? oli-obk cc ``@RalfJung``
2024-02-12Auto merge of #120980 - matthiaskrgr:rollup-dsjsqql, r=matthiaskrgrbors-5/+5
Rollup of 11 pull requests Successful merges: - #120765 (Reorder diagnostics API) - #120833 (More internal emit diagnostics cleanups) - #120899 (Gracefully handle non-WF alias in `assemble_alias_bound_candidates_recur`) - #120917 (Remove a bunch of dead parameters in functions) - #120928 (Add test for recently fixed issue) - #120933 (check_consts: fix duplicate errors, make importance consistent) - #120936 (improve `btree_cursors` functions documentation) - #120944 (Check that the ABI of the instance we are inlining is correct) - #120956 (Clean inlined type alias with correct param-env) - #120962 (Add myself to library/std review) - #120972 (fix ICE for deref coercions with type errors) r? `@ghost` `@rustbot` modify labels: rollup
2024-02-12Remove impl_polarity queryOli Scherer-0/+5
2024-02-12Implement intrinsics with fallback bodiesOli Scherer-1/+2
2024-02-12Stop calling `impl_polarity` when `impl_trait_ref` was also calledOli Scherer-5/+6
2024-02-12Eagerly dismiss binderOli Scherer-8/+5
2024-02-12Unwrap an Option that can only be Some, as inherent impls can't overlapOli Scherer-6/+6
2024-02-12Use a struct instead of a tupleOli Scherer-1/+8
2024-02-12Make impl_trait_ref into a query also returning more information about the implOli Scherer-0/+9
2024-02-12Make `is_intrinsic` query return the intrinsic nameOli Scherer-4/+9
2024-02-12Tweak delayed bug mentions.Nicholas Nethercote-5/+5
Now that we have both `delayed_bug` and `span_delayed_bug`, it makes sense to use the generic term "delayed bug" more.
2024-02-12Dejargnonize substShoyu Vanilla-80/+80
2024-02-12Lowering field access for anonymous adtsFrank King-0/+19