about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/print
AgeCommit message (Collapse)AuthorLines
2024-10-23nightly feature tracking: get rid of the per-feature bool fieldsRalf Jung-1/+1
2024-10-20Remove the BoundConstness::NotConst variantMichael Goulet-4/+8
2024-10-02Improve const traits diagnostics for new desugaringDeadbeef-12/+34
2024-09-25Compiler: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-2/+2
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-7/+7
2024-09-12Rollup merge of #130250 - compiler-errors:useless-conversion, r=jieyouxuStuart Cook-1/+1
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-11clippy::useless_conversionMichael Goulet-1/+1
2024-09-11Simplify some nested if statementsMichael Goulet-4/+2
2024-08-22Rollup merge of #129395 - fmease:pp-dyn-w-gat, r=compiler-errorsMatthias Krüger-1/+4
Pretty-print own args of existential projections (dyn-Trait w/ GAT constraints) Previously we would just drop them. This bug isn't that significant as it can only be triggered by user code that constrains GATs inside trait object types which is currently gated under the interim feature `generic_associated_types_extended` (whose future is questionable) or on stable if the GATs are 'disabled' in dyn-Trait via `where Self: Sized` (in which case the assoc type bindings get ignored anyway (and trigger the warn-by-default lint `unused_associated_type_bounds`)), so yeah. Affects diagnostic output and output of `std::any::type_name{_of_val}`.
2024-08-22Pretty-print own args of existential projectionsLeón Orell Valerian Liehr-1/+4
2024-08-17Use cnum for extern crate dataMichael Goulet-5/+3
2024-08-14Auto merge of #129076 - matthiaskrgr:rollup-rg8mi2x, r=matthiaskrgrbors-1/+3
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-13Use is_lang_item moreMichael Goulet-1/+3
2024-08-09Shrink `TyKind::FnPtr`.Nicholas Nethercote-4/+4
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-07-29Reformat `use` declarations.Nicholas Nethercote-17/+13
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-19Avoid ref when using format! in compilerYuri Astrakhan-1/+1
Clean up a few minor refs in `format!` macro, as it has a performance cost. Apparently the compiler is unable to inline `format!("{}", &variable)`, and does a run-time double-reference instead (format macro already does one level referencing). Inlining format args prevents accidental `&` misuse.
2024-07-17Put the dots backMichael Goulet-2/+5
2024-07-07Get rid of the redundant elaboration in middleMichael Goulet-7/+8
2024-07-04Auto merge of #123781 - RalfJung:miri-fn-identity, r=oli-obkbors-2/+2
Miri function identity hack: account for possible inlining Having a non-lifetime generic is not the only reason a function can be duplicated. Another possibility is that the function may be eligible for cross-crate inlining. So also take into account the inlining attribute in this Miri hack for function pointer identity. That said, `cross_crate_inlinable` will still sometimes return true even for `inline(never)` functions: - when they are `DefKind::Ctor(..) | DefKind::Closure` -- I assume those cannot be `InlineAttr::Never` anyway? - when `cross_crate_inline_threshold == InliningThreshold::Always` so maybe this is still not quite the right criterion to use for function pointer identity.
2024-07-03Auto merge of #125507 - compiler-errors:type-length-limit, r=lcnrbors-1/+31
Re-implement a type-size based limit r? lcnr This PR reintroduces the type length limit added in #37789, which was accidentally made practically useless by the caching changes to `Ty::walk` in #72412, which caused the `walk` function to no longer walk over identical elements. Hitting this length limit is not fatal unless we are in codegen -- so it shouldn't affect passes like the mir inliner which creates potentially very large types (which we observed, for example, when the new trait solver compiles `itertools` in `--release` mode). This also increases the type length limit from `1048576 == 2 ** 20` to `2 ** 24`, which covers all of the code that can be reached with craterbot-check. Individual crates can increase the length limit further if desired. Perf regression is mild and I think we should accept it -- reinstating this limit is important for the new trait solver and to make sure we don't accidentally hit more type-size related regressions in the future. Fixes #125460
2024-07-02Re-implement a type-size based limitMichael Goulet-1/+31
2024-07-02Miri function identity hack: account for possible inliningRalf Jung-2/+2
2024-07-01Make `FloatTy` checks exhaustive in pretty printTrevor Gross-16/+18
This should prevent the default fallback if we add more float types in the future.
2024-06-21Rename a bunch of thingsMichael Goulet-1/+1
2024-06-18Make pretty printing for `f16` and `f128` consistentTrevor Gross-1/+9
Currently the docs show e.g. {transmute(0xfffeffffffffffffffffffffffffffff): f128} for f128 constants. This should fix that to instead use apfloat for printing, as is done for `f32` and `f64`.
2024-06-14Use is_lang_item more aggressivelyMichael Goulet-3/+3
2024-06-10ScalarInt: size mismatches are a bug, do not delay the panicRalf Jung-2/+2
2024-06-06Revert "Rollup merge of #124976 - petrochenkov:usedcrates, r=oli-obk"Rémy Rakic-1/+1
This reverts commit eda4a35f365535af72118118a3597edf5a13c12d, reversing changes made to eb6b35b5bcb3c2a594cb29cd478aeb2893f49d30.
2024-06-05Misc fixes (pattern type lowering, cfi, pretty printing)Boxy-18/+1
2024-06-05Add `Ty` to `ConstKind::Value`Boxy-3/+3
2024-06-05Basic removal of `Ty` from places (boring)Boxy-2/+2
2024-06-04Rollup merge of #125968 - BoxyUwU:shrink_ty_expr, r=oli-obkMichael Goulet-58/+44
Store the types of `ty::Expr` arguments in the `ty::Expr` Part of #125958 In attempting to remove the `ty` field on `Const` it will become necessary to store the `Ty<'tcx>` inside of `Expr<'tcx>`. In order to do this without blowing up the size of `ConstKind`, we start storing the type/const args as `GenericArgs` r? `@oli-obk`
2024-06-04Downsize `ty::Expr`Boxy-58/+44
2024-06-03Align Term methods with GenericArg methodsMichael Goulet-3/+3
2024-06-03Auto merge of #125778 - estebank:issue-67100, r=compiler-errorsbors-1/+1
Use parenthetical notation for `Fn` traits Always use the `Fn(T) -> R` format when printing closure traits instead of `Fn<(T,), Output = R>`. Address #67100: ``` error[E0277]: expected a `Fn()` closure, found `F` --> file.rs:6:13 | 6 | call_fn(f) | ------- ^ expected an `Fn()` closure, found `F` | | | required by a bound introduced by this call | = note: wrap the `F` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `call_fn` --> file.rs:1:15 | 1 | fn call_fn<F: Fn() -> ()>(f: &F) { | ^^^^^^^^^^ required by this bound in `call_fn` help: consider further restricting this bound | 5 | fn call_any<F: std::any::Any + Fn()>(f: &F) { | ++++++ ```
2024-06-01Uplift TypeRelation and RelateMichael Goulet-2/+5
2024-05-29Use parenthetical notation for `Fn` traitsEsteban Küber-1/+1
Always use the `Fn(T) -> R` format when printing closure traits instead of `Fn<(T,), Output = R>`. Fix #67100: ``` error[E0277]: expected a `Fn()` closure, found `F` --> file.rs:6:13 | 6 | call_fn(f) | ------- ^ expected an `Fn()` closure, found `F` | | | required by a bound introduced by this call | = note: wrap the `F` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `call_fn` --> file.rs:1:15 | 1 | fn call_fn<F: Fn() -> ()>(f: &F) { | ^^^^^^^^^^ required by this bound in `call_fn` help: consider further restricting this bound | 5 | fn call_any<F: std::any::Any + Fn()>(f: &F) { | ++++++ ```
2024-05-28Add an intrinsic for `ptr::metadata`Scott McMurray-0/+2
2024-05-27Auto merge of #125410 - fmease:adj-lint-diag-api, r=nnethercotebors-1/+1
[perf] Delay the construction of early lint diag structs Attacks some of the perf regressions from https://github.com/rust-lang/rust/pull/124417#issuecomment-2123700666. See individual commits for details. The first three commits are not strictly necessary. However, the 2nd one (06bc4fc67145e3a7be9b5a2cf2b5968cef36e587, *Remove `LintDiagnostic::msg`*) makes the main change way nicer to implement. It's also pretty sweet on its own if I may say so myself.
2024-05-23Auto merge of #125434 - nnethercote:rm-more-extern-tracing, r=jackh726bors-0/+1
Remove more `#[macro_use] extern crate tracing` 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 and #124914. r? `@jackh726`
2024-05-23Remove `#[macro_use] extern crate tracing` from `rustc_middle`.Nicholas Nethercote-0/+1
2024-05-23Remove `DelayDm`León Orell Valerian Liehr-1/+1
With the removal of `LintDiagnostic::msg` / the `msg` param from lint diag APIs, primary messages for lint diags are always constructed lazily inside decorator fns rendering this wrapper type unused / useless.
2024-05-22rustc: Use `tcx.used_crates(())` moreVadim Petrochenkov-1/+1
And explain when it should be used.
2024-05-21Uplift OutlivesPredicate, remove a bunch of unnecessary associated types ↵Michael Goulet-6/+2
from Interner
2024-05-21Uplift binderMichael Goulet-14/+5
2024-05-19Add and use generics.is_empty() and generics.is_own_empty, rather than using ↵Santiago Pastorino-1/+1
generics' attributes
2024-05-17Rename Unsafe to SafetySantiago Pastorino-1/+1
2024-05-16Uplift FnSigMichael Goulet-10/+10
2024-05-13Uplift AliasTyMichael Goulet-27/+27
2024-05-13Apply nitsMichael Goulet-1/+2