Commit Graph

271770 Commits

Author SHA1 Message Date
Xiaoguang Wang
92a1a1de17 Remove unused code 2024-11-30 16:29:49 +08:00
bors
d6f88291f3 Auto merge of #133409 - RalfJung:target-consistency, r=lcnr
ensure JSON-defined targets are consistent

We have a `check_consistency` check that ensures some invariants which (presumably) the rest of the compiler relies on. However, JSON targets can easily be written in a way that violates those invariants. So this PR applies the same consistency check to JSON targets that we already enforce for built-in targets.

I have converted many of the assertions in that function to new macros that show a nice error instead of a panic; if people are okay with the general approach here, I can do that for the rest of the checks as well.
2024-11-29 01:35:20 +00:00
bors
d53f0b1d8e Auto merge of #123244 - Mark-Simulacrum:share-inline-never-generics, r=saethlin
Enable -Zshare-generics for inline(never) functions

This avoids inlining cross-crate generic items when possible that are
already marked inline(never), implying that the author is not intending
for the function to be inlined by callers. As such, having a local copy
may make it easier for LLVM to optimize but mostly just adds to binary
bloat and codegen time. In practice our benchmarks indicate this is
indeed a win for larger compilations, where the extra cost in dynamic
linking to these symbols is diminished compared to the advantages in
fewer copies that need optimizing in each binary.

It might also make sense it expand this with other heuristics (e.g.,
`#[cold]`) in the future, but this seems like a good starting point.

FWIW, I expect that doing cleanup in where we make the decision
what should/shouldn't be shared is also a good idea. Way too
much code needed to be tweaked to check this. But I'm hoping
to leave that for a follow-up PR rather than blocking this on it.
2024-11-28 21:44:34 +00:00
bors
a2545fd6fc Auto merge of #133540 - ehuss:compiletest-proc-macro, r=jieyouxu
Compiletest: add proc-macro header

This adds a `proc-macro` header to simplify using proc-macros, and to reduce boilerplate. This header works similar to the `aux-build` header where you pass a path for a proc-macro to be built.

This allows the `force-host`, `no-prefer-dynamic` headers, and `crate_type` attribute to be removed. Additionally it uses `--extern` like `aux_crate` (allows implicit `extern crate` in 2018) and `--extern proc_macro` (to place in the prelude in 2018).

~~This also includes a secondary change which defaults the edition of proc-macros to 2024. This further reduces boilerplate (removing `extern crate proc_macro;`), and allows using modern Rust syntax. I was a little on the fence including this. I personally prefer it, but I can imagine it might be confusing to others.~~ EDIT: Removed

Some tests were changed so that when there is a chain of dependencies A→B→C, that the `@ proc-macro` is placed in `B` instead of `A` so that the `--extern` flag works correctly (previously it depended on `-L` to find `C`). I think this is better to make the dependencies more explicit. None of these tests looked like the were actually testing this behavior.

There is one test that had an unexplained output change: `tests/ui/macros/same-sequence-span.rs`. I do not know why it changed, but it didn't look like it was particularly important. Perhaps there was a normalization issue?

This is currently not compatible with the rustdoc `build-aux-docs` header. It can probably be fixed, I'm just not feeling motivated to do that right now.

### Implementation steps

- [x] Document this new behavior in rustc-dev-guide once we figure out the specifics. https://github.com/rust-lang/rustc-dev-guide/pull/2149
2024-11-28 19:00:58 +00:00
Mark Rousskov
4a216a25d1 Share inline(never) generics across crates
This reduces code sizes and better respects programmer intent when
marking inline(never). Previously such a marking was essentially ignored
for generic functions, as we'd still inline them in remote crates.
2024-11-28 13:43:05 -05:00
bors
7e565cce6a Auto merge of #133468 - lcnr:uwu4, r=BoxyUwU
always create `DefId`s for anon consts

but don't use them anywhere, we intentionally don't encode them in the crate metadata.

best reviewed by disabling whitespace.

This pretty much reimplements #133285 while adding the tests of #133455. Fixes #133064

