Commit Graph

231862 Commits

Author SHA1 Message Date
Michael Goulet e4cf708d2f Don't add associated type bound for non-types 2023-08-11 21:33:08 +00:00
bors b03864d546 Auto merge of #114729 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`

cc `@Centri3` This reinstates the `filter_map_bool_then` lint https://github.com/rust-lang/rust/pull/114715, since I think you fixed the ICE in beb57f074e which is included in this sync.
2023-08-11 14:46:07 +00:00
bors 08691f0c92 Auto merge of #113432 - klensy:ms-cut-backtrace, r=ChrisDenton
reduce deps for windows-msvc targets for backtrace

(eventually) mirrors https://github.com/rust-lang/backtrace-rs/pull/543

Some dependencies of backtrace don't used on windows-msvc targets, so exclude them:

    miniz_oxide (+ adler)
    addr2line (+ gimli)
    object (+ memchr)

This saves about 30kb of std.dll + 17.5mb of rlibs
2023-08-11 12:07:04 +00:00
Philipp Krones 852bf4e51b
Merge commit '1e8fdf492808a25d78a97e1242b835ace9924e4d' into clippyup 2023-08-11 14:05:13 +02:00
bors 1e8fdf4928 Auto merge of #11320 - max-niederman:redundant_locals_shadow_mutated, r=Alexendoo
redundant_locals: fix FPs on mutated shadows

Fixes #11290.

When a mutable binding is shadowed by
a mutable binding of the same name in a different scope, mutations in that scope have different meaning.
This PR fixes spurious `redundant_locals` emissions on such locals.

cc `@Centri3,` `@flip1995`

changelog: [`redundant_locals`]: fix false positives on mutated shadows
2023-08-11 10:58:13 +00:00
bors 4d7a80d486 Auto merge of #114672 - lenawanel:master, r=compiler-errors
make `typeid::typeid_itanium_cxx_abi::transform_ty` evaluate length in array types

the ICE in https://github.com/rust-lang/rust/issues/114275 was caused by `transform_ty`
in compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs encountering an unevaluated const, while expecting it to already be evaluated.
2023-08-11 09:30:41 +00:00
bors 8703661a9a Auto merge of #11316 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

cc `@max-niederman` With the latest sync, I'm getting a lot of FP in the `redundant_locals` lint you recently added. Any ideas where this could come from?

changelog: none
2023-08-11 08:54:35 +00:00
Philipp Krones 3927677234
Dogfood and bless tests 2023-08-11 10:53:18 +02:00
Philipp Krones 0fc051ddba
Fix redundant_locals for Async desugaring 2023-08-11 10:51:18 +02:00
bors 7d8386f05c Auto merge of #114719 - compiler-errors:rollup-bf1vr51, r=compiler-errors
Rollup of 5 pull requests

Successful merges:

 - #114194 (Inline trivial (noop) flush calls)
 - #114257 (Avoid using `ptr::Unique` in `LinkedList` code)
 - #114359 ([library/std] Replace condv while loop with `cvar.wait_while`.)
 - #114402 (Fix documentation of impl From<Vec<T>> for Rc<[T]>)
 - #114715 (Revert clippy lint [`filter_map_bool_then`])

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-11 06:54:10 +00:00
bors a07bc13e14 Auto merge of #114718 - compiler-errors:rollup-1am5rpn, r=compiler-errors
Rollup of 7 pull requests

Successful merges:

 - #114599 (Add impl trait declarations to SMIR)
 - #114622 (rustc: Move `crate_types` and `stable_crate_id` from `Session` to `GlobalCtxt`)
 - #114662 (Unlock trailing where-clauses for lazy type aliases)
 - #114693 (Remove myself from the review rotation)
 - #114694 (make the provisional cache slightly less broken)
 - #114705 (Add spastorino to mailmap)
 - #114712 (Fix a couple of bad comments)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-11 04:17:57 +00:00
Michael Goulet 35a76a6c32
Rollup merge of #114715 - Centri3:revert-clippy-11115, r=Manishearth
Revert clippy lint [`filter_map_bool_then`]

r? `@Manishearth`

Issue in question is https://github.com/rust-lang/rust-clippy/issues/11309.

