Commit Graph

270278 Commits

Author SHA1 Message Date
Jubilee
4036472749
Rollup merge of #132131 - celinval:smir-crate-defs, r=compiler-errors
[StableMIR] API to retrieve definitions from crates

Add functions to retrieve function definitions and static items from all crates (local and external).

For external crates, we're still missing items from trait implementation and primitives.

r? ````@compiler-errors:```` Do you know what is the best way to retrieve the associated items for primitives and trait implementations for external crates? Thanks!
2024-11-07 18:48:22 -08:00
Jubilee
6c0e8ef86a
Rollup merge of #132095 - gechelberger:fix-131977, r=wesleywiser
Fix #131977 parens mangled in shared mut static lint suggestion

Resolves #131977 for static mut references after discussion with
Esteban & Jieyou on [t-compiler/help](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/linting.20with.20parens.20in.20the.20HIR).

This doesn't do anything to change the underlying issue if there are other expressions that generate lint suggestions which need to be applied within parentheses.
2024-11-07 18:48:21 -08:00
Jubilee
93e9ec05a9
Rollup merge of #131913 - jieyouxu:only_debug_assertions, r=onur-ozkan
Add `{ignore,needs}-{rustc,std}-debug-assertions` directive support

Add `{ignore,needs}-{rustc,std}-debug-assertions` compiletest directives and retire the old `{ignore,only}-debug` directives. The old `{ignore,only}-debug` directives were ambiguous because you could have std built with debug assertions but rustc not built with debug assertions or vice versa. If we want to support the use case of controlling test run based on if rustc was built with debug assertions, then having `{ignore,only}-debug` will be very confusing.

cc ````@matthiaskrgr````

Closes #123987.

r? bootstrap (or compiler tbh)
2024-11-07 18:48:21 -08:00
Jubilee
60e8ab6ba8
Rollup merge of #130586 - dpaoliello:fixrawdylib, r=wesleywiser
Set "symbol name" in raw-dylib import libraries to the decorated name

`windows-rs` received a bug report that mixing raw-dylib generated and the Windows SDK import libraries was causing linker failures: <https://github.com/microsoft/windows-rs/issues/3285>

The root cause turned out to be #124958, that is we are not including the decorated name in the import library and so the import name type is also not being correctly set.

This change modifies the generation of import libraries to set the "symbol name" to the fully decorated name and correctly marks the import as being data vs function.

Note that this also required some changes to how the symbol is named within Rust: for MSVC we now need to use the decorated name but for MinGW we still need to use partially decorated (or undecorated) name.

Fixes #124958

Passing i686 MSVC and MinGW build: <https://github.com/rust-lang/rust/actions/runs/11000433888?pr=130586>

r? `@ChrisDenton`
2024-11-07 18:48:20 -08:00
Celina G. Val
0ce579f6f3 [StableMIR] API to retrieve definitions from crates
Add functions to retrieve function definitions and static items from
all crates (local and external).

For external crates, add a query to retrieve the number of defs in a
foreign crate.
2024-11-07 13:11:46 -08:00
bors
b91a3a0560 Auto merge of #132472 - taiki-e:sparc-asm, r=Amanieu
Basic inline assembly support for SPARC and SPARC64

