Commit Graph

232591 Commits

Author SHA1 Message Date
Matthias Krüger
2bca4b5913
Rollup merge of #115000 - RalfJung:custom-mir-call, r=compiler-errors,JakobDegen
custom_mir: change Call() terminator syntax to something more readable

I find our current syntax very hard to read -- I cannot even remember the order of arguments, and having the "next block" *before* the actual function call is very counter-intuitive IMO. So I suggest we use `Call(ret_val = function(v), next_block)` instead.

r? `@JakobDegen`
2023-08-20 08:34:05 +02:00
Matthias Krüger
4542711a69
Rollup merge of #114999 - GuillaumeGomez:migrate-gui-test-color-34, r=notriddle
Migrate GUI colors test to original CSS color format

Follow-up of https://github.com/rust-lang/rust/pull/111459.

This test needed more cleanup: first I removed duplication by using a function, then I merge similar rules which had the same values.

r? `@notriddle`
2023-08-20 08:34:04 +02:00
Matthias Krüger
e25dfe1ef6
Rollup merge of #114976 - Enselic:incr-comp-dir-error, r=compiler-errors
Ignore unexpected incr-comp session dirs

Clearly the code path can be hit without the presence of a compiler bug.
All it takes is mischief. See #71698.

Ignore problematic directories instead of ICE:ing. `continue`ing is
 already done for problematic dirs in the code block above us.

Closes #71698.

With this fix, the output is this instead of ICE:

```
$ cargo +stage1 new gz-ice && cd gz-ice
$ cargo +stage1 build
$ find target -type f -exec gzip {} \;
$ cargo +stage1 run

     Created binary (application) `gz-ice` package
   Compiling gz-ice v0.1.0 (/tmp/gz-ice)
    Finished dev [unoptimized + debuginfo] target(s) in 0.13s
gzip: target/debug/gz-ice has 1 other link  -- unchanged
gzip: target/debug/deps/gz_ice-de919414dd9926b9 has 1 other link  -- unchanged
   Compiling gz-ice v0.1.0 (/tmp/gz-ice)
warning: failed to garbage collect invalid incremental compilation session directory `/tmp/gz-ice/target/debug/incremental/gz_ice-23qx9z9j9vghe/s-gnwd8daity-kp10sj.lock.gz`: Not a directory (os error 20)

warning: `gz-ice` (bin "gz-ice") generated 1 warning
    Finished dev [unoptimized + debuginfo] target(s) in 0.13s
     Running `target/debug/gz-ice`
Hello, world!
```
2023-08-20 08:34:04 +02:00
Matthias Krüger
7b66abe5a2
Rollup merge of #114968 - ShE3py:unix-getsetenv-ub, r=thomcc
Fix UB in `std::sys::os::getenv()`

Fixes #114949.

Reduced the loops to 1k iterations (100k was taking way too long), Miri no longer shows any UB.

`@rustbot` label +A-process +C-bug +I-unsound +O-unix
2023-08-20 08:34:03 +02:00
Matthias Krüger
33771dfaf0
Rollup merge of #114834 - compiler-errors:try_coerce-side-effects, r=lcnr
Avoid side-effects from `try_coerce` when suggesting borrowing LHS of cast

The name `try_coerce` is a bit misleading -- it has side-effects, so when it's used in diagnostics code, it sometimes causes spurious obligations to be registered which cause other errors to occur that really make no sense in context.

Addendum: let's just rename `try_coerce` to `coerce` -- the `try_` part doesn't really add much, imo.
2023-08-20 08:34:03 +02:00
bors
39e0749329 Auto merge of #114914 - compiler-errors:deduce-tait-in-future-output, r=lcnr
Normalize return type of `deduce_future_output_from_obligations`

Fixes #114909
Also confirmed to fix #114727 manually

Now that we have weak/lazy type aliases, we need to normalize those in future signatures to ensure that `replace_opaque_types_with_inference_vars` actually sees TAITs behind them. This isn't needed in the new solver, but added a test to make sure it doesn't regress there either.

r? types cc `@oli-obk` (who's gone, worst case can delay this PR until he's back)
2023-08-20 06:24:44 +00:00
bors
484cb4e78d Auto merge of #114332 - nbdd0121:riscv, r=compiler-errors
Fix ABI flags in RISC-V/LoongArch ELF file generated by rustc

Fix #114153

It turns out the current way to set these flags are completely wrong. In LLVM the target ABI is used instead of target features to determine these flags.

Not sure how to write a test though. Or maybe a test isn't necessary because this affects only those touching target json?

