Commit Graph

226431 Commits

Author SHA1 Message Date
hkalbasi
08f89193b5 Fix drop scopes in mir 2023-06-04 01:03:32 +03:30
Rémy Rakic
4117b5e65b improve target selection conditions 2023-06-03 19:50:45 +00:00
bors
398fa2187c Auto merge of #112253 - matthiaskrgr:rollup-c37jpm5, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #111659 (suggest `Option::as_deref(_mut)` on type mismatch in option combinator if it passes typeck)
 - #111702 (Option::map_or_else: Show an example of integrating with Result)
 - #111878 (Fix codegen test suite for bare-metal-like targets)
 - #111969 (bootstrap: Make `clean` respect `dry-run`)
 - #111998 (Add other workspaces to `linkedProjects` in rust_analyzer_settings)
 - #112215 (only suppress coercion error if type is definitely unsized)
 - #112231 (Make sure the build.rustc version is either the same or 1 apart (revised))

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-03 19:18:43 +00:00
Matthias Krüger
d4f87d1e4f
Rollup merge of #112231 - chenyukang:yukang-fix-110067-version-issue, r=jyn514
Make sure the build.rustc version is either the same or 1 apart (revised)

https://github.com/rust-lang/rust/pull/111538 is reverted in https://github.com/rust-lang/rust/pull/112023.

This PR will only check `build.rustc` to confirm the correct version.
2023-06-03 20:38:13 +02:00
Matthias Krüger
20cbbbb977
Rollup merge of #112215 - compiler-errors:check-sized-better, r=cjgillot
only suppress coercion error if type is definitely unsized

we previously suppressed coercion errors when the return type was `dyn Trait` because we expect a far more descriptive `Sized` trait error to be emitted instead, however the code that does this suppression does not consider where-clause predicates since it just looked at the HIR. let's do that instead by creating an obligation and checking if it may hold.

fixes #110683
fixes #112208
2023-06-03 20:38:12 +02:00
Matthias Krüger
ea8b4ff2a6
Rollup merge of #111998 - jyn514:ra-dogfooding, r=Mark-Simulacrum
Add other workspaces to `linkedProjects` in rust_analyzer_settings

This makes go-to-definition, etc. work in cg_clif, cg_gcc, rust-analyzer, and src/tools/x.
2023-06-03 20:38:12 +02:00
Matthias Krüger
95b909a119
Rollup merge of #111969 - clubby789:clean-dry-run, r=Mark-Simulacrum
bootstrap: Make `clean` respect `dry-run`

I noticed `clean_default` was getting run twice as the `DryRun::SelfCheck` flag is ignored
2023-06-03 20:38:11 +02:00
Matthias Krüger
bdf9ed497a
Rollup merge of #111878 - ferrocene:pa-codegen-tests, r=Mark-Simulacrum
Fix codegen test suite for bare-metal-like targets

For Ferrocene I needed to run the test suite for custom target with no unwinding and static relocation. Running the tests uncovered ~20 failures due to the test suite not accounting for these options. This PR fixes them by:

* Fixing `CHECK`s to account for functions having extra LLVM IR attributes (in this case `nounwind`).
* Fixing `CHECK`s to account for the `dso_local` LLVM IR modifier, which is [added to every item when relocation is static](f3d597b31c/compiler/rustc_codegen_llvm/src/mono_item.rs (L139-L142)).
* Fixing `CHECK`s to account for missing `uwtables` attributes.
* Added the `needs-unwind` attributes for tests that are designed to check unwinding.

There is no part of Rust CI that checks this unfortunately, and testing whether the PR works locally is kinda hard because you need a target with std enabled but no unwinding and static relocations. Still, this works in my local testing, and if future PRs accidentally break this Ferrocene will take care of sending followup PRs.
2023-06-03 20:38:11 +02:00
Matthias Krüger
6e024ecab8
Rollup merge of #111702 - cgwalters:option-map-or-else-with-result, r=Mark-Simulacrum
Option::map_or_else: Show an example of integrating with Result

Moving this from https://github.com/rust-lang/libs-team/issues/59 where an API addition was rejected.  But I think it's valuable to add this example to the documentation at least.
2023-06-03 20:38:11 +02:00
Matthias Krüger
91f222f931
Rollup merge of #111659 - y21:suggest-as-deref, r=cjgillot
suggest `Option::as_deref(_mut)` on type mismatch in option combinator if it passes typeck