r? `@BoxyUwU` `@compiler-errors`
2024-11-28 15:58:17 +00:00
lcnr
d401a078e7 update comment 2024-11-28 12:22:02 +00:00
lcnr
23ba2d1194 ast_lowering: rm separate def_id_parent
no longer necessary as we now always create a ` DefId`  for anon-consts
2024-11-28 12:22:02 +00:00
lcnr
94131bd0a8 always create DefIds when lowering anon-consts 2024-11-28 12:22:02 +00:00
lcnr
467e200cd5 add tests 2024-11-28 12:20:00 +00:00
bors
9b4d7c6a40 Auto merge of #133568 - GuillaumeGomez:rollup-js22ovb, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #133358 (Don't type error if we fail to coerce `Pin<T>` because it doesnt contain a ref)
 - #133422 (Fix clobber_abi in RV32E and RV64E inline assembly)
 - #133452 (Support predicate registers (clobber-only) in Hexagon inline assembly)
 - #133463 (Fix handling of x18 in AArch64 inline assembly on ohos/trusty or with -Zfixed-x18)
 - #133487 (fix confusing diagnostic for reserved `##`)
 - #133557 (Small doc fixes in `rustc_codegen_ssa`)
 - #133560 (Trim extra space in 'repeated `mut`' diagnostic)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-28 11:20:29 +00:00
Guillaume Gomez
22c5bb0bdc
Rollup merge of #133560 - clubby789:mut-mut-space, r=jieyouxu
Trim extra space in 'repeated `mut`' diagnostic

Trim an extra space when removing repeated `mut`.

Also an extra test for even more repeated `mut`s
2024-11-28 12:06:07 +01:00
Guillaume Gomez
7201f70c37
Rollup merge of #133557 - Monadic-Cat:small_doc_fixes, r=bjorn3
Small doc fixes in `rustc_codegen_ssa`

I'm trying to make a toy codegen backend for `rustc`, and I got confused for a few minutes about what `codegen_backend` was referring to in the `CodegenBackend::join_codegen` docs.

Experimentally, it looks like the result of `CodegenBackend::codegen_crate` is passed to `CodegenBackend::join_codegen`, so this updates the docs to refer to that. This time using intra-doc links to hopefully cause people to notice if that gets out of date again.

Also, added another intra-doc link nearby, on `CodegenBackend::link`, for the same reason.
2024-11-28 12:06:07 +01:00
Guillaume Gomez
ca71c8fe5e
Rollup merge of #133487 - pitaj:reserve-guarded-strings, r=fee1-dead
fix confusing diagnostic for reserved `##`

Closes #131615
2024-11-28 12:06:04 +01:00
Guillaume Gomez
23bab15d73
Rollup merge of #133463 - taiki-e:aarch64-asm-x18, r=Amanieu
Fix handling of x18 in AArch64 inline assembly on ohos/trusty or with -Zfixed-x18

Currently AArch64 inline assembly allows using x18 on ohos/trusty or with -Zfixed-x18.

7db7489f9b/compiler/rustc_target/src/asm/aarch64.rs (L74-L76)

However, x18 is reserved in these environments and should not be allowed in the input/output operands of inline assemblies as it is in Android, Windows, etc..

7db7489f9b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs (L19)
7db7489f9b/compiler/rustc_target/src/spec/targets/aarch64_unknown_trusty.rs (L18)
7db7489f9b/compiler/rustc_codegen_llvm/src/llvm_util.rs (L764-L771)