r? `@Nilstrieb`
2023-08-20 04:38:08 +00:00
bors
82c5732b9a Auto merge of #113966 - lu-zero:relocation-model-in-cfg, r=bjorn3
Add the relocation_model to the cfg

This way is possible to write inline assembly code aware of it.
2023-08-20 02:48:33 +00:00
Zalathar
72f4c78dc6 coverage: Don't store function_source_hash in BcbCounter::Counter
This shows one small benefit of separating `BcbCounter` from `CoverageKind`.
The function source hash will be the same for all counters within a function,
so instead of passing it through `CoverageCounters` and storing it in every
counter, we can just supply it during the final conversion to `CoverageKind`.
2023-08-20 12:02:40 +10:00
Zalathar
fbab055e77 coverage: Give the instrumentor its own counter type, separate from MIR
This splits off `BcbCounter` from MIR's `CoverageKind`, allowing the two types
to evolve in different directions as necessary.
2023-08-20 12:02:40 +10:00
Zalathar
629437eec7 coverage: Move a debug print into make_code_region 2023-08-20 12:02:40 +10:00
Zalathar
cad50f40e5 coverage: Remove a useless let () = 2023-08-20 12:02:40 +10:00
bors
9c699a40cc Auto merge of #113167 - ChAoSUnItY:redundant_explicit_link, r=GuillaumeGomez
rustdoc: Add lint `redundant_explicit_links`

Closes #87799.
- Lint warns by default
- Reworks link parser to cache original link's display text

r? `@jyn514`
2023-08-20 01:04:22 +00:00
Michael Goulet
fad7d220fd Warn on elided lifetimes in associated constants 2023-08-20 00:21:47 +00:00
bors
f32ced6481 Auto merge of #115009 - matthiaskrgr:rollup-ainf2gb, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #114605 (Increase clarity about Hash - Eq consistency in HashMap and HashSet docs)
 - #114934 (instantiate response: no unnecessary new universe)
 - #114950 (Inline strlen_rt in CStr::from_ptr)
 - #114973 (Expose core::error::request_value in std)
 - #114983 (Usage zero as language id for `FormatMessageW()`)
 - #114991 (remove redundant var rebindings)
 - #114992 (const-eval: ensure we never const-execute a function marked rustc_do_not_const_check)
 - #115001 (clippy::perf stuff)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-19 22:56:47 +00:00
Matthias Krüger
d49b1aba80
Rollup merge of #115001 - matthiaskrgr:perf_clippy, r=cjgillot
clippy::perf stuff
2023-08-20 00:28:34 +02:00
Matthias Krüger
bb3cf24d15
Rollup merge of #114992 - RalfJung:rustc_do_not_const_check, r=b-naber
const-eval: ensure we never const-execute a function marked rustc_do_not_const_check
2023-08-20 00:28:33 +02:00
Matthias Krüger
a12d58c2ca
Rollup merge of #114991 - matthiaskrgr:no_rebind, r=cjgillot
remove redundant var rebindings
2023-08-20 00:28:33 +02:00
Matthias Krüger
d761a5fe11
Rollup merge of #114983 - crlf0710:formatmsg, r=ChrisDenton
Usage zero as language id for `FormatMessageW()`

This switches the language selection from using system language (note that this might be different than application language, typically stored as thread ui language) to use `FormatMessageW` default search strategy, which is `neutral` first, then `thread ui lang`, then `user language`, then `system language`, then `English`. (See https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-formatmessagew)

This allows the Rust program to take more control of `std::io::Error`'s message field, by setting up thread ui language themselves before hand (which many programs already do).
2023-08-20 00:28:32 +02:00
Matthias Krüger
cbcdf7580b
Rollup merge of #114973 - shepmaster:std-provide-value, r=Amanieu
Expose core::error::request_value in std

I think this was simply forgotten in #113464.

/cc ``@waynr``

r? ``@Amanieu``
2023-08-20 00:28:32 +02:00
Matthias Krüger
cad8f8cbff
Rollup merge of #114950 - xfix:inline-cstr-from-ptr, r=cuviper
Inline strlen_rt in CStr::from_ptr

This enables LLVM to optimize this function as if it was strlen (LLVM knows what it does, and can avoid calling it in certain situations) without having to enable std-aware LTO. This is essentially doing what https://github.com/rust-lang/rust/pull/90007 did, except updated for this function being `const`.

