Commit Graph

19780 Commits

Author SHA1 Message Date
Alona Enraght-Moony
078332fdc8 rustdoc-json: Structured attributes
Implements https://www.github.com/rust-lang/rust/issues/141358.

This has 2 primary benefits:

1. For rustdoc-json consumers, they no longer need to parse strings of
   attributes, but it's there in a structured and normalized way.
2. For rustc contributors, the output of HIR pretty printing is no
   longer a versioned thing in the output. People can work on
   https://github.com/rust-lang/rust/issues/131229 without needing to
   bump `FORMAT_VERSION`.

(Over time, as the attribute refractor continues, I expect we'll add new
things to `rustdoc_json_types::Attribute`. But this can be done
separately to the rustc changes).
2025-07-15 16:52:41 +00:00
Deadbeef
fd48b7b8dd Comment more code and make tests clearer
Co-Authored-By: Ralf Jung <post@ralfj.de>
2025-07-16 00:50:20 +08:00
Deadbeef
3f2dc2bd1a add const_make_global; err for const_allocate ptrs if didn't call
Co-Authored-By: Ralf Jung <post@ralfj.de>
Co-Authored-By: Oli Scherer <github333195615777966@oli-obk.de>
2025-07-16 00:32:12 +08:00
Michael Goulet
78fa79e7a6 Add tests, some of them fail... 2025-07-15 16:02:26 +00:00
Michael Goulet
512cf3ae88 Gate things properly 2025-07-15 16:02:26 +00:00
Michael Goulet
e3f643c706 Consider outlives assumptions when proving auto traits for coroutine interiors 2025-07-15 16:02:26 +00:00
bors
3014e79f9c Auto merge of #143877 - xizheyin:143813, r=scottmcm,saethlin
`std::vec`: Add UB check for `set_len`, `from_raw_parts_in`, and etc.

Closes rust-lang/rust#143813

I noticed that `from_parts_in` do the similar things like `from_raw_parts_in`, so I add the UB check in the last commit. If it is not appropriate, I will remove it.

And I fix a typo in the first commit.

r? `@scottmcm`
2025-07-15 14:47:10 +00:00
tiif
7dd28181e2 Add tests 2025-07-15 13:48:30 +00:00
tiif
dd067a689a Lint against having both #[unstable_feature_bound] and #[stable] on the same item 2025-07-15 13:48:30 +00:00
tiif
ab29256b96 Make stability attribute not to error when unstable feature bound is in effect 2025-07-15 13:48:30 +00:00
tiif
fecd99881d Setup unstable feature bound attribute 2025-07-15 13:48:29 +00:00
David Mládek
8b868fa534 Implement resolver warnings about reexporting private dependencies 2025-07-15 15:44:25 +02:00
bors
e27f16a499 Auto merge of #143958 - samueltardieu:rollup-lh1s143, r=samueltardieu
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#142301 (tests: Fix duplicated-path-in-error fail with musl)
 - rust-lang/rust#143630 (Drop `./x suggest`)
 - rust-lang/rust#143736 (Give all bytes of TypeId provenance)
 - rust-lang/rust#143752 (Don't panic if WASI_SDK_PATH not set when detecting compiler)
 - rust-lang/rust#143837 (Adjust `run_make_support::symbols` helpers)
 - rust-lang/rust#143878 (Port `#[pointee]` to the new attribute parsing infrastructure)
 - rust-lang/rust#143905 (Recover and suggest to use `;` to construct array type)
 - rust-lang/rust#143907 (core: make `str::split_at_unchecked()` inline)
 - rust-lang/rust#143910 (Add experimental `backtrace-trace-only` std feature)
 - rust-lang/rust#143927 (Preserve constness in trait objects up to hir ty lowering)
 - rust-lang/rust#143935 (rustc_type_ir/walk: move docstring to `TypeWalker` itself)
 - rust-lang/rust#143938 (Update books)
 - rust-lang/rust#143941 (update `cfg_select!` documentation)