Fixes #106342.
This adds a suggestion to call `.as_deref()` (or `.as_deref_mut()` resp.) if typeck fails due to a type mismatch in the function passed to an `Option` combinator such as `.map()` or `.and_then()`.
For example:
```rs
fn foo(_: &str) {}
Some(String::new()).map(foo);
```
The `.map()` method requires its argument to satisfy `F: FnOnce(String)`, but it received `fn(&str)`, which won't pass. However, placing a `.as_deref()` before the `.map()` call fixes this since `&str == &<String as Deref>::Target`
2023-06-03 20:38:10 +02:00
Guillaume Gomez
d029800992 Update reexport-attr-merge rustdoc test 2023-06-03 19:57:17 +02:00
jyn
42a9898fd1 disable truncation in CI 2023-06-03 11:29:56 -05:00
jyn
3591a1239c Allow disabling truncation for long config lines 2023-06-03 11:29:21 -05:00
Rémy Rakic
17d321cd11 rust-lld: add rpath to the root LLVM shared lib
rust-lld is not located in the same directory as the other binaries that
point to ../lib, but in a deeper directory in lib. So we need to point
a few layers up for rust-lld to find the LLVM shared library without
rustup's LD_LIBRARY_PATH overrides.
2023-06-03 16:19:09 +00:00
Ralf Jung
ca720fdfee miri compiletest: no longer allow some warnings in rustc test suite 2023-06-03 17:48:51 +02:00
Guillaume Gomez
5c77a0d7a7 Remove unneeded Buffer allocations when &mut fmt::Write can be used directly 2023-06-03 17:23:02 +02:00
y21
268b08b01b do not use ty_adt_id from internal trait 2023-06-03 17:17:56 +02:00
bors
df4b808db4 Auto merge of #2914 - RalfJung:unchecked_shl, r=RalfJung
add unchecked_shl test

https://github.com/rust-lang/rust/pull/112238  made me realize that we have a test for add,sub,mul,shr but not shl. Add the missing test. Also name the existing tests more consistently.
2023-06-03 15:04:38 +00:00
Ralf Jung
e13d2380ae add unchecked_shl test 2023-06-03 17:03:24 +02:00
bors
2f5e6bb817 Auto merge of #112032 - sladyn98:migrate-item-primitive, r=GuillaumeGomez
Migrate  `item_primitive` to Askama

This PR migrates `item_primitive` to Askama

Refers https://github.com/rust-lang/rust/issues/108868
2023-06-03 14:37:23 +00:00
bors
e5c56cd9a0 Auto merge of #14955 - HKalbasi:mir-fix, r=HKalbasi
Remove unnecessary `StorageDead`

I hope this reduces MIR memory usage.
2023-06-03 13:55:40 +00:00
hkalbasi
f44fc271d4 Remove unnecessary StorageDead 2023-06-03 17:24:10 +03:30
Camille GILLOT
9e683442a9 Only check inlining counter after recusing. 2023-06-03 12:29:49 +00:00
bors
dd0c29c934 Auto merge of #14952 - lowr:fix/assignments-are-right-associative, r=HKalbasi
fix: assignment operators are right associative

Fixes #14944

Assignment operators, be they simple or complex, are right associative in Rust ([reference]). We need to consider that fact when computing [binding power][bp] of infix operators.

The changes in `0072_destructuring_assignment.{rs,rast}` are unexpected, but I'm pretty sure it's a typo and fixed the `.rs` file accordingly.

[reference]: https://doc.rust-lang.org/reference/expressions.html#expression-precedence
[bp]: https://matklad.github.io/2020/04/13/simple-but-powerful-pratt-parsing.html
2023-06-03 12:01:09 +00:00
Ryo Yoshida
f9c1a7dcd9
fix: assignment operators are right associative 2023-06-03 19:58:35 +09:00
bors
1e17cef9e2 Auto merge of #109432 - flba-eb:108594_forkspawn_exponential_backoff, r=workingjubilee
QNX Neutrino: exponential backoff when fork/spawn needs a retry

Fixes #108594: When retrying, sleep with an exponential duration. When sleep duration is lower than minimum possible sleeping time, yield instead (this will not be often due to the exponential increase of duration).

Minimum possible sleeping time is determined using `libc::clock_getres` but only when spawn/fork failed the first time in a request. This is cached using a LazyLock.

CC `@gh-tr`

r? `@workingjubilee`
`@rustbot` label +O-neutrino
2023-06-03 10:06:59 +00:00
bors
8177591aec Auto merge of #111516 - compiler-errors:issue-111500, r=jackh726
Don't use `can_eq` in `derive(..)` suggestion for missing method

Unsatisfied predicates returned from method probe may reference inference vars from that probe, so drop this extra check I added in #110877 for more accurate derive suggestions...

Fixes #111500
2023-06-03 07:25:40 +00:00
许杰友 Jieyou Xu (Joe)
2a7c6a99ef
Fix suggestion for matching struct with .. on both ends 2023-06-03 15:02:13 +08:00
bors
7d5b746e1c Auto merge of #111350 - chenyukang:yukang-remove-type-asc, r=Nilstrieb
Remove leftover of type ascription feature gating

Fixes #111325

r? `@Nilstrieb`
2023-06-03 04:54:28 +00:00
yukang
bff5ecd382 only check when we specify rustc in config.toml 2023-06-03 11:35:53 +08:00
bors
dff88b2064 Auto merge of #112217 - arlosi:update-vuln-deps, r=Mark-Simulacrum
Update dependencies with reported vulnerabilities

Vulnerable dependencies:
* bumpalo 3.12.1 (yanked)
  * updated to 3.13.0
* tokio 1.8.4 - https://rustsec.org/advisories/RUSTSEC-2023-0001
  * updated to 1.28.2
