Commit Graph

246706 Commits

Author SHA1 Message Date
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
Markus Reiter
a4d969b30e
Refactor trait implementations in core::convert::num. 2024-02-19 06:03: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
Vadim Petrochenkov
24cffbf703 resolve: Scale back unloading of speculatively loaded crates 2024-02-18 20:59:19 +03: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
Matthias Krüger
5c03d0f422
Rollup merge of #121266 - SabrinaJewson:easy-syscall-aliases, r=Mark-Simulacrum
Add uncontroversial syscall doc aliases to std docs

This PR contains the parts of #113891 that don’t break the doc alias policy.

r? `@Mark-Simulacrum`
2024-02-18 18:54:35 +01:00
Matthias Krüger
d35c4f9cdb
Rollup merge of #121260 - gurry:constprop-lint-cleanup, r=oli-obk
Remove const_prop.rs

Removed const_prop.rs and moved its contents to const_prop_lint.rs and dataflow_const_prop.rs where they are used.

const_prop.rs does not actually do any const propagation any more. After #116012 all it contains is code that is used by const_prop_lint.rs and one macro that is used by dataflow_const_prop.rs. So it made sense to just move it to those two places and remove this file.
2024-02-18 18:54:34 +01:00
Matthias Krüger
717d602c22
Rollup merge of #121257 - tshepang:extraneous, r=Mark-Simulacrum
remove extraneous text from example config
2024-02-18 18:54:34 +01:00
Matthias Krüger
57d9523a95
Rollup merge of #121247 - scottmcm:intrinsic-reminder, r=petrochenkov
Add help to `hir_analysis_unrecognized_intrinsic_function`

To help remind forgetful people like me what step they forgot.

(If this just ICE'd, https://github.com/rust-lang/compiler-team/issues/620 style, the stack trace would point me here, but since there's a "nice" error that information is lost.)
2024-02-18 18:54:33 +01:00
Matthias Krüger
c8f2a00aec
Rollup merge of #121224 - hi-rustin:rustin-patch-unit-binding, r=Mark-Simulacrum
Remove unnecessary unit binding

It appears that the unit binding is not necessary at this time. However, I am unsure of its importance in the past. Please let me know if it is unsafe to remove.
2024-02-18 18:54:33 +01:00
Matthias Krüger
ddf6c6dbc6
Rollup merge of #121067 - tshepang:make-expand-translatable, r=fmease
make "invalid fragment specifier" translatable
2024-02-18 18:54:32 +01:00
Matthias Krüger
99560a428a
Rollup merge of #118569 - blyxxyz:platform-os-str-slice, r=Mark-Simulacrum
Move `OsStr::slice_encoded_bytes` validation to platform modules

This delegates OS string slicing (`OsStr::slice_encoded_bytes`) validation to the underlying platform implementation. For now that results in increased performance and better error messages on Windows without any changes to semantics. In the future we may want to provide different semantics for different platforms.

The existing implementation is still used on Unix and most other platforms and is now optimized a little better.

Tracking issue: https://github.com/rust-lang/rust/issues/118485

cc `@epage,` `@BurntSushi`
2024-02-18 18:54:32 +01:00
Vadim Petrochenkov
12d7bac2a4 Update coverage-run tests 2024-02-18 20:51:45 +03:00
bors
c9c83cca51 Auto merge of #121265 - klensy:bump-18-02-24, r=Mark-Simulacrum
bump some deps

First commit dedupes darling* crates and remove one more syn 1.* dep
Second one bumps windows crate to 0.52
2024-02-18 16:54:15 +00:00
Caleb Zulawski
b2691baa90 Merge commit '649110751ef4f27440d7cc711b3e07d11bf02d4a' into sync-portable-simd-2024-02-18 2024-02-18 10:14:03 -05:00
Caleb Zulawski
649110751e
Merge pull request #395 from rust-lang/swizzle_dyn_fix
Fix swizzle_dyn
2024-02-18 10:11:17 -05:00
SabrinaJewson
6be93ccbee
Add uncontroversial syscall doc aliases to std docs 2024-02-18 14:04:27 +00:00
bors
8b21296b5d Auto merge of #117772 - surechen:for_117448, r=petrochenkov
Tracking import use types for more accurate redundant import checking

