Commit Graph

238679 Commits

Author SHA1 Message Date
bors
cd05ffa472 Auto merge of #117955 - notriddle:master, r=GuillaumeGomez
rustdoc-search: simplify the checkTypes fast path

This reduces code size while still matching the common case for plain, concrete types. This should not introduce any user-visible behavior changes.

The perf impact of the change was evaluated using <https://gitlab.com/notriddle/rustdoc-js-profile>. The output of the tool can be found here: http://notriddle.com/rustdoc-html-demo-5/profile-1/index.html

r? `@GuillaumeGomez`
2023-11-16 10:48:45 +00:00
bors
48d8100543 Auto merge of #117930 - thomcc:const_str-unnamed, r=nikic
Ensure strings created with `const_str` get the `unnamed_addr` attribute

This function (`const_str`) is only used when we need to invent a string during codegen -- for example, for a panic message to pass when codegening some of the assert/panic/etc terminators (for stuff like divide by zero).

AFAICT all other consts, such as the user-defined ones from const eval, should already be getting this attribute (things that come from a ConstAllocation do, for example). Which means that the "unnamed" part is even more true than usual here, these aren't strings that even exist as far as the user can tell.

~~Setting this attribute allows LLVM to merge these constants, leading to significant binary size savings (much more than I would expect). On x86_64-unknown-linux-gnu, t takes a build of ripgrep (release without debug info) from 9.7MiB to 6.0MiB (a savings of over 30%!?), and a build of rustc_driver's shared object from 123MiB to 112MiB (less drastic, but still over 10% reduced).~~

~~The effect on ripgrep is substantially reduced on macOS for reasons beyond me (I may have fucked up the test), only saving around 0.2MiB, although rustc_driver is still around 10MB or smaller than it had been previously.~~

~~This raises some questions, such as "does that mean 1/3 of ripgrep was made of division by zero complaints?" I'm not sure, that may be the case. The output of `strings path/to/rg` is \~2MB smaller, so it seems like a lot of it was. Allowing these to be merged presumably also allow functions that contain them to be merged (if the addresses had semantic meaning, then it stands).~~

~~I intend to do some more analysis here, but I got this up as soon as I realized that this attribute was only missing for internal const strings, and all other ones already get it.~~

Edit: The wins are much more marginal, but there's some argument to do this for the sake of consistency.
2023-11-16 08:43:05 +00:00
bors
525c91d096 Auto merge of #117916 - weihanglo:update-cargo, r=weihanglo
Update cargo

