about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2023-07-24interpret: support projecting into Place::Local without force_allocationRalf Jung-3/+2
2023-07-24new unstable option: -Zwrite-long-types-to-diskMahdi Dibaiee-2/+7
This option guards the logic of writing long type names in files and instead using short forms in error messages in rustc_middle/ty/error behind a flag. The main motivation for this change is to disable this behaviour when running ui tests. This logic can be triggered by running tests in a directory that has a long enough path, e.g. /my/very-long-path/where/rust-codebase/exists/ This means ui tests can fail depending on how long the path to their file is. Some ui tests actually rely on this behaviour for their assertions, so for those we enable the flag manually.
2023-07-23match on chars instead of &strs for .split() or .strip_prefix()Matthias Krüger-2/+2
2023-07-22rustdoc: handle cross-crate RPITITs correctlyLeón Orell Valerian Liehr-2/+2
2023-07-21Revert "Auto merge of #113166 - moulins:ref-niches-initial, r=oli-obk"David Tolnay-296/+44
This reverts commit 557359f92512ca88b62a602ebda291f17a953002, reversing changes made to 1e6c09a803fd543a98bfbe1624d697a55300a786.
2023-07-21Auto merge of #113922 - matthiaskrgr:rollup-90cj2vv, r=matthiaskrgrbors-4/+8
Rollup of 4 pull requests Successful merges: - #113887 (new solver: add a separate cache for coherence) - #113910 (Add FnPtr ty to SMIR) - #113913 (error/E0691: include alignment in error message) - #113914 (rustc_target: drop duplicate code) r? `@ghost` `@rustbot` modify labels: rollup
2023-07-21Track (partial) niche information in `NaiveLayout`Moulins-10/+48
Still more complexity, but this allows computing exact `NaiveLayout`s for null-optimized enums, and thus allows calls like `transmute::<Option<&T>, &U>()` to work in generic contexts.
2023-07-21new solver: add a separate cache for coherencelcnr-4/+8
2023-07-21CTFE: move `target_{i, u}size_{min, max)` to `rustc_abi::TargetDataLayout`Moulins-22/+8
2023-07-21Add doc-comments for `NaiveLayout`Moulins-14/+29
2023-07-21Track ABI info. in `NaiveLayout`, and use it for `PointerLike` checksMoulins-31/+126
THis significantly complicates `NaiveLayout` logic, but is necessary to ensure that bounds like `NonNull<T>: PointerLike` hold in generic contexts. Also implement exact layout computation for structs.
2023-07-21Track exactness in `NaiveLayout` and use it for `SizeSkeleton` checksMoulins-7/+29
2023-07-21Don't treat ref. fields with non-null niches as `dereferenceable_or_null`Moulins-21/+28
2023-07-21recover null-ptr optimization by adding a special case to the niching logicMoulins-0/+1
2023-07-21support non-null pointer niches in CTFEMoulins-1/+0
2023-07-21add crate-local `-Z reference_niches` unstable flag (does nothing for now)Moulins-0/+6
2023-07-21add `naive_layout_of` queryMoulins-0/+83
2023-07-20Auto merge of #113546 - cjgillot:unused-query, r=compiler-errorsbors-0/+4
Querify unused trait check. This code transitively loads information for all bodies, and from resolutions. As it does not return a value, it should be beneficial to have it as a query.
2023-07-20Rollup merge of #113884 - oli-obk:delay_span_bug_detrans_late, r=davidtwcoMatthias Krüger-2/+1
Don't translate compiler-internal bug messages These are not very useful to be translated, as * translators would get really weird and bad english versions to start out from, * compiler devs have to do some work for what is supposed to be dead code and just a sanity check, * the target audience is other compiler devs. r? `@davidtwco`
2023-07-20Don't translate compiler-internal bug messagesOli Scherer-2/+1
2023-07-20add FIXMElcnr-0/+3
2023-07-20XSimplifiedType to SimplifiedType::Xlcnr-55/+57
2023-07-19Rollup merge of #113765 - compiler-errors:at-least, r=oli-obkDylan DPC-1/+1
Make it clearer that edition functions are `>=`, not `==` r? `@Nilstrieb` We could also perhaps derive `Ord` on `Edition` and use comparison operators.
2023-07-19Rollup merge of #113754 - cjgillot:simplify-foreign, r=petrochenkovDylan DPC-1/+1
Simplify native_libs query Drive-by cleanup I saw while implementing https://github.com/rust-lang/rust/pull/113734
2023-07-19Rollup merge of #113716 - DianQK:add-no_builtins-to-function, r=pnkfelixDylan DPC-0/+2
Add the `no-builtins` attribute to functions when `no_builtins` is applied at the crate level. **When `no_builtins` is applied at the crate level, we should add the `no-builtins` attribute to each function to ensure it takes effect in LTO.** This is also the reason why no_builtins does not take effect in LTO as mentioned in #35540. Now, `#![no_builtins]` should be similar to `-fno-builtin` in clang/gcc, see https://clang.godbolt.org/z/z4j6Wsod5. Next, we should make `#![no_builtins]` participate in LTO again. That makes sense, as LTO also takes into consideration function-level instruction optimizations, such as the MachineOutliner. More importantly, when a user writes a large `#![no_builtins]` crate, they would like this crate to participate in LTO as well. We should also add a function-level no_builtins attribute to allow users to have more control over it. This is similar to Clang's `__attribute__((no_builtin))` feature, see https://clang.godbolt.org/z/Wod6KK6eq. Before implementing this feature, maybe we should discuss whether to support more fine-grained control, such as `__attribute__((no_builtin("memcpy")))`. Related discussions: - #109821 - #35540 Next (a separate pull request?): - [ ] Revert #35637 - [ ] Add a function-level `no_builtin` attribute?
2023-07-19Make it clearer that edition functions are >=, not ==Michael Goulet-1/+1
2023-07-18Auto merge of #113777 - nnethercote:overlap-based-cgu-merging, r=pnkfelixbors-0/+8
Inline overlap based CGU merging Introduce a new CGU merging algorithm that aims to minimize the number of duplicated inlined items. r? `@wesleywiser`
2023-07-19Add a useful comment.Nicholas Nethercote-0/+2
2023-07-19Add `MonoItemData::inlined`.Nicholas Nethercote-0/+6
2023-07-18Rollup merge of #113832 - WaffleLapkin:track_lint_caller, r=compiler-errorsMatthias Krüger-0/+6
Add `#[track_caller]` to lint related diagnostic functions This fixes locations reported by `-Ztrack-diagnostics`.
2023-07-18Rollup merge of #113824 - lcnr:exhaustive-match, r=wesleywiserMatthias Krüger-9/+9
a small `fn needs_drop` refactor I am generally a fan of exhaustively matching on `TyKind` once we care about more than 1 variant
2023-07-18Add `#[track_caller]` to lint related diagnostic functionsMaybe Waffle-0/+6
2023-07-18Add the `no-builtins` attribute to functions when `no_builtins` is applied ↵DianQK-0/+2
at the crate level. When `no_builtins` is applied at the crate level, we should add the `no-builtins` attribute to each function to ensure it takes effect in LTO.
2023-07-18some additional refactorlcnr-9/+9
also, treat placeholders equal to params
2023-07-18Auto merge of #113677 - bryangarza:unevaluated-const-ice_issue-110892, ↵bors-0/+8
r=davidtwco Safe Transmute: Fix ICE (due to UnevaluatedConst) This patch updates the code that looks at the `Assume` type when evaluating if transmutation is possible. An ICE was being triggered in the case that the `Assume` parameter contained an unevaluated const (in this test case, due to a function with missing parameter names). Fixes #110892
2023-07-17Rename arg_iter to iter_instantiatedMichael Goulet-15/+19
2023-07-17Safe Transmute: Fix ICE (due to UnevaluatedConst)Bryan Garza-0/+8
This patch updates the code that looks at the `Assume` type when evaluating if transmutation is possible. An ICE was being triggered in the case that the `Assume` parameter contained an unevaluated const (in this test case, due to a function with missing parameter names). Fixes #110892
2023-07-17Do not fetch HIR in native_libs.Camille GILLOT-1/+1
2023-07-17Auto merge of #113562 - saethlin:larger-incr-comp-offset, r=nnethercotebors-4/+7
Use u64 for incr comp allocation offsets Fixes https://github.com/rust-lang/rust/issues/76037 Fixes https://github.com/rust-lang/rust/issues/95780 Fixes https://github.com/rust-lang/rust/issues/111613 These issues are all reporting ICEs caused by using `u32` to store offsets to allocations in the incremental compilation cache. This PR aims to lift that limitation by changing the offset type in question to `u64`. There are two perf runs in this PR. The first reports a regression, and the second does not. The changes are the same in both. I rebased the PR then did the second perf run because I noticed that the primary regression in it was very commonly seen in spurious regression reports. I do not know what the perf run will report when this is merged. I would not be surprised to see regression or neutral, but the cachegrind diffs for the regression point at `try_mark_previous_green` which is a common source of inexplicable regressions and I don't think should be perturbed by this PR. I'm not opposed to adding a regression test such as ```rust fn main() { println!("{}", [37; 1 << 30].len()); } ``` But that program takes 1 minute to compile and consumes 4.6 GB of memory then writes that much to disk. Is that a concerning amount of resource use for a test? r? `@nnethercote`
2023-07-17Auto merge of #113772 - nnethercote:streamline-size-estimates-2, r=wesleywiserbors-21/+30
Streamline size estimates (take 2) This was merged in #113684 but then [something happened](https://github.com/rust-lang/rust/pull/113684#issuecomment-1636811985): > There has been a bors issue that lead to the merge commit of this PR getting purged from master. > You'll have to make a new PR to reapply it. So this is exactly the same changes. `@bors` r=wesleywiser
2023-07-17Auto merge of #113336 - compiler-errors:new-solver-iat, r=lcnrbors-1/+1
Add support for inherent projections in new solver Not hard to support these, and it cuts out a really big chunk of failing UI tests with `--compare-mode=next-solver` r? `@lcnr` (feel free to reassign, anyone can review this)
2023-07-17Remove `instance_def_size_estimate` query.Nicholas Nethercote-11/+12
It doesn't seem worthwhile now that `MonoItem::size_estimate` is called much less often.
2023-07-17Store item size estimate in `MonoItemData`.Nicholas Nethercote-5/+6
This means we call `MonoItem::size_estimate` (which involves a query) less often: just once per mono item, and then once more per inline item placement. After that we can reuse the stored value as necessary. This means `CodegenUnit::compute_size_estimate` is cheaper.
2023-07-17Introduce `MonoItemData`.Nicholas Nethercote-5/+12
It replaces `(Linkage, Visibility)`, making the code nicer. Plus the next commit will add another field.
2023-07-17Rollup merge of #113539 - agnarrarendelle:master, r=workingjubileeMatthias Krüger-1/+1
fixed typo Hi, I have fixed a few typos in commands. Please review my pr.
2023-07-16Querify unused trait check.Camille GILLOT-0/+4
2023-07-16Add support for inherent projectionsMichael Goulet-1/+1
2023-07-15Auto merge of #112157 - erikdesjardins:align, r=nikicbors-0/+2
Resurrect: rustc_target: Add alignment to indirectly-passed by-value types, correcting the alignment of byval on x86 in the process. Same as #111551, which I [accidentally closed](https://github.com/rust-lang/rust/pull/111551#issuecomment-1571222612) :/ --- This resurrects PR #103830, which has sat idle for a while. Beyond #103830, this also: - fixes byval alignment for types containing vectors on Darwin (see `tests/codegen/align-byval-vector.rs`) - fixes byval alignment for overaligned types on x86 Windows (see `tests/codegen/align-byval.rs`) - fixes ABI for types with 128bit requested alignment on ARM64 Linux (see `tests/codegen/aarch64-struct-align-128.rs`) r? `@nikic` --- `@pcwalton's` original PR description is reproduced below: Commit 88e4d2c from five years ago removed support for alignment on indirectly-passed arguments because of problems with the `i686-pc-windows-msvc` target. Unfortunately, the `memcpy` optimizations I recently added to LLVM 16 depend on this to forward `memcpy`s. This commit attempts to fix the problems with `byval` parameters on that target and now correctly adds the `align` attribute. The problem is summarized in [this comment] by `@eddyb.` Briefly, 32-bit x86 has special alignment rules for `byval` parameters: for the most part, their alignment is forced to 4. This is not well-documented anywhere but in the Clang source. I looked at the logic in Clang `TargetInfo.cpp` and tried to replicate it here. The relevant methods in that file are `X86_32ABIInfo::getIndirectResult()` and `X86_32ABIInfo::getTypeStackAlignInBytes()`. The `align` parameter attribute for `byval` parameters in LLVM must match the platform ABI, or miscompilations will occur. Note that this doesn't use the approach suggested by eddyb, because I felt it was overkill to store the alignment in `on_stack` when special handling is really only needed for 32-bit x86. As a side effect, this should fix #80127, because it will make the `align` parameter attribute for `byval` parameters match the platform ABI on LLVM x86-64. [this comment]: #80822 (comment)
2023-07-14i686-windows: make requested alignment > 4 special case apply transitivelyErik Desjardins-1/+1
2023-07-14Use u64 for incr comp allocation offsetsBen Kimock-4/+7