Commit Graph

229941 Commits

Author SHA1 Message Date
Guillaume Gomez
6fb4ce9f88 Fix invalid display of inlined re-export 2023-07-18 10:41:15 +02:00
bors
0f16bd341e Auto merge of #113659 - ericmarkmartin:smir-refs-and-ptrs, r=spastorino
Add ty convs for smir refs and ptrs

r? `@spastorino`
2023-07-18 07:22:33 +00:00
bors
6b9236ed5a Auto merge of #113801 - compiler-errors:iter-instantiated, r=oli-obk
Rename `arg_iter` to `iter_instantiated`

`arg_iter` doesn't make sense, and doesn't really indicate what it's doing (returning an iterator that ~~substitutes~~ instantiates its elements).

`iter_instantiated_copied` is kinda awkward but i don't really wanna bikeshed it.

r? `@oli-obk`
2023-07-18 05:33:23 +00:00
Ed Page
2779d15317 docs(release): Remove nightly-only cargo item
See rust-lang/cargo#12343
2023-07-17 21:53:19 -05:00
bors
ec362f0ae8 Auto merge of #113574 - GuillaumeGomez:rustdoc-json-strip-hidden-impl, r=aDotInTheVoid,notriddle
Strip impl if not re-exported and is doc(hidden)

Part of #112852.

r? `@aDotInTheVoid`
2023-07-18 02:47:03 +00:00
许杰友 Jieyou Xu (Joe)
33bd453f35
Fix removal span calculation of unused_qualifications suggestion 2023-07-18 09:52:08 +08:00
Eric Mark Martin
c8ee46be75 conversions to smir RawPtr and Ref 2023-07-17 21:08:49 -04:00
Eric Mark Martin
08e89acd2e add RawPtr 2023-07-17 20:47:27 -04:00
Eric Mark Martin
285920ea2d move const definition 2023-07-17 20:47:27 -04:00
bors
745efcc7d9 Auto merge of #113061 - Amanieu:x86_64-ohos, r=compiler-errors
Add x86_64-unknown-linux-ohos target

This complements the existing `aarch64-unknown-linux-ohos` and `armv7-unknown-linux-ohos` targets.

