Commit Graph

232543 Commits

Author SHA1 Message Date
ouz-a
7928c5f830 make comments less cryptic 2023-09-06 12:09:29 +03: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
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
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
bors
154ae32a55 Auto merge of #114643 - dpaoliello:inlinedebuginfo, r=wesleywiser
Use the same DISubprogram for each instance of the same inlined function within a caller

# Issue Details:
The call to `panic` within a function like `Option::unwrap` is translated to LLVM as a `tail call` (as it will never return), when multiple calls to the same function like this is inlined LLVM will notice the common `tail call` block (i.e., loading the same panic string + location info and then calling `panic`) and merge them together.

When merging these instructions together, LLVM will also attempt to merge the debug locations as well, but this fails (i.e., debug info is dropped) as Rust emits a new `DISubprogram` at each inline site thus LLVM doesn't recognize that these are actually the same function and so thinks that there isn't a common debug location.

As an example of this when building for x86_64 Windows (note the lack of `.cv_loc` before the call to `panic`, thus it will be attributed to the same line at the `addq` instruction):

```
	.cv_loc	0 1 23 0                        # src\lib.rs:23:0
	addq	$40, %rsp
	retq
	leaq	.Lalloc_f570dea0a53168780ce9a91e67646421(%rip), %rcx
	leaq	.Lalloc_629ace53b7e5b76aaa810d549cc84ea3(%rip), %r8
	movl	$43, %edx
	callq	_ZN4core9panicking5panic17h12e60b9063f6dee8E
	int3
```

# Fix Details:
Cache the `DISubprogram` emitted for each inlined function instance within a caller so that this can be reused if that instance is encountered again, this also requires caching the `DILexicalBlock` and `DIVariable` objects to avoid creating duplicates.

After this change the above assembly now looks like:

```
	.cv_loc	0 1 23 0                        # src\lib.rs:23:0
	addq	$40, %rsp
	retq
	.cv_inline_site_id 5 within 0 inlined_at 1 0 0
	.cv_inline_site_id 6 within 5 inlined_at 1 12 0
	.cv_loc	6 2 935 0                       # library\core\src\option.rs:935:0
	leaq	.Lalloc_5f55955de67e57c79064b537689facea(%rip), %rcx
	leaq	.Lalloc_e741d4de8cb5801e1fd7a6c6795c1559(%rip), %r8
	movl	$43, %edx
	callq	_ZN4core9panicking5panic17hde1558f32d5b1c04E
	int3
```
2023-08-22 20:15:29 +00:00
Chris Denton
ca055f148b
Automatically add OS labels to std PRs 2023-08-22 20:38:25 +01:00
Wesley Wiser
1097e0957e
Fix spelling mistake 2023-08-22 15:30:26 -04:00
ouz-a
015b5cb306 add generics_of to smir 2023-08-22 21:47:46 +03:00
bors
712d962cef Auto merge of #115104 - compiler-errors:rollup-8235xz5, r=compiler-errors
Rollup of 6 pull requests

Successful merges:

 - #114959 (fix #113702 emit a proper diagnostic message for unstable lints passed from CLI)
 - #115011 (Warn on elided lifetimes in associated constants (`ELIDED_LIFETIMES_IN_ASSOCIATED_CONSTANT`))
 - #115077 (Do not emit invalid suggestion in E0191 when spans overlap)
 - #115087 (Add disclaimer on size assertion macro)
 - #115090 (Always use `os-release` rather than `/lib` to detect `NixOS` (bootstrap))
 - #115101 (triagebot: add dependency licensing pings)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-22 16:16:32 +00:00
Michael Goulet
266b65a34a
Rollup merge of #115101 - davidtwco:add-licensing-pings, r=wesleywiser
triagebot: add dependency licensing pings

If a compiler dependency is added, it's probably worth having that double-checked by compiler co-leads to confirm the licensing is okay.

r? `@wesleywiser`
2023-08-22 09:00:51 -07:00
Michael Goulet
634ab606a4
Rollup merge of #115090 - eopb:dont-check-lib-bootstrap, r=ozkanonur
Always use `os-release` rather than `/lib` to detect `NixOS` (bootstrap)