Failed merges:

 - rust-lang/rust#143926 (Remove deprecated fields in bootstrap)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-15 11:42:55 +00:00
Samuel Tardieu
010e3ef113 Rollup merge of #143941 - folkertdev:cfg-select-docs, r=traviscross
update `cfg_select!` documentation

tracking issue: https://github.com/rust-lang/rust/issues/115585

After rust-lang/rust#143461, and with an eye on a soon(ish) stabilization, I think the docs need some work.

The existing text read more like a motivation for the feature existing to me, so I've tried to now be a bit more descriptive. Still, suggestions are very welcome.

I also added a test for an empty `select! {}` because it's just the sort of thing that might break.

r? ``@traviscross``
2025-07-15 12:52:44 +02:00
Samuel Tardieu
cc26852148 Rollup merge of #143927 - oli-obk:const-dyn-trait-hir-ty, r=fmease
Preserve constness in trait objects up to hir ty lowering

r? ``@compiler-errors``

While we don't support `dyn const Trait`, we can at least also inform the user that `const Trait` is only legal for `#[const_trait] trait Trait {}`
2025-07-15 12:52:43 +02:00
Samuel Tardieu
281990eb16 Rollup merge of #143905 - xizheyin:143828, r=compiler-errors
Recover and suggest to use `;` to construct array type

Fixes rust-lang/rust#143828

r? compiler
2025-07-15 12:52:40 +02:00
Samuel Tardieu
b89c63de0e Rollup merge of #143837 - jieyouxu:symbol-apis, r=ChrisDenton
Adjust `run_make_support::symbols` helpers

Massage the `symbols` helpers to fill out {match all, match any} x {substring match, exact match}:

|           | Substring match                        | Exact match                   |
|-----------|----------------------------------------|-------------------------------|
| Match any | `object_contains_any_symbol_substring` | `object_contains_any_symbol`  |
| Match all | `object_contains_all_symbol_substring` | `object_contains_all_symbols` |

As I'd like to use `object_contains_all_symbols` for rust-lang/rust#143669.

As part of this:

- Rename `any_symbol_contains` to `object_contains_any_symbol_substring` for accuracy, as `any_symbol_contains` is actually "contains any matching substring".
- Remove `with_symbol_iter`.

Noticed while working on https://github.com/rust-lang/rust/pull/143669.

r? ``@ChrisDenton`` (or compiler)
2025-07-15 12:52:39 +02:00
Samuel Tardieu
e66f26fb74 Rollup merge of #143736 - oli-obk:uninspectable-type-id, r=RalfJung
Give all bytes of TypeId provenance

This makes all bytes of TypeId uninspectable at compile-time.

For context see https://github.com/rust-lang/rust/issues/77125#issuecomment-3057049217

r? ``@RalfJung``
2025-07-15 12:52:38 +02:00
Samuel Tardieu
4e72ed79d4 Rollup merge of #142301 - Gelbpunkt:duplicated-path-in-error-musl, r=workingjubilee,fmease,jieyouxu
tests: Fix duplicated-path-in-error fail with musl

musl's dlopen returns a different error than glibc, which contains the name of the file. This would cause the test to fail, since the filename would appear twice in the output (once in the error from rustc, once in the error message from musl). Split the expected test outputs for the different libc implementations.

Fixes rust-lang/rust#128474
2025-07-15 12:52:36 +02:00
Oli Scherer
2b4ede7e3d constify Index trait and its slice impls 2025-07-15 08:27:15 +00:00
Oli Scherer
cb7d52f643 constify some methods using SliceIndex 2025-07-15 07:58:29 +00:00
Jonathan Brouwer
7a7c74ad89 New example for E0536 2025-07-15 09:21:27 +02:00
Jonathan Brouwer
c7f5ddc098 Changes to diagnostics 2025-07-15 09:21:27 +02:00
xizheyin
a74a28493a Add tests for UB check in set_len, from_raw_parts_in, from_parts_in
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-15 15:12:24 +08:00
Karan Janthe
80224c3e88 test: Add UI tests for testing type analysis autodiff
Signed-off-by: Karan Janthe <karanjanthe@gmail.com>
2025-07-15 04:17:29 +00:00
xizheyin
ed88af2163 Recover and suggest use ; to construct array type
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-15 12:00:46 +08:00
Folkert de Vries
d0153f5872 update cfg_select! documentation
and make internal terminology consistent