We usually wait until the next sync but this ICE is entirely unpreventable and happens often for code where type annotations are needed alongside a lifetime parameter so I think it's a good idea to revert it here. Also, this got into 1.71.1: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=620a95846a0e4810dffb39d7594d62d7
2023-08-10 21:17:38 -07:00
Michael Goulet 9546d7140e
Rollup merge of #114402 - tifv:tifv-fix-rc-doc, r=cuviper
Fix documentation of impl From<Vec<T>> for Rc<[T]>

The example in the documentation of `impl From<Vec<T>> for <Rc<[T]>` is irrelevant (likely was copied from `impl From<Box<T>> for <Rc<T>`). I suggest taking corresponding example from the documentation of `Arc` and replacing `Arc` with `Rc`.
2023-08-10 21:17:37 -07:00
Michael Goulet 5da7f36485
Rollup merge of #114359 - ttsugriy:barrier-simpl, r=cuviper
[library/std] Replace condv while loop with `cvar.wait_while`.

`wait_while` takes care of spurious wake-ups in centralized place, reducing chances for mistakes and potential future optimizations (who knows, maybe in future there will be no spurious wake-ups? :)
2023-08-10 21:17:37 -07:00
Michael Goulet 3791f6dded
Rollup merge of #114257 - rytheo:linked-list-avoid-unique, r=cuviper
Avoid using `ptr::Unique` in `LinkedList` code