fixes #117448

By tracking import use types to check whether it is scope uses or the other situations like module-relative uses,  we can do more accurate redundant import checking.

For example unnecessary imports in std::prelude that can be eliminated:

```rust
use std::option::Option::Some;//~ WARNING the item `Some` is imported redundantly
use std::option::Option::None; //~ WARNING the item `None` is imported redundantly
```
2024-02-18 13:56:07 +00:00
klensy
92386223a1 tidy: add windows-core 2024-02-18 16:17:56 +03:00
klensy
35fe26757a windows bump to 0.52 2024-02-18 16:02:16 +03:00
klensy
5e2a7ac47a opt-dist: bump derive_builder to dedupe darling* and remove one more syn 1.* dep 2024-02-18 14:40:19 +03:00
bors
6f726205a1 Auto merge of #121255 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? ghost
2024-02-18 10:04:13 +00:00
Gurinder Singh
50e316bdc0 Remove const_prop.rs
and move its content to const_prop_lint.rs and dataflow_const_prop.rs where it is used
2024-02-18 15:31:44 +05:30
Jason Newcomb
864cee3ea3 Allow AST and HIR visitors to return ControlFlow 2024-02-18 03:49:28 -05:00
Tshepang Mbambo
6147973082 remove extraneous text from example config 2024-02-18 10:41:31 +02:00
surechen
a61126cef6 By tracking import use types to check whether it is scope uses or the other situations like module-relative uses, we can do more accurate redundant import checking.
fixes #117448

For example unnecessary imports in std::prelude that can be eliminated:

```rust
use std::option::Option::Some;//~ WARNING the item `Some` is imported redundantly
use std::option::Option::None; //~ WARNING the item `None` is imported redundantly
```
2024-02-18 16:38:11 +08:00
Vadim Petrochenkov
9f8d05f29f macro_rules: Preserve all metavariable spans in a global side table 2024-02-18 11:19:24 +03:00
bors
bcb3545164 Auto merge of #121034 - obeis:improve-static-mut-ref, r=RalfJung
Improve wording of `static_mut_ref`

Close #120964
2024-02-18 08:00:34 +00:00
Laurențiu Nicola
b72ae2c9ea Merge commit 'ac998a74b3c8ff4b81c3eeb9a18811d4cc76226d' into sync-from-ra 2024-02-18 09:41:20 +02:00
Scott McMurray
5793f82030 Add help to hir_analysis_unrecognized_intrinsic_function
To help remind forgetful people like me what step they forgot.
2024-02-17 23:16:30 -08:00
bors
23a3d777c8 Auto merge of #121252 - fmease:rollup-x7zogl8, r=fmease
Rollup of 7 pull requests

Successful merges:

 - #120526 (rustdoc: Correctly handle long crate names on mobile)
 - #121100 (Detect when method call on argument could be removed to fulfill failed trait bound)
 - #121160 (rustdoc: fix and refactor HTML rendering a bit)
 - #121198 (Add more checks for `unnamed_fields` during HIR analysis)
 - #121218 (Fix missing trait impls for type in rustc docs)
 - #121221 (AstConv: Refactor lowering of associated item bindings a bit)
 - #121237 (Use better heuristic for printing Cargo specific diagnostics)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-02-18 06:02:16 +00:00
León Orell Valerian Liehr
5628786484
Rollup merge of #121237 - Urgau:better-cargo-heuristic, r=compiler-errors
Use better heuristic for printing Cargo specific diagnostics

