Commit Graph

250310 Commits

Author SHA1 Message Date
Matthias Krüger
4f3050b85a
Rollup merge of #121543 - onur-ozkan:clippy-args, r=oli-obk
various clippy fixes

We need to keep the order of the given clippy lint rules before passing them.
Since clap doesn't offer any useful interface for this purpose out of the box,
we have to handle it manually.

Additionally, this PR makes `-D` rules work as expected. Previously, lint rules were limited to `-W`. By enabling `-D`, clippy began to complain numerous lines in the tree, all of which have been resolved in this PR as well.

Fixes #121481
cc `@matthiaskrgr`
2024-03-20 05:51:22 +01:00
Joshua Wong
37718f949f fix OOB pointer formed in Vec::index
Move the length check to before using `index` with `ptr::add` to prevent
an out of bounds pointer from being formed.

Fixes #122760
2024-03-19 22:47:35 -05:00
bors
b7dcabe55e Auto merge of #122119 - estebank:issue-117846, r=Nadrieril
Silence unecessary !Sized binding error

When gathering locals, we introduce a `Sized` obligation for each
binding in the pattern. *After* doing so, we typecheck the init
expression. If this has a type failure, we store `{type error}`, for
both the expression and the pattern. But later we store an inference
variable for the pattern.

We now avoid any override of an existing type on a hir node when they've
already been marked as `{type error}`, and on E0277, when it comes from
`VariableType` we silence the error in support of the type error.

Fix https://github.com/rust-lang/rust/issues/117846
2024-03-20 02:36:37 +00:00
bors
a77c20c4b9 Auto merge of #122753 - weihanglo:update-cargo, r=weihanglo
Update cargo

