Commit Graph

29804 Commits

Author SHA1 Message Date
bors
0ea7ddcc35 Auto merge of #117956 - saethlin:provenance-gc-access, r=RalfJung
Let Miri see the AllocId for all TyCtxt allocations

Per https://github.com/rust-lang/miri/pull/3103#discussion_r1391589896

r? `@RalfJung`
2023-11-16 15:15:54 +00:00
Ben Kimock
d7cecd3db2 Let Miri see the AllocId for all TyCtxt allocations 2023-11-16 08:30:49 -05:00
bors
1be1e84872 Auto merge of #117875 - Mark-Simulacrum:bootstrap-bump, r=clubby789
Bootstrap bump

Bumps bootstrap compiler to just-released beta.

https://forge.rust-lang.org/release/process.html#master-bootstrap-update-t-2-day-tuesday
2023-11-16 12:45:27 +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
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
Mark Rousskov
9e8edb6659 Add check-cfg to cranelift 2023-11-15 21:45:48 -05:00
Mark Rousskov
917f6540ed Re-format code with new rustfmt 2023-11-15 21:45:48 -05:00
Mark Rousskov
db3e2bacb6 Bump cfg(bootstrap)s 2023-11-15 19:41:28 -05:00
Mark Rousskov
efe54e24aa Substitute version placeholders 2023-11-15 19:40:51 -05: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
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
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
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
Tomasz Miąsko
6873465600 Fix def-use check for call terminators 2023-11-14 17:07:34 +01: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
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
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
Matthias Krüger
a87ad4e2a7
Rollup merge of #117870 - lcnr:rename-args_ref, r=compiler-errors
`fn args_ref_X` to `fn args_X`
2023-11-13 21:28:55 +01:00
Matthias Krüger
918c17acc3
Rollup merge of #117695 - 3tilley:prioritise-unwrap-expect-over-last-method-call, r=compiler-errors
Reorder checks to make sure potential missing expect on Option/Result…

… runs before removing last method call

Fixes #117669
2023-11-13 21:28:55 +01:00
Matthias Krüger
03d6e7ade0
Rollup merge of #114224 - inferiorhumanorgans:solaris-llvm-wrapper, r=cuviper
rustc_llvm: Link to libkstat on Solaris/SPARC

getHostCPUName calls into libkstat but as of
LLVM 16.0.6 libLLVMTargetParser is not explicitly
linked against libkstat causing builds to fail
due to undefined symbols.

See also: llvm/llvm-project#64186
2023-11-13 21:28:54 +01:00
Esteban Küber
5061c09c58 review comments: more targeted span setting approach 2023-11-13 19:57:15 +00:00
bors
85b8450466 Auto merge of #116866 - slanterns:inspect-stabilize, r=BurntSushi
Stabilize `result_option_inspect`

This PR stabilizes `result_option_inspect`:

```rust
// core::option

impl Option<T> {
    pub fn inspect<F: FnOnce(&T)>(self, f: F) -> Self;
}

// core::result

impl Result<T, E> {
    pub fn inspect<F: FnOnce(&T)>(self, f: F) -> Self;
    pub fn inspect_err<F: FnOnce(&E)>(self, f: F) -> Self;
}
```

<br>

Tracking issue: https://github.com/rust-lang/rust/issues/91345.
Implementation PR: https://github.com/rust-lang/rust/pull/91346.

Closes https://github.com/rust-lang/rust/issues/91345.
2023-11-13 19:46:18 +00:00
Josh Stone
855388e9a2
Mention LLVM 64186 in a comment 2023-11-13 11:04:53 -08:00
bors
531cb83fcf Auto merge of #117881 - TaKO8Ki:rollup-n7jtmgj, r=TaKO8Ki
Rollup of 5 pull requests

Successful merges:

 - #117737 (Remove `-Zkeep-hygiene-data`.)
 - #117830 (Small improvements in object lifetime default code)
 - #117858 (Compute layout with spans for better cycle errors in coroutines)
 - #117863 (Remove some unused stuff from `rustc_index`)
 - #117872 (Cranelift isn't available on non-nightly channels)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-13 17:29:00 +00:00