Commit Graph

241288 Commits

Author SHA1 Message Date
bors
56d25ba5ea Auto merge of #118500 - ZetaNumbers:tcx_hir_refactor, r=petrochenkov
Move some methods from `tcx.hir()` to `tcx`

https://github.com/rust-lang/rust/pull/118256#issuecomment-1826442834

Renamed:
- find -> opt_hir_node
- get -> hir_node
- find_by_def_id -> opt_hir_node_by_def_id
- get_by_def_id -> hir_node_by_def_id
2023-12-13 10:31:56 +00:00
bors
2fdd9eda0c Auto merge of #118534 - RalfJung:extern-type-size-of-val, r=WaffleLapkin
codegen: panic when trying to compute size/align of extern type

The alignment is also computed when accessing a field of extern type at non-zero offset, so we also panic in that case.

Previously `size_of_val` worked because the code path there assumed that "thin pointer" means "sized". But that's not true any more with extern types. The returned size and align are just blatantly wrong, so it seems better to panic than returning wrong results. We use a non-unwinding panic since code probably does not expect size_of_val to panic.
2023-12-13 08:33:05 +00:00
Jakub Beránek
066e6ffa02
Fix LLD thread flag selection for Windows targets 2023-12-13 07:47:46 +01:00
Jakub Beránek
c5208518fa
Add TargetSelection::is_windows method 2023-12-13 07:47:25 +01:00
bors
f651b436ce Auto merge of #117050 - c410-f3r:here-we-go-again, r=petrochenkov
[`RFC 3086`] Attempt to try to resolve blocking concerns

Implements what is described at https://github.com/rust-lang/rust/issues/83527#issuecomment-1744822345 to hopefully make some progress.

It is unknown if such approach is or isn't desired due to the lack of further feedback, as such, it is probably best to nominate this PR to the official entities.

`@rustbot` labels +I-compiler-nominated
2023-12-13 06:37:08 +00:00
bors
9f1bfe53b6 Auto merge of #118900 - workingjubilee:rollup-wkv9hq1, r=workingjubilee
Rollup of 10 pull requests

Successful merges:

 - #118858 (Remove dead codes in core)
 - #118864 (Fix alignment passed down to LLVM for simd_masked_load)
 - #118872 (Add rustX check to codeblock attributes lint)
 - #118873 (fix `waker_getters` tracking issue number)
 - #118884 (NFC: simplify merging of two vecs)
 - #118885 (clippy::complexity fixes)
 - #118886 (Clean up variables in `search.js`)
 - #118887 (Typo)
 - #118889 (more clippy::complexity fixes)
 - #118891 (Actually parse async gen blocks correctly)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-12-13 04:38:30 +00:00
Jubilee
f9078a40ee
Rollup merge of #118891 - compiler-errors:async-gen-blocks, r=eholk
Actually parse async gen blocks correctly

1. I got the control flow in `parse_expr_bottom` messed up, and obviously forgot a test for `async gen`, so we weren't actually ever parsing it correctly.
2. I forgot to gate the span for `async gen {}`, so even if we did parse it, we wouldn't have correctly denied it in `cfg(FALSE)`.

r? eholk
2023-12-12 18:48:55 -08:00
Jubilee
4583a0134f
Rollup merge of #118889 - matthiaskrgr:compl_2023_2, r=WaffleLapkin
more clippy::complexity fixes

      redundant_guards
      redundant_slicing
      filter_next
      needless_borrowed_reference
      useless_format
2023-12-12 18:48:54 -08:00
Jubilee
df0686b629
Rollup merge of #118887 - smoelius:patch-1, r=Nilstrieb
Typo
2023-12-12 18:48:54 -08:00
Jubilee
2f937c720d
Rollup merge of #118886 - GuillaumeGomez:clean-up-search-vars, r=notriddle
Clean up variables in `search.js`

While reviewing https://github.com/rust-lang/rust/pull/118402, I saw a few small clean ups that were needed, mostly about variables creation.

r? ```@notriddle```
2023-12-12 18:48:53 -08:00
Jubilee
5308733112
Rollup merge of #118885 - matthiaskrgr:compl_2023, r=compiler-errors
clippy::complexity fixes

 filter_map_identity
 needless_bool
 search_is_some
 unit_arg
 map_identity
 needless_question_mark
 derivable_impls
2023-12-12 18:48:53 -08:00
Jubilee
89d4a9bee9
Rollup merge of #118884 - matthiaskrgr:auszweimacheins, r=Nadrieril
NFC: simplify merging of two vecs
2023-12-12 18:48:52 -08:00
Jubilee
18e0966f39
Rollup merge of #118873 - lukas-code:fix_waker_getter_tracking_issue_number, r=workingjubilee
fix `waker_getters` tracking issue number

