about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/print
AgeCommit message (Collapse)AuthorLines
2023-12-12Uplift TypeAndMutMichael Goulet-4/+4
2023-12-12Uplift ClosureKindMichael Goulet-5/+1
2023-12-11Auto merge of #118661 - fee1-dead-contrib:restore-const-partialEq, ↵bors-23/+8
r=compiler-errors Restore `const PartialEq` And thus fixes a number of tests. There is a bug that still needs to be fixed, so WIP for now. r? `@compiler-errors`
2023-12-10Auto merge of #118692 - surechen:remove_unused_imports, r=petrochenkovbors-6/+5
remove redundant imports detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR. r? `@petrochenkov`
2023-12-10clean up leftover FIXMEDeadbeef-28/+1
2023-12-10fix testsDeadbeef-1/+2
2023-12-10Revert "Don't print host effect param in pretty path_generic_args"Deadbeef-18/+29
This reverts commit f1bf874fb13703d706fc8184407c6df12555d8e9.
2023-12-10remove redundant importssurechen-6/+5
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-12-09Print constness in TraitPredPrintModifiersAndPathMichael Goulet-3/+6
2023-12-09Don't print host effect param in pretty path_generic_argsMichael Goulet-29/+18
2023-12-08Auto merge of #118725 - lcnr:normalizes-to-projection-split-3, r=BoxyUwUbors-0/+7
split `NormalizesTo` out of `Projection` 3 third attempt at #112658. Rebasing #116262 is very annoying, so I am doing it again from scratch. We should now be able to merge it without regressing anything as we handle occurs check failures involving aliases correctly since #117088. see https://hackmd.io/ktEL8knTSYmtdfrMMnA-Hg fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/1 r? `@compiler-errors`
2023-12-08implement and use `NormalizesTo`lcnr-1/+7
2023-12-07Auto merge of #118324 - RalfJung:ctfe-read-only-pointers, r=saethlinbors-3/+3
compile-time evaluation: detect writes through immutable pointers This has two motivations: - it unblocks https://github.com/rust-lang/rust/pull/116745 (and therefore takes a big step towards `const_mut_refs` stabilization), because we can now detect if the memory that we find in `const` can be interned as "immutable" - it would detect the UB that was uncovered in https://github.com/rust-lang/rust/pull/117905, which was caused by accidental stabilization of `copy` functions in `const` that can only be called with UB When UB is detected, we emit a future-compat warn-by-default lint. This is not a breaking change, so completely in line with [the const-UB RFC](https://rust-lang.github.io/rfcs/3016-const-ub.html), meaning we don't need t-lang FCP here. I made the lint immediately show up for dependencies since it is nearly impossible to even trigger this lint without `const_mut_refs` -- the accidentally stabilized `copy` functions are the only way this can happen, so the crates that popped up in #117905 are the only causes of such UB (in the code that crater covers), and the three cases of UB that we know about have all been fixed in their respective crates already. The way this is implemented is by making use of the fact that our interpreter is already generic over the notion of provenance. For CTFE we now use the new `CtfeProvenance` type which is conceptually an `AllocId` plus a boolean `immutable` flag (but packed for a more efficient representation). This means we can mark a pointer as immutable when it is created as a shared reference. The flag will be propagated to all pointers derived from this one. We can then check the immutable flag on each write to reject writes through immutable pointers. I just hope perf works out.
2023-12-07add unused `NormalizesTo` predicatelcnr-0/+1
2023-12-07ctfe interpreter: extend provenance so that it can track whether a pointer ↵Ralf Jung-3/+3
is immutable
2023-12-05Add print_trait_sugaredMichael Goulet-1/+45
2023-12-03rustc: Harmonize `DefKind` and `DefPathData`Vadim Petrochenkov-3/+3
`DefPathData::(ClosureExpr,ImplTrait)` are renamed to match `DefKind::(Closure,OpaqueTy)`. `DefPathData::ImplTraitAssocTy` is replaced with `DefPathData::TypeNS(kw::Empty)` because both correspond to `DefKind::AssocTy`. It's possible that introducing `(DefKind,DefPathData)::AssocOpaqueTy` could be a better solution, but that would be a much more invasive change. Const generic parameters introduced for effects are moved from `DefPathData::TypeNS` to `DefPathData::ValueNS`, because constants are values. `DefPathData` is no longer passed to `create_def` functions to avoid redundancy.
2023-12-02Rename `Handler::delay_good_path_bug` as `Handler::good_path_delayed_bug`.Nicholas Nethercote-1/+1
In line with the previous commits.
2023-11-27Rollup merge of #118340 - compiler-errors:tweaks, r=lqdTakayuki Maeda-10/+10
Use helper functions in `pretty.rs` instead of accessing the `Cell`s manually Pulled this out of another PR that I never landed.
2023-11-26Use helpersMichael Goulet-10/+10
2023-11-24Separate Nan/Inf floats with _Michael Goulet-2/+5
2023-11-22Auto merge of #118120 - compiler-errors:closure-kind, r=lcnrbors-5/+0
Remove `PredicateKind::ClosureKind` We don't need the `ClosureKind` predicate kind -- instead, `Fn`-family trait goals are left as ambiguous, and we only need to make progress on `FnOnce` projection goals for inference purposes. This is similar to how we do confirmation of `Fn`-family trait and projection goals in the new trait solver, which also doesn't use the `ClosureKind` predicate. Some hacky logic is added in the second commit so that we can keep the error messages the same.
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-9/+9
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-11-21Remove ClosureKind predicate kindMichael Goulet-5/+0
2023-11-19Add documentation for some queriesNilstrieb-1/+2
2023-11-14finish `RegionKind` renamelcnr-4/+4
- `ReFree` -> `ReLateParam` - `ReEarlyBound` -> `ReEarlyParam`
2023-11-13rename `ReLateBound` to `ReBound`lcnr-13/+9
other changes: - `Region::new_late_bound` -> `Region::new_bound` - `Region::is_late_bound` -> `Region::is_bound`
2023-10-30Some more coroutine renamingsMichael Goulet-1/+1
2023-10-28Remove needless `allow`sNilstrieb-5/+0
2023-10-28Move macros to usageNilstrieb-40/+40
2023-10-28Remove needless print ctx defsNilstrieb-7/+0
2023-10-25Auto merge of #116993 - compiler-errors:clause-kind, r=jackh726bors-45/+53
Uplift `ClauseKind` and `PredicateKind` into `rustc_type_ir` Uplift `ClauseKind` and `PredicateKind` into `rustc_type_ir`. Blocked on #116951 r? `@ghost`
2023-10-24Get rid of 'tcx on ConstVid, EffectVidMichael Goulet-3/+3
2023-10-21Make `ty::print::Printer` take `&mut self` instead of `self`Nilstrieb-279/+296
This simplifies the code by removing all the `self` assignments and makes the flow of data clearer - always into the printer. Especially in v0 mangling, which already used `&mut self` in some places, it gets a lot more uniform.
2023-10-20Uplift ClauseKind and PredicateKindMichael Goulet-45/+53
2023-10-20Rename `CoroutineKind::Gen` to `::Coroutine`Oli Scherer-1/+1
2023-10-20s/generator/coroutine/Oli Scherer-11/+11
2023-10-20s/Generator/Coroutine/Oli Scherer-7/+7
2023-10-19Auto merge of #116874 - compiler-errors:elaborator-nits, r=wesleywiserbors-2/+3
Some small elaborator nits Didn't want to fold these into a totally unrelated pr.
2023-10-18Make sure that non-pretty-printing usages are using the correct elaboratorMichael Goulet-2/+3
2023-10-17Remove `Print::Error`Nilstrieb-22/+11
All printing goes through `fmt::Error` now.
2023-10-17Remove `Printer::Error`Nilstrieb-95/+93
It's always a `fmt::Error` except in some cases where it was `!`, but we're not really winning anything in that case.
2023-10-17Remove `Print::Output`Nilstrieb-27/+19
Now that `Printer` doesn't have subprinters anymore, the output of a printing operation is always the same.
2023-10-17Remove "subprinter" types from `Printer`Nilstrieb-88/+56
These are `Self` in almost all printers except one, which can just store the state as a field instead. This simplifies the printer and allows for further simplifications, for example using `&mut self` instead of passing around the printer.
2023-10-13Format all the let chains in compilerMichael Goulet-15/+26
2023-09-26Don't store lazyness in DefKindMichael Goulet-3/+3
2023-09-24Remove span from BrAnon.Camille GILLOT-2/+2
2023-09-23Remove GeneratorWitness and rename GeneratorWitnessMIR.Camille GILLOT-6/+2
2023-09-21adjust how closure/generator types and rvalues are printedRalf Jung-7/+7
2023-09-19use pretty_print_const_value from MIR constant 'extra' printingRalf Jung-1/+1