Commit Graph

246624 Commits

Author SHA1 Message Date
Nilstrieb
ac030bcf05
Rollup merge of #121307 - estebank:drive-by, r=compiler-errors
Drive-by `DUMMY_SP` -> `Span` and fmt changes

Noticed these while doing something else. There's no practical change, but it's preferable to use `DUMMY_SP` as little as possible, particularly when we have perfectlly useful `Span`s available.
2024-02-20 07:35:47 +01:00
Nilstrieb
46cab11ed1
Rollup merge of #121256 - Jarcho:visitor2, r=oli-obk
Allow AST and HIR visitors to return `ControlFlow`

Alternative to #108598.

Since rust-lang/libs-team#187 was rejected, this implements our own version of the `Try` trait (`VisitorResult`) and the `try` macro (`try_visit`). Since this change still allows visitors to return `()`, no changes have been made to the existing ones. They can be done in a separate PR.
2024-02-20 07:35:47 +01:00
Nilstrieb
4131f6e730
Rollup merge of #121233 - Zalathar:extra-directives, r=oli-obk
Move the extra directives for `Mode::CoverageRun` into `iter_header`

When these extra directives were ported over as part of #112300, it made sense to introduce `iter_header_extra` and pass them in as an extra argument.

But now that #120881 has added a `mode` parameter to `iter_header` for its own purposes, it's slightly simpler to move the coverage special-case code directly into `iter_header` as well. This lets us get rid of `iter_header_extra`.
2024-02-20 07:35:46 +01:00
Nilstrieb
328a5b7719
Rollup merge of #121205 - nnethercote:fix-stable-mir-CompilerError, r=oli-obk
Merge `CompilerError::CompilationFailed` and `CompilerError::ICE`.

`CompilerError` has `CompilationFailed` and `ICE` variants, which seems reasonable at first. But the way it identifies them is flawed:
- If compilation errors out, i.e. `RunCompiler::run` returns an `Err`, it uses `CompilationFailed`, which is reasonable.
- If compilation panics with `FatalError`, it catches the panic and uses `ICE`. This is sometimes right, because ICEs do cause `FatalError` panics, but sometimes wrong, because certain compiler errors also cause `FatalError` panics. (The compiler/rustdoc/clippy/whatever just catches the `FatalError` with `catch_with_exit_code` in `main`.)

In other words, certain non-ICE compilation failures get miscategorized as ICEs. It's not possible to reliably distinguish the two cases, so this commit merges them. It also renames the combined variant as just `Failed`, to better match the existing `Interrupted` and `Skipped` variants.

Here is an example of a non-ICE failure that causes a `FatalError` panic, from `tests/ui/recursion_limit/issue-105700.rs`:
```
 #![recursion_limit="4"]
 #![invalid_attribute]
 #![invalid_attribute]
 #![invalid_attribute]
 #![invalid_attribute]
 #![invalid_attribute]
 //~^ERROR recursion limit reached while expanding

 fn main() {{}}
```

r? ``@spastorino``
2024-02-20 07:35:46 +01:00
Nilstrieb
4c2af78778
Rollup merge of #121195 - D0liphin:master, r=ehuss
unstable-book: Separate testing and production sanitizers