The feature currently links to the closed issue https://github.com/rust-lang/rust/issues/87021. Make it link to the tracking issue https://github.com/rust-lang/rust/issues/96992 instead.
2023-12-12 18:48:52 -08:00
Jubilee
0430782d1d
Rollup merge of #118872 - GuillaumeGomez:codeblock-attr-lint, r=notriddle
Add rustX check to codeblock attributes lint

We discovered this issue [here](https://github.com/rust-lang/rust/pull/118802#discussion_r1421815943).

I assume that the issue will be present in other places outside of the compiler so it's worth adding a check for it.

First commit is just a small cleanup about variables creation which was a bit strange (at least more than necessary).

r? ```@notriddle```
2023-12-12 18:48:51 -08:00
Jubilee
a33f1a3d3a
Rollup merge of #118864 - farnoy:masked-load-store-fixes, r=workingjubilee
Fix alignment passed down to LLVM for simd_masked_load

Follow up to #117953

The alignment for a masked load operation should be that of the element/lane, not the vector as a whole

It can produce miscompilations after the LLVM optimizer notices the higher alignment and promotes this to an unmasked, aligned load followed up by blend/select - https://rust.godbolt.org/z/KEeGbevbb
2023-12-12 18:48:51 -08:00
Jubilee
2d1d443d7f
Rollup merge of #118858 - mu001999:dead_code/clean, r=cuviper
Remove dead codes in core

Detected by #118257
2023-12-12 18:48:50 -08:00
bors
77d1699756 Auto merge of #116438 - ChrisDenton:truncate, r=thomcc
Windows: Allow `File::create` to work on hidden files

This makes `OpenOptions::new().write(true).create(true).truncate(true).open(&path)` work if the path exists and is a hidden file. Previously it would fail with access denied.

This makes it consistent with `OpenOptions::new().write(true).truncate(true).open(&path)` (note the lack of `create`) which does not have this restriction. It's also more consistent with other platforms.

Fixes #115745 (see that issue for more details).
2023-12-13 02:27:12 +00:00
Josh Stone
233de9d89e Set the StackProbeType in apple::opts 2023-12-12 17:26:51 -08:00
Michael Goulet
9f0849f9e0 Uplift TypeAndMut 2023-12-12 23:24:44 +00:00
Michael Goulet
b8ea6e686f Uplift ClosureKind 2023-12-12 23:24:44 +00:00
David Tolnay
b30e94b7bb
Unbreak non-unix non-windows bootstrap 2023-12-12 13:11:39 -08:00
bors
3340d49d22 Auto merge of #118765 - weihanglo:update-cargo, r=weihanglo
Update cargo

20 commits in 9787229614b27854cf73d57ffae430d7c1e6caa4..1aa9df1a5be205cce621f0bc0ea6062a5e22a98c
2023-12-06 02:29:23 +0000 to 2023-12-12 14:52:31 +0000
- crates-io: Add support for other 2xx HTTP status codes (rust-lang/cargo#13158)
- Remove the deleted feature test_2018_feature from the test (rust-lang/cargo#13156)
- refactor(schema): Remove reliance on cargo types (rust-lang/cargo#13154)
- fix(toml)!: Disallow `[lints]` in virtual workspaces (rust-lang/cargo#13155)
- Limit exported-private-dependencies lints to libraries (rust-lang/cargo#13135)
- chore: update to gix-index@0.27.1 (rust-lang/cargo#13148)
- Update curl-sys to bring in curl 8.5.0 (rust-lang/cargo#13147)
- chore: downgrade to openssl v1.1.1 (rust-lang/cargo#13144)
- fix: explicitly remap current dir by using `.` (rust-lang/cargo#13114)
- Don't rely on mtime to test changes (rust-lang/cargo#13143)
- refactor: Pull PackageIdSpec into schema (rust-lang/cargo#13128)
- fix: Print rustc messages colored on wincon (rust-lang/cargo#13140)
- Add a windows manifest file (rust-lang/cargo#13131)
- Avoid writing CACHEDIR.TAG if it already exists (rust-lang/cargo#13132)
- re-enable flaky tests thanks to update to `gix-config`. (rust-lang/cargo#11821) (rust-lang/cargo#13130)
- fix bash completion in directory with spaces (rust-lang/cargo#13126)
- test: re-ignore git auth tests for gitoxide (rust-lang/cargo#13129)
- fix(toml): Disallow inheriting of dependency public status (rust-lang/cargo#13125)
- re-enable previously disabled tests with Windows-specific fix (rust-lang/cargo#13117)
- refactor: Clarify PackageId constructor names (rust-lang/cargo#13123)
2023-12-12 20:19:25 +00:00
Michael Goulet
1d78ce681e Actually parse async gen blocks correctly 2023-12-12 20:13:37 +00:00
Matthias Krüger
2a1acc26a0
Update compiler/rustc_pattern_analysis/src/constructor.rs
add note that `missing_empty` is cleared now

Co-authored-by: Nadrieril <Nadrieril@users.noreply.github.com>
2023-12-12 21:12:19 +01:00
Matthias Krüger
3795cc8eb0 more clippy::complexity fixes
redundant_guards
      redundant_slicing
      filter_next
      needless_borrowed_reference
      useless_format
2023-12-12 20:41:51 +01:00
Samuel Moelius
046f2dea33
Typo 2023-12-12 13:48:20 -05:00
Guillaume Gomez
58327c10c5 Add a test for a codeblock with multiple invalid attributes 2023-12-12 19:41:09 +01:00
Guillaume Gomez
f1342f30a5 Clean up variables in search.js 2023-12-12 19:31:43 +01:00
Matthias Krüger
d707461a1a clippy::complexity fixes
filter_map_identity
 needless_bool
 search_is_some
 unit_arg
 map_identity
 needless_question_mark
 derivable_impls
2023-12-12 19:28:13 +01:00
bors
028b6d152e Auto merge of #118881 - matthiaskrgr:rollup-0rl3tir, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #116740 (dont ICE when ConstKind::Expr for is_const_evaluatable)
 - #117914 (On borrow return type, suggest borrowing from arg or owned return type)
 - #117927 (Clarify how to choose a FutureIncompatibilityReason variant.)
 - #118855 (Improve an error involving attribute values.)
 - #118856 (rustdoc-search: clean up parser)
 - #118865 (rustc_codegen_llvm: Enforce `rustc::potential_query_instability` lint)
 - #118866 (llvm-wrapper: adapt for LLVM API change)
 - #118868 (Correctly gate the parsing of match arms without body)
 - #118877 (tests: CGU tests require build-pass, not check-pass (remove FIXME))

r? `@ghost`
`@rustbot` modify labels: rollup
2023-12-12 18:20:37 +00:00
Matthias Krüger
6892fcd690 simplify merging of two vecs 2023-12-12 18:42:37 +01:00
Hosssein
a2ffff0708
Change a typo mistake in the-doc-attribute.md
I guess that `Bar` in the section I changed should be `bar` because when I run the program it has its page under struct but bar doesn't have any page.
2023-12-12 20:22:41 +03:30
Matthias Krüger
010f30150a
Rollup merge of #118877 - Enselic:remove-cgu-fixme, r=Nilstrieb
tests: CGU tests require build-pass, not check-pass (remove FIXME)

CGU tests require CGU code to be exercised. We can't merely do "cargo check" on these tests.

Part of #62277
2023-12-12 17:40:56 +01:00
Matthias Krüger
d661974017
Rollup merge of #118868 - Nadrieril:correctly-gate-never_patterns-parsing, r=petrochenkov
Correctly gate the parsing of match arms without body

https://github.com/rust-lang/rust/pull/118527 accidentally allowed the following to parse on stable:
```rust
match Some(0) {
    None => { foo(); }
    #[cfg(FALSE)]
    Some(_)
}
```

This fixes that oversight. The way I choose which error to emit is the best I could think of, I'm open if you know a better way.

r? `@petrochenkov` since you're the one who noticed
2023-12-12 17:40:56 +01:00
Matthias Krüger
9ed12f8d7a
Rollup merge of #118866 - krasimirgg:llvm-18-ref, r=durin42
llvm-wrapper: adapt for LLVM API change

LLVM commit f09cf34d00 (old) moved some functions to a different header. It looks we were getting it transitively in PassWrapper, and something in LLVM recently removed it from the set of transitively available headers, so include it directly:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/24416#018c5de6-b9c9-4b22-9473-6070d99dcfa7/233-537

r? `@nikic`
2023-12-12 17:40:55 +01:00
Matthias Krüger
04c77a51ef
Rollup merge of #118865 - Enselic:rustc_codegen_llvm-lint-fix, r=petrochenkov
rustc_codegen_llvm: Enforce `rustc::potential_query_instability` lint

Stop allowing `rustc::potential_query_instability` on all of `rustc_codegen_llvm` and instead allow it on a case-by-case basis if it is safe to do so. In this case, all 2 instances are safe to allow.

Part of https://github.com/rust-lang/rust/issues/84447 which is E-help-wanted.
2023-12-12 17:40:55 +01:00
Matthias Krüger
6459121a6c
Rollup merge of #118856 - notriddle:notriddle/search-js, r=GuillaumeGomez
rustdoc-search: clean up parser

The `c === "="` was redundant when `isSeparatorCharacter` already checks that.

The function `isStopCharacter` and `isEndCharacter` functions did exactly the same thing and have synonymous names. There doesn't seem much point in having both.
2023-12-12 17:40:55 +01:00
Matthias Krüger
cd7809b953
Rollup merge of #118855 - nnethercote:improve-attribute-value-error, r=compiler-errors,petrochenkov
Improve an error involving attribute values.

Attribute values must be literals. The error you get when that doesn't hold is pretty bad, e.g.:
```
unexpected expression: 1 + 1
```
You also get the same error if the attribute value is a literal, but an invalid literal, e.g.:
```
unexpected expression: "foo"suffix
```

This commit does two things.
- Changes the error message to "attribute value must be a literal", which gives a better idea of what the problem is and how to fix it. It also no longer prints the invalid expression, because the carets below highlight it anyway.
- Separates the "not a literal" case from the "invalid literal" case. Which means invalid literals now get the specific error at the literal level, rather than at the attribute level.

r? `@compiler-errors`
2023-12-12 17:40:54 +01:00
Matthias Krüger
111c40ec22
Rollup merge of #117927 - ehuss:future-incompat-docs, r=wesleywiser
Clarify how to choose a FutureIncompatibilityReason variant.

There has been some confusion about how to choose these variants, or what the procedure is for handling future-incompatible errors. Hopefully this helps provide some more information on how these work.
2023-12-12 17:40:53 +01:00
Matthias Krüger
ffdb471872
Rollup merge of #117914 - estebank:issue-85843, r=wesleywiser
On borrow return type, suggest borrowing from arg or owned return type

When we encounter a function with a return type that has an anonymous lifetime with no argument to borrow from, besides suggesting the `'static` lifetime we now also suggest changing the arguments to be borrows or changing the return type to be an owned type.

```
error[E0106]: missing lifetime specifier
  --> $DIR/variadic-ffi-6.rs:7:6
   |
LL | ) -> &usize {
   |      ^ expected named lifetime parameter
   |
   = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
   |
LL | ) -> &'static usize {
   |       +++++++
help: instead, you are more likely to want to change one of the arguments to be borrowed...
   |
LL |     x: &usize,
   |        +
help: ...or alternatively, to want to return an owned value
   |
LL - ) -> &usize {
LL + ) -> usize {
   |
```

Fix #85843.
2023-12-12 17:40:53 +01:00
Matthias Krüger
b2a0175b97
Rollup merge of #116740 - lenko-d:const_evaluatable_failed_for_non_unevaluated_const, r=BoxyUwU
dont ICE when ConstKind::Expr for is_const_evaluatable

The problem is that we are not handling ConstKind::Expr inside report_not_const_evaluatable_error

Fixes [#114151]
2023-12-12 17:40:52 +01:00
Ralf Jung
f813ccd784 also add a Miri test 2023-12-12 17:19:19 +01:00
Ralf Jung
edcb7aba6b also test projecting to some sized fields at non-zero offset in structs with an extern type tail 2023-12-12 17:19:19 +01:00
Ralf Jung
a47416beb5 test that both size_of_val and align_of_val panic 2023-12-12 17:19:19 +01:00
Weihang Lo
e29be2a9be
Update cargo 2023-12-12 11:16:29 -05:00
bors
835ed0021e Auto merge of #118751 - lcnr:writeback-change, r=compiler-errors
refactor writeback: emit normalization errors with new solver

implements https://github.com/rust-lang/rust/pull/118725#discussion_r1419824030

r? `@compiler-errors` `@BoxyUwU` whoever comes first n stuff
2023-12-12 16:14:57 +00:00
Martin Nordholts
41c9404133 tests: CGU tests require build-pass, not check-pass (remove FIXME)
CGU tests require CGU code to be exercised. We can't merely do "cargo
check" on these tests.
2023-12-12 15:48:48 +01:00
Guillaume Gomez
bb0fd665a8 Follow guidelines for lint suggestions 2023-12-12 15:43:20 +01:00
Guillaume Gomez
98aa20b0a7 Add test for rustX codeblock attribute 2023-12-12 15:42:49 +01:00
Guillaume Gomez
d3cb25f4cf Add rustX check to codeblock attributes lint 2023-12-12 15:42:48 +01:00