about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2023-08-30Auto merge of #115058 - Swatinem:inline-add-coverage, r=compiler-errorsbors-123/+46
Inline functions called from `add_coverage` This removes quite a bit of indirection and duplicated code related to getting the `FunctionCoverage`. CC `@Zalathar`
2023-08-30Auto merge of #114616 - oli-obk:gotta_capture_'em_all, r=compiler-errorsbors-80/+207
Capture all lifetimes for TAITs and impl trait in associated types This reverts commit cb9467515b5a9b15aaa905683c6b4dd9e851056c, reversing changes made to 57781b24c54f9548722927ba88c343ff28da94ce. (This is only true for the tests, the change itself was done from scratch, as the compiler has diverged sufficiently for a revert to not make sense anymore). This implements the lang team decision from this meeting: https://hackmd.io/sFaSIMJOQcuwCdnUvCxtuQ?view r? `@cjgillot` on the impl
2023-08-30Auto merge of #114483 - RalfJung:unsized-fields, r=oli-obkbors-213/+374
interpret: fix projecting into an unsized field of a local See the new Miri testcase that didn't work before. r? `@oli-obk`
2023-08-30storage_live: avoid computing the layout unless necessaryRalf Jung-18/+69
2023-08-30unify passing of sized and unsized function arguments :-)Ralf Jung-31/+35
2023-08-30a bit of meta-related cleanup on ProjectableRalf Jung-36/+32
2023-08-30move marking-locals-live out of push_stack_frame, so it happens with ↵Ralf Jung-105/+188
argument passing this entirely avoids even creating unsized locals in Immediate::Uninitialized state
2023-08-30interpret: fix projecting into an unsized field of a localRalf Jung-97/+124
new invariant: Place::Local never refers to something unsized
2023-08-30Test variances of TAITsOli Scherer-0/+136
2023-08-30Revert "Auto merge of #102417 - oli-obk:opaque_lifetimes2, r=jackh726"Oli Scherer-80/+71
This reverts commit cb9467515b5a9b15aaa905683c6b4dd9e851056c, reversing changes made to 57781b24c54f9548722927ba88c343ff28da94ce.
2023-08-30Auto merge of #111713 - Zoxc:lock-switch, r=nnethercotebors-139/+368
Use conditional synchronization for Lock This changes `Lock` to use synchronization only if `mode::is_dyn_thread_safe` could be true. This reduces overhead for the parallel compiler running with 1 thread. The emitters are changed to use `DynSend` instead of `Send` so they can still use `Lock`. A Rayon thread pool is not used with 1 thread anymore, as session globals contains `Lock`s which are no longer `Sync`. Performance improvement with 1 thread and `cfg(parallel_compiler)`: <table><tr><td rowspan="2">Benchmark</td><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th></tr><tr><td align="right">Time</td><td align="right">Time</td><td align="right">%</th></tr><tr><td>🟣 <b>clap</b>:check</td><td align="right">1.7665s</td><td align="right">1.7336s</td><td align="right">💚 -1.86%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2780s</td><td align="right">0.2736s</td><td align="right">💚 -1.61%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">0.9994s</td><td align="right">0.9824s</td><td align="right">💚 -1.70%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.5875s</td><td align="right">1.5656s</td><td align="right">💚 -1.38%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">6.0682s</td><td align="right">5.9532s</td><td align="right">💚 -1.90%</td></tr><tr><td>Total</td><td align="right">10.6997s</td><td align="right">10.5083s</td><td align="right">💚 -1.79%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9831s</td><td align="right">💚 -1.69%</td></tr></table> cc `@SparrowLii`
2023-08-30Auto merge of #115370 - matthiaskrgr:rollup-l0e1zuj, r=matthiaskrgrbors-188/+498
Rollup of 7 pull requests Successful merges: - #113565 (Make SIGSEGV handler emit nicer backtraces) - #114704 (parser: not insert dummy field in struct) - #115272 (miri/diagnostics: don't forget to print_backtrace when ICEing on unexpected errors) - #115313 (Make `get_return_block()` return `Some` only for HIR nodes in body) - #115347 (suggest removing `impl` in generic trait bound position) - #115355 (new solver: handle edge case of a recursion limit of 0) - #115363 (Don't suggest adding parentheses to call an inaccessible method.) r? `@ghost` `@rustbot` modify labels: rollup
2023-08-30Rollup merge of #115363 - kpreid:suggest-private, r=compiler-errorsMatthias Krüger-13/+30
Don't suggest adding parentheses to call an inaccessible method. Previously, code of this form would emit E0615 (attempt to use a method as a field), thus emphasizing the existence of private methods that the programmer probably does not care about. Now it ignores their existence instead, producing error E0609 (no field). The motivating example is: ```rust let x = std::rc::Rc::new(()); x.inner; ``` which would previously mention the private method `Rc::inner()`, even though `Rc<T>` intentionally has no public methods so that it can be a transparent smart pointer for any `T`. ```rust error[E0615]: attempted to take value of method `inner` on type `Rc<()>` --> src/main.rs:3:3 | 3 | x.inner; | ^^^^^ method, not a field | help: use parentheses to call the method | 3 | x.inner(); | ++ ``` With this change, it emits E0609 and no suggestion.
2023-08-30Rollup merge of #115355 - lqd:issue-115351, r=compiler-errorsMatthias Krüger-1/+44
new solver: handle edge case of a recursion limit of 0 Apparently a recursion limit of 0 is possible/valid/useful/used/cute, the more you know 🌟 . (It's somewhat interesting to me that the old solver seemingly handles this, and that the new solver currently requires a recursion limit of 2 here) r? `@compiler-errors.` Fixes #115351.
2023-08-30Rollup merge of #115347 - y21:generic-bound-impl-trait-ty, r=compiler-errorsMatthias Krüger-12/+66
suggest removing `impl` in generic trait bound position rustc already does this recovery in type param position (`<T: impl Trait>` -> `<T: Trait>`). This PR also adds that suggestion in trait bound position (e.g. `where T: impl Trait` or `trait Trait { type Assoc: impl Trait; }`)
2023-08-30Rollup merge of #115313 - gurry:issue-114918-cycle-detected, r=compiler-errorsMatthias Krüger-1/+103
Make `get_return_block()` return `Some` only for HIR nodes in body Fixes #114918 The issue occurred while compiling the following input: ```rust fn uwu() -> [(); { () }] { loop {} } ``` It was caused by the code below trying to suggest a missing return type which resulted in a const eval cycle: https://github.com/rust-lang/rust/blob/1bd043098e05839afb557bd7a2858cb09a4054ca/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs#L68-L75 The root cause was `get_return_block()` returning an `Fn` node for a node in the return type (i.e. the second `()` in the return type `[(); { () }]` of the input) although it is supposed to do so only for nodes that lie in the body of the function and return `None` otherwise (at least as per my understanding). The PR fixes the issue by fixing this behaviour of `get_return_block()`.
2023-08-30Rollup merge of #115272 - RalfJung:miri-error-print, r=saethlinMatthias Krüger-44/+57
miri/diagnostics: don't forget to print_backtrace when ICEing on unexpected errors This should fix the missing output encountered [here](https://github.com/rust-lang/rust/issues/115145#issuecomment-1694334410). r? `@saethlin`
2023-08-30Rollup merge of #114704 - bvanjoi:fix-114636, r=compiler-errorsMatthias Krüger-51/+47
parser: not insert dummy field in struct Fixes #114636 This PR eliminates the dummy field, initially introduced in #113999, thereby enabling unrestricted use of `ident.unwrap()`. A side effect of this action is that we can only report the error of the first macro invocation field within the struct node. An alternative solution might be giving a virtual name to the macro, but it appears more complex.(https://github.com/rust-lang/rust/issues/114636#issuecomment-1670228715). Furthermore, if you think https://github.com/rust-lang/rust/issues/114636#issuecomment-1670228715 is a better solution, feel free to close this PR.
2023-08-30Rollup merge of #113565 - workingjubilee:better-signal-handler-message, ↵Matthias Krüger-66/+151
r=pnkfelix Make SIGSEGV handler emit nicer backtraces This annotates the code heavily with comments to explain what is going on, for the benefit of other compiler contributors. The backtrace also emits appropriate comments to clarify, to a programmer who may not know why a bunch of file paths and hexadecimal blather was just dumped into stderr, what is going on. Finally, it detects cycles and uses their regularity to avoid repeating a bunch of text. The previous backtraces we were emitting was extremely unfriendly, potentially confusing, and often alarming, and this makes things almost "nice". We can't necessarily make them much nicer than this, because a signal handler must use "signal-safe" functions. This precludes conveniences like dynamic allocations. Fortunately, Rust's stdlib has allocation-free formatting, but it may hinder integrating this error with our localization middleware, as I wasn't able to clearly ascertain, at a glance, whether there was a zero-alloc path through it. r? `@Nilstrieb`
2023-08-30Auto merge of #114908 - cjgillot:no-let-under, r=compiler-errorsbors-4/+3
Do not compute unneeded query results. r? `@ghost`
2023-08-30Don't use `wait_for_query` without the Rayon thread poolJohn Kåre Alsaker-13/+13
2023-08-30Use conditional synchronization for LockJohn Kåre Alsaker-126/+355
2023-08-30Auto merge of #113542 - saethlin:adaptive-tables, r=b-naberbors-47/+125
Adapt table sizes to the contents This is an implementation of https://github.com/rust-lang/compiler-team/issues/666 The objective of this PR is to permit the rmeta format to accommodate larger crates that need offsets larger than a `u32` can store without compromising performance for crates that do not need such range. The second commit is a number of tiny optimization opportunities I noticed while looking at perf recordings of the first commit. The rmeta tables need to have fixed-size elements to permit lazy random access. But the size only needs to be fixed _per table_, not per element type. This PR adds another `usize` to the table header which indicates the table element size. As each element of a table is set, we keep track of the widest encoded table value, then don't bother encoding all the unused trailing bytes on each value. When decoding table elements, we copy them to a full-width array if they are not already full-width. `LazyArray` needs some special treatment. Most other values that are encoded in tables are indexes or offsets, and those tend to be small so we get to drop a lot of zero bytes off the end. But `LazyArray` encodes _two_ small values in a fixed-width table element: A position of the table and the length of the table. The treatment described above could trim zero bytes off the table length, but any nonzero length shields the position bytes from the optimization. To improve this, we interleave the bytes of position and length. This change is responsible for about half of the crate metadata win on many crates. Fixes https://github.com/rust-lang/rust/issues/112934 (probably) Fixes https://github.com/rust-lang/rust/issues/103607
2023-08-30Make get_return_block() return Some only for HIR nodes in bodyGurinder Singh-1/+103
Fixes # 114918
2023-08-29Document in the code how this scheme worksBen Kimock-14/+25
2023-08-29Remove `allow_private` entirely.Kevin Reid-13/+5
2023-08-29Auto merge of #115365 - weihanglo:update-cargo, r=weihanglobors-0/+0
Update cargo 18 commits in 925280f028db3a322935e040719a0754703947cf..96fe1c9e1aecd8f57063e3753969bb6418fd2fd5 2023-08-25 21:16:44 +0000 to 2023-08-29 20:10:34 +0000 - fix(lints): Fail when overriding inherited lints (rust-lang/cargo#12584) - cargo install: suggest --git when package name is url (rust-lang/cargo#12575) - chore: remove unstable-options for logout (rust-lang/cargo#12588) - Improve logout message for asymmetric tokens (rust-lang/cargo#12587) - fix(update): Remove references to -p in help (rust-lang/cargo#12586) - fix(update): Make `-p` more convenient by being positional (rust-lang/cargo#12545) - Set tracing target for networking messages. (rust-lang/cargo#12582) - Retry docs (rust-lang/cargo#12583) - feat(resolver): **Very** preliminary MSRV resolver support (rust-lang/cargo#12560) - Update git2 (rust-lang/cargo#12580) - Explain how `version` works for `git` dependencies (rust-lang/cargo#12270) - Improve deserialization errors of untagged enums (rust-lang/cargo#12574) - Add support for `target.'cfg(..)'.linker` (rust-lang/cargo#12535) - Improve resolver version mismatch warning (rust-lang/cargo#12573) - Stabilize `--keep-going` (rust-lang/cargo#12568) - Define {{command}} for use in src/doc/man/includes (rust-lang/cargo#12570) - Update serde (rust-lang/cargo#12569) - chore: add missing `windows-sys` features back (rust-lang/cargo#12563) r? ghost
2023-08-29Update cargoWeihang Lo-0/+0
2023-08-29Don't suggest adding parentheses to call an inaccessible method.Kevin Reid-1/+26
Previously, the test code would emit E0615, thus revealing the existence of private methods that the programmer probably does not care about. Now it ignores their existence instead, producing error E0609 (no field). The motivating example is: ```rust let x = std::rc::Rc::new(()); x.inner; ``` which would previously mention the private method `Rc::inner()`, even though `Rc<T>` intentionally has no public methods so that it can be a transparent smart pointer for any `T`.
2023-08-29Auto merge of #114114 - ↵bors-25/+57
keith:ks/always-add-lc_build_version-for-metadata-object-files, r=wesleywiser Always add LC_BUILD_VERSION for metadata object files As of Xcode 15 Apple's linker has become a bit more strict about the warnings it produces. One of those new warnings requires all valid Mach-O object files in an archive to have a LC_BUILD_VERSION load command: ``` ld: warning: no platform load command found in 'ARCHIVE[arm64][2106](lib.rmeta)', assuming: iOS-simulator ``` This was already being done for Mac Catalyst so this change expands this logic to include it for all Apple platforms. I filed this behavior change as FB12546320 and was told it was the new intentional behavior.
2023-08-29Auto merge of #115354 - matthiaskrgr:rollup-4cotcxz, r=matthiaskrgrbors-117/+203
Rollup of 6 pull requests Successful merges: - #111580 (Don't ICE on layout computation failure) - #114923 (doc: update lld-flavor ref) - #115174 (tests: add test for #67992) - #115187 (Add new interface to smir) - #115300 (Tweaks and improvements on SMIR around generics_of and predicates_of) - #115340 (some more is_zst that should be is_1zst) r? `@ghost` `@rustbot` modify labels: rollup
2023-08-29add non-regression test for issue 115351Rémy Rakic-0/+39
2023-08-29handle edge-case of a recursion limit of 0Rémy Rakic-1/+5
2023-08-29Rollup merge of #115340 - RalfJung:more_is_1zst, r=oli-obkMatthias Krüger-8/+8
some more is_zst that should be is_1zst Follow-up to https://github.com/rust-lang/rust/pull/115277
2023-08-29Rollup merge of #115300 - spastorino:smir-tweaks, r=oli-obkMatthias Krüger-71/+41
Tweaks and improvements on SMIR around generics_of and predicates_of r? `@oli-obk` This allows an API like the following ... ```rust let trait_decls = stable_mir::all_trait_decls().iter().map(|trait_def| { let trait_decl = stable_mir::trait_decl(trait_def); let generics = trait_decl.generics_of(); let predicates = trait_decl.predicates_of().predicates; ``` I didn't like that much `trait_def.trait_decl()` which is it possible but adding a method to a def_id that loads up a whole trait definition looks backwards to me.
2023-08-29Rollup merge of #115187 - ouz-a:smir_wrap, r=oli-obkMatthias Krüger-33/+54
Add new interface to smir Removes the boiler plate from `crate-info.rs`, and creates new interface for the smir. Addressing https://github.com/rust-lang/project-stable-mir/issues/23 r? `@spastorino`
2023-08-29Rollup merge of #115174 - davidtwco:needs-test-bad-location-list-67992, ↵Matthias Krüger-0/+31
r=wesleywiser tests: add test for #67992 Fixes #67992. Just adding a regression test for this issue.
2023-08-29Rollup merge of #114923 - cuishuang:master, r=wesleywiserMatthias Krüger-1/+1
doc: update lld-flavor ref
2023-08-29Rollup merge of #111580 - atsuzaki:layout-ice, r=oli-obkMatthias Krüger-4/+68
Don't ICE on layout computation failure Fixes #111176 regression. r? `@oli-obk`
2023-08-29suggest removing `impl` in generic trait bound positiony21-12/+66
2023-08-29Auto merge of #115183 - flip1995:clippyup, r=Manishearth,oli-obkbors-9631/+16631
Update Clippy r? `@oli-obk` Assigning you, because something broke with ui_test: ``` tests/ui/crashes/ice-7272.rs FAILED: command: "<unknown>" A bug in `ui_test` occurred: called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" } full stderr: ``` (and that 103 times) Thought I would ping you, before starting to investigate. Maybe you know what's going on.
2023-08-29Auto merge of #112775 - c410-f3r:t3st3ss, r=petrochenkovbors-1/+1
Move tests r? `@petrochenkov`
2023-08-29Bump ui_testOli Scherer-27/+27
2023-08-29Create StableMir replacer for SMirCallsouz-a-33/+54
2023-08-29some more is_zst that should be is_1zstRalf Jung-8/+8
2023-08-29Auto merge of #114894 - Zoxc:sharded-cfg-cleanup2, r=cjgillotbors-73/+48
Remove conditional use of `Sharded` from query state `Sharded` is already a zero cost abstraction, so it shouldn't affect the performance of the single thread compiler if LLVM does its job. r? `@cjgillot`
2023-08-29Call these methods from high level stable_mir::trait_decl(trait_def) and so onSantiago Pastorino-12/+0
2023-08-29Implement generics_of and predicates_of only for TraitDecl for nowSantiago Pastorino-6/+10
2023-08-29Deduplicate GenericPredicatesSantiago Pastorino-11/+5
2023-08-29Index def_ids directlySantiago Pastorino-20/+4