Commit Graph

48471 Commits

Author SHA1 Message Date
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
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
Jonathan Brouwer
6133c676d7 Define attribute parser & config evaluator 2025-07-15 09:21:26 +02:00
Jonathan Brouwer
30f4a9cd53 Move cfg -> cfg_old 2025-07-15 09:01:03 +02:00
Jonathan Brouwer
38dd6f5206 Allow Early stage to emit errors 2025-07-15 09:01:03 +02:00
Jonathan Brouwer
a14baf1e56 Define datastructures for #[cfg] attribute, move StrippedCfgItem 2025-07-15 09:01:00 +02: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
Jonathan Brouwer
f0d0afab8e Port #[pointee] to the new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-14 23:16:31 +02: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
Ada Alakbarova
1b8d65ed29 rustc_type_ir/walk: move docstring to TypeWalker itself
having it on the impl block is a bit weird imo
2025-07-14 18:14:02 +02:00
Samuel Tardieu
8fcef5674a Rollup merge of #143901 - compiler-errors:region-constraint-nits, r=lcnr
Region constraint nits

Couple miscellaneous region constraints that have a bit to do with rust-lang/rust#143545 but stand on their own.
2025-07-14 18:05:47 +02:00
Samuel Tardieu
16b3f47658 Rollup merge of #143868 - jdonszelmann:fix-align-on-fields, r=workingjubilee
warn on align on fields to avoid breaking changes

r? `@workingjubilee`
2025-07-14 18:05:45 +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
Oli Scherer
eef08a3f44 Give all bytes of TypeId provenance 2025-07-14 08:33:51 +00:00
Oli Scherer
7f95f04267 Eliminate all direct uses of LLVMMDStringInContext2 2025-07-14 08:27:08 +00:00
Oli Scherer
56d22cd29f Use context methods instead of directly calling FFI 2025-07-14 08:27:08 +00:00
Oli Scherer
b9baf63f99 Merge typeid_metadata and create_metadata 2025-07-14 08:27:08 +00:00
Oli Scherer
e574fef728 Shrink some unsafe blocks in cg_llvm 2025-07-14 08:27:08 +00:00
Oli Scherer
d3d51b4fdb Avoid a bunch of unnecessary unsafe blocks in cg_llvm 2025-07-14 08:27:08 +00: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
Michael Goulet
f6f2f83043 Simplify make_query_region_constraints 2025-07-13 19:22:17 +00:00
Michael Goulet
c2c9aad3f6 Make sure that users don't take region obligations in a snapshot 2025-07-13 19:22:17 +00: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
Michael Goulet
ef726a4cef Ensure proper item queries for assoc tys 2025-07-13 16:31:58 +00:00
Deadbeef
6b02597ed3 update issue number for const_trait_impl 2025-07-13 23:55:06 +08:00
Camille GILLOT
21fd82adbc Retire hir::*ItemRef. 2025-07-13 13:50:01 +00:00
Camille GILLOT
5bd3841668 Retire hir::ForeignItemRef. 2025-07-13 13:50:00 +00:00
Camille GILLOT
36bc0948e0 Generalize TyCtxt::item_name. 2025-07-13 13:50:00 +00:00
Camille GILLOT
277b0ecf34 Remove hir::AssocItemKind. 2025-07-13 13:50:00 +00:00
Camille GILLOT
3ecd03bdfd Move trait_item_def_id from ImplItemRef to ImplItem. 2025-07-13 13:50:00 +00:00
Camille GILLOT
50ca0c6ab8 Delegation: self parameter must be named exactly self. 2025-07-13 13:50:00 +00:00
Camille GILLOT
ad6e587e83 Remove usused depth. 2025-07-13 13:50:00 +00:00
Matthias Krüger
b4b00c7d10 Rollup merge of #143785 - bjorn3:faster_ra_build_script_build, r=Kobzol
Add --compile-time-deps argument for x check

Together with skipping building C++ code in rustc_llvm for check, this reduces the amount of time it takes to do the x check for rust-analyzer analysis from 12m16s to 3m06s when the bootstrap compiler is already downloaded.
2025-07-13 15:16:00 +02:00
Matthias Krüger
dcdb35a730 Rollup merge of #143734 - LorrensP-2158466:refactor-resolve-resolution-bindings, r=petrochenkov
Refactor resolve resolution bindings

This pr does the work asked in https://github.com/rust-lang/rust/pull/142547#issuecomment-3001339385. This part:

> move the `(non)_glob_binding` change

r? ````@petrochenkov````
2025-07-13 15:15:59 +02:00
Matthias Krüger
acbf5e4f50 Rollup merge of #143685 - LorrensP-2158466:merge-import-bindings, r=petrochenkov
Resolve: merge `source_bindings` and `target_bindings` into `bindings`

Attempts to merge the 2 fields `source_bindings` and `target_bindings` of `ImportKind::Single` into 1 field called `bindings`.

r? ````@petrochenkov````
2025-07-13 15:15:59 +02:00
Matthias Krüger
762b3143fc Rollup merge of #143634 - nia-e:init-and-wildcards, r=RalfJung
interpret/allocation: expose init + write_wildcards on a range

Part of https://github.com/rust-lang/miri/pull/4456, so that we can mark down when a foreign access to our memory happened. Should this also move `prepare_for_native_access()` itself into Miri, given that everything there can be implemented on Miri's side?

r? `````@RalfJung`````
2025-07-13 15:15:58 +02:00
Matthias Krüger
7e0721b798 Rollup merge of #143519 - mu001999-contrib:dead-code/impl-items, r=petrochenkov
Check assoc consts and tys later like assoc fns

This PR
1. checks assoc consts and tys later like assoc fns
2. marks assoc consts appear in poly-trait-ref live

For assoc consts, considering
```rust
#![deny(dead_code)]

trait Tr { // ERROR trait `Tr` is never used
    const I: Self;
}

struct Foo; //~ ERROR struct `Foo` is never constructed

impl Tr for Foo {
    const I: Self = Foo;
}

fn main() {}
```

Current this will produce unused `I` instead of unused `Tr` and `Foo` ([play](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=e0490d4a2d522cb70437b26e514a3d9c)), because `const I: Self = Foo;` will be added into the worklist at first:
```
error: associated constant `I` is never used
 --> src/main.rs:4:11
  |
3 | trait Tr { // ERROR trait `Tr` is never used
  |       -- associated constant in this trait
4 |     const I: Self;
  |           ^
  |
note: the lint level is defined here
 --> src/main.rs:1:9
  |
1 | #![deny(dead_code)]
  |         ^^^^^^^^^

error: could not compile `playground` (bin "playground") due to 1 previous error
```

This also happens to assoc tys, see the [new test](https://github.com/rust-lang/rust/compare/master...mu001999-contrib:rust:dead-code/impl-items?expand=1#diff-bf45fa403934a31c9d610a073ed2603d885e7e81572e8edf38b7f4e08a1f3531)

Fixes rust-lang/rust#126729

r? `````@petrochenkov`````
2025-07-13 15:15:57 +02:00
Folkert de Vries
3689b80b75 make cfg_select a builtin macro 2025-07-13 14:34:40 +02:00
Anne Stijns
75561c446a Port #[link_ordinal] to the new attribute parsing infrastructure. 2025-07-13 11:51:01 +02:00
usamoi
f58accb8f3 pass --gc-sections if -Zexport-executable-symbols is enabled and improve tests 2025-07-13 16:27:47 +08:00