Addresses a [comment](https://github.com/rust-lang/rust/pull/103093#discussion_r1268506747) by `@RalfJung` about avoiding use of `core::ptr::Unique` in the standard library.
2023-08-10 21:17:36 -07:00
Michael Goulet 0c241e6bdb
Rollup merge of #114194 - thomcc:flushinline, r=cuviper
Inline trivial (noop) flush calls

At work I noticed that `writer.flush()?` didn't get optimized away in cases where the flush is obviously a no-op, which I had expected (well, desired).

I went through and added `#[inline]` to a bunch of cases that were obviously noops, or delegated to ones that were obviously noops. I omitted platforms I don't have access to (some tier3). I didn't do this very scientifically, in cases where it was non-obvious I left `#[inline]` off.
2023-08-10 21:17:36 -07:00
Michael Goulet 5f906897f6
Rollup merge of #114712 - compiler-errors:comment-nits, r=lcnr
Fix a couple of bad comments

A couple of nits I saw. Sorry, this really should be folded into some other PR of mine, but I will literally forget if I don't put these up now.
2023-08-10 21:17:10 -07:00
Michael Goulet 891b3842b7
Rollup merge of #114705 - spastorino:add-spastorino-mailmap, r=compiler-errors
Add spastorino to mailmap
2023-08-10 21:17:09 -07:00
Michael Goulet a04dfc32e6
Rollup merge of #114694 - lcnr:provisional-cache, r=compiler-errors
make the provisional cache slightly less broken

It is still broken for the following cycles:
```mermaid
graph LR
   R["R: coinductive"] --> A["A: inductive"]
   R --> B["B: coinductive"]
   A --> B
   B --> R
```
the `R -> A -> B -> R` cycle should be considered to not hold, as it is mixed, but because we first put `B` into the cache from the `R -> B -> R` cycle which is coinductive, it does hold.

This issue will also affect our new coinduction approach. Longterm cycles are coinductive as long as one step goes through an impl where-clause, see f4fc5bae36/crates/formality-prove/src/prove/prove_wc.rs (L51-L62). Here we would first have a fully inductive cycle `R -> B -> R` which is then entered by a cycle with a coinductive step `R -> A -coinductive-> B -> R`.

I don't know how to soundly implement a provisional cache for goals not on the stack without tracking all cycles the goal was involved in and whether they were inductive or not. We could then only use goals from the cache if the *inductivity?* of every cycle remained the same. This is a mess to implement. I therefore want to rip out the provisional cache entirely, but will wait with this until I talked about it with `@nikomatsakis.`

r? `@compiler-errors`
2023-08-10 21:17:09 -07:00
Michael Goulet 2845baddb3
Rollup merge of #114693 - pietroalbini:pa-pietro-review-rotation, r=compiler-errors
Remove myself from the review rotation

I'll go on vacation soon, and in general I've not been able to keep up with the reviews.

r? `@Mark-Simulacrum`
2023-08-10 21:17:08 -07:00
Michael Goulet 076c9d7593
Rollup merge of #114662 - fmease:lazy-ty-aliases-unlock-trailing-wcs, r=oli-obk
Unlock trailing where-clauses for lazy type aliases

Allows trailing where-clauses on lazy type aliases and forbids[^1] leading ones.
Completes #89122 (see section *Top-level type aliases*).

`@rustbot` label F-lazy_type_alias
r? `@oli-obk`

[^1]: This is absolutely fine since lazy type aliases are only meant to be stabilized as part of a new edition.
2023-08-10 21:17:08 -07:00
Michael Goulet 94533d924e
Rollup merge of #114622 - petrochenkov:noplugin, r=oli-obk
rustc: Move `crate_types` and `stable_crate_id` from `Session` to `GlobalCtxt`

Removes two pieces of mutable state.
Follow up to https://github.com/rust-lang/rust/pull/114578.
2023-08-10 21:17:07 -07:00
Michael Goulet 12551a5151
Rollup merge of #114599 - spastorino:add-impl-trait-smir, r=oli-obk
Add impl trait declarations to SMIR

r? `@oli-obk`
2023-08-10 21:17:07 -07:00
Max Niederman a5f62bdfcd
redundant_locals: fix FPs on mutated shadows
When a mutable binding is shadowed by
a mutable binding of the same name in a different scope,
mutations in that scope have different meaning.
This commit fixes spurious `redundant_locals` emissions
on such locals.
2023-08-10 19:53:45 -07:00
bors e286f25ec0 Auto merge of #114507 - sebastiantoh:issue-114235, r=jackh726
Add suggestion to quote inlined format argument as string literal

Fixes #114235
2023-08-11 01:41:30 +00:00
bors bd1554c425 Auto merge of #11318 - Centri3:#11309, r=Manishearth
[`filter_map_bool_then`]: Don't ICE on late bound regions

Fixes #11309

Also lints `&NonCopy` now, since any `&` is `Copy`. That was accidental, but it seems that this is a consequence (or improvement!) of this fix.

r? `@Jarcho`

changelog: [`filter_map_bool_then`]: Don't ICE on late bound regions
2023-08-11 00:17:15 +00:00
Michael Goulet 540afe202f Comment nits 2023-08-10 23:22:03 +00:00
bors a9b2c6a0ce Auto merge of #114005 - Zalathar:no-cstr, r=jackh726
coverage: Don't convert filename/symbol strings to `CString` for FFI

LLVM APIs are usually perfectly happy to accept pointer/length strings, as long as we supply a suitable length value when creating a `StringRef` or `std::string`.

This lets us avoid quite a few intermediate `CString` copies during coverage codegen. It also lets us use an `IndexSet<Symbol>` (instead of an `IndexSet<CString>`) when building the deduplicated filename table.
2023-08-10 23:06:10 +00:00
Catherine Flores c0ae75bf37 Revert "New lint [`filter_map_bool_then`]"
This reverts commits 978b1daf99 and 3235d9d612.
2023-08-10 17:28:01 -05:00
Catherine Flores 7b2fd81f43 Add test for `&mut` 2023-08-10 16:33:07 -05:00
Catherine Flores beb57f074e Don't ICE with late bound regions 2023-08-10 16:26:22 -05:00
Santiago Pastorino fad7c4dcaa
Add spastorino to mailmap 2023-08-10 18:12:00 -03:00
bors 439d066bcf Auto merge of #114474 - estebank:missing-semi, r=compiler-errors
Detect missing `;` that parses as function call

Fix #106515.
2023-08-10 20:30:18 +00:00
Philipp Krones 61e9b157e2
Bump nightly version -> 2023-08-10 2023-08-10 21:49:36 +02:00
Philipp Krones 17b9c42572
Merge remote-tracking branch 'upstream/master' into rustup 2023-08-10 21:15:24 +02:00
Santiago Pastorino 5f0e662523
Add impl trait declarations to SMIR 2023-08-10 14:17:50 -03:00
Santiago Pastorino 8b29ad7215
Fix copy & paste doc error 2023-08-10 14:17:08 -03:00
bors faee636ebf Auto merge of #114697 - matthiaskrgr:rollup-ywooy8x, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #114278 (better error handling for `rust.codegen-backends` on deserialization)
 - #114674 (Add clubby789 to `users_on_vacation`)
 - #114678 (`Expr::can_have_side_effects()` is incorrect for struct/enum/array/tuple literals)
 - #114681 (doc (unstable-book): fix a typo)
 - #114684 (Remove redundant calls to `resolve_vars_with_obligations`)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-10 15:46:39 +00:00
León Orell Valerian Liehr 051eb7ca7c
Unlock trailing where-clauses for lazy type aliases 2023-08-10 16:13:08 +02:00
Matthias Krüger 5f0d5855cb
Rollup merge of #114684 - compiler-errors:redundant-resolves, r=lcnr
Remove redundant calls to `resolve_vars_with_obligations`

I've been auditing the calls to `resolve_vars_with_obligations` for the new solver, and have found a few that have no effect on diagnostics. Let's just remove 'em.

Also remove a redundant `resolve_vars_with_obligations_and_mutate_fulfillment` call.

r? ``@lcnr``
2023-08-10 15:08:54 +02:00
Matthias Krüger 7e3616d685
Rollup merge of #114681 - zamazan4ik:master, r=compiler-errors
doc (unstable-book): fix a typo

Just fix a small typo.
2023-08-10 15:08:54 +02:00
Matthias Krüger 710b989b32
Rollup merge of #114678 - MortenLohne:bugfix/hir-has-side-effects, r=compiler-errors
`Expr::can_have_side_effects()` is incorrect for struct/enum/array/tuple literals

It would return 'false' unless *all* sub-expressions had side effects. This would easily allow side effects to slip through, and also wrongly label empty literals as having side effects. Add some tests for the last point

The function is only used for simple lints and error messages, so not a serious bug.
2023-08-10 15:08:53 +02:00
Matthias Krüger 5b558639f6
Rollup merge of #114674 - clubby789:clubby-vacation, r=compiler-errors
Add clubby789 to `users_on_vacation`

I'm on holiday until the 30th of August so won't be able to take on reviews until then
2023-08-10 15:08:53 +02:00
Matthias Krüger b9648d4c62
Rollup merge of #114278 - ozkanonur:validate-codegen-backend-config, r=clubby789
better error handling for `rust.codegen-backends` on deserialization

Fixes #109315
2023-08-10 15:08:52 +02:00
bors 9fa6bdd764 Auto merge of #112482 - tgross35:ci-non-rust-linters, r=pietroalbini
Add support for tidy linting via external tools for non-rust files

This change adds the flag `--check-extras` to `tidy`. It accepts a comma separated list of any of the options:

* py (test everything applicable for python files)
* py:lint (lint python files using `ruff`)
* py:fmt (check formatting for python files using `black`)
* shell or shell:lint (lint shell files using `shellcheck`)

Specific files to check can also be specified via positional args. Examples:

* `./x test tidy --check-extras=shell,py`
* `./x test tidy --check-extras=py:fmt -- src/bootstrap/bootstrap.py`
* `./x test tidy --check-extras=shell -- src/ci/*.sh`
* Python formatting can be applied with bless: `./x test tidy --ckeck-extras=py:fmt --bless`

`ruff` and `black` need to be installed via pip; this tool manages these within a virtual environment at `build/venv`. `shellcheck` needs to be installed on the system already.

---

This PR doesn't fix any of the errors that show up (I will likely go through those at some point) and it doesn't enforce anything new in CI. Relevant zulip discussion: https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/Other.20linters.20in.20CI
2023-08-10 13:07:18 +00:00
lcnr 02529d2cbe add and move trait solver cycle tests 2023-08-10 14:18:31 +02:00
lcnr d558353f28 make the provisional cache slightly less broken 2023-08-10 12:35:34 +02:00
Pietro Albini 26efc2f358
update my entry in the mailmap 2023-08-10 12:24:00 +02:00
Pietro Albini 32e6a2239b
remove myself from the review rotation 2023-08-10 12:20:47 +02:00
lena 7834ffbebe fix #114275
this ICE was caused by `transform_ty`
in compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs
encountering an unevaluated const, while expecting it to already be evaluated.

add a regression test

Update tests/ui/sanitize/issue-114275-cfi-const-expr-in-arry-len.rs

Co-authored-by: Michael Goulet <michael@errs.io>

Update tests/ui/sanitize/issue-114275-cfi-const-expr-in-arry-len.rs

Co-authored-by: Michael Goulet <michael@errs.io>

fix test compiling for targets with -crt-static and failing

this was causign https://github.com/rust-lang/rust/pull/114686 to fail
2023-08-10 11:00:06 +02:00