Pretty sure it's safe to roll-up, considering last time I did make this change it didn't affect performance (`CStr::from_ptr` isn't really used all that often in Rust code that is checked by rust-perf).
2023-08-20 00:28:31 +02:00
Matthias Krüger
03455c8895
Rollup merge of #114934 - lcnr:generalize-substs-relate, r=compiler-errors
instantiate response: no unnecessary new universe

this previously was a off-by-one error.

fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/55

r? ````@compiler-errors````
2023-08-20 00:28:31 +02:00
Matthias Krüger
0cc4b55a12
Rollup merge of #114605 - Easyoakland:hash-collection-doc, r=thomcc
Increase clarity about Hash - Eq consistency in HashMap and HashSet docs

As discussed [here](https://users.rust-lang.org/t/what-hapens-if-hash-and-partialeq-dont-match-when-using-hashmap/98052/13) the description of logic errors in `HashMap` and `HashSet` does not explicitly apply to
```text
k1 == k2 -> hash(k1) == hash(k2)
```
but this is likely what is intended.

This PR is a small doc change to correct this.

r? rust-lang/libs
2023-08-20 00:28:31 +02:00
Michael Goulet
406b0e2935 Rename try_coerce to coerce 2023-08-19 22:12:52 +00:00
Michael Goulet
822caa8b80 Avoid side-effects from try_coerce when suggesting borrowing LHS of cast 2023-08-19 22:12:51 +00:00
Ralf Jung
7a6346660e custom_mir: change Call() terminator syntax to something more readable 2023-08-19 22:41:33 +02:00
Michael Goulet
acd3542b8d Don't do intra-pass validation on MIR shims 2023-08-19 18:47:08 +00:00
Matthias Krüger
4cd3b0b71c use static arrays instead of vectors 2023-08-19 18:49:58 +02:00
Guillaume Gomez
03a3d24a11 Migrate GUI colors test to original CSS color format 2023-08-19 17:52:20 +02:00
Guillaume Gomez
87a0efbf02 Merge values with same colors 2023-08-19 17:52:15 +02:00
Guillaume Gomez
ba33bb4569 Use function to remove code duplication for search-form-elements.goml test 2023-08-19 17:52:12 +02:00
Matthias Krüger
76efd398ba instead of collecting newly formatted Strings into one String, only create a single String and write!() to it (clippy::format_collect) 2023-08-19 17:08:09 +02:00
bors
83b3ba1b81 Auto merge of #15483 - matklad:up-me-baby-one-more-time, r=Veykril
internal: post-bump lsp-server version
2023-08-19 14:54:31 +00:00
Alex Kladov
1cebc0ca13 internal: post-bump lsp-server version 2023-08-19 15:28:32 +01:00
bors
6ef7d16be0 Auto merge of #114979 - weihanglo:update-cargo, r=weihanglo
Update cargo

15 commits in 7c3904d6c3ed54e8a413023519b55a536ad44d5b..80eca0e58fb2ff52c1e94fc191b55b37ed73e0e4
2023-08-14 20:11:43 +0000 to 2023-08-19 00:52:06 +0000
- chore: Downgrade serde below the binary blob (rust-lang/cargo#12528)
- Improve error message for when no credential providers are available (rust-lang/cargo#12526)
- Fix typo: "use" -> "used" (rust-lang/cargo#12522)
- Document layout SemVer compatibility. (rust-lang/cargo#12169)
- Make cargo-credential-gnome-secret built-in as cargo:libsecret (rust-lang/cargo#12521)
- login: allow passing additional args to provider (rust-lang/cargo#12499)
- cargo-credential-gnome-secret: dynamically load libsecret (rust-lang/cargo#12518)
- credential-providers: make 1password no longer built-in (rust-lang/cargo#12507)
- Print environment variables for `cargo run` in extra verbose mode (rust-lang/cargo#12498)
- chore(cargo-util): bump version to 0.2.6 (rust-lang/cargo#12517)
- credential: rename cargo:basic to cargo:token-from-stdout (rust-lang/cargo#12512)
- fix(xtask-bump-check): query by package name to detect changes (rust-lang/cargo#12513)
- ci: use pull request head commit whenever possible (rust-lang/cargo#12508)
- Update hermit-abi (rust-lang/cargo#12504)
- Crate checksum lookup query should match on semver build metadata (rust-lang/cargo#11447)

r? ghost
2023-08-19 14:20:06 +00:00
bors
904b326c11 Auto merge of #15482 - matklad:🪄deblobify, r=Veykril
fix: avoid problematic serde release

serde 1.0.172 and up rely on opaque non-reproducible binary blobs to function, explicitly not providing a library-level opt-out.

This is problematic for two reasons:

- directly, unauditable binary blobs are a security issue.
- indirectly, it becomes much harder to predict future behaviors of the crate.

As such, I am willing to go on a limb here and forbid building rust-analyzer with those versions of serde. Normally, my philosophy is to defer the choice to the end user, but it's also a design constraint of rust-analyzer that we don't run random binaries downloaded from the internet without explicit user's concent.

Concretely, this upper-bounds serde for both rust-analyzer workspace, as well as the lsp-server lib.

See https://github.com/serde-rs/serde/issues/2538 for wider context.
2023-08-19 13:35:02 +00:00
Alex Kladov
6c46b98a95 fix: avoid problematic serde release
serde 1.0.172 and up rely on opaque non-reproducible binary blobs to
function, explicitly not providing a library-level opt-out.

This is problematic for two reasons:

- directly, unauditable binary blobs are a security issue.
- indirectly, it becomes much harder to predict future behaviors of the
  crate.

As such, I am willing to go on a limb here and forbid building
rust-analyzer with those versions of serde. Normally, my philosophy is
to defer the choice to the end user, but it's also a design constraint
of rust-analyzer that we don't run random binaries downloaded from the
internet without explicit user's concent.

Concretely, this upper-bounds serde for both rust-analyzer workspace, as
well as the lsp-server lib.

See https://github.com/serde-rs/serde/issues/2538 for wider context.
2023-08-19 14:14:23 +01:00
bors
721e0e3512 Auto merge of #15480 - matklad:lsp-server-up, r=Veykril
upgrade lsp server
2023-08-19 12:41:38 +00:00
Alex Kladov
dadbfe7f4b upgrade lsp server 2023-08-19 13:36:07 +01:00
Ralf Jung
410bd45ff2 const-eval: ensure we never const-execute a function marked rustc_do_not_const_check 2023-08-19 14:33:31 +02:00
Matthias Krüger
269803ee56 remove redundant var rebindings 2023-08-19 14:09:30 +02:00
John Kåre Alsaker
1e87ef66f4 Fix a stack overflow with long else if chains 2023-08-19 13:11:16 +02:00
bors
3e50a641da Auto merge of #114980 - matthiaskrgr:rollup-3y7651q, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #114953 (Add myself back to review rotation)
 - #114958 (`ignore-cross-compile` on `optimization-remarks-dir-pgo` test)
 - #114971 (Add doc aliases for trigonometry and other f32,f64 methods.)
 - #114972 (Add a test to check that inline const is in required_consts)
 - #114977 (Add `modulo` and `mod` as doc aliases for `rem_euclid`.)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-19 10:58:57 +00:00
Weihang Lo
07ff87bf73
Update cargo 2023-08-19 08:46:37 +01:00
Charles Lew
4504cc513f Usage zero as language id for FormatMessageW() 2023-08-19 14:32:15 +08:00
Matthias Krüger
8e0a8cdecb
Rollup merge of #114977 - kpreid:modulo, r=thomcc
Add `modulo` and `mod` as doc aliases for `rem_euclid`.

When I was learning Rust I looked for “a modulo function” and couldn’t find one, so thought I had to write my own; it wasn't at all obvious that a function with “rem” in the name was the function I wanted. Hopefully this will save the next learner from that.

However, it does have the disadvantage that the top results in rustdoc for “mod” are now these aliases instead of the Rust keyword, which probably isn't ideal.
2023-08-19 03:27:01 +02:00
Matthias Krüger
d8bde4878a
Rollup merge of #114972 - nbdd0121:const_check, r=compiler-errors
Add a test to check that inline const is in required_consts

This was a commit in #104087. This commit, as a test, can go in while the overall inline const stabilisation is blocked.

Suggested in https://github.com/rust-lang/rust/issues/76001#issuecomment-1315975027
2023-08-19 03:27:00 +02:00
Matthias Krüger
8d52b4d2f3
Rollup merge of #114971 - kpreid:trig, r=joshtriplett
Add doc aliases for trigonometry and other f32,f64 methods.

These are common alternate names, usually a less-abbreviated form, for the operation; e.g. `arctan` instead of `atan`. Prompted by <https://users.rust-lang.org/t/64-bit-trigonometry/98599>
2023-08-19 03:27:00 +02:00
Matthias Krüger
2b13128be8
Rollup merge of #114958 - ferrocene:optimization-remarks-dir-pgo, r=lqd
`ignore-cross-compile` on `optimization-remarks-dir-pgo` test

We noticed this on our upstream pull on ferrocene a week ago as it was failing our CI. The test attempts to run the produced binary which won't work when cross compiling.
2023-08-19 03:26:59 +02:00
Matthias Krüger
0e609c4610
Rollup merge of #114953 - WaffleLapkin:waffle-back-to-rotation-hehehee, r=WaffleLapkin
Add myself back to review rotation

r? ``@ghost``
2023-08-19 03:26:59 +02:00