[Two users over on zulip](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Bootstrapping.20on.20NixOS) bumped into issues where NixOS wasn't being properly detected.

I believe this was caused by the presence of `/lib` on their machines. `/lib` is not standard on NixOS but can still be created by users or scripts.

We are already checking `/etc/os-release`. The presence of `ID=nixos` in it's output should be trustworthy and we shouldn't then go on to also check for `/lib`.
2023-08-22 09:00:50 -07:00
Michael Goulet
39066450e3
Rollup merge of #115087 - Nilstrieb:sizeassert, r=fee1-dead
Add disclaimer on size assertion macro

Sometimes people are inspired by rustc to add size assertions to their code and copy the macro. This is bad because it causes hard build errors. rustc happens to be special where it makes this okay.

For example, see #115028 (not sure whether they were directly inspired by this function), but I think I've also seen other cases.
2023-08-22 09:00:50 -07:00
Michael Goulet
0e84d42a9e
Rollup merge of #115077 - estebank:issue-115019, r=compiler-errors
Do not emit invalid suggestion in E0191 when spans overlap

Fix #115019.
2023-08-22 09:00:49 -07:00
Michael Goulet
e9897c3a71
Rollup merge of #115011 - compiler-errors:warn-on-elided-assoc-ct-lt, r=cjgillot
Warn on elided lifetimes in associated constants (`ELIDED_LIFETIMES_IN_ASSOCIATED_CONSTANT`)

Elided lifetimes in associated constants (in impls) erroneously resolve to fresh lifetime parameters on the impl since #97313. This is not correct behavior (see #38831).

I originally opened #114716 to fix this, but given the time that has passed, the crater results seem pretty bad: https://github.com/rust-lang/rust/pull/114716#issuecomment-1682091952

This PR alternatively implements a lint against this behavior, and I'm hoping to bump this to deny in a few versions.
2023-08-22 09:00:49 -07:00
Michael Goulet
6c7678d328
Rollup merge of #114959 - mojave2:issue-113702, r=petrochenkov
fix #113702 emit a proper diagnostic message for unstable lints passed from CLI

Current output:
```bash
$ build/host/stage1/bin/rustc hello.rs -Wunnameable_types
warning: unknown lint: `unnameable_types`
  |
  = note: the `unnameable_types` lint is unstable
  = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
  = help: add `-Zcrate-attr="feature(type_privacy_lints)"` to the command-line options to enable
  = note: `#[warn(unknown_lints)]` on by default