19 commits in 6790a5127895debec95c24aefaeb18e059270df3..2c03e0e2dcd05dd064fcf10cc1050d342eaf67e3
2023-11-10 17:09:35 +0000 to 2023-11-16 04:21:44 +0000
- docs(ref): Find a place to comment on --cap-lints (rust-lang/cargo#12976)
- Switch from AtomicU64 to Mutex. (rust-lang/cargo#12981)
- If the only path is a loop then counted as the shortest path. (rust-lang/cargo#12977)
- fix(resolver): Prefer MSRV, rather than ignore incompatible (rust-lang/cargo#12950)
- fix error message for duplicate links (rust-lang/cargo#12973)
- Only filter out target if its in the package root (rust-lang/cargo#12944)
- Ignore changing_spec_relearns_crate_types on windows-gnu (rust-lang/cargo#12972)
- fix: do not panic when failed to parse rustc commit-hash (rust-lang/cargo#12965)
- query{_vec} use IndexSummary (rust-lang/cargo#12970)
- Bump to 0.77.0; update changelog (rust-lang/cargo#12966)
- Improve about information of `cargo search` (rust-lang/cargo#12962)
- Fix --quiet being used with nested subcommands. (rust-lang/cargo#12959)
- make some debug assertion failures more informative (rust-lang/cargo#12963)
- refactor(toml): Consistently lead with 'Toml' prefix (rust-lang/cargo#12960)
- refactor(toml): Remove unused method (rust-lang/cargo#12961)
- Fix non-deterministic behavior in last-use repopulation (rust-lang/cargo#12958)
- Add cache garbage collection (rust-lang/cargo#12634)
- refactor(toml): Improve consistency (rust-lang/cargo#12954)
- Fix typo (rust-lang/cargo#12956)
2023-11-16 05:26:40 +00:00
Weihang Lo
8b2e36008e
Update cargo 2023-11-16 00:23:39 -05:00
bors
6faa181015 Auto merge of #117948 - aeubanks:dibuilder, r=durin42
llvm-wrapper: Pass newly added param to DIBuilder::createStaticMemberType()

This was added in https://github.com/llvm/llvm-project/pull/72234.
DW_TAG_member was the implicit default before.

The LLVM change is quite sinister since due to weakly typed ints and default params, this was still successfully compiling against LLVM but was passing the wrong parameters.
2023-11-16 03:14:51 +00:00
bors
9144d51175 Auto merge of #117954 - aeubanks:dibuilder2, r=durin42
llvm-wrapper: Pass newly added param to DIBuilder::createEnumerationType()

Added in LLVM in https://github.com/llvm/llvm-project/pull/72011.
2023-11-16 00:03:50 +00:00
Arthur Eubanks
7cde2cee35 llvm-wrapper: Pass newly added param to DIBuilder::createEnumerationType()
Added in LLVM in https://github.com/llvm/llvm-project/pull/72011.
2023-11-15 14:42:53 -08:00
Michael Howell
512aa5ed0f rustdoc-search: simplify the checkTypes fast path
This reduces code size while still matching the common case
for plain, concrete types.
2023-11-15 15:20:56 -07:00
Arthur Eubanks
e2c3e94be9 17 -> 18 2023-11-15 13:15:55 -08:00
Arthur Eubanks
984898da17 [llvm-wrapper] Pass newly added param to DIBuilder::createStaticMemberType()
This was added in https://github.com/llvm/llvm-project/pull/72234.
DW_TAG_member was the implicit default before.
2023-11-15 11:29:35 -08:00
bors
6b771f6b5a Auto merge of #117878 - gavinleroy:proper-depth-check, r=lcnr
Fix depth check in ProofTreeVisitor.

The hack to cutoff overflows and cycles in the new trait solver was incorrect. We want to inspect everything with depth [0..10].

This fix exposed a previously unseen bug, which caused the compiler to ICE when invoking `trait_ref` on a non-assoc type projection. I simply added the guard in the `AmbiguityCausesVisitor`, and updated the expected output for the `auto-trait-coherence` test which now includes the extra note:
```text
   |
   = note: upstream crates may add a new impl of trait `std::marker::Send` for type `OpaqueType` in future versions
```

r? `@lcnr`
2023-11-15 18:53:04 +00:00
bors
0b24479638 Auto merge of #116555 - paulmenage:llvm-module-flag, r=wesleywiser
Add -Z llvm_module_flag

Allow adding values to the `!llvm.module.flags` metadata for a generated module.  The syntax is

`-Z llvm_module_flag=<name>:<type>:<value>:<behavior>`

Currently only u32 values are supported but the type is required to be specified for forward compatibility.  The `behavior` element must match one of the named LLVM metadata behaviors.viors.

This flag is expected to be perma-unstable.
2023-11-15 16:54:31 +00:00
bors
d4559c01c2 Auto merge of #117819 - fmease:rustc_parse_format-stable-rustc, r=Nilstrieb
Make `rustc_parse_format` compile on stable again

Fixes [#115948 (review comment)](8222335596 (r1385932710)).
cc `@Veykril` `@notriddle`

r? compiler
2023-11-15 14:55:35 +00:00
bors
1500db7314 Auto merge of #117908 - lcnr:region-kind-rename, r=BoxyUwU
finish `RegionKind` renaming

second step of https://github.com/rust-lang/types-team/issues/95

continues the work from #117876. While working on this and I encountered a bunch of further cleanup which I'll either open a tracking issue for or will do in a separate PR:
- rewrite the `RegionKind` docs, they still talk about `ReEmpty` and are generally out of date
- rename `DescriptionCtx` to `DescriptionCtxt`
- what is `CheckRegions::Bound`?
- `collect_late_bound_regions` et al
- `erase_late_bound_regions` -> `instantiate_bound_regions_with_erased`?
- `EraseEarlyRegions` visitor should be removed, feels duplicate

r? `@BoxyUwU`
2023-11-15 12:55:42 +00:00
bors
383bf020f2 Auto merge of #117848 - compiler-errors:method-ambiguity-no-rcvr, r=TaKO8Ki
Don't expect a rcvr in `print_disambiguation_help`

We don't necessarily have a receiver when we are both accidentally using the `.` operator *AND* we have more than one ambiguous method candidate.

Fixes #117728
2023-11-15 10:58:50 +00:00
bors
ee85f7fc48 Auto merge of #117814 - RalfJung:rustc-logger-without-set-var, r=TaKO8Ki
rustc_log: provide a way to init logging based on the values, not names, of the env vars

Miri wants to affect how rustc does logging. So far this required setting environment variables before calling `rustc_driver::init_rustc_env_logger`. However, `set_var` is a function one should really [avoid calling](https://github.com/rust-lang/rust/issues/90308), so this adds the necessary APIs to rustc such that Miri can just pass it the *values* of all the log-relevant environment variables, rather than having to change the global environment.
2023-11-15 08:03:07 +00:00
Thom Chiovoloni
268f5c57b9 Ensure strings created with const_str get the unnamed_addr attribute 2023-11-15 07:56:40 +00:00
bors
698fcc8219 Auto merge of #117517 - klinvill:smir-projections, r=ouz-a
Add richer structure for Stable MIR Projections

Resolves https://github.com/rust-lang/project-stable-mir/issues/49.

Projections in Stable MIR are currently just strings. This PR replaces that representation with a richer structure, namely projections become vectors of `ProjectionElem`s, just as in MIR. The `ProjectionElem` enum is heavily based off of the MIR `ProjectionElem`.

This PR is a draft since there are several outstanding issues to resolve, including:

- How should `UserTypeProjection`s be represented in Stable MIR? In MIR, the projections are just a vector of `ProjectionElem<(),()>`, meaning `ProjectionElem`s that don't have Local or Type arguments (for `Index`, `Field`, etc. objects). Should `UserTypeProjection`s be represented this way in Stable MIR as well? Or is there a more user-friendly representation that wouldn't drag along all the `ProjectionElem` variants that presumably can't appear?
- What is the expected behavior of a `Place`'s `ty` function? Should it resolve down the chain of projections so that something like `*_1.f` would return the type referenced by field `f`?
- Tests should be added for `UserTypeProjection`
2023-11-15 06:05:54 +00:00
bors
cc8681b64b Auto merge of #117917 - slanterns:slanterns-1.74-release_note, r=Mark-Simulacrum
Add missing entries in 1.74 release notes
2023-11-15 03:56:07 +00:00
Kirby Linvill
c036a10ed5
Make UserTypeProjection projections Opaque
Also shifts comments explaining why Stable MIR drops an optional variant
name field, for `Downcast` projection elements, to the `Place::stable`
function.
2023-11-14 19:19:35 -07:00
bors
6d069a0ac7 Auto merge of #117359 - tmiasko:call-def, r=cjgillot
Fix def-use check for call terminators

Fixes #117331.
2023-11-15 01:31:46 +00:00
lcnr
18281d39cf fix doc link 2023-11-15 01:24:44 +00:00
Slanterns
563d975364
tidy 2023-11-15 08:56:00 +08:00
bors
003fa886f5 Auto merge of #117915 - matthiaskrgr:rollup-ztljqrr, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #116244 (Apply structured suggestion that allows test to work since 1.64)
 - #117686 (Build pre-coroutine-transform coroutine body on error)
 - #117834 (target_feature: make it more clear what that 'Option' means)
 - #117893 (Suggest dereferencing the LHS for binops such as `&T == T`)
 - #117911 (Fix some typos)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-14 22:36:39 +00:00
Slanterns
7f10299d9b
Add missing entries in 1.74 release notes 2023-11-15 06:01:57 +08:00
Matthias Krüger
2e00c6ffd7
Rollup merge of #117911 - catandcoder:master, r=lqd
Fix some typos
2023-11-14 21:50:39 +01:00
Matthias Krüger
52f3a6fdb2
Rollup merge of #117893 - sjwang05:issue-52544-take-1, r=wesleywiser
Suggest dereferencing the LHS for binops such as `&T == T`

Fixes #52544
2023-11-14 21:50:39 +01:00
Matthias Krüger
7435887d6c
Rollup merge of #117834 - RalfJung:target-feature-stability, r=b-naber
target_feature: make it more clear what that 'Option' means

Reading those tables in compiler/rustc_codegen_ssa/src/target_features.rs, it's not immediately clear that `None` means "stable". Let's use an enum with appropriately named variants to make that more obvious.
2023-11-14 21:50:38 +01:00
Matthias Krüger
d2cdf6c479
Rollup merge of #117686 - compiler-errors:gen-body, r=wesleywiser
Build pre-coroutine-transform coroutine body on error

I was accidentally building the post-transform coroutine body, rather than the pre-transform coroutine body. There's no pinning expected here yet, and the return type isn't yet transformed into `CoroutineState`.

Fixes #117670
2023-11-14 21:50:38 +01:00
Matthias Krüger
00ba7fc007
Rollup merge of #116244 - estebank:issue-73497, r=b-naber
Apply structured suggestion that allows test to work since 1.64

Close #73497.
2023-11-14 21:50:37 +01:00
bors
dd430bc8c2 Auto merge of #117907 - nikic:update-llvm-17, r=cuviper
Update to LLVM 17.0.5

Fixes https://github.com/rust-lang/rust/issues/116177.
Fixes the compile-time issue reported at https://internals.rust-lang.org/t/significant-increase-in-fat-lto-time-post-update-to-rustc-1-75-0-nightly/19765.

r? `@cuviper`
2023-11-14 20:39:19 +00:00
bors
49b27f4efb Auto merge of #117701 - lnicola:sync-from-ra, r=onur-ozkan,HKalbasi
Subtree update of `rust-analyzer`

r? `@HKalbasi`
2023-11-14 18:43:27 +00:00
Tomasz Miąsko
6873465600 Fix def-use check for call terminators 2023-11-14 17:07:34 +01:00
Laurențiu Nicola
6ad73f5ee8 Depend on rustc_driver 2023-11-14 18:07:02 +02:00
bors
8d57ad1ade Auto merge of #117849 - compiler-errors:cycle, r=cjgillot
make `LayoutError::Cycle` carry `ErrorGuaranteed`

Addresses a FIXME, and also I think it's wise for error variants to carry their `ErrorGuaranteed` -- makes it easier to use that `ErrorGuaranteed` for creating, e.g. `TyKind::Error` and other error kinds. Splitting out from #117703.
2023-11-14 16:04:29 +00:00
cui fliter
a44a4edc0e Fix some typos
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-11-14 23:06:50 +08:00
lcnr
8fcbd1991f review + fix CI 2023-11-14 13:41:28 +00:00
lcnr
15f21562e6 finish RegionKind rename
- `ReFree` -> `ReLateParam`
- `ReEarlyBound` -> `ReEarlyParam`
2023-11-14 13:13:27 +00:00
bors
d97bb195bf Auto merge of #117787 - ouz-a:smir_coroutinewitness, r=celinval
Add CoroutineWitness to covered types in smir

Previously we accepted `CouroutineWitness` as `unreachable!` but https://github.com/rust-lang/project-stable-mir/issues/50 shows it is indeed reachable, this pr fixes that and covers `CouroutineWitness`
2023-11-14 13:10:25 +00:00
Gavin Gray
caae1e08ec Add guard checking for associated types before computing intercrate ambiguity of projections. Bless test with more specific notes on the ambiguity cause. 2023-11-14 13:55:59 +01:00
Nikita Popov
8e2fcc4ca2 Update to LLVM 17.0.5 2023-11-14 12:06:30 +01:00
bors
fa14810f21 Auto merge of #117731 - nnethercote:rustc_macros, r=Nilstrieb
`rustc_macros` cleanups

Just some improvements I found while reading over this code.

r? `@Nilstrieb`
2023-11-14 10:55:42 +00:00
bors
5526682702 Auto merge of #117330 - tmiasko:custom-mir-cleanup-blocks, r=cjgillot
Custom MIR: Support cleanup blocks

Cleanup blocks are declared with `bb (cleanup) = { ... }`.

`Call` and `Drop` terminators take an additional argument describing the unwind action, which is one of the following:

* `UnwindContinue()`
* `UnwindUnreachable()`
* `UnwindTerminate(reason)`, where reason is `ReasonAbi` or `ReasonInCleanup`
* `UnwindCleanup(block)`

Also support unwind resume and unwind terminate terminators:

* `UnwindResume()`
* `UnwindTerminate(reason)`
2023-11-14 08:53:25 +00:00
Tomasz Miąsko
78da577650 Custom MIR: Support cleanup blocks
Cleanup blocks are declared with `bb (cleanup) = { ... }`.

`Call` and `Drop` terminators take an additional argument describing the
unwind action, which is one of the following:

* `UnwindContinue()`
* `UnwindUnreachable()`
* `UnwindTerminate(reason)`, where reason is `ReasonAbi` or `ReasonInCleanup`
* `UnwindCleanup(block)`

Also support unwind resume and unwind terminate terminators:

* `UnwindResume()`
* `UnwindTerminate(reason)`
2023-11-14 08:23:58 +01:00
bors
173b6e686b Auto merge of #117856 - estebank:issue-66023, r=compiler-errors
Always point at index span on index obligation failure

Use more targetted span for index obligation failures by rewriting the obligation cause span.

CC #66023
2023-11-14 06:20:25 +00:00
bors
5777f2c6bd Auto merge of #117801 - tmiasko:remove-zsts-fuel, r=cjgillot
Remove incorrect transformation from RemoveZsts

Partial removal of storage statements for a local is incorrect, so a decision to optimize cannot be make independently for each statement.

Avoid the issue by performing the transformation completely or not at all.
2023-11-14 04:22:56 +00:00
bors
d5375d0587 Auto merge of #117773 - nnethercote:rm-Zperf-stats, r=wesleywiser
Remove `-Zperf-stats`.

The included measurements have varied over the years. At one point there were quite a few more, but #49558 deleted a lot that were no longer used. Today there's just four, and it's a motley collection that doesn't seem particularly valuable.

I think it has been well and truly subsumed by self-profiling, which collects way more data.

r? `@wesleywiser`
2023-11-14 02:24:05 +00:00
sjwang05
614ddc9695
Suggest lhs deref for binops 2023-11-13 16:25:16 -08:00
bors
b9175240ea Auto merge of #116301 - mj10021:issue-115737-fix, r=cuviper
fix rounding issue with exponents in fmt

fixes issue #115737 , where the decimal places are rounded incorrectly when formatting scientific notation
2023-11-14 00:04:05 +00:00
bors
ba7c7a3019 Auto merge of #117887 - matthiaskrgr:rollup-rgur03f, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #114224 (rustc_llvm: Link to libkstat on Solaris/SPARC)
 - #117695 (Reorder checks to make sure potential missing expect on Option/Result…)
 - #117870 (`fn args_ref_X` to `fn args_X`)
 - #117879 (tests: update check for inferred nneg on zext)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-13 21:47:18 +00:00