* remove_dir_all 0.5.3 - https://rustsec.org/advisories/RUSTSEC-2023-0018
  * removed by using the standard library function in `rust-installer` instead and updating to `tempfile@3.5.0` (which also removes the dependency).

The new dependencies come from `tempfile@3.5.0` which adds the dependency on `rustix`
2023-06-03 01:59:14 +00:00
yukang
8baa32ff95 cleanup 2023-06-03 09:44:30 +08:00
yukang
2d27932b6c remove EarlySyntaxWarning for type ascription 2023-06-03 09:22:47 +08:00
yukang
b002c9ff11 remove type ascription feature gate 2023-06-03 09:22:47 +08:00
bors
7a0070eaea Auto merge of #112228 - compiler-errors:rollup-97i0pli, r=compiler-errors
Rollup of 6 pull requests

Successful merges:

 - #109609 (Separate AnonConst from ConstBlock in HIR.)
 - #112166 (bootstrap: Rename profile = user to profile = dist)
 - #112168 (Lower `unchecked_div`/`_rem` to MIR's `BinOp::Div`/`Rem`)
 - #112183 (Normalize anon consts in new solver)
 - #112211 (pass `--lib` to `x doc`)
 - #112223 (Don't ICE in new solver when auto traits have associated types)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-02 23:02:42 +00:00
Michael Goulet
18763cb464
Rollup merge of #112223 - compiler-errors:new-solver-auto-proj, r=BoxyUwU
Don't ICE in new solver when auto traits have associated types

People can write malformed auto traits, and that shouldn't cause the new solver to ICE
2023-06-02 16:02:07 -07:00
Michael Goulet
163ce686be
Rollup merge of #112211 - eval-exec:exec/fix-bootstrap-rustdoc, r=ozkanonur
pass `--lib` to `x doc`

This PR want to close #112082
2023-06-02 16:02:07 -07:00
Michael Goulet
e4a6b24245
Rollup merge of #112183 - compiler-errors:new-solver-anon-ct, r=BoxyUwU
Normalize anon consts in new solver

We don't do any of that `expand_abstract_consts` stuff so this isn't sufficient to make GCE work, but it does allow, e.g. `[(); 1]: Default`, to solve.

r? `@BoxyUwU`
2023-06-02 16:02:06 -07:00
Michael Goulet
5460f92a0f
Rollup merge of #112168 - scottmcm:lower-div-rem-unchecked-to-mir, r=oli-obk
Lower `unchecked_div`/`_rem` to MIR's `BinOp::Div`/`Rem`

As described in <https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/enum.BinOp.html#variant.Div>, the ordinary `BinOp`s for these are already UB for division by zero ([or overflow](https://llvm.org/docs/LangRef.html#sdiv-instruction), [demo](https://rust.godbolt.org/z/71e7P7Exh)), as MIR building is responsible for inserting code to panic for those cases regardless of whether the overflow checks are enabled.

So we can lower these in the same arm that lowers `wrapping_add` to MIR `BinOp::Add` and such, as all these cases turn into ordinary `Rvalue::BinaryOp`s.
2023-06-02 16:02:06 -07:00
Michael Goulet
dd09f4d35c
Rollup merge of #112166 - AnakinSkywalkeer:master, r=clubby789
bootstrap: Rename profile = user to profile = dist

Fixes #112074
2023-06-02 16:02:05 -07:00
Michael Goulet
6c9b7d6cbf
Rollup merge of #109609 - cjgillot:split-anon-const, r=BoxyUwU
Separate AnonConst from ConstBlock in HIR.

Their behaviours are different enough to justify having separate nodes.
2023-06-02 16:02:05 -07:00
Michael Goulet
84196f3371 Elaborate comment, make sure we do normalizes-to hack eventually for IATs, don't partially support const projection for impls 2023-06-02 22:07:58 +00:00
Michael Goulet
8912015f71 No const equate in new solver 2023-06-02 22:07:57 +00:00
Michael Goulet
2c1473ca70 Normalize anon consts in new solver 2023-06-02 22:07:57 +00:00
Michael Goulet
4fbb43e70f No more TyCtxt::lazy_normalization 2023-06-02 22:07:57 +00:00
Camille GILLOT
ca4d0d4c24 Separate AnonConst from ConstBlock in HIR. 2023-06-02 21:25:18 +00:00
bors
7f3bfc6ae7 Auto merge of #14951 - HKalbasi:mir-fix, r=HKalbasi
Fix string pattern matching in mir interpreter
2023-06-02 20:16:28 +00:00
hkalbasi
aab7589c40 Fix string pattern matching in mir interpreter 2023-06-02 23:45:29 +03:30
bors
dd5d7c729d Auto merge of #112162 - nnethercote:clarify-mono-item-usage, r=wesleywiser
Clarify mono item usage

Some commits that make the terminology around mono items clearer, and simplify related data structures.

r? `@wesleywiser`
2023-06-02 19:53:32 +00:00
Michael Goulet
ecd7809784 Don't ICE in new solver when auto traits have associated types 2023-06-02 19:22:25 +00:00