Commit Graph

232768 Commits

Author SHA1 Message Date
Weihang Lo
81a24922e7
lint: translate RenamedOrRemovedLint 2023-08-24 01:09:46 +01:00
Mark Rousskov
0a916062aa Bump cfg(bootstrap) 2023-08-23 20:05:14 -04:00
bors
4410868798 Auto merge of #106511 - MaskRay:gotpcrelx, r=nikic
Default relax_elf_relocations to true

This option tells LLVM to emit relaxable relocation types R_X86_64_GOTPCRELX/R_X86_64_REX_GOTPCRELX/R_386_GOT32X in applicable cases. True matches Clang's CMake default since 2020-08 [1] and latest LLVM default[2].

This also works around a GNU ld<2.41 issue[2] when using general-dynamic/local-dynamic TLS models in `-Z plt=no` mode with latest LLVM.

[1]: c41a18cf61
[2]: 2aedfdd9b8
[3]: https://sourceware.org/bugzilla/show_bug.cgi?id=24784
2023-08-23 22:26:31 +00:00
Esteban Küber
c1a7af0f2a Suggest mutable borrow on read only for-loop that should be mutable
```
error[E0596]: cannot borrow `*test` as mutable, as it is behind a `&` reference
  --> $DIR/suggest-mut-iterator.rs:22:9
   |
LL |     for test in &tests {
   |                 ------ this iterator yields `&` references
LL |         test.add(2);
   |         ^^^^ `test` is a `&` reference, so the data it refers to cannot be borrowed as mutable
   |
help: use a mutable iterator instead
   |
LL |     for test in &mut tests {
   |                  +++
```

Address #114311.
2023-08-23 21:46:18 +00:00
Noah Lev
912d11d4d1 Fix rustdoc-json tests 2023-08-23 11:52:49 -07:00
Noah Lev
d4ab99d946 rustdoc: Rename typedef to type alias in jsondoclint 2023-08-23 11:47:35 -07:00
John Kåre Alsaker
246a6a6589 Extend comment on assertion 2023-08-23 20:16:22 +02:00
Fangrui Song
f3d81917fc Default relax_elf_relocations to true
This option tells LLVM to emit relaxable relocation types
R_X86_64_GOTPCRELX/R_X86_64_REX_GOTPCRELX/R_386_GOT32X in applicable cases. True
matches Clang's CMake default since 2020-08 [1] and latest LLVM default[2].

This also works around a GNU ld<2.41 issue[3] when using
general-dynamic/local-dynamic TLS models in `-Z plt=no` mode with latest LLVM.

[1]: c41a18cf61
[2]: 2aedfdd9b8
[3]: https://sourceware.org/bugzilla/show_bug.cgi?id=24784
2023-08-23 11:12:30 -07:00
bors
249595b752 Auto merge of #115112 - tmandry:backtrace-0369, r=compiler-errors
Bump backtrace to 0.3.69
2023-08-23 18:01:35 +00:00
John Kåre Alsaker
6101ddd793 Check that the old values match 2023-08-23 19:50:24 +02:00
bors
8e8231f64e Auto merge of #115137 - GuillaumeGomez:rollup-37jqoyg, r=GuillaumeGomez
Rollup of 6 pull requests

Successful merges:

 - #114696 (Fix a pthread_t handle leak #114610)
 - #115102 (Improve note for the `invalid_reference_casting` lint)
 - #115103 (Disable bootstrap rustc version check)
 - #115106 (ArchiveWrapper: handle LLVM API update)
 - #115109 (Skip ExpandYamlAnchors when the config is missing)
 - #115135 (Rustdoc: Add unstable --no-html-source flag)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-23 16:10:43 +00:00
Camille GILLOT
1c5f1762b7 Do not convert copies of packed projections to moves. 2023-08-23 16:09:57 +00:00
Guillaume Gomez
5cbc00fb7e
Rollup merge of #115135 - GuillaumeGomez:no-html-source-flag, r=notriddle
Rustdoc: Add unstable --no-html-source flag

Fixes https://github.com/rust-lang/rust/issues/115060.

This is the equivalent of `#![doc(no_html_source)]` but on the command-line. It disables the generation of the source pages (and of the links pointing to them as well).

The motivation behind this is to enable to reduce documentation size when generating it in some locations without enforcing this to end users or adding a new feature to enable/disable the crate attribute.

r? `@notriddle`
2023-08-23 17:46:35 +02:00
Guillaume Gomez
b88610fdb7
Rollup merge of #115109 - cuviper:yaml-404, r=albertlarsan68
Skip ExpandYamlAnchors when the config is missing

