about summary refs log tree commit diff
path: root/compiler/rustc_middle
AgeCommit message (Collapse)AuthorLines
2024-01-19Pack the u128 in SwitchTargetsJosh Stone-15/+12
2024-01-20Auto merge of #116672 - maurer:128-align, r=nikicbors-3/+9
LLVM 18 x86 data layout update With https://reviews.llvm.org/D86310 LLVM now has i128 aligned to 16-bytes on x86 based platforms. This will be in LLVM-18. This patch updates all our spec targets to be 16-byte aligned, and removes the alignment when speaking to older LLVM. This results in Rust overaligning things relative to LLVM on older LLVMs. This implements MCP https://github.com/rust-lang/compiler-team/issues/683. See #54341
2024-01-19Consolidate logic around resolving built-in coroutine trait implsMichael Goulet-0/+50
2024-01-19Always use RevealAll for const eval queriesOli Scherer-2/+2
2024-01-19LLVM 18 x86 data layout updateMatthew Maurer-3/+9
With https://reviews.llvm.org/D86310 LLVM now has i128 aligned to 16-bytes on x86 based platforms. This will be in LLVM-18. This patch updates all our spec targets to be 16-byte aligned, and removes the alignment when speaking to older LLVM. This results in Rust overaligning things relative to LLVM on older LLVMs. This alignment change was discussed in rust-lang/compiler-team#683 See #54341 for additional information about why this is happening and where this will be useful in the future. This *does not* stabilize `i128`/`u128` for FFI.
2024-01-19Fix `Stable` trait and its impls to work with the new `with_tables`Oli Scherer-3/+24
2024-01-19Auto merge of #120112 - matthiaskrgr:rollup-48o3919, r=matthiaskrgrbors-18/+40
Rollup of 9 pull requests Successful merges: - #119582 (bootstrap: handle vendored sources when remapping crate paths) - #119730 (docs: fix typos) - #119828 (Improved collapse_debuginfo attribute, added command-line flag) - #119869 (replace `track_errors` usages with bubbling up `ErrorGuaranteed`) - #120037 (Remove `next_root_ty_var`) - #120094 (tests/ui/asm/inline-syntax: adapt for LLVM 18) - #120096 (Set RUSTC_BOOTSTRAP=1 consistently) - #120101 (change `.unwrap()` to `?` on write where `fmt::Result` is returned) - #120102 (Fix typo in munmap_partial.rs) r? `@ghost` `@rustbot` modify labels: rollup
2024-01-18Modify GenericArg and Term structs to use strict provenance rulesKamalesh Palanisamy-18/+56
2024-01-19Auto merge of #120006 - cjgillot:no-hir-owner, r=wesleywiserbors-71/+35
Get rid of the hir_owner query. This query was meant as a firewall between `hir_owner_nodes` which is supposed to change often, and the queries that only depend on the item signature. That firewall was inefficient, leaking the contents of the HIR body through `HirId`s. `hir_owner` incurs a significant cost, as we need to hash HIR twice in multiple modes. This PR proposes to remove it, and simplify the hashing scheme. For the future, `def_kind`, `def_span`... are much more efficient for incremental decoupling, and should be preferred.
2024-01-18Rollup merge of #120101 - mj10021:issue-120090-fix, r=WaffleLapkinMatthias Krüger-2/+2
change `.unwrap()` to `?` on write where `fmt::Result` is returned Fixes #120090 which points out that some of the `.unwrap()`s in `rustc_middle/src/mir/pretty.rs` are likely meant to be `?`s
2024-01-18Rollup merge of #119869 - oli-obk:track_errors2, r=matthewjasperMatthias Krüger-14/+37
replace `track_errors` usages with bubbling up `ErrorGuaranteed` more of the same as https://github.com/rust-lang/rust/pull/117449 (removing `track_errors`)
2024-01-18Rollup merge of #119828 - azhogin:azhogin/collapse_debuginfo_improved_attr, ↵Matthias Krüger-2/+1
r=petrochenkov Improved collapse_debuginfo attribute, added command-line flag Improved attribute collapse_debuginfo with variants: `#[collapse_debuginfo=(no|external|yes)]`. Added command-line flag for default behaviour. Work-in-progress: will add more tests. cc https://github.com/rust-lang/rust/issues/100758
2024-01-18Auto merge of #120089 - matthiaskrgr:rollup-xyfqrb5, r=matthiaskrgrbors-57/+30
Rollup of 8 pull requests Successful merges: - #119172 (Detect `NulInCStr` error earlier.) - #119833 (Make tcx optional from StableMIR run macro and extend it to accept closures) - #119967 (Add `PatKind::Err` to AST/HIR) - #119978 (Move async closure parameters into the resultant closure's future eagerly) - #120021 (don't store const var origins for known vars) - #120038 (Don't create a separate "basename" when naming and opening a MIR dump file) - #120057 (Don't ICE when deducing future output if other errors already occurred) - #120073 (Remove spastorino from users_on_vacation) r? `@ghost` `@rustbot` modify labels: rollup
2024-01-18change unwrap to `?` on write where result is returnedJames Dietz-2/+2
2024-01-18Auto merge of #118553 - jackh726:lint-implied-bounds, r=lcnrbors-2/+15
error on incorrect implied bounds in wfcheck except for Bevy dependents Rebase of #109763 Additionally, special cases Bevy `ParamSet` types to not trigger the lint. This is tracked in #119956. Fixes #109628
2024-01-18Rollup merge of #120038 - Zalathar:dump-path, r=WaffleLapkinMatthias Krüger-38/+20
Don't create a separate "basename" when naming and opening a MIR dump file These functions were split up by #77080, in order to support passing the dump file's “basename” (filename without extension) to the implementation of `-Zdump-mir-spanview`, so that it could be used as a page title. That flag has since been removed (#119566), so now there's no particular reason for this code to handle the basename separately from the filename or full path. This PR therefore restores things to (roughly) how they were before #77080.
2024-01-18Rollup merge of #120021 - lcnr:const-var-value, r=compiler-errorsMatthias Krüger-19/+10
don't store const var origins for known vars r? types
2024-01-17Correctly handle normalization in implied boundsAli MJ Al-Nasrawy-2/+15
Special-case Bevy dependents to not error
2024-01-17Improved collapse_debuginfo attribute, added command-line flag (no|external|yes)Andrew Zhogin-2/+1
2024-01-17Use FnOnceOutput instead of FnOnce where expectedOli Scherer-1/+1
2024-01-17Make crate_inherent_impls fallible and stop using `track_errors` for itOli Scherer-12/+33
2024-01-17Make crate_inherent_impls_overlap_check bubble up its errorsOli Scherer-1/+2
2024-01-17Move `check_mod_impl_wf` query call out of track_errors and bubble errors up ↵Oli Scherer-1/+2
instead.
2024-01-17Auto merge of #119111 - michaelwoerister:measureme-11, r=Mark-Simulacrumbors-1/+1
Update measureme crate to version 11 perf.rlo has been updated to use 11.0.0 already, so it should be able to handle the new file format. r? `@Mark-Simulacrum` Fixes https://github.com/rust-lang/rust/issues/99282 Fixes https://github.com/rust-lang/rust/issues/119103
2024-01-17Auto merge of #119922 - nnethercote:fix-Diag-code-is_lint, r=oli-obkbors-5/+2
Rework how diagnostic lints are stored. `Diagnostic::code` has the type `DiagnosticId`, which has `Error` and `Lint` variants. Plus `Diagnostic::is_lint` is a bool, which should be redundant w.r.t. `Diagnostic::code`. Seems simple. Except it's possible for a lint to have an error code, in which case its `code` field is recorded as `Error`, and `is_lint` is required to indicate that it's a lint. This is what happens with `derive(LintDiagnostic)` lints. Which means those lints don't have a lint name or a `has_future_breakage` field because those are stored in the `DiagnosticId::Lint`. It's all a bit messy and confused and seems unintentional. This commit: - removes `DiagnosticId`; - changes `Diagnostic::code` to `Option<String>`, which means both errors and lints can straightforwardly have an error code; - changes `Diagnostic::is_lint` to `Option<IsLint>`, where `IsLint` is a new type containing a lint name and a `has_future_breakage` bool, so all lints can have those, error code or not. r? `@oli-obk`
2024-01-17Inline `dump_file_basename` into `dump_path`Zalathar-19/+10
2024-01-17Inline `create_dump_file_with_basename`Zalathar-22/+13
2024-01-16Get rid of the hir_owner query.Camille GILLOT-71/+35
2024-01-16Auto merge of #119977 - Mark-Simulacrum:defid-cache, r=cjgillotbors-1/+2
Cache local DefId-keyed queries without hashing This caches local DefId-keyed queries using just an IndexVec. This costs ~5% extra max-rss at most but brings significant runtime improvement, up to 13% cycle counts (mean: 4%) on primary benchmarks. It's possible that further tweaks could reduce the memory overhead further but this win seems worth landing despite the increased memory, particularly with regards to eliminating the present set in non-incr or storing it inline (skip list?) with the main data. We tried applying this scheme to all keys in the [first perf run] but found that it carried a significant memory hit (50%). instructions/cycle counts were also much more mixed, though that may have been due to the lack of the present set optimization (needed for fast iter() calls in incremental scenarios). Closes https://github.com/rust-lang/rust/issues/45275 [first perf run]: https://perf.rust-lang.org/compare.html?start=30dfb9e046aeb878db04332c74de76e52fb7db10&end=6235575300d8e6e2cc6f449cb9048722ef43f9c7&stat=instructions:u
2024-01-16Auto merge of #116520 - Enselic:large-copy-into-fn, r=oli-obkbors-4/+51
large_assignments: Lint on specific large args passed to functions Requires lowering function call arg spans down to MIR, which is done in the second commit. Part of #83518 Also see * https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/arg.20Spans.20for.20TerminatorKind.3A.3ACall.3F * https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/move_size_limit.20lint r? `@oli-obk` (E-mentor)
2024-01-16Rollup merge of #119969 - compiler-errors:simplify-closure-env-ty, r=oli-obkMatthias Krüger-9/+5
Simplify `closure_env_ty` and `closure_env_param` Random cleanup that I found when working on async closures. This makes it easier to separate the latter into a new tykind.
2024-01-16don't store const var origins for known varslcnr-19/+10
2024-01-15Cache local DefId-keyed queries without hashingMark Rousskov-1/+2
Foreign maps are used to cache external DefIds, typically backed by metadata decoding. In the future we might skip caching `V` there (since loading from metadata usually is already cheap enough), but for now this cuts down on the impact to memory usage and time to None-init a bunch of memory. Foreign data is usually much sparser, since we're not usually loading *all* entries from the foreign crate(s).
2024-01-15large_assignments: Lint on specific large args passed to functionsMartin Nordholts-0/+12
2024-01-15compiler: Lower fn call arg spans down to MIRMartin Nordholts-4/+14
To enable improved accuracy of diagnostics in upcoming commits.
2024-01-15Implement TypeVisitable and TypeFoldable for SpannedMartin Nordholts-0/+25
The traits are already implemented for Span, so it makes sense to also have them for Spanned (upcoming commits will make use of this).
2024-01-15Rollup merge of #119974 - nnethercote:trimmed_def_paths-improvements, ↵Matthias Krüger-31/+26
r=compiler-errors Minor `trimmed_def_paths` improvements r? `@compiler-errors`
2024-01-15Rollup merge of #119897 - compiler-errors:fulfillment-errors, r=lcnrMatthias Krüger-2/+2
`OutputTypeParameterMismatch` -> `SignatureMismatch` I'm probably missing something that made this rename more complicated. What did you end up getting stuck on when renaming this selection error, `@lcnr?` **also** I renamed the `FulfillmentErrorCode` variants. This is just churn but I wanted to do it forever. I can move it out of this PR if desired. r? lcnr
2024-01-15Replace `TrimmedDefPaths` with a bool.Nicholas Nethercote-13/+11
It's a tri-state enum but the `Always` variant is never used, so a bool is simpler.
2024-01-15Refactor `try_print_trimmed_def_path`.Nicholas Nethercote-18/+11
Inverting the condition lets us merge the two `Ok(false)` paths. I also find the inverted condition easier to read: "all the things that must be true for trimming to occur", instead of "any of the things that must be true for trimming to not occur".
2024-01-15Add some helpful comments in `trimmed_def_paths`.Nicholas Nethercote-1/+5
To explain things that took me a minute to work out.
2024-01-14Simplify closure_env_ty and closure_env_paramMichael Goulet-9/+5
2024-01-14Rework how diagnostic lints are stored.Nicholas Nethercote-5/+2
`Diagnostic::code` has the type `DiagnosticId`, which has `Error` and `Lint` variants. Plus `Diagnostic::is_lint` is a bool, which should be redundant w.r.t. `Diagnostic::code`. Seems simple. Except it's possible for a lint to have an error code, in which case its `code` field is recorded as `Error`, and `is_lint` is required to indicate that it's a lint. This is what happens with `derive(LintDiagnostic)` lints. Which means those lints don't have a lint name or a `has_future_breakage` field because those are stored in the `DiagnosticId::Lint`. It's all a bit messy and confused and seems unintentional. This commit: - removes `DiagnosticId`; - changes `Diagnostic::code` to `Option<String>`, which means both errors and lints can straightforwardly have an error code; - changes `Diagnostic::is_lint` to `Option<IsLint>`, where `IsLint` is a new type containing a lint name and a `has_future_breakage` bool, so all lints can have those, error code or not.
2024-01-13Auto merge of #119088 - George-lewis:glewis/suggest-upgrading-compiler, ↵bors-2/+1
r=Nilstrieb Suggest Upgrading Compiler for Gated Features This PR addresses #117318 I have a few questions: 1. Do we want to specify the current version and release date of the compiler? I have added this in via environment variables, which I found in the code for the rustc cli where it handles the `--version` flag a. How can I handle the changing message in the tests? 3. Do we want to only show this message when the compiler is old? a. How can we determine when the compiler is old? I'll wait until we figure out the message to bless the tests
2024-01-13Add check for ui_testing via promoting parameters from `ParseSess` to `Session`George-lewis-2/+1
2024-01-13Update measureme crate to version 11Michael Woerister-1/+1
2024-01-13Rollup merge of #119898 - compiler-errors:error-reporting, r=oli-obkMatthias Krüger-5/+0
Remove unused `ErrorReporting` variant from overflow handling r? oli-obk
2024-01-13Auto merge of #118947 - Bryanskiy:delegStep1, r=petrochenkov,lcnrbors-1/+5
Delegation implementation: step 1 See https://github.com/rust-lang/rust/issues/118212 for more details. r? `@petrochenkov`
2024-01-12Remove unused ErrorReporting variant from overflow handlingMichael Goulet-5/+0
2024-01-12OutputTypeParameterMismatch -> SignatureMismatchMichael Goulet-2/+2