This should be covered by the existing MCP (https://github.com/rust-lang/compiler-team/issues/568), but I can also create a new MCP if that is preferred.
2023-07-18 00:19:18 +00:00
bors
da6b55cc5e Auto merge of #89132 - Cyborus04:rc_allocator_support, r=Amanieu
Add support for allocators in `Rc` & `Arc`

Adds the ability for `std::rc:Rc`, `std::rc::Weak`, `std::sync::Arc`, and `std::sync::Weak` to live in custom allocators
2023-07-17 21:51:46 +00:00
Guillaume Gomez
c132cdbe5f Improve issue-112852 tests 2023-07-17 23:36:47 +02:00
Michael Goulet
05f6890b3e Rename arg_iter to iter_instantiated 2023-07-17 21:04:12 +00:00
James Farrell
c59b82353d Better diagnostics for dlltool errors.
When dlltool fails, show the full command that was executed. In
particular, llvm-dlltool is not very helpful, printing a generic usage
message rather than what actually went wrong, so stdout and stderr
aren't of much use when troubleshooting.
2023-07-17 20:20:01 +00:00
bors
1787f31290 Auto merge of #113720 - eduardosm:miri-target-feature, r=RalfJung,oli-obk
miri: fail when calling a function that requires an unavailable target feature

miri will report an UB when calling a function that has a `#[target_feature(enable = ...)]` attribute is called and the required feature is not available.

"Available features" are the same that `is_x86_feature_detected!` (or equivalent) reports to be available during miri execution (which can be enabled or disabled with the `-C target-feature` flag).
2023-07-17 19:57:37 +00:00
Wesley Wiser
12bed9d8cc Update natvis to match full type names for Arc, Rc, Weak, etc
Also update a test case to have the correct whitespace in a type name.
2023-07-17 15:51:46 -04:00
bors
4eaad89dce Auto merge of #113686 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`
2023-07-17 18:04:55 +00:00
Bryan Garza
ef50e204f3 Safe Transmute: Fix ICE (due to UnevaluatedConst)
This patch updates the code that looks at the `Assume` type when evaluating if
transmutation is possible. An ICE was being triggered in the case that the
`Assume` parameter contained an unevaluated const (in this test case, due to a
function with missing parameter names).

Fixes #110892
2023-07-17 09:43:35 -07:00
bors
c4e6fe9240 Auto merge of #113714 - Kobzol:ci-cmake, r=nikic
CI: build CMake 3.20 to support LLVM 17

LLVM 17 will require CMake at least 3.20, so we have to go back to building our own CMake on the Linux x64 dist builder.

r? `@nikic`
2023-07-17 15:46:43 +00:00
bors
b3c7a7e749 Auto merge of #113791 - lnicola:sync-from-ra, r=lnicola
⬆️ `rust-analyzer`

r? `@ghost`
2023-07-17 13:54:44 +00:00
Laurențiu Nicola
d35f6c6c11 Merge commit '37f84c101bca43b11027f30ab0c2852f9325bc3d' into sync-from-ra 2023-07-17 16:49:15 +03:00
bors
37f84c101b Auto merge of #15301 - bjorn3:uncompressed_dylib_metadata, r=lnicola
Support reading uncompressed proc macro metadata

rust-lang/rust#113695 makes the dylib metadata uncompressed for perf reasons. This commit allows reading both the current compressed and future uncompressed dylib metadata.
2023-07-17 13:31:41 +00:00
bjorn3
17a6bb557e Support reading uncompressed proc macro metadata
rust-lang/rust#113695 makes the dylib metadata uncompressed for perf
reasons. This commit allows reading both the current compressed and
future uncompressed dylib metadata.
2023-07-17 13:30:19 +00:00
lcnr
8a0802089c exhaustive matches are good 2023-07-17 15:12:21 +02:00
bors
81744506ca Auto merge of #15302 - lnicola:sync-from-rust, r=lnicola
minor: Sync from rust
2023-07-17 13:10:31 +00:00
Laurențiu Nicola
71499fcd22 Merge remote-tracking branch 'upstream/master' into sync-from-rust 2023-07-17 16:09:39 +03:00
bors
1a8d09468f Auto merge of #113782 - matthiaskrgr:rollup-mmrjvx3, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #112741 (fix typo in `rustdoc/src/what-is-rustdoc.md`)
 - #113535 (Add a sparc-unknown-none-elf target.)
 - #113651 (self type param infer, avoid ICE)
 - #113770 (Generate safe stable code for derives on empty enums)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-17 12:07:38 +00:00
Matthias Krüger
93b9812be8
Rollup merge of #113770 - dtolnay:derivevoid, r=compiler-errors,nnethercote
Generate safe stable code for derives on empty enums

Generate `match *self {}` instead of `unsafe { core::intrinsics::unreachable() }`.

This is:

1. safe
2. stable

for the benefit of everyone looking at these derived impls through `cargo expand`.

[Both expansions compile to the same code at all optimization levels (including `0`).](https://rust.godbolt.org/z/P79joGMh3)
2023-07-17 12:58:54 +02:00
Matthias Krüger
eca9c0101c
Rollup merge of #113651 - lcnr:parent-def-id, r=compiler-errors
self type param infer, avoid ICE

fixes #113610, which is caused by 33a2c2487a/compiler/rustc_hir_analysis/src/collect/generics_of.rs (L190-L205)
2023-07-17 12:58:53 +02:00
Matthias Krüger
e31ebae35a
Rollup merge of #113535 - jonathanpallant:sparc-bare-metal, r=jackh726
Add a sparc-unknown-none-elf target.

# `sparc-unknown-none-elf`

**Tier: 3**

Rust for bare-metal 32-bit SPARC V7 and V8 systems, e.g. the Gaisler LEON3.

## Target maintainers

- Jonathan Pallant, `jonathan.pallant@ferrous-systems.com`, https://ferrous-systems.com

## Requirements

> Does the target support host tools, or only cross-compilation?

Only cross-compilation.

> Does the target support std, or alloc (either with a default allocator, or if the user supplies an allocator)?

Only tested with `libcore` but I see no reason why you couldn't also support `liballoc`.

> Document the expectations of binaries built for the target. Do they assume
specific minimum features beyond the baseline of the CPU/environment/etc? What
version of the OS or environment do they expect?

Tested by linking with a standard SPARC bare-metal toolchain - specifically I used the [BCC2] toolchain from Gaisler (both GCC and clang variants, both pre-compiled for x64 Linux and compiling my own SPARC GCC from source to run on `aarch64-apple-darwin`).

The target is set to use the lowest-common-denominator `SPARC V7` architecture (yes, they started at V7 - see [Wikipedia](https://en.wikipedia.org/wiki/SPARC#History)).

[BCC2]: https://www.gaisler.com/index.php/downloads/compilers

> Are there notable `#[target_feature(...)]` or `-C target-feature=` values that
programs may wish to use?

`-Ctarget-cpu=v8` adds the instructions added in V8.

`-Ctarget-cpu=leon3` adds the V8 instructions and sets up scheduling to suit the Gaisler LEON3.

> What calling convention does `extern "C"` use on the target?

I believe this is defined by the SPARC architecture reference manuals and V7, V8 and V9 are all compatible.

> What format do binaries use by default? ELF, PE, something else?

ELF

## Building the target

> If Rust doesn't build the target by default, how can users build it? Can users
just add it to the `target` list in `config.toml`?

Yes. I did:

```toml
target = ["aarch64-apple-darwin", "sparc-unknown-none-elf"]
```

## Building Rust programs

> Rust does not yet ship pre-compiled artifacts for this target. To compile for
this target, you will either need to build Rust with the target enabled (see
"Building the target" above), or build your own copy of `core` by using
`build-std` or similar.

Correct.

## Testing

> Does the target support running binaries, or do binaries have varying
expectations that prevent having a standard way to run them?

No - it's a bare metal platform.

> If users can run binaries, can they do so in some common emulator, or do they need native
hardware?

But if you use [BCC2] as the linker, you get default memory map suitable for the LEON3, and a default BSP for the LEON3, and so you can run the binaries in the `tsim-leon3` simulator from Gaisler.

```console
$ cat .cargo/config.toml | grep runner
runner = "tsim-leon3 -c sim-commands.txt"
$ cat sim-commands.txt
run
quit
$ cargo +sparcrust run --targe=sparc-unknown-none-elf
   Compiling sparc-demo-rust v0.1.0 (/work/sparc-demo-rust)
    Finished dev [unoptimized + debuginfo] target(s) in 3.44s
     Running `tsim-leon3 -c sim-commands.txt target/sparc-unknown-none-elf/debug/sparc-demo-rust`

 TSIM3 LEON3 SPARC simulator, version 3.1.9 (evaluation version)

 Copyright (C) 2023, Frontgrade Gaisler - all rights reserved.
 This software may only be used with a valid license.
 For latest updates, go to https://www.gaisler.com/
 Comments or bug-reports to support@gaisler.com

 This TSIM evaluation version will expire 2023-11-28

Number of CPUs: 2
system frequency: 50.000 MHz
icache: 1 * 4 KiB, 16 bytes/line (4 KiB total)
dcache: 1 * 4 KiB, 16 bytes/line (4 KiB total)
Allocated 8192 KiB SRAM memory, in 1 bank at 0x40000000
Allocated 32 MiB SDRAM memory, in 1 bank at 0x60000000
Allocated 8192 KiB ROM memory at 0x00000000
section: .text, addr: 0x40000000, size: 104400 bytes
section: .rodata, addr: 0x400197d0, size: 15616 bytes
section: .data, addr: 0x4001d4d0, size: 1176 bytes
read 1006 symbols

  Initializing and starting from 0x40000000
Hello, this is Rust!
PANIC: PanicInfo { payload: Any { .. }, message: Some(I am a panic), location: Location { file: "src/main.rs", line: 33, col: 5 }, can_unwind: true }

  Program exited normally on CPU 0.
```

> Does the target support running the Rust testsuite?

I don't think so, the testsuite requires `libstd` IIRC.

## Cross-compilation toolchains and C code

> Does the target support C code?

Yes.

> If so, what toolchain target should users use to build compatible C code? (This may match the target triple, or it may be a toolchain for a different target triple, potentially with specific options or caveats.)

I suggest [BCC2] from Gaisler. It comes in both GCC and Clang variants.
2023-07-17 12:58:53 +02:00
Matthias Krüger
cfeeab5ce0
Rollup merge of #112741 - geometryolife:fix, r=workingjubilee
fix typo in `rustdoc/src/what-is-rustdoc.md`
2023-07-17 12:58:52 +02:00
Philipp Krones
8ca13e8338
Another fix for incorrect_impls 2023-07-17 10:22:49 +02:00
Philipp Krones
c2490bdc44
Update Cargo.lock/toml
Remove clippy_test_deps from Cargo.toml
2023-07-17 10:22:41 +02:00
Philipp Krones
561303d74c
Merge commit 'd9c24d1b1ee61f276e550b967409c9f155eac4e3' into clippyup 2023-07-17 10:22:32 +02:00
Camille GILLOT
fdc93f307f Do not fetch HIR in native_libs. 2023-07-17 07:37:03 +00:00
Camille GILLOT
51e1f7a561 Simplify foreign_modules. 2023-07-17 07:37:03 +00:00
Jakub Beránek
e95caa7b72 Link to execinfo on NetBSD 2023-07-17 08:30:54 +02:00
bors
6f65ef5717 Auto merge of #113562 - saethlin:larger-incr-comp-offset, r=nnethercote
Use u64 for incr comp allocation offsets

Fixes https://github.com/rust-lang/rust/issues/76037
Fixes https://github.com/rust-lang/rust/issues/95780
Fixes https://github.com/rust-lang/rust/issues/111613

These issues are all reporting ICEs caused by using `u32` to store offsets to allocations in the incremental compilation cache. This PR aims to lift that limitation by changing the offset type in question to `u64`.

There are two perf runs in this PR. The first reports a regression, and the second does not. The changes are the same in both. I rebased the PR then did the second perf run because I noticed that the primary regression in it was very commonly seen in spurious regression reports.

I do not know what the perf run will report when this is merged. I would not be surprised to see regression or neutral, but the cachegrind diffs for the regression point at `try_mark_previous_green` which is a common source of inexplicable regressions and I don't think should be perturbed by this PR.

I'm not opposed to adding a regression test such as
```rust
fn main() {
    println!("{}", [37; 1 << 30].len());
}
```
But that program takes 1 minute to compile and consumes 4.6 GB of memory then writes that much to disk. Is that a concerning amount of resource use for a test?

r? `@nnethercote`
2023-07-17 04:45:10 +00:00
bors
299179e694 Auto merge of #113772 - nnethercote:streamline-size-estimates-2, r=wesleywiser
Streamline size estimates (take 2)

This was merged in #113684 but then [something happened](https://github.com/rust-lang/rust/pull/113684#issuecomment-1636811985):

> There has been a bors issue that lead to the merge commit of this PR getting purged from master.
> You'll have to make a new PR to reapply it.

So this is exactly the same changes.

`@bors` r=wesleywiser
2023-07-17 02:56:10 +00:00
bors
4c7af429f3 Auto merge of #113336 - compiler-errors:new-solver-iat, r=lcnr
Add support for inherent projections in new solver

Not hard to support these, and it cuts out a really big chunk of failing UI tests with `--compare-mode=next-solver`

r? `@lcnr` (feel free to reassign, anyone can review this)
2023-07-17 01:06:36 +00:00
bors
f1eab64d4f Auto merge of #113769 - matthiaskrgr:rollup-p6i1rco, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #113042 (Add Platform Support documentation for MIPS Release 6 targets)
 - #113539 (fixed typo)
 - #113614 (platform-support.md: It's now verified that NetBSD/riscv64 can self-h…)
 - #113750 (Add missing italicization to `sort_unstable_by_key` complexity )
 - #113755 (Normalize lazy type aliases when probing for ADTs)
 - #113756 (fix wrong link)
 - #113762 (Fix typo)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-16 23:14:36 +00:00
Nicholas Nethercote
005a70e303 Remove instance_def_size_estimate query.
It doesn't seem worthwhile now that `MonoItem::size_estimate` is called
much less often.
2023-07-17 08:44:48 +10:00
Nicholas Nethercote
87c509da95 Ignore unreachable inlined items in debug_dump.
They're quite rare, and ignoring them simplifies things quite a bit, and
further reduces the number of calls to `MonoItem::size_estimate` to the
number of placed items (one per root item, and one or more per reachable
inlined item).
2023-07-17 08:44:48 +10:00
Nicholas Nethercote
edd1f3827e Store item size estimate in MonoItemData.
This means we call `MonoItem::size_estimate` (which involves a query)
less often: just once per mono item, and then once more per inline item
placement. After that we can reuse the stored value as necessary. This
means `CodegenUnit::compute_size_estimate` is cheaper.
2023-07-17 08:44:48 +10:00
Nicholas Nethercote
b52f9eb6ca Introduce MonoItemData.
It replaces `(Linkage, Visibility)`, making the code nicer. Plus the
next commit will add another field.
2023-07-17 08:44:48 +10:00
David Tolnay
56633b3f51
Add a comparison between match *self and intrinsics::unreachable() 2023-07-16 15:33:29 -07:00
Matthias Krüger
a7d31deb1d
Rollup merge of #113762 - alexpovel:master, r=Nilstrieb
Fix typo

Typo in a docstring, noticed [here](https://doc.rust-lang.org/std/result/enum.Result.html#method.map_or).
2023-07-17 00:14:07 +02:00
Matthias Krüger
d52865100a
Rollup merge of #113756 - catandcoder:master, r=workingjubilee
fix wrong link
2023-07-17 00:14:06 +02:00
Matthias Krüger
b42ada2b12
Rollup merge of #113755 - fmease:probe-adt-norm-lazy-ty-alias, r=oli-obk
Normalize lazy type aliases when probing for ADTs

Fixes #113736.

r? ```@oli-obk```
2023-07-17 00:14:06 +02:00
Matthias Krüger
80599b93a4
Rollup merge of #113750 - nipzu:italicize-sort-complexity, r=workingjubilee
Add missing italicization to `sort_unstable_by_key` complexity

Other methods like `sort_by_key` already had `m` italicized.
2023-07-17 00:14:05 +02:00