The dist-src tarball does not include `.github/` at all, so we can't
check whether it needs to be regenerated.
2023-08-23 17:46:35 +02:00
Guillaume Gomez
8c24ce115e
Rollup merge of #115106 - durin42:llvm-18-symtabwritingmode, r=nikic
ArchiveWrapper: handle LLVM API update

In llvm/llvm-project@f740bcb370 a boolean parameter changed to an enum.

r? ``@nikic``
``@rustbot`` label: +llvm-main
2023-08-23 17:46:35 +02:00
Guillaume Gomez
b3949c0174
Rollup merge of #115103 - djkoloski:disable_bootstrap_version_check, r=compiler-errors
Disable bootstrap rustc version check

Mitigates #115065
2023-08-23 17:46:34 +02:00
Guillaume Gomez
c9dbff2f42
Rollup merge of #115102 - Urgau:invalid_ref_casting-book-note, r=est31
Improve note for the `invalid_reference_casting` lint

This PR add link to the book interior mutability chapter, https://doc.rust-lang.org/book/ch15-05-interior-mutability.html; this is done to guide peoples to a place with many useful information and context.

*Note that this isn't the first occurrence of a link to the book in [tests outputs](https://github.com/search?q=repo%3Arust-lang%2Frust+book+path%3A%2F%5Etests%5C%2Fui%5C%2F%2F&type=code).*

r? `@est31`
2023-08-23 17:46:34 +02:00
Guillaume Gomez
128ff0897b
Rollup merge of #114696 - g0djan:godjan/fix_114610, r=Mark-Simulacrum
Fix a pthread_t handle leak #114610

https://github.com/rust-lang/rust/issues/114610

Ran the tests as described in https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support/wasm32-wasi-preview1-threads.md?plain=1#L125
2023-08-23 17:46:33 +02:00
Jakub Beránek
9cabc91a5f Use LLVM 17 as the host compiler 2023-08-23 16:56:55 +02:00
Eric Mark Martin
107cb5c904
predicates of 2023-08-23 11:47:13 -03:00
Guillaume Gomez
73ccfc5683 Update run-make/issue-88756-default-output test 2023-08-23 16:33:07 +02:00
Guillaume Gomez
d3f35e96c1 Add test for --no-html-source flag 2023-08-23 15:54:04 +02:00
Guillaume Gomez
7ab27c5ed5 Add unstable --no-html-source rustdoc flag 2023-08-23 15:53:48 +02:00
Eric Mark Martin
735e9c0c51
stable types for predicates 2023-08-23 10:43:10 -03:00
bors
97fff1f2ed Auto merge of #114790 - taiki-e:asm-maybe-uninit, r=Amanieu
Allow MaybeUninit in input and output of inline assembly

**Motivation:**