Co-authored-by: Travis Cross <tc@traviscross.com>
2025-07-14 22:29:28 +02:00
Jens Reidel
ae1b1b4f8a tests: Fix duplicated-path-in-error fail with musl
musl's dlopen returns a different error than glibc, which contains the
name of the file. This would cause the test to fail, since the filename
would appear twice in the output (once in the error from rustc, once in
the error message from musl). Split the expected test outputs for the
different libc implementations.

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2025-07-14 18:37:49 +02:00
Samuel Tardieu
9b260f6ccf Rollup merge of #143903 - vtjl10:master, r=jieyouxu
Fix typos in documentation files

## Summary
Fix minor typos in documentation files to improve readability.

## Changes
- **tests/mir-opt/pre-codegen/README.md**: Fix typo `condiguration` → `configuration`
- **tests/ui/SUMMARY.md**: Fix typo in RFC link URL (`namepsace ` → `namespace`)

## Type of Change
- [x] Documentation update
- [x] Bug fix (typo correction)
2025-07-14 18:05:47 +02:00
Samuel Tardieu
bbda0c9fb5 Rollup merge of #143855 - JonathanBrouwer:omit_gdb_pretty_printer_section, r=jdonszelmann
Port `#[omit_gdb_pretty_printer_section]` to the new attribute parsing

Ports `#[omit_gdb_pretty_printer_section]` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971351163

r? ```@jdonszelmann```
2025-07-14 18:05:45 +02:00
Samuel Tardieu
c59bc44ca9 Rollup merge of #143848 - makai410:smir-rename, r=oli-obk
Rename `stable_mir` and `rustc_smir`

This PR only renames the two crate names.

There is no doubt that we want to rename `stable_mir` to `rustc_public`, while it hasn't been discussed yet that what the new name for `rustc_smir` should be.

This PR proposes a new name for `rustc_smir`, that is `rustc_public_shim`, since `rustc_smir` now is mostly a proxy to do calls to rustc queries and the public API of rustc that is invoked by the `rustc_public` crate.

However, I don't think that name is good enough. I hope there would be a way better name.

r? `@oli-obk`
2025-07-14 18:05:44 +02:00
Jake Goulding
5530744318 Reword mismatched-lifetime-syntaxes text based on feedback
Key changes include:

- Removal of the word "syntax" from the lint message. More accurately,
  it could have been something like "syntax group" or "syntax
  category", but avoiding it completely is easier.
- The primary lint message now reflects exactly which mismatch is
  occurring, instead of trying to be general. A new `help` line is
  general across the mismatch kinds.
- Suggestions have been reduced to be more minimal, no longer also
  changing non-idiomatic but unrelated aspects.
- Suggestion text no longer mentions changes when those changes don't
  occur in that specific suggestion.
2025-07-14 09:52:58 -04:00
Oli Scherer
000e67aafb Preserve constness in trait objects up to hir ty lowering 2025-07-14 12:52:44 +00:00
Makai
6598c61725 rename stable_mir to rustc_public, and rustc_smir to rustc_public_bridge 2025-07-14 09:25:54 +00:00
Jakub Beránek
a7ad680269 Rollup merge of #143875 - fee1-dead-contrib:push-zvqrmzrprpzt, r=compiler-errors
update issue number for `const_trait_impl`

r? project-const-traits

cc rust-lang/rust#67792 rust-lang/rust#143874
2025-07-14 11:04:55 +02:00
Jakub Beránek
93c10272d0 Rollup merge of #143217 - Periodic1911:link-ordinal, r=jdonszelmann
Port #[link_ordinal] to the new attribute parsing infrastructure