(As for ohos, +reserve-x18 is [redundant](c417b7a695 (diff-0ddf23e0bf2b28b2d05f842f087d1e6f694e8e06d1765e8d0f10d47fddcdff9c)) since 7a966b9188 that starting using llvm's ohos targets. So removed it from target-spec.)

This fix may potentially break the code for tier 2 target (aarch64-unknown-linux-ohos). (As for others, aarch64-unknown-trusty is tier 3 and -Zfixed-x18 is unstable so breaking them should be fine.)
However, in any case, it seems suspicious that the code that is broken by this was sound.

r? `@Amanieu`

`@rustbot` label O-AArch64 +A-inline-assembly
2024-11-28 12:06:02 +01:00
Guillaume Gomez
470c4f94e8
Rollup merge of #133452 - taiki-e:hexagon-asm-pred, r=Amanieu
Support predicate registers (clobber-only) in Hexagon inline assembly

The result of the Hexagon instructions such as comparison, store conditional, etc. is stored in predicate registers (`p[0-3]`), but currently there is no way to mark it as clobbered in `asm!`.

This is also needed for `clobber_abi` (although implementing `clobber_abi` will require the addition of support for [several more register classes](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/Hexagon/HexagonRegisterInfo.cpp#L71-L90). see also https://github.com/rust-lang/rust/issues/93335#issuecomment-2395210055).

Refs:
- [Section 6 "Conditional Execution" in Qualcomm Hexagon V73 Programmer’s Reference Manual](https://docs.qualcomm.com/bundle/publicresource/80-N2040-53_REV_AB_Qualcomm_Hexagon_V73_Programmers_Reference_Manual.pdf#page=90)
- [Register definition in LLVM](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/Hexagon/HexagonRegisterInfo.td#L155)

cc `@androm3da` (target maintainer of hexagon-unknown-{[none-elf](https://doc.rust-lang.org/nightly/rustc/platform-support/hexagon-unknown-none-elf.html#target-maintainers),[linux-musl](https://doc.rust-lang.org/nightly/rustc/platform-support/hexagon-unknown-linux-musl.html#target-maintainers)})

r? `@Amanieu`

`@rustbot` label +A-inline-assembly
(Currently there is no O-hexagon label...)
2024-11-28 12:06:02 +01:00
Guillaume Gomez
89ae19ee0d
Rollup merge of #133422 - taiki-e:riscv-e-clobber-abi, r=Amanieu
Fix clobber_abi in RV32E and RV64E inline assembly

Currently clobber_abi in RV32E and RV64E inline assembly is implemented using InlineAsmClobberAbi::RiscV, but broken since x16-x31 cannot be used in RV32E and RV64E.

```
error: cannot use register `x16`: register can't be used with the `e` target feature
  --> <source>:42:14
   |
42 |     asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags));
   |              ^^^^^^^^^^^^^^^^

error: cannot use register `x17`: register can't be used with the `e` target feature
  --> <source>:42:14
   |
42 |     asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags));
   |              ^^^^^^^^^^^^^^^^

error: cannot use register `x28`: register can't be used with the `e` target feature
  --> <source>:42:14
   |
42 |     asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags));
   |              ^^^^^^^^^^^^^^^^

error: cannot use register `x29`: register can't be used with the `e` target feature
  --> <source>:42:14
   |
42 |     asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags));
   |              ^^^^^^^^^^^^^^^^

error: cannot use register `x30`: register can't be used with the `e` target feature
  --> <source>:42:14
   |
42 |     asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags));
   |              ^^^^^^^^^^^^^^^^

error: cannot use register `x31`: register can't be used with the `e` target feature
  --> <source>:42:14
   |
42 |     asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags));
   |              ^^^^^^^^^^^^^^^^
```

r? `@Amanieu`

`@rustbot` label O-riscv +A-inline-assembly
2024-11-28 12:06:01 +01:00
Guillaume Gomez
bda2851826
Rollup merge of #133358 - compiler-errors:pin-coerce, r=eholk
Don't type error if we fail to coerce `Pin<T>` because it doesnt contain a ref

Fixes https://github.com/rust-lang/rust/issues/133222. Also moves some tests into a directory for better bookkeeping.

r? eholk or re-roll
2024-11-28 12:06:00 +01:00
bors
c1cfab230e Auto merge of #133564 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2024-11-28 08:24:44 +00:00
Laurențiu Nicola
15e8a2691b Fix proc macro test 2024-11-28 09:40:14 +02:00
Ralf Jung
77080d8eb3 move target JSON (de)serialization to separate file 2024-11-28 07:58:46 +01:00
Laurențiu Nicola
8cf30c2356
Merge pull request #18566 from lnicola/sync-from-rust
minor: Sync from downstream
2024-11-28 06:54:16 +00:00
Laurențiu Nicola
1a435ed7ed Bump rustc crates 2024-11-28 08:39:56 +02:00
Laurențiu Nicola
c91f2a3280 Merge from rust-lang/rust 2024-11-28 08:37:36 +02:00
Laurențiu Nicola
6e3cb4abfb Preparing for merge from rust-lang/rust 2024-11-28 08:37:22 +02:00
bors
f005c7437d Auto merge of #133561 - GuillaumeGomez:rollup-g4upmv4, r=GuillaumeGomez
Rollup of 12 pull requests

Successful merges:

 - #129409 (Expand std::os::unix::fs::chown() doc with a warning)
 - #133320 (Add release notes for Rust 1.83.0)
 - #133368 (Delay a bug when encountering an impl with unconstrained generics in `codegen_select`)
 - #133428 (Actually use placeholder regions for trait method late bound regions in `collect_return_position_impl_trait_in_trait_tys`)
 - #133512 (Add `as_array` and `as_mut_array` conversion methods to slices.)
 - #133519 (Check `xform_ret_ty` for WF in the new solver to improve method winnowing)
 - #133520 (Structurally resolve before applying projection in borrowck)
 - #133534 (extend group-forbid-always-trumps-cli test)
 - #133537 ([rustdoc] Fix new clippy lints)
 - #133543 ([AIX] create shim for lgammaf_r)
 - #133547 (rustc_span: Replace a `HashMap<_, ()>` with `HashSet`)
 - #133550 (print generated doc paths)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-28 03:36:03 +00:00
Guillaume Gomez
ed913fe3ee
Rollup merge of #133550 - onur-ozkan:doc-log, r=jieyouxu
print generated doc paths

Resolves #133002
2024-11-28 03:14:52 +01:00
Guillaume Gomez
63a6e9c907
Rollup merge of #133547 - cuviper:span-set-entry, r=jieyouxu
rustc_span: Replace a `HashMap<_, ()>` with `HashSet`

Now that `HashSet::entry()` exists, we don't need to fake it with a map.
2024-11-28 03:14:51 +01:00
Guillaume Gomez
82d4eaeaff
Rollup merge of #133543 - mustartt:aix-lgammaf_r-shim, r=cuviper
[AIX] create shim for lgammaf_r

On AIX, we don't have 32bit floating point for re-entrant `lgammaf_r` but we do have the 64bit floating point re-entrant `lgamma_r` so we can use the 64bit version instead and truncate back to a 32bit float.

This solves the linker missing symbol for `.lgammaf_r` when testing and using these parts of the `std`.
2024-11-28 03:14:51 +01:00
Guillaume Gomez
0cad2dcba6
Rollup merge of #133537 - GuillaumeGomez:fix-clippy-lints, r=GuillaumeGomez
[rustdoc] Fix new clippy lints

Lots of small things that clippy lints about.

r? `@fmease`
2024-11-28 03:14:50 +01:00
Guillaume Gomez
7e2f261e05
Rollup merge of #133534 - RalfJung:cli-lint-flags, r=Nadrieril
extend group-forbid-always-trumps-cli test

Test it not just for a lint group, but also an individual lint, or when mixing the lint and the group. And test both orders in which the flags could be passed.
2024-11-28 03:14:50 +01:00
Guillaume Gomez
b46ed7119e
Rollup merge of #133520 - compiler-errors:structurally-resolve-mir-borrowck, r=lcnr
Structurally resolve before applying projection in borrowck

As far as I can tell, all other `.normalize` calls in borrowck are noops and can remain that way. This is the only one that actually requires structurally resolving the type.

r? lcnr
2024-11-28 03:14:49 +01:00
Guillaume Gomez
06815d0cc1
Rollup merge of #133519 - compiler-errors:xform-ret-wf, r=lcnr
Check `xform_ret_ty` for WF in the new solver to improve method winnowing

This is a bit interesting. Method probing in the old solver is stronger than the new solver because eagerly normalizing types causes us to check their corresponding trait goals. This is important because we don't end up checking all of the where clauses of a method when method probing; just the where clauses of the impl. i.e., for:

```
impl Foo
where
   WC1,
{
    fn method()
    where
        WC2,
    {}
}
```

We only check WC1 and not WC2. This is because at this point in probing the method is instantiated w/ infer vars, and checking the where clauses in WC2 will lead to cycles if we were to check them (at least that's my understanding; I could investigate changing that in general, incl. in the old solver, but I don't have much confidence that it won't lead to really bad overflows.)

This PR chooses to emulate the old solver by just checking that the return type is WF. This is theoretically stronger, but I'm not too worried about it. I think we alternatively have several approaches we can take here, though this one seems the simplest. Thoughts?

r? lcnr
2024-11-28 03:14:48 +01:00
Guillaume Gomez
b1c33f4f09
Rollup merge of #133512 - bjoernager:slice-as-array, r=Amanieu
Add `as_array` and `as_mut_array` conversion methods to slices.

Tracking issue: #133508

This PR unstably implements the `as_array` and `as_mut_array` converters to `[T]`, `*const [T]`, and `*mut [T]`.
2024-11-28 03:14:48 +01:00
Guillaume Gomez
3e095e864a
Rollup merge of #133428 - compiler-errors:rpitit-unsound, r=lcnr
Actually use placeholder regions for trait method late bound regions in `collect_return_position_impl_trait_in_trait_tys`

So in https://github.com/rust-lang/rust/pull/113182, I introduced a "diagnostics improvement" in the form of 473c88dfb6, which changes which signature we end up instantiating with placeholder regions and which signature we end up instantiating with fresh region vars so that we have placeholders corresponding to the names of the late-bound regions coming from the *impl*.

However, this is not sound, since now we're essentially no longer proving that *all* instantiations of the trait method are compatible with an instantiation of the impl method, but vice versa (which is weaker).  Let's look at the example `tests/ui/impl-trait/in-trait/do-not-imply-from-trait-impl.rs`:

```rust
trait MkStatic {
    fn mk_static(self) -> &'static str;
}

impl MkStatic for &'static str {
    fn mk_static(self) -> &'static str { self }
}

trait Foo {
    fn foo<'a: 'static, 'late>(&'late self) -> impl MkStatic;
}

impl Foo for str {
    fn foo<'a: 'static>(&'a self) -> impl MkStatic + 'static {
        self
    }
}

fn call_foo<T: Foo + ?Sized>(t: &T) -> &'static str {
    t.foo().mk_static()
}

fn main() {
    let s = call_foo(String::from("hello, world").as_str());
    println!("> {s}");
}
```

To collect RPITITs, we were previously instantiating the trait signature with infer vars (`fn(&'?0 str) -> ?1t` where `?1t` is the variable we use to infer the RPITIT) and the impl signature with placeholders (there are no late-bound regions in that signature, so we just have `fn(&'a str) -> Opaque`).

Equating the signatures works, since all we do is unify `?1t` with `Opaque` and `'?0` with `'a`. However, conceptually it *shouldn't* hold, since this definition is not valid for *all* instantiations of the trait method but just the one where `'0` (i.e. `'late`) is equal to `'a` :(

## So what

This PR effectively reverts 473c88dfb6 to fix the unsoundness.

Fixes #133427
Also fixes #133425, which is actually coincidentally another instance of this bug (but not one that is weaponized into UB, just one that causes an ICE in refinement checking).
2024-11-28 03:14:47 +01:00
Guillaume Gomez
acf48fcb9d
Rollup merge of #133368 - compiler-errors:codegen-select-unconstrained-params, r=lcnr
Delay a bug when encountering an impl with unconstrained generics in `codegen_select`

Despite its name, `codegen_select` is what powers `Instance::try_resolve`, which is used in pre-codegen contexts to try to resolve a method where possible. One place that it's used is in the "recursion MIR lint" that detects recursive MIR bodies.

If we encounter an impl in `codegen_select` that contains unconstrained generic parameters, we expect that impl to caused an error to be reported; however, there's no temporal guarantee that this error is reported *before* we call `codegen_select`. This is what a delayed bug is *for*, and this PR makes us use a delayed bug rather than asserting something about errors already having been emitted.

Fixes  #126646
2024-11-28 03:14:46 +01:00
Guillaume Gomez
09734ac3af
Rollup merge of #133320 - cuviper:relnotes-1.83.0, r=cuviper
Add release notes for Rust 1.83.0

Issues: https://github.com/rust-lang/rust/issues?q=is%3Aissue%20state%3Aopen%20label%3Arelnotes-tracking-issue%20milestone%3A1.83.0

r? `@Mark-Simulacrum`
cc `@rust-lang/release`
2024-11-28 03:14:46 +01:00
Guillaume Gomez
10193a347a
Rollup merge of #129409 - grinapo:patch-1, r=Amanieu
Expand std::os::unix::fs::chown() doc with a warning

Include warning about losing setuid/gid when chowning, per POSIX.

It is about the underlying system call but it is rather useful to mention it in the help in case someone accidentally forgets (don't look at me :)).
2024-11-28 03:14:45 +01:00
Guillaume Gomez
f0c301ffe4 Fix new clippy lints 2024-11-28 03:05:43 +01:00
clubby789
c3c68c5cb1 Trim extra space in 'repeated mut' diagnostic 2024-11-28 01:37:01 +00:00
bors
eddb717281 Auto merge of #133551 - matthiaskrgr:rollup-m0rr5oz, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #132410 (Some more refactorings towards removing driver queries)
 - #133418 (coverage: Store coverage source regions as `Span` until codegen)
 - #133498 (Add missing code examples on `LocalKey`)
 - #133518 (Structurally resolve before checking `!` in HIR typeck)
 - #133521 (Structurally resolve before matching on type of projection)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-28 00:51:37 +00:00
Monadic Cat
ca55eeeaf3
use intra-doc links for CodegenBackend::link 2024-11-27 18:42:14 -06:00
Monadic Cat
52684a4c52
update comment (codegen_backend -> codegen_crate)
use intra-doc links so there'll be a doc gen fail next time this becomes
wrong
2024-11-27 18:26:08 -06:00
Matthias Krüger
5fc4f85f60
Rollup merge of #133521 - compiler-errors:structurally-resolve-cat-proj, r=lcnr
Structurally resolve before matching on type of projection

Another missing structural resolve in closure upvar analysis. I think it's better to place the normalization here rather than trying to guarantee that all types returned by the expr use visitor are structurally normalized, which I don't think we do now. Thoughts?

r? lcnr
2024-11-27 22:23:26 +01:00
Matthias Krüger
5d0ee56e88
Rollup merge of #133518 - compiler-errors:structurally-resolve-never, r=lcnr
Structurally resolve before checking `!` in HIR typeck

Some more missing structural resolves in HIR typeck :>

r? lcnr
2024-11-27 22:23:26 +01:00
Matthias Krüger
a8b690fada
Rollup merge of #133498 - GuillaumeGomez:missing-examples, r=joboet
Add missing code examples on `LocalKey`

r? ``@Amanieu``
2024-11-27 22:23:25 +01:00
Matthias Krüger
adf9b5fcd1
Rollup merge of #133418 - Zalathar:spans, r=jieyouxu
coverage: Store coverage source regions as `Span` until codegen

Historically, coverage spans were converted into line/column coordinates during the MIR instrumentation pass.

This PR moves that conversion step into codegen, so that coverage spans spend most of their time stored as `Span` instead.

In addition to being conceptually nicer, this also reduces the size of coverage mappings in MIR, because `Span` is smaller than 4x u32.

---

There should be no changes to coverage output.
2024-11-27 22:23:25 +01:00
Matthias Krüger
af1ca153d4
Rollup merge of #132410 - bjorn3:yet_another_driver_refactor_round, r=cjgillot
Some more refactorings towards removing driver queries

Follow up to https://github.com/rust-lang/rust/pull/127184

## Custom driver breaking change

The `after_analysis` callback is changed to accept `TyCtxt` instead of `Queries`. The only safe query in `Queries` to call at this point is `global_ctxt()` which allows you to enter the `TyCtxt` either way. To fix your custom driver, replace the `queries: &'tcx Queries<'tcx>` argument with `tcx: TyCtxt<'tcx>` and remove your `queries.global_ctxt().unwrap().enter(|tcx| { ... })` call and only keep the contents of the closure.

## Custom driver deprecation

The `after_crate_root_parsing` callback is now deprecated. Several custom drivers are incorrectly calling `queries.global_ctxt()` from inside of it, which causes some driver code to be skipped. As such I would like to either remove it in the future or if custom drivers still need it, change it to accept an `&rustc_ast::Crate` instead.
2024-11-27 22:23:24 +01:00
bors
66adeaf46b Auto merge of #133509 - Urgau:dangling_lint_perf, r=Noratrieb
Recover some lost performence from #132732

This PR reorders some conditions in the `dangling_pointers_from_temporaries` lint to avoid some potentially expensive query call, in particular those who could involve some metadata decoding from disk.

cc https://github.com/rust-lang/rust/pull/132732#issuecomment-2499990683
cc `@Kobzol`
2024-11-27 21:19:54 +00:00
Michael Goulet
871cfc9dff Further simplifications 2024-11-27 21:03:15 +00:00