warning: 1 warning emitted
```

Previously, the feature gate diagnostic message is like below, which is the same as the message for unstable lints from the root module.

```shell
= help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
```

Fixes https://github.com/rust-lang/rust/issues/113702
2023-08-22 09:00:48 -07:00
Esteban Küber
b86285af16 Do not emit invalid suggestion in E0191 when spans overlap
Fix #115019.
2023-08-22 15:51:12 +00:00
David Wood
d5269a1d7b
triagebot: add dependency licensing pings
Signed-off-by: David Wood <david@davidtw.co>
2023-08-22 16:15:00 +01:00
bors
3e9e5745df Auto merge of #115066 - allaboutevemirolive:pluralize_macro, r=Nilstrieb
Redefine the pluralize macro's arm

Redefine the unintuitive pluralize macro's arm because of the negation. The initial code starts with check if count is not 1, which is confusing and unintuitive.

The arm shoud start with checking,

- if "count" `is 1` then, append `""` (empty string) - indicate as singular
- Then check if "count" `is not 1` (more than 1), append `"s"` - indicate as plural

Before:
```rs
// This arm is abit confusing since it start with checking, if "count" is more than 1, append "s".
($x:expr) => {
    if $x != 1 { "s" } else { "" }
};
```

After:
```rs
// Pluralize based on count (e.g., apples)
($x:expr) => {
    if $x == 1 { "" } else { "s" }
};
```
2023-08-22 14:22:10 +00:00
Urgau
7ee77b5d1b Add support for ptr::write for the invalid_reference_casting lint 2023-08-22 15:47:29 +02:00
kadiwa
265c1b5d50
add regression test for not memcpying padding bytes 2023-08-22 15:10:56 +02:00
bors
d8c69dfb37 Auto merge of #115095 - RalfJung:miri, r=RalfJung
update Miri

r? `@ghost`
2023-08-22 12:32:50 +00:00
Ralf Jung
47ba2a9465 update lockfile 2023-08-22 13:47:38 +02:00
mojave2
d2744175ac
unknown unstable lint command line
fix ##113702

fix #113702

unknown unstable lint command lint

improve impelementation
2023-08-22 18:58:39 +08:00
bors
b2e9d73606 Auto merge of #115086 - RalfJung:miri-locked, r=albertlarsan68
bootstrap/miri: respect config_locked_deps
2023-08-22 10:43:48 +00:00
Ethan Brierley
0e070aa548
Always use os-release rather than /lib to detect NixOS
[Two users over on zulip](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Bootstrapping.20on.20NixOS) bumped into issues where NixOS wasn't being properly detected.

I believe this was caused by the presence of `/lib` on their machines. `/lib` is not standard on NixOS but can still be created by users or scripts.

We are already checking `/etc/os-release`. The presence of `ID=nixos` in it's output should be trustworthy and we shouldn't then go on to also check for `/lib`.
2023-08-22 11:06:43 +01:00
bors
0c2dde342b Auto merge of #3036 - RalfJung:josh-autostart, r=RalfJung
automatically start and stop josh in rustc-pull/push

Let's make use of the fact that this is not a shell script any more. :)
2023-08-22 09:25:49 +00:00
Ralf Jung
ee1fbd7a93 miri-script: start and stop josh automatically 2023-08-22 11:22:44 +02:00
Nilstrieb
d16e9c3369 Convert it into a warning
Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
2023-08-22 09:17:46 +00:00
bors
95305899b8 Auto merge of #115089 - fee1-dead-contrib:pause, r=fee1-dead
Remove myself from review rotation

I'll.. still be around, just not as active as I had been. I'm not adding myself to `users_on_vacation`, because anyone should still feel free to r? me if they want a specific review from me.
2023-08-22 08:55:43 +00:00
Ralf Jung
6117fa1fef make sure './miri many-seeds ./miri run' does not re-invoke the auto-ops 2023-08-22 10:29:26 +02:00
Deadbeef
ddf89a8776 Remove myself from review rotation 2023-08-22 08:05:00 +00:00
bors
57277c3a8e Auto merge of #3035 - RalfJung:serde, r=RalfJung
bump serde

bump to a version with the binary blob removed

also, respect CARGO_EXTRA_FLAGS in more places
2023-08-22 07:25:57 +00:00
Ralf Jung
269cbc20ac respect CARGO_EXTRA_FLAGS in more places 2023-08-22 09:25:33 +02:00
Nilstrieb
1b9159e448 Add disclaimer on size assertion macro
Sometimes people are inspired by rustc to add size assertions to their
code and copy the macro. This is bad because it causes hard build
errors. rustc happens to be special where it makes this okay.
2023-08-22 06:59:09 +00:00
Ralf Jung
28de139d35 bootstrap/miri: respect config_locked_deps 2023-08-22 08:54:51 +02:00
Ralf Jung
95fe7ab2a8 bump serde 2023-08-22 08:36:54 +02:00
bors
b4d09f3b81 Auto merge of #115075 - workingjubilee:retier-sparc-none, r=compiler-errors
Reassign sparc-unknown-none-elf to tier 3

It should never have been moved to tier 2. It is a new platform and the maintainer has agreed to do tier 3 maintenance for it, not tier 2.

r? `@jonathanpallant`
2023-08-22 06:36:15 +00:00
bors
32aa40538e Auto merge of #115055 - Kriskras99:master, r=ehuss
Fix table issues in platform support documentation (closes #115047)

mdBook needs an empty line before and after the table block.
In addition, in the tier-3 list three targets forgot about the host column and therefore showed the notes in the host column.

Closes #115047
2023-08-22 01:45:22 +00:00