Ports link_ordinal to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197
2025-07-14 11:04:52 +02:00
fuder.eth
19fccacd4a Update SUMMARY.md
Update README.md
2025-07-14 12:01:41 +03:00
Oli Scherer
eef08a3f44 Give all bytes of TypeId provenance 2025-07-14 08:33:51 +00:00
xizheyin
1cac8cbde9 Add test array-type-no-semi.rs
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-14 14:26:47 +08:00
Martin Nordholts
500b743f7e tests: Test line debuginfo for linebreaked function parameters 2025-07-14 07:11:57 +02:00
bors
ad635e5d06 Auto merge of #143779 - JonathanBrouwer:automatically_derived_parser, r=oli-obk
Port `#[automatically_derived]` to the new attribute parsing infrastructure

Ports `#[automatically_derived]` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971351163

r? `@oli-obk`
cc `@jdonszelmann`
2025-07-14 04:29:53 +00:00
bors
9c3064e131 Auto merge of #143357 - cjgillot:no-assoc-item-kind, r=compiler-errors
Retire hir::*ItemRef.

This information was kept for various places that iterate on HIR to know about trait-items and impl-items.

This PR replaces them by uses of the `associated_items` query that contain pretty much the same information.

This shortens many spans to just `def_span`, which can be easier to read.
2025-07-13 22:39:10 +00:00
Daniel Paoliello
d77c387272 Fixes for Arm64EC 2025-07-13 15:01:48 -07:00
Kivooeo
b7d024b056 moved tests 2025-07-14 02:28:43 +05:00
bors
e9182f195b Auto merge of #143461 - folkertdev:cfg-select-builtin-macro, r=petrochenkov
make `cfg_select` a builtin macro

tracking issue: https://github.com/rust-lang/rust/issues/115585

This parses mostly the same as the `macro cfg_select` version, except:

1. wrapping in double brackets is no longer supported (or needed): `cfg_select {{ /* ... */ }}` is now rejected.
2. in an expression context, the rhs is no longer wrapped in a block, so that this now works:
  ```rust
  fn main() {
      println!(cfg_select! {
          unix => { "foo" }
          _ => { "bar" }
      });
  }
  ```
3. a single wildcard rule is now supported: `cfg_select { _ => 1 }` now works

I've also added an error if none of the rules evaluate to true, and warnings for any arms that follow the `_` wildcard rule.

cc `@traviscross` if I'm missing any feature that should/should not be included
r? `@petrochenkov` for the macro logic details
2025-07-13 18:34:13 +00:00
Michael Goulet
8daf98b623 Imply always-const host effects the same as any other item bound 2025-07-13 16:31:59 +00:00
Michael Goulet
549a5d8b28 Dont collect assoc ty item bounds from trait where clause for host effect predicates 2025-07-13 16:31:59 +00:00
Deadbeef
6b02597ed3 update issue number for const_trait_impl 2025-07-13 23:55:06 +08:00
bors
56835d7ac1 Auto merge of #143888 - matthiaskrgr:rollup-fv9x7kf, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#143301 (`tests/ui`: A New Order [26/N])
 - rust-lang/rust#143519 (Check assoc consts and tys later like assoc fns)
 - rust-lang/rust#143554 (slice: Mark `rotate_left`, `rotate_right` unstably const)
 - rust-lang/rust#143634 (interpret/allocation: expose init + write_wildcards on a range)
 - rust-lang/rust#143685 (Resolve: merge `source_bindings` and `target_bindings` into `bindings`)
 - rust-lang/rust#143734 (Refactor resolve resolution bindings)
 - rust-lang/rust#143774 (constify `From` and `Into`)
 - rust-lang/rust#143785 (Add --compile-time-deps argument for x check)
 - rust-lang/rust#143786 (Fix fallback for CI_JOB_NAME)
 - rust-lang/rust#143825 (clippy: fix test filtering when TESTNAME is empty)
 - rust-lang/rust#143826 (Fix command trace)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-13 15:32:13 +00:00
Camille GILLOT
27127e342d Bless incremental tests. 2025-07-13 13:50:01 +00:00