This implements asm_experimental_arch (tracking issue https://github.com/rust-lang/rust/issues/93335) for SPARC and SPARC64.

This PR includes:

- General-purpose registers `r[0-31]` (`reg` register class, LLVM/GCC constraint `r`)
  Supported types: i8, i16, i32, i64 (SPARC64-only)
  Aliases: `g[0-7]` (`r[0-7]`), `o[0-7]` (`r[8-15]`), `l[0-7]` (`r[16-23]`), `i[0-7]` (`r[24-31]`)
- `y` register (clobber-only, needed for clobber_abi)
- preserves_flags: Integer condition codes (`icc`, `xcc`) and floating-point condition codes (`fcc*`)

The following are *not* included:

- 64-bit integer support on SPARC-V8+'s global or out registers (`g[0-7]`, `o[0-7]`): GCC's `h` constraint (it seems that there is no corresponding constraint in LLVM?)
- Floating-point registers (LLVM/GCC constraint `e`/`f`):
  I initially tried to implement this, but postponed it for now because there seemed to be several parts in LLVM that behaved differently than in the LangRef's description.
- clobber_abi: Support for floating-point registers is needed.

Refs:
- LLVM
  - Reserved registers https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/Sparc/SparcRegisterInfo.cpp#L52
  - Register definitions https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/Sparc/SparcRegisterInfo.td
  - Supported constraints https://llvm.org/docs/LangRef.html#supported-constraint-code-list
- GCC
  - Reserved registers 63b6967b06/gcc/config/sparc/sparc.h (L633-L658)
  - Supported constraints https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html
- SPARC ISA/ABI
  - (64-bit ISA) The SPARC Architecture Manual, Version 9
    (32-bit ISA) The SPARC Architecture Manual, Version 8
    (64-bit ABI) System V Application Binary Interface SPARC Version 9 Processor Supplement, Rev 1.35
    (32-bit ABI) System V Application Binary Interface SPARC Processor Supplement, Third Edition
    The above docs can be downloaded from https://sparc.org/technical-documents
  - (32-bit V8+ ABI) The V8+ Technical Specification
    https://temlib.org/pub/SparcStation/Standards/V8plus.pdf

cc `@thejpster` (sparc-unknown-none-elf target maintainer)
(AFAIK, other sparc/sprac64 targets don't have target maintainers)

r? `@Amanieu`

`@rustbot` label +O-SPARC +A-inline-assembly
2024-11-07 21:07:06 +00:00
bors
57a8a7efdb Auto merge of #132736 - matthiaskrgr:rollup-66naqwb, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #132638 (Remove fixme comment about clobber_abi on PowerPC)
 - #132726 (Remove unused intercrate dependencies)
 - #132729 (Make fn_abi_sanity_check a bit stricter)
 - #132734 ( remove 'platform-intrinsic' ABI leftovers)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-07 18:22:59 +00:00
Matthias Krüger
fd41a373f3
Rollup merge of #132734 - RalfJung:platform-intrinsic, r=compiler-errors
remove 'platform-intrinsic' ABI leftovers

This was removed a while ago, but some parts haven't been fully cleaned up.
2024-11-07 18:19:38 +01:00
Matthias Krüger
bf0de1f308
Rollup merge of #132729 - bjorn3:fn_abi_extra_sanity_checks, r=compiler-errors
Make fn_abi_sanity_check a bit stricter

The Rust ABI must ignore all ZST arguments, all ignored arguments must be either ZST or uninhabited. And finally ScalarPair should never be passed as PassMode::Direct.
2024-11-07 18:19:38 +01:00
Matthias Krüger
77ba4f03b0
Rollup merge of #132726 - clubby789:unused-deps, r=compiler-errors
Remove unused intercrate dependencies

Checked by enabling `-Wunused-crate-dependencies`

`driver_impl` still depends on `index` to forward the `rustc_randomized_layouts` feature, and `rustc_main` depends on several unused crates for sysroot reasons

r? compiler
2024-11-07 18:19:37 +01:00
Matthias Krüger
27c193496d
Rollup merge of #132638 - taiki-e:ppc-asm-fixme, r=jieyouxu
Remove fixme comment about clobber_abi on PowerPC

This was considered an unresolved question in https://github.com/rust-lang/rust/pull/131341, but according to the ABI document published in 2011 by Power.org the current implementation is fine as-is.
https://github.com/rust-lang/rust/pull/131341#discussion_r1829358396

> According to [Power Architecture 32-bit Application Binary Interface Supplement 1.0 - Linux & Embedded](https://web.archive.org/web/20120608163804/https://www.power.org/resources/downloads/Power-Arch-32-bit-ABI-supp-1.0-Unified.pdf) published in 2011, PPC32 has the same convention here as PPC64.
>
> Therefore, we can just remove the FIXME comment here.

r? workingjubilee
2024-11-07 18:19:37 +01:00
Ralf Jung
fa0b97268a remove 'platform-intrinsic' ABI leftovers 2024-11-07 17:42:49 +01:00
bjorn3
c8f0b15a2d Make fn_abi_sanity_check a bit stricter
The Rust ABI must ignore all ZST arguments, all ignored arguments must
be either ZST or uninhabited. And finally ScalarPair should never be
passed as PassMode::Direct.
2024-11-07 15:54:40 +00:00
bors
9a77c3c2cb Auto merge of #132714 - mati865:update-memchr, r=tgross35
unpin and update memchr

I'm unable to build x86_64-pc-windows-gnu Rust due to some weird binutils bug, but thinlto issue seems to be no longer present. Let's give it a go on the CI.
Possibly fixed by https://github.com/rust-lang/rust/pull/129079

Fixes #127890
2024-11-07 15:34:14 +00:00
clubby789
b480f0f224 Remove unused intercrate dependencies 2024-11-07 14:17:16 +00:00
Taiki Endo
e2d50315ef Add links about clobber_abi on PowerPC 2024-11-07 22:21:27 +09:00
Taiki Endo
01b5a678c5 Remove fixme comment about clobber_abi on PowerPC 2024-11-07 22:13:15 +09:00
bors
3d1dba830a Auto merge of #132722 - joboet:rollup-0q67jyo, r=joboet
Rollup of 6 pull requests

Successful merges:

 - #132057 (miri: update ABI compat checks to accept Option-like types)
 - #132665 (Implement `div_ceil` for `NonZero<unsigned>`)
 - #132694 (fix(x): fix a regex used to find python executable)
 - #132707 (Add --diagnostic-width to some tests failing after 1a0c502183)
 - #132715 (fix `LazyLock::get` and `LazyLock::get_mut` document)
 - #132716 (chore(issue-template): fix branch name)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-07 13:03:03 +00:00
Taiki Endo
241f82ad91 Basic inline assembly support for SPARC and SPARC64 2024-11-07 21:19:03 +09:00
Jonas Böttiger
194ce894b6
Rollup merge of #132716 - ismailarilik:chore/issue-template/fix-branch-name, r=tgross35
chore(issue-template): fix branch name

It was renamed to "main" from "master".

It might seem not important (actually it is not important) but I think there is no need to see this every time when we clicked this link:

![image](https://github.com/user-attachments/assets/145dc587-c365-47e6-83da-69c17f409f71)

And this way is faster I guess.
2024-11-07 13:08:30 +01:00
Jonas Böttiger
0a0cadfe8a
Rollup merge of #132715 - tabokie:fix-lazy-lock-doc, r=Noratrieb
fix `LazyLock::get` and `LazyLock::get_mut` document
2024-11-07 13:08:29 +01:00
Jonas Böttiger
59582fb21a
Rollup merge of #132707 - zmodem:tests_vs_diagnostic_width, r=jieyouxu
Add --diagnostic-width to some tests failing after 1a0c502183

Otherwise the tests would fail depending on the execution environment.
2024-11-07 13:08:28 +01:00
Jonas Böttiger
7044cc7447
Rollup merge of #132694 - ismailarilik:fix/x/fix-a-regex-used-to-find-python-executable, r=jieyouxu
fix(x): fix a regex used to find python executable

Isn't the regex `^python[2-3]\.[0-9]\+$` wrong? It doesn't match, for example, with `python2.8`. There should be a plus sign at the end for a match, like `python2.8+`. I think `[0-9]+` is meant here instead of `[0-9]\+`. In that case a string like `python2.8` would match. This wasn't noticed because the script probably find and run the Python executable before this line.
2024-11-07 13:08:28 +01:00
Jonas Böttiger
49a58c8723
Rollup merge of #132665 - tyilo:nonzero-u-div-ceil, r=joboet
Implement `div_ceil` for `NonZero<unsigned>`

ACP: https://github.com/rust-lang/libs-team/issues/471
2024-11-07 13:08:27 +01:00
Jonas Böttiger
6b5a58c265
Rollup merge of #132057 - RalfJung:miri-abi-compat, r=wesleywiser
miri: update ABI compat checks to accept Option-like types

This implements the t-lang decision described [here](https://github.com/rust-lang/rust/pull/130628#issuecomment-2402761599).

Fixes https://github.com/rust-lang/miri/issues/3983
2024-11-07 13:08:27 +01:00
bors
fe43131683 Auto merge of #132635 - kiike:fix/dots_in_target, r=onur-ozkan
bootstrap: add quoting support to avoid splitting

With this change, it is now possible to pass quotes to the configure script, such as

`./configure.py --set=target.\"thumbv8m.main-none-eabi\".linker=/linker`
or
`./configure.py '--set=target."thumbv8m.main-none-eabi".linker=/linker'`

, which will treat `thumbv8.main-none-eabi` as a whole part. Currently, the string would be split into two elements: `thumbv8`, and `main-none-eabi`.

The approach taken is to perform custom splitting instead of using `str.split()` and then repairing the split. Also, There are numerous corner cases not handled: the custom split doesn't differentiate between single quotes or double quotes, so it is perfectly possible to pass `./configure.py --set=target.\"thumbv8m.main-none-eabi\'.linker=/linker` and the behaviour would be the same as with all double quotes or single quotes.

As for the code, i'm unsure on whether to delimit strings with double or single quotes. I've seen both single quotes and double quotes used to delimit strings, like in
```py
err("Option '{}' provided more than once".format(key))
```
and this a handful of lines down:
```py
if option.name == 'sccache':
    set('llvm.ccache', 'sccache', config)
```
Please advise on the wanted one.

Fixes #130602

r? `@onur-ozkan`

Thanks in advance for the feedback!
2024-11-07 09:50:31 +00:00
bors
9200cbc712 Auto merge of #132710 - matthiaskrgr:padautz, r=jieyouxu
more crash tests

r? `@jieyouxu`
2024-11-07 07:21:20 +00:00
ismailarilik
2e42b7600b chore(issue-template): fix branch name
It was renamed to "main" from "master".
2024-11-07 10:19:17 +03:00
bors
546a1eaab9 Auto merge of #132705 - kornelski:inline-repeat, r=tgross35
Inline str::repeat

`str` is non-generic and `str.repeat()` doesn't get inlined, which makes it use a slower algorithm in case of 1-char repetitions. Equivalent byte slice does get inlined: https://rust.godbolt.org/z/4arvh97r4
2024-11-07 04:26:33 +00:00
Xinye
557c7f8cdd fix lazylock comment
Signed-off-by: Xinye <xinye.tao@metabit-trading.com>
2024-11-07 10:51:00 +08:00
bors
775f6d8d9d Auto merge of #131888 - ChrisDenton:deopt, r=ibraheemdev
Revert using `HEAP` static in Windows alloc

Fixes #131468

This does the minimum to remove the `HEAP` static that was causing chromium issues. It would be worth having a more substantial look at this module but for now I think this addresses the immediate issue.

cc `@danakj`
2024-11-07 01:23:47 +00:00
Mateusz Mikuła
7cdbb59c26 unpin and update memchr 2024-11-07 02:09:39 +01:00
bors
c07aa1e171 Auto merge of #132625 - compiler-errors:cache-only-if-opaque, r=lcnr
Only disable cache if predicate has opaques within it

This is an alternative to https://github.com/rust-lang/rust/pull/132075.

This refines the check implemented in https://github.com/rust-lang/rust/pull/126024 to only disable the global cache if the predicate being considered has opaques in it. This is still theoretically unsound, since goals can indirectly rely on opaques in the defining scope, but we're much less likely to hit it.

It doesn't totally fix https://github.com/rust-lang/rust/issues/132064: for example, `lemmy` goes from 1:29 (on rust 1.81) to 9:53 (on nightly) to 4:07 (after this PR). But I think it's at least *more* sound than a total revert :/

r? lcnr
2024-11-06 21:22:14 +00:00
Matthias Krüger
9b286cf088 more crash tests 2024-11-06 22:10:23 +01:00
Enric Morales
8471c6bb0c
bootstrap: add quoting support to avoid splitting
With this change, it is now possible to pass quotes to the configure
script, such as

`./configure.py --set=target.\"thumbv8m.main-none-eabi\".linker=/linker`

, which will treat `thumbv8.main-none-eabi` as a whole part. Currently,
the string would be split into two elements: `thumbv8`, and
`main-none-eabi`.
2024-11-06 21:03:02 +01:00
Hans Wennborg
029add206f Add --diagnostic-width to some tests failing after 1a0c502183
Otherwise the tests would fail depending on the execution environment.
2024-11-06 20:02:42 +01:00
Kornel
5a855654de Inline str::repeat 2024-11-06 18:54:50 +00:00
bors
8549802939 Auto merge of #132703 - GuillaumeGomez:rollup-tfuef34, r=GuillaumeGomez
Rollup of 3 pull requests

Successful merges:

 - #132617 (Fix an extra newline in rendered std doc)
 - #132698 (Remove unneeded fields in `scrape_examples::FindCalls`)
 - #132700 (add note not to re-report crashes from `crashes` tests)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-06 18:53:35 +00:00
Guillaume Gomez
4c7e92f76b
Rollup merge of #132700 - matthiaskrgr:plzno, r=fmease
add note not to re-report crashes from `crashes` tests

for reasons... 😅
r? `@fmease`
2024-11-07 02:09:53 +08:00
Guillaume Gomez
d150498be4
Rollup merge of #132698 - GuillaumeGomez:rm-unneeded-fields, r=notriddle
Remove unneeded fields in `scrape_examples::FindCalls`

Just a small cleanup while going through something bigger.

r? `@notriddle`
2024-11-07 02:09:52 +08:00
Guillaume Gomez
d6a43d4724
Rollup merge of #132617 - uellenberg:fix-rendered-doc, r=cuviper
Fix an extra newline in rendered std doc

Fixes #132564

![17308581942254367500907812250579](https://github.com/user-attachments/assets/9e946c49-c0a6-40ba-ab69-b80fe0e085e1)
(taken from the issue above)

The problem with the formatting is due to that newline between `<code>` and `<svg>`. Any newlines outside of the code (i.e., within elements inside of it) are fine.
2024-11-07 02:09:51 +08:00
Matthias Krüger
da5102c172 add note not to re-report crashes from crashes tests 2024-11-06 18:07:47 +01:00
Guillaume Gomez
03a63fd4a4 Remove unneeded fields in scrape_examples::FindCalls 2024-11-06 17:35:14 +01:00
bors
116fc31c5c Auto merge of #132697 - compiler-errors:async-closure-sugar, r=fmease
Clean middle generics using paren sugar if trait has `#[rustc_paren_sugar]`

That is to say, generalize the `Fn()` paren sugar handling to *any* trait that is marked with `rustc_paren_sugar`. This means that `AsyncFn` is also covered here.

r? fmease
2024-11-06 16:22:16 +00:00
Michael Goulet
7d8ca6d4fc Clean middle generics using paren sugar if trait has rustc_paren_sugar 2024-11-06 15:50:50 +00:00
ismailarilik
e0b98c739a fix(x): fix a regex used to find python executable 2024-11-06 16:40:02 +03:00
bors
4d215e2426 Auto merge of #132404 - makai410:suggest-swap-lhs-rhs, r=fee1-dead
Suggest swapping LHS and RHS when RHS impls `PartialEq<lhs_ty>`

Closes: #130495
r? `@fee1-dead`
2024-11-06 11:49:52 +00:00
bors
2796048328 Auto merge of #131721 - okaneco:const_eq_ignore_ascii_case, r=m-ou-se
Add new unstable feature `const_eq_ignore_ascii_case`

Tracking issue - #131719

Mark `[u8]`, `str` `eq_ignore_ascii_case` functions const

---

The codegen for this implementation matches the existing `iter::zip` implementation better than incrementing with a counter

while loop with counter - https://rust.godbolt.org/z/h9cs5zajc
while let - https://rust.godbolt.org/z/ecMeMjjEb
2024-11-06 09:08:53 +00:00
bors
e1fb288562 Auto merge of #132663 - estebank:e0320-tweak, r=compiler-errors
Tweak E0320 overflow error wording

Surround type with backticks as we should in every error.
2024-11-06 06:40:17 +00:00
bors
cf2b370ad0 Auto merge of #132500 - RalfJung:char-is-whitespace-const, r=jhpratt
make char::is_whitespace unstably const

I am adding this to the existing https://github.com/rust-lang/rust/issues/132241 feature gate, since `is_digit` and `is_whitespace` seem similar enough that one can group them together.
2024-11-06 04:07:32 +00:00