5 commits in 2fe739fcf16c5bf8c2064ab9d357f4a0e6c8539b..d438c80c45c24be676ef5867edc79d0a14910efe
2024-03-15 21:39:18 +0000 to 2024-03-19 16:11:22 +0000
- refactor(toml): Expose surce/spans for VirtualManifests (rust-lang/cargo#13603)
- cargo/init: avoid target.name assignments if possible (rust-lang/cargo#13606)
- chore: Fix minor grammar nit in command-line help (rust-lang/cargo#13602)
- Bump to 0.80.0; update changelog (rust-lang/cargo#13604)
- cargo: prevent dashes in lib.name (rust-lang/cargo#12783)

r? ghost
2024-03-20 00:33:53 +00:00
bors
89aba8d45d Auto merge of #12511 - humannum14916:assigning_clones_msrv, r=Alexendoo
`assigning_clones` should respect MSRV

Fixes: #12502

This PR fixes the `assigning_clones` lint suggesting to use `clone_from` or `clone_into` on incompatible MSRVs.

`assigning_clones` will suggest using either `clone_from` or `clone_into`, both of which were stabilized in 1.63. If the current MSRV is below 1.63, the lint should not trigger.

changelog: [`assigning_clones`]: don't lint when the MSRV is below 1.63.
2024-03-19 23:46:51 +00:00
Mark Rousskov
e4c58eb8da Bump stage0 2024-03-19 19:27:24 -04:00
Mark Rousskov
4fb89c5056 branch 1.78: replace-version-placeholder 2024-03-19 19:27:24 -04:00
Weihang Lo
ae2933656d
Update cargo 2024-03-19 18:31:12 -04:00
bors
76096efb48 Auto merge of #122029 - estebank:drive-by-ui-test, r=oli-obk
When displaying multispans, ignore empty lines adjacent to `...`

```
error[E0308]: `match` arms have incompatible types
   --> tests/ui/codemap_tests/huge_multispan_highlight.rs:98:18
    |
6   |       let _ = match true {
    |               ---------- `match` arms have incompatible types
7   |           true => (
    |  _________________-
8   | |             // last line shown in multispan header
...   |
96  | |
97  | |         ),
    | |_________- this is found to be of type `()`
98  |           false => "
    |  __________________^
...   |
119 | |
120 | |         ",
    | |_________^ expected `()`, found `&str`

error[E0308]: `match` arms have incompatible types
   --> tests/ui/codemap_tests/huge_multispan_highlight.rs:215:18
    |
122 |       let _ = match true {
    |               ---------- `match` arms have incompatible types
123 |           true => (
    |  _________________-
124 | |
125 | |         1 // last line shown in multispan header
...   |
213 | |
214 | |         ),
    | |_________- this is found to be of type `{integer}`
215 |           false => "
    |  __________________^
216 | |
217 | |
218 | |         1 last line shown in multispan
...   |
237 | |
238 | |         ",
    | |_________^ expected integer, found `&str`
```
2024-03-19 22:11:59 +00:00
bors
bd459c2877 Auto merge of #122029 - estebank:drive-by-ui-test, r=oli-obk
When displaying multispans, ignore empty lines adjacent to `...`

```
error[E0308]: `match` arms have incompatible types
   --> tests/ui/codemap_tests/huge_multispan_highlight.rs:98:18
    |
6   |       let _ = match true {
    |               ---------- `match` arms have incompatible types
7   |           true => (
    |  _________________-
8   | |             // last line shown in multispan header
...   |
96  | |
97  | |         ),
    | |_________- this is found to be of type `()`
98  |           false => "
    |  __________________^
...   |
119 | |
120 | |         ",
    | |_________^ expected `()`, found `&str`

error[E0308]: `match` arms have incompatible types
   --> tests/ui/codemap_tests/huge_multispan_highlight.rs:215:18
    |
122 |       let _ = match true {
    |               ---------- `match` arms have incompatible types
123 |           true => (
    |  _________________-
124 | |
125 | |         1 // last line shown in multispan header
...   |
213 | |
214 | |         ),
    | |_________- this is found to be of type `{integer}`
215 |           false => "
    |  __________________^
216 | |
217 | |
218 | |         1 last line shown in multispan
...   |
237 | |
238 | |         ",
    | |_________^ expected integer, found `&str`
```
2024-03-19 22:11:59 +00:00
Esteban Küber
b1575b71d4 Silence unecessary !Sized binding error
When gathering locals, we introduce a `Sized` obligation for each
binding in the pattern. *After* doing so, we typecheck the init
expression. If this has a type failure, we store `{type error}`, for
both the expression and the pattern. But later we store an inference
variable for the pattern.

We now avoid any override of an existing type on a hir node when they've
already been marked as `{type error}`, and on E0277, when it comes from
`VariableType` we silence the error in support of the type error.

Fix #117846.
2024-03-19 21:26:11 +00:00
humannum14916
7c0b2dd352 Add assigning_clones to MSRV config option docs 2024-03-19 17:12:16 -04:00
onur-ozkan
81d7d7aabd resolve clippy errors
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-03-20 00:12:00 +03:00
humannum14916
8c866d36cc Add test for MSRV checking for assigning_clones 2024-03-19 17:07:27 -04:00
Nicholas Nethercote
de38888256 Reduce pub usage in rustc_session.
In particular, almost none of the errors in `errors.rs` are used outside
the crate.
2024-03-20 08:07:15 +11:00
humannum14916
21a97f0192 Specify an MSRV of 1.63.0 for assigning_clones 2024-03-19 17:05:32 -04:00
Michael Goulet
541858ed78 Add a few more comments 2024-03-19 16:59:24 -04:00
Michael Goulet
f1fef64e19 Fix ABI for FnMut/Fn impls for async closures 2024-03-19 16:59:24 -04:00
Michael Goulet
05116c5c30 Only split by-ref/by-move futures for async closures 2024-03-19 16:59:23 -04:00
Esteban Küber
3f2159fda5 Add test for #117846 2024-03-19 20:56:45 +00:00
Jubilee Young
140b4c611a Inline conditionals in the parser
There are a bunch of small helper conditionals we use.
Inline them to get slightly better perf in a few cases,
especially when rustc is compiled without PGO.
2024-03-19 13:56:02 -07:00
bors
a7e4de13c1 Auto merge of #116935 - oli-obk:different_lifetime_taits_in_same_sig, r=compiler-errors
Prevent opaque types being instantiated twice with different regions within the same function

addresses https://github.com/orgs/rust-lang/projects/22/views/1?pane=issue&itemId=41329537

r? `@compiler-errors`
2024-03-19 19:57:51 +00:00
bors
3f338b304e Auto merge of #12510 - goodmost:master, r=Alexendoo
chore: fix typo

changelog: none
2024-03-19 19:41:43 +00:00
Tshepang Mbambo
75a5196490
use more accurate terminology
rustc is just one tool/executable, even if at the center of the toolchain
2024-03-19 20:32:55 +02:00
Sky
49dd50f880
Add "put" as a confusable for insert on hash map/set 2024-03-19 14:28:01 -04:00
bors
e760daa6a7 Auto merge of #122735 - matthiaskrgr:rollup-pgb1s90, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #122435 (Don't trigger `unused_qualifications` on global paths)
 - #122556 (Extend format arg help for simple tuple index access expression)
 - #122634 (compiletest: Add support for `//@ aux-bin: foo.rs`)
 - #122677 (Fix incorrect mutable suggestion information for binding in ref pattern.)
 - #122691 (Fix ICE: `global_asm!()` Don't Panic When Unable to Evaluate Constant)
 - #122695 (Change only_local to a enum type.)
 - #122717 (Ensure stack before parsing dot-or-call)
 - #122719 (Ensure nested statics have a HIR node to prevent various queries from ICEing)
 - #122720 ([doc]:fix error code example)
 - #122724 (add test for casting pointer to union with unsized tail)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-19 17:52:46 +00:00
Ben Kimock
82717ab877 Account for #[link_name] intrinsics shims 2024-03-19 13:18:23 -04:00
Matthias Krüger
433449a900
Rollup merge of #122724 - lukas-code:unsized-union-cast-ice-test, r=compiler-errors
add test for casting pointer to union with unsized tail

closes https://github.com/rust-lang/rust/issues/122581
2024-03-19 18:03:54 +01:00
Matthias Krüger
f7731243d9
Rollup merge of #122720 - heisen-li:offset_of, r=workingjubilee
[doc]:fix error code example

fixs #122716
2024-03-19 18:03:53 +01:00
Matthias Krüger
671a2f7d67
Rollup merge of #122719 - oli-obk:nested_static_feed_hir, r=fee1-dead
Ensure nested statics have a HIR node to prevent various queries from ICEing

fixes https://github.com/rust-lang/miri/issues/3389
2024-03-19 18:03:53 +01:00
Matthias Krüger
65618908ef
Rollup merge of #122717 - workingjubilee:handle-call-call-call-call-calling-me-maybe, r=compiler-errors
Ensure stack before parsing dot-or-call

There are many cases where, due to codegen or a massively unruly codebase, a deeply nested `call(call(call(call(call(call(call(call(call(f())))))))))` can happen. This is a spot where it would be good to grow our stack, so that we can survive to tell the programmer their code is dubiously written.

Closes https://github.com/rust-lang/rust/issues/122715
2024-03-19 18:03:52 +01:00
Matthias Krüger
ea7ea2df86
Rollup merge of #122695 - surechen:make_only_local_explict_argument, r=lcnr
Change only_local to a enum type.

Change only_local to enum type and change the macros to always require a variant of that enum.

r? `@lcnr`
2024-03-19 18:03:52 +01:00
Matthias Krüger
2ad2492b7b
Rollup merge of #122691 - veera-sivarajan:bugfix-121099, r=Amanieu
Fix ICE: `global_asm!()` Don't Panic When Unable to Evaluate Constant

Fixes #121099

A bit of an inelegant fix but given that the error is created only
after call to `const_eval_poly()` and that the calling function
cannot propagate the error anywhere else, the error has to be
explicitly handled inside `mono_item.rs`.

r? `@Amanieu`
2024-03-19 18:03:51 +01:00
Matthias Krüger
17386b8fbf
Rollup merge of #122677 - surechen:fix_122415, r=Nadrieril
Fix incorrect mutable suggestion information for binding in ref pattern.

For ref pattern in func param, the mutability suggestion has to apply to the binding.

For example: `fn foo(&x: &i32)` -> `fn foo(&(mut x): &i32)`

fixes #122415
2024-03-19 18:03:51 +01:00
Matthias Krüger
42dec6f874
Rollup merge of #122634 - Enselic:aux-bin, r=oli-obk
compiletest: Add support for `//@ aux-bin: foo.rs`

Which enables ui tests to use auxiliary binaries. See the added
self-test for an example.

This is an enabler for the test in https://github.com/rust-lang/rust/pull/121573.
2024-03-19 18:03:50 +01:00
Matthias Krüger
45e005df42
Rollup merge of #122556 - jieyouxu:non-identifier-format-arg, r=petrochenkov
Extend format arg help for simple tuple index access expression

The help is only applicable for simple field access `a.b` and (with this PR) simple tuple index access expressions `a.0`.

Closes #122535.
2024-03-19 18:03:50 +01:00
Matthias Krüger
489c2e9918
Rollup merge of #122435 - jieyouxu:unused_qualifications_global_paths, r=petrochenkov
Don't trigger `unused_qualifications` on global paths

Fixes #122374.
2024-03-19 18:03:49 +01:00
clubby789
f8fd23a2ad Manually implement PartialOrd/Ord for Option 2024-03-19 16:32:07 +00:00
clubby789
5f254d8b66 Remove SpecOptionPartialEq 2024-03-19 16:32:01 +00:00
Michael Goulet
3d56178880 Remove redundant coroutine captures note 2024-03-19 12:02:21 -04:00
Michael Goulet
bca708b9fa Do binder folding eagerly in bound_coroutine_hidden_types
I refuse to fix this in the old solver; its lazy instantiation of
binders will be the end of me.
2024-03-19 11:52:45 -04:00
bors
a385e5667c Auto merge of #122392 - BoxyUwU:misc_cleanup, r=lcnr
misc cleanups from debugging something

rename `instantiate_canonical_with_fresh_inference_vars` to `instantiate_canonical`  the substs for the canonical are not solely infer vars as that would be wildly wrong and it is rather confusing to see this method called and think that the entire canonicalization setup is completely broken when it is not 👍

also update region debug printing to be more like the custom impls for Ty/Const, right now regions in debug output are horribly verbose and make it incredibly hard to read but with this atleast boundvars and placeholders when debugging the new solver do not take up excessive amounts of space.

r? `@lcnr`
2024-03-19 15:38:41 +00:00
Martin Nordholts
3a5eb35577 compiletest: Add support for //@ aux-bin: foo.rs
Which enables ui tests to use auxiliary binaries. See the added
self-test for an example.
2024-03-19 16:37:34 +01:00
Martin Nordholts
4c95d76660 compiletest: Replace bool with enum AuxType for clarity 2024-03-19 16:37:10 +01:00
Martin Nordholts
9de0921852 compiletest: Fix typos in get_lib_name() comment 2024-03-19 16:36:24 +01:00
Michael Goulet
67f1c53c05 Don't ICE when encountering bound regions in generator interior type 2024-03-19 11:30:12 -04:00
Ana Hobden
d82d4196ac
Expose ucred::peer_cred on QNX targets to enable dist builds 2024-03-19 07:34:27 -07:00
Mara Bos
5a594f7bcd SeqCst->Relaxed for xous set_nonblocking.
The SeqCst wasn't synchronizing with anything. Relaxed is enough.
2024-03-19 15:27:11 +01:00
Mara Bos
69a4d77d67 SeqCst->{Release,Acquire} for xous DropLock.
SeqCst is unnecessary. Release+Acquire is the right ordering for a
mutex.
2024-03-19 15:27:11 +01:00
Mara Bos
60ad49005a SeqCst->Relaxed in pal::windows::pipe.
Relaxed is enough to ensure fetch_add(1) returns each integer exactly
once.
2024-03-19 15:27:11 +01:00