It was [reported](https://github.com/rust-lang/rust/issues/82450#issuecomment-1948574677) in the check-cfg call for testing that the Rust for Linux project is setting the `CARGO` env without compiling with it, which is an issue since we are using the `CARGO` env as a proxy for "was launched from Cargo".

This PR switch to the `CARGO_CRATE_NAME` [Cargo env](https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates), which shouldn't collide (as much) with other build systems. I also took the opportunity to consolidate all the checks under the same function.
2024-02-18 05:10:18 +01:00
León Orell Valerian Liehr
9811358f59
Rollup merge of #121221 - fmease:refactor-astconv-assoc-item-bindings, r=compiler-errors
AstConv: Refactor lowering of associated item bindings a bit

Split off from #119385 as discussed, namely the first two commits (modulo one `FIXME` getting turned into a `NOTE`).

The second commit removes `astconv::ConvertedBinding{,Kind}` in favor of `hir::TypeBinding{,Kind}`. The former was a — in my opinion — super useless intermediary. As you can tell from the diff, its removal shaves off some code. Furthermore, yeeting it will make it easier to implement the type resolution fixes in #119385.

Nothing in this PR should have any semantic effect.

r? `@compiler-errors`

<sub>**Addendum** as in #118668: What I call “associated item bindings” are commonly referred to as “type bindings” for historical reasons. Nowadays, “type bindings” include assoc type bindings, assoc const bindings and RTN (return type notation) which is why I prefer not to use this outdated term.</sub>
2024-02-18 05:10:18 +01:00
León Orell Valerian Liehr
8ba0ad0775
Rollup merge of #121218 - ShoyuVanilla:fix-issue-76736, r=notriddle
Fix missing trait impls for type in rustc docs

Fixes #76736
2024-02-18 05:10:18 +01:00
León Orell Valerian Liehr
68cf5372b3
Rollup merge of #121198 - clubby789:unnamed-fields-hir-checks, r=compiler-errors
Add more checks for `unnamed_fields` during HIR analysis

Fixes #121151

I also found that we don't prevent enums here so
```rs
#[repr(C)]
#[derive(Debug)]
enum A {
    #[default]
    B,
    C,
}

#[repr(C)]
#[derive(Debug)]
struct D {
    _: A,
}
```
leads to an ICE on an `self.is_struct() || self.is_union()` assertion, so fixed that too.
2024-02-18 05:10:17 +01:00
León Orell Valerian Liehr
28c0fa87bb
Rollup merge of #121160 - fmease:rustdoc-fix-n-refactor-html-rendering, r=GuillaumeGomez
rustdoc: fix and refactor HTML rendering a bit

* refactoring: get rid of a bunch of manual `f.alternate()` branches
  * not sure why this wasn't done so already, is this perf-sensitive?
* fix an ICE in debug builds of rustdoc
  * rustdoc used to crash on empty outlives-bounds: `where 'a:`
* properly escape const generic defaults
* actually print empty trait and outlives-bounds (doesn't work for cross-crate reexports yet, will fix that at some other point) since they can have semantic significance
  * outlives-bounds: forces lifetime params to be early-bound instead of late-bound which is technically speaking part of the public API
  * trait-bounds: can affect the well-formedness, consider
    * makeshift “const-evaluatable” bounds under `generic_const_exprs`
    * bounds to force wf-checking in light of #100041 (quite artificial I know, I couldn't figure out something better), see https://github.com/rust-lang/rust/pull/121160#discussion_r1491563816
2024-02-18 05:10:17 +01:00
León Orell Valerian Liehr
6499eb5577
Rollup merge of #121100 - estebank:issue-71252, r=compiler-errors
Detect when method call on argument could be removed to fulfill failed trait bound

When encountering

```rust
struct Foo;
struct Bar;
impl From<Bar> for Foo {
    fn from(_: Bar) -> Self { Foo }
}
fn qux(_: impl From<Bar>) {}
fn main() {
    qux(Bar.into());
}
```

Suggest removing `.into()`:

```
error[E0283]: type annotations needed
 --> f100.rs:8:13
  |
8 |     qux(Bar.into());
  |     ---     ^^^^
  |     |
  |     required by a bound introduced by this call
  |
  = note: cannot satisfy `_: From<Bar>`
note: required by a bound in `qux`
 --> f100.rs:6:16
  |
6 | fn qux(_: impl From<Bar>) {}
  |                ^^^^^^^^^ required by this bound in `qux`
help: try using a fully qualified path to specify the expected types
  |
8 |     qux(<Bar as Into<T>>::into(Bar));
  |         +++++++++++++++++++++++   ~
help: consider removing this method call, as the receiver has type `Bar` and `Bar: From<Bar>` trivially holds
  |
8 -     qux(Bar.into());
8 +     qux(Bar);
  |
```

Fix #71252
2024-02-18 05:10:16 +01:00