As part of the work to remove UBs from crossbeam's AtomicCell, I'm writing a library to implement atomic operations on MaybeUnint using inline assembly ([atomic-maybe-uninit](https://github.com/taiki-e/atomic-maybe-uninit), https://github.com/crossbeam-rs/crossbeam/pull/1015).

However, currently, MaybeUnint cannot be used in input&output of inline assembly, so when processing MaybeUninit, values must be [passed through memory](https://github.com/taiki-e/atomic-maybe-uninit/blob/main/src/arch/aarch64.rs#L121-L122). It is inefficient and microbenchmarks have [actually shown significant performance degradation](https://github.com/crossbeam-rs/crossbeam/pull/1015#issuecomment-1676549870).

It would be nice if we could allow MaybeUninit in input and output of inline assembly.

---

This PR changed the type check in rustc_hir_analysis to allow `MaybeUnint<int | float | ptr | fn ptr | simd vector>` in input and output of inline assembly and added a simple test.

To be honest, I'm not sure that this is the correct way to do it, because this is like doing transmute to integers/floats/etc from MaybeUninit on the compiler side. EDIT: [this seems fine](https://rust-lang.zulipchat.com/#narrow/stream/216763-project-inline-asm/topic/MaybeUninit.20in.20asm!/near/384662900)

r? `@Amanieu`
cc `@thomcc` (because you [had previously proposed this](https://rust-lang.zulipchat.com/#narrow/stream/216763-project-inline-asm/topic/MaybeUninit.20in.20asm!))
2023-08-23 13:40:41 +00:00
Taiki Endo
03fd2d4379 Allow MaybeUninit in input and output of inline assembly 2023-08-23 21:57:18 +09:00
bors
544dea6aee Auto merge of #115123 - cuviper:llvm-17-rc3, r=nikic
Update LLVM submodule to 17.0.0-rc3
2023-08-23 11:20:51 +00:00
Urgau
aa7730003e Improve note for the invalid_reference_casting lint
Add link to the book interior mutability chapter,
https://doc.rust-lang.org/book/ch15-05-interior-mutability.html.
2023-08-23 11:27:33 +02:00
bors
3475fa74e1 Auto merge of #113986 - MaskRay:freebsd, r=nikic
ci: Update FreeBSD and illumos binutils to 2.40

The current old 2.25 seems to cause trouble to #106511.

Install texinfo to dist-x86_64-freebsd/Dockerfile like other containers
to fix
```
  MAKEINFO doc/bfd.info
/binutils/binutils-2.40/missing: 81: /binutils/binutils-2.40/missing: makeinfo: not found
WARNING: 'makeinfo' is missing on your system.
```

---

https://www.freshports.org/devel/binutils uses 2.40 for FreeBSD 12.x as well.

`@nikic`
2023-08-23 09:02:08 +00:00
bors
810573919f Auto merge of #115126 - Dylan-DPC:rollup-g6w3qjd, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #114930 (Automatically add OS labels to std PRs)
 - #115053 (docs: Add example, reference link for `type` keyword.)
 - #115092 (Add generics_of to smir)
 - #115096 (Add regression test for not `memcpy`ing padding bytes)
 - #115100 (Add support for `ptr::write`s for the `invalid_reference_casting` lint)
 - #115114 (Contents of reachable statics is reachable)
 - #115122 (Fix clippy lint for identical `if`/`else` contraining `?` expressions)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-23 07:16:47 +00:00
Dylan DPC
867a12d994
Rollup merge of #115122 - estebank:fix-clippy, r=Manishearth
Fix clippy lint for identical `if`/`else` contraining `?` expressions

Follow up to #114819.
2023-08-23 05:35:18 +00:00
Dylan DPC
0a78123b55
Rollup merge of #115114 - tmiasko:115052, r=compiler-errors
Contents of reachable statics is reachable

Fixes #115052.
2023-08-23 05:35:18 +00:00
Dylan DPC
7257e9c2de
Rollup merge of #115100 - Urgau:invalid_ref_casting-ptr-writes, r=est31
Add support for `ptr::write`s for the `invalid_reference_casting` lint

This PR adds support for `ptr::write` and others for the `invalid_reference_casting` lint.

Detecting instances where instead of using the deref (`*`) operator to assign someone uses `ptr::write`, `ptr::write_unaligned` or `ptr::write_volatile`.

```rust
let data_len = 5u64;

std::ptr::write(
    std::mem::transmute::<*const u64, *mut u64>(&data_len),
    new_data_len,
);
```

r? ``@est31``
2023-08-23 05:35:17 +00:00
Dylan DPC
391cbdaa7c
Rollup merge of #115096 - kadiwa4:no_memcpy_padding, r=cjgillot
Add regression test for not `memcpy`ing padding bytes

Closes #56297

See this comparison: https://rust.godbolt.org/z/jjzfonfcE

I don't have any experience with codegen tests, I hope this is correct
2023-08-23 05:35:17 +00:00
Dylan DPC
d99466d84e
Rollup merge of #115092 - ouz-a:smir_generic_of, r=spastorino
Add generics_of to smir

Continuing our covering of smir.

r? `@spastorino`
2023-08-23 05:35:16 +00:00
Dylan DPC
21411c4db5
Rollup merge of #115053 - waywardmonkeys:augment-type-keyword-docs, r=cuviper
docs: Add example, reference link for `type` keyword.

Fixes #114281.
2023-08-23 05:35:16 +00:00
Dylan DPC
0718b75ecb
Rollup merge of #114930 - ChrisDenton:label-os, r=cuviper
Automatically add OS labels to std PRs

I'd love to have `library/std/src/sys` PRs that touch Windows stuff to have the `O-windows` label for easier discovery (and rediscovery). While I'm here I added a couple of other auto OS labels. Perhaps `O-unix` is a little too broad but it's hard to be more specific and I think it's still useful insomuch as POSIX is a thing.

r? libs
2023-08-23 05:35:15 +00:00
bors
6046aa06b6 Auto merge of #115119 - cuviper:relnotes-1.72-api, r=Mark-Simulacrum
Update the links for Stabilized APIs in 1.72.0

* Use `stable` instead of `nightly` paths.
* Fix the anchors for `CStr::to_*` links.

r? `@Mark-Simulacrum`
2023-08-23 03:43:29 +00:00
Tomoaki Kawada
65217a72b0 kmc-solid: Import std::sync::PoisonError in std::sys::solid::os 2023-08-23 11:44:18 +09:00
bors
e3a0e383dc Auto merge of #115121 - weihanglo:update-cargo, r=weihanglo
Update cargo

3 commits in 80eca0e58fb2ff52c1e94fc191b55b37ed73e0e4..2cc50bc0b63ad20da193e002ba11d391af0104b7
2023-08-19 00:52:06 +0000 to 2023-08-22 22:43:08 +0000
- config: merge lists in precedence order (rust-lang/cargo#12515)
- ci: test `resolver-tests` in a separate job (rust-lang/cargo#12540)
- refactor: Use clap to suggest alternative argument for unsupported arguments (rust-lang/cargo#12529)

r? ghost
2023-08-23 01:56:45 +00:00
Josh Stone
15beac8975 Update LLVM submodule to 17.0.0-rc3 2023-08-22 17:59:58 -07:00
Esteban Küber
91cf04d207 Fix clippy lint for identical if/else contraining ? expressions
Follow up to #114819.
2023-08-23 00:58:09 +00:00
Weihang Lo
4dd31a22a4
Update cargo 2023-08-23 01:06:48 +01:00
bors
c6f5495591 Auto merge of #115070 - notriddle:notriddle/utf8-redundant-explicit-links, r=GuillaumeGomez,ChAoSUnItY
rustdoc: use unicode-aware checks for redundant explicit link fastpath

Fixes #115064
Fixes #115062
Fixes #115116
2023-08-23 00:02:50 +00:00
Josh Stone
42f993fd02 Update the links for Stabilized APIs in 1.72.0
* Use `stable` instead of `nightly` paths.
* Fix the anchors for `CStr::to_*` links.
2023-08-22 15:24:35 -07:00
bors
c469197b19 Auto merge of #115005 - compiler-errors:passes, r=cjgillot
Don't do intra-pass validation on MIR shims

Fixes #114375

In the test that was committed, we end up generating the drop shim for `struct Foo` that looks like:

```
fn std::ptr::drop_in_place(_1: *mut Foo) -> () {
    let mut _0: ();

    bb0: {
        goto -> bb5;
    }

    bb1: {
        return;
    }

    bb2 (cleanup): {
        resume;
    }

    bb3: {
        goto -> bb1;
    }

    bb4 (cleanup): {
        drop(((*_1).0: foo::WrapperWithDrop<()>)) -> [return: bb2, unwind terminate];
    }

    bb5: {
        drop(((*_1).0: foo::WrapperWithDrop<()>)) -> [return: bb3, unwind: bb2];
    }
}
```

In `bb4` and `bb5`, we assert that `(*_1).0` has type `WrapperWithDrop<()>`. However, In a user-facing param env, the type is actually `WrapperWithDrop<Tait>`. These types are not equal in a user-facing param-env (and can't be made equal even if we use `DefiningAnchor::Bubble`, since it's a non-local TAIT).
2023-08-22 22:04:49 +00:00
Tyler Mandry
4c14ca3141 Bump backtrace to 0.3.69 2023-08-22 15:01:14 -07:00
Fangrui Song
5ee08a0c93 ci: Update FreeBSD and illumos binutils to 2.40
The current old 2.25 seems to cause trouble to #106511.

Install texinfo to dist-x86_64-freebsd/Dockerfile like other containers
to fix
```
  MAKEINFO doc/bfd.info
/binutils/binutils-2.40/missing: 81: /binutils/binutils-2.40/missing: makeinfo: not found
WARNING: 'makeinfo' is missing on your system.
```
2023-08-22 14:54:41 -07:00
Felix S. Klock II
3c6f4cc743 Better diagnostics for people using nix subshell on non-NixOS.
1. Turned patch-binaries-for-nix from a boolean into a ternary flag: true,
   false, and unset.

2. When patch-binaries-for-nix is unset, we continue with the existing NixOS
   detection heuristic (look for nixos in /etc/os-release, if present), but if
   we are not atop NixOS, then issue a note if we see the IN_NIX_SHELL
   environment variable telling the user to consider setting
   patch-binaries-for-nix explicitly.
2023-08-22 17:45:54 -04:00
Felix S. Klock II
4332e8417d drive-by fix to Python doc comment. 2023-08-22 16:16:44 -04:00