This is a redo of [this PR](https://github.com/rust-lang/rust/pull/108942). Left the commit as before (except for reflowing to 80-width), since it already got approved.
2024-02-20 07:35:45 +01:00
Nilstrieb
5b8b435d5d
Rollup merge of #120716 - spastorino:change-some-lint-msgs, r=lcnr
Change leak check and suspicious auto trait lint warning messages

The leak check lint message "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!" is misleading as some cases may not be phased out and could end being accepted. This is under discussion still.

The suspicious auto trait lint the change in behavior already happened, so the new message is probably more accurate.

r? `@lcnr`

Closes #93367
2024-02-20 07:35:45 +01:00
bors
0b9f6ad994 Auto merge of #120628 - workingjubilee:reimpl-meaningful-test-name-lint, r=compiler-errors
Reimpl meaningful test name lint MCP658

This reintroduces the tidy rule originally proposed in https://github.com/rust-lang/rust/pull/113583 that then became an MCP in https://github.com/rust-lang/compiler-team/issues/658 which eventually surfaced a quite-reasonable request for a diagnostic enhancement. I have added that to the rule. It produces output like this:
```
tidy error: file `ui/unsized/issue-115809.rs` must begin with a descriptive name, try `{reason}-issue-115809.rs`
tidy error: file `ui/unsized/issue-115203.rs` must begin with a descriptive name, try `{reason}-issue-115203.rs`
tidy error: file `ui/privacy/issue-113860-2.rs` must begin with a descriptive name, try `{reason}-issue-113860.rs`
tidy error: file `ui/privacy/issue-117997.rs` must begin with a descriptive name, try `{reason}-issue-117997.rs`
tidy error: file `ui/privacy/issue-119463.rs` must begin with a descriptive name, try `{reason}-issue-119463.rs`
tidy error: file `ui/privacy/auxiliary/issue-117997.rs` must begin with a descriptive name, try `{reason}-issue-117997.rs`
tidy error: file `ui/privacy/auxiliary/issue-119463-extern.rs` must begin with a descriptive name, try `{reason}-issue-119463.rs`
tidy error: file `ui/privacy/issue-113860-1.rs` must begin with a descriptive name, try `{reason}-issue-113860.rs`
tidy error: file `ui/privacy/issue-113860.rs` must begin with a descriptive name, try `{reason}-issue-113860.rs`
tidy error: file `ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.rs` must begin with a descriptive name, try `{reason}-issue-114151.rs`
tidy error: file `ui/did_you_mean/issue-114112.rs` must begin with a descriptive name, try `{reason}-issue-114112.rs`
tidy error: file `ui/did_you_mean/issue-105225.rs` must begin with a descriptive name, try `{reason}-issue-105225.rs`
tidy error: file `ui/did_you_mean/issue-105225-named-args.rs` must begin with a descriptive name, try `{reason}-issue-105225.rs`
```

You get the idea.

There are some tests which merely would require reordering of the name according to the rule. I could modify the diagnostic further to identify those, but doing such would make it prone to bad suggestions. I have opted to trust contributors to recognize the diagnostic is robotic, as the pattern we are linting on is easier to match if we do not speculate on what parts of the name are meaningful: sometimes a word is a reason, but sometimes it is a mere "tag", such as with a pair like:
- issue-314159265-blue.rs
- issue-314159265-red.rs

Starting them with `red-` and `blue-` means they do not sort together, despite being related, and the color names are still not very descriptive. Recognizing a good name is an open-ended task, though this pair might be:
- colored-circle-gen-blue.rs
- colored-circle-gen-red.rs

Deciding exactly *how* to solve this is not the business of tidy, only recognizing a what.

r? `@compiler-errors`
2024-02-20 02:31:17 +00:00
bors
7d61394948 Auto merge of #121296 - madsmtm:fix-mac-catalyst-deployment-target, r=shepmaster
Fix `IPHONEOS_DEPLOYMENT_TARGET` on Mac Catalyst

Some of the target code invalidly assumed that the deployment target variable on Mac Catalyst is `MACOSX_DEPLOYMENT_TARGET`, which is wrong, Mac Catalyst uses the same environment variable as iOS.

Additionally, the deployment target was hardcoded to `14.0`, I've lowered this to `13.1` ([same default as Clang](d022f32c73/clang/lib/Driver/ToolChains/Darwin.cpp (L2038))), and made it properly load from the environment.

This shouldn't require any changes to the `cc` crate, as that uses `rustc --print=deployment-target` to get this information automatically.

CC `@BlackHoleFox`
r? `@rust-lang/macos`
2024-02-20 00:04:03 +00:00
bors
0395fa387a Auto merge of #121211 - lcnr:nll-relate-handle-infer, r=BoxyUwU
deduplicate infer var instantiation

Having 3 separate implementations of one of the most subtle parts of our type system is not a good strategy if we want to maintain a sound type system  while working on this I already found some subtle bugs in the existing code, so that's awesome 🎉 cc #121159

This was necessary as I am not confident in my nll changes in #119106, so I am first cleaning this up in a separate PR.

r? `@BoxyUwU`
2024-02-19 22:04:58 +00:00
Santiago Pastorino
4803f173be
Inline do_orphan_check_impl 2024-02-19 17:41:51 -03:00
Santiago Pastorino
086463b227
Remove suspicious auto trait lint 2024-02-19 17:41:48 -03:00
bors
3246e79513 Auto merge of #121185 - GuillaumeGomez:update-stdarch, r=Amanieu
Update stdarch submodule

I'm syncing the rustc_codegen_gcc backend currently and it seems that the new rustc version we use is not happy with the current stdarch submodule version: https://github.com/rust-lang/rustc_codegen_gcc/actions/runs/7930753019/job/21653642490?pr=439

r? `@Amanieu`
2024-02-19 20:04:07 +00:00
Oli Iliffe
3e5ad4285c Separate testing and production sanitizers 2024-02-19 10:40:43 -08:00
bors
ccb1415eac Auto merge of #121177 - joboet:move_pal_locks, r=ChrisDenton
Move locks to `sys`

Part of #117276.

r? `@ChrisDenton`
2024-02-19 18:04:28 +00:00
Esteban Küber
b4a424feb8 Drive-by DUMMY_SP -> Span and fmt changes
Noticed these while doing something else. There's no practical change, but it's preferable to use `DUMMY_SP` as little as possible, particularly when we have perfectlly useful `Span`s available.
2024-02-19 17:04:23 +00:00
bors
02438348b9 Auto merge of #120463 - lcnr:eager-inference-replacement, r=compiler-errors
some trait system cleanups

Always eagerly replace projections with infer vars if normalization is ambig. Unsure why we previously didn't do so, wasn't able to find an explanation in #90887. This adds some complexity to the trait system and is afaict unnecessary.

The second commit simplifies `pred_known_to_hold_modulo_regions`, afaict the optional `fulfill` isn't necessary anymore.

r? types cc `@jackh726`
2024-02-19 15:48:21 +00:00
bors
e29a1530f6 Auto merge of #121295 - matthiaskrgr:rollup-j2vffew, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #119808 (Store core::str::CharSearcher::utf8_size as u8)
 - #121032 (Continue reporting remaining errors instead of silently dropping them)
 - #121041 (Add `Future` and `IntoFuture` to the 2024 prelude)
 - #121230 (Extend Level API)
 - #121272 (Add diagnostic items for legacy numeric constants)
 - #121275 (add test for panicking attribute macros)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-02-19 13:41:13 +00:00
Mads Marquart
a3cf493642 Lower default Mac Catalyst deployment target to 13.1
Same default as Clang:
d022f32c73/clang/lib/Driver/ToolChains/Darwin.cpp (L2038)
2024-02-19 13:30:53 +01:00
Mads Marquart
cd530fccb3 Merge deployment target variable loading on iOS and Mac Catalyst 2024-02-19 13:23:02 +01:00
Mads Marquart
3cb4e34310 Fix ld platform_version argument on Mac Catalyst 2024-02-19 13:10:07 +01:00
Matthias Krüger
3fe809b38d
Rollup merge of #121275 - tshepang:test-panicking-proc-macros, r=nnethercote
add test for panicking attribute macros
2024-02-19 13:04:34 +01:00
Matthias Krüger
c2cc066761
Rollup merge of #121272 - pitaj:diag_items-legacy_numeric_constants, r=Nilstrieb
Add diagnostic items for legacy numeric constants

For rust-lang/rust-clippy#12312
2024-02-19 13:04:34 +01:00
Matthias Krüger
ec07410f05
Rollup merge of #121230 - GuillaumeGomez:extend-level-api, r=Nadrieril
Extend Level API

I need this API for https://github.com/rust-lang/rust-clippy/pull/12303: I have a nested `cfg` attribute (so a `MetaItem`) and I'd like to still be able to match against all possible kind of `Level`s.
2024-02-19 13:04:34 +01:00
Matthias Krüger
cf0b36a1c5
Rollup merge of #121041 - Nilstrieb:into-the-future-of-2024, r=Mark-Simulacrum
Add `Future` and `IntoFuture` to the 2024 prelude

Implements rust-lang/rfcs#3509.
2024-02-19 13:04:33 +01:00
Matthias Krüger
25bba60e9d
Rollup merge of #121032 - oli-obk:cyclic_type_ice, r=cjgillot
Continue reporting remaining errors instead of silently dropping them

I was too eager to add assertions in https://github.com/rust-lang/rust/pull/120342/files#diff-593003090e0fb5c21f31413ce5feb506e235ec33c4775da88b853980429b9ff1R741

fixes #120864
2024-02-19 13:04:33 +01:00
Matthias Krüger
c5da0382c8
Rollup merge of #119808 - GnomedDev:encode-charsearcher-size-in-type, r=Mark-Simulacrum
Store core::str::CharSearcher::utf8_size as u8

This is already relied on being smaller than u8 due to the `safety invariant: utf8_size must be less than 5`, so this helps LLVM optimize and maybe improve copies due to padding instead of unused bytes.
2024-02-19 13:04:32 +01:00
Mads Marquart
92d4b313eb Make LLVM target contain correct deployment target info on Mac Catalyst 2024-02-19 12:57:08 +01:00
Mads Marquart
94ddbb615d Remove MACOSX_DEPLOYMENT_TARGET env var when linking Mac Catalyst
Mac Catalyst uses IPHONEOS_DEPLOYMENT_TARGET to specify the deployment target, so it makes no sense to remove that variable.
2024-02-19 12:34:12 +01:00
bors
43d3470f11 Auto merge of #121079 - onur-ozkan:install-conflicts, r=albertlarsan68
distribute tool documentations and avoid file conflicts on `x install`

I suggest reading commits one-by-one with the descriptions for more context about the changes.

Fixes #115213
2024-02-19 11:28:34 +00:00
Guillaume Gomez
9f3f2cd90a Update stdarch submodule 2024-02-19 10:49:20 +01:00
onur-ozkan
435e1c6dc5 install rustc before the tools
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-02-19 12:40:26 +03:00
bors
eb1f279477 Auto merge of #121203 - Nilstrieb:fp, r=Mark-Simulacrum
Add `rust.frame-pointers` config option

This is very helpful for profiling. I've hacked this in many times, so let's add it properly.
2024-02-19 09:25:17 +00:00
lcnr
0c7672a532 remove outdated comment 2024-02-19 09:17:01 +01:00
lcnr
9771fb08b6 split project into multiple files 2024-02-19 09:17:00 +01:00
lcnr
df55f56283 normalize_projection_ty is not used with next-solver 2024-02-19 09:06:34 +01:00
lcnr
399a258f46 remove pred_known_to_hold_modulo_regions 2024-02-19 09:06:34 +01:00
lcnr
486c7b6a50 never normalize without eager inference replacement 2024-02-19 09:06:34 +01:00
bors
bea5bebf3d Auto merge of #105917 - a1phyr:read_chain_more_impls, r=workingjubilee
Specialize some methods of `io::Chain`

This PR specializes the implementation of some methods of `io::Chain`, which could bring performance improvements when using it.
2024-02-19 04:43:54 +00:00
bors
d573564575 Auto merge of #121269 - calebzulawski:sync-portable-simd-2024-02-18, r=Mark-Simulacrum
Portable SIMD subtree update

Syncs nightly to the latest changes from rust-lang/portable-simd

r? `@rust-lang/libs`

Also, fixes #119904 which is now fixed upstream.
2024-02-19 02:34:01 +00:00
bors
61223975d4 Auto merge of #121101 - GnomedDev:dyn-small-c-string, r=Nilstrieb
Reduce monomorphisation bloat in small_c_string

This is a code path usually next to an FFI call, so taking the `dyn` slowdown for the 1159 llvm-line (fat lto, codegen-units 1, release build) drop in my testing program [t2fanrd](https://github.com/GnomedDev/t2fanrd) is worth it imo.
2024-02-18 22:54:22 +00:00
Nilstrieb
bd8a1a417a Add Future and IntoFuture to the 2024 prelude
Implements RFC 3509.
2024-02-18 23:20:05 +01:00
Santiago Pastorino
eee9d2a773
Change leak check lint message to behavior is likely to change in the future 2024-02-18 19:16:17 -03:00
Nilstrieb
09e6043483 Add rust.frame-pointers config option
This is very helpful for profiling. I've hacked this in many times, so
let's add it properly.
2024-02-18 22:23:09 +01:00
Tshepang Mbambo
9f614cb1a0 add test for panicking attribute macros 2024-02-18 22:51:19 +02:00
bors
2bf78d12d3 Auto merge of #119673 - petrochenkov:dialoc5, r=compiler-errors,cjgillot
macro_rules: Preserve all metavariable spans in a global side table

This PR preserves spans of `tt` metavariables used to pass tokens to declarative macros.
Such metavariable spans can then be used in span combination operations like `Span::to` to improve all kinds of diagnostics.

Spans of non-`tt` metavariables are currently kept in nonterminal tokens, but the long term plan is remove all nonterminal tokens from rustc parser and rely on the proc macro model with invisible delimiters (#114647, #67062).
In particular, `NtIdent` nonterminal (corresponding to `ident` metavariables) becomes easy to remove when this PR lands (#119412 does it).

The metavariable spans are kept in a global side table keyed by `Span`s of original tokens.
The alternative to the side table is keeping them in `SpanData` instead, but the performance regressions would be large because any spans from tokens passed to declarative macros would stop being inline and would work through span interner instead, and the penalty would be paid even if we never use the metavar span for the given original span.
(But also see the comment on `fn maybe_use_metavar_location` describing the map collision issues with the side table approach.)

There are also other alternatives - keeping the metavar span in `Token` or `TokenTree`, but associating it with `Span` itsel is the most natural choice because metavar spans are used in span combining operations, and those operations are not necessarily tied to tokens.
2024-02-18 20:51:16 +00:00
Peter Jaszkowiak
d9c1c73d2c diagnostic items for legacy numeric constants 2024-02-18 12:08:16 -07:00
bors
8a497723e3 Auto merge of #121271 - matthiaskrgr:rollup-56ru17w, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #118569 (Move `OsStr::slice_encoded_bytes` validation to platform modules)
 - #121067 (make "invalid fragment specifier" translatable)
 - #121224 (Remove unnecessary unit binding)
 - #121247 (Add help to `hir_analysis_unrecognized_intrinsic_function`)
 - #121257 (remove extraneous text from example config)
 - #121260 (Remove const_prop.rs)
 - #121266 (Add uncontroversial syscall doc aliases to std docs)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-02-18 18:52:11 +00:00
David Thomas
dbb15fb45d
Dyn erase at call site 2024-02-18 17:58:52 +00:00
David Thomas
0433439433
Add some comments to prevent regression 2024-02-18 17:57:13 +00:00
David Thomas
8daf137543
Reduce monomorphisation bloat in small_c_string 2024-02-18 17:57:12 +00:00