Commit Graph

168798 Commits

Author SHA1 Message Date
bors
cbdce42320 Auto merge of #97382 - Dylan-DPC:rollup-2t4ov4z, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #93604 (Make llvm-libunwind a per-target option)
 - #97026 (Change orderings of `Debug` for the Atomic types to `Relaxed`.)
 - #97105 (Add tests for lint on type dependent on consts)
 - #97323 (Introduce stricter checks for might_permit_raw_init under a debug flag )
 - #97379 (Add aliases for `current_dir`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-25 06:14:15 +00:00
Dylan DPC
70bdfc1d79
Rollup merge of #97379 - ear7h:master, r=thomcc
Add aliases for `current_dir`

Aliases were added for the equivalent C/C++ APIs for POSIX and Windows. Also, I added one for `pwd` which users may be more familiar with, from the command line.
2022-05-25 07:31:45 +02:00
Dylan DPC
02c0c768c1
Rollup merge of #97323 - 5225225:strict_init_checks, r=oli-obk
Introduce stricter checks for might_permit_raw_init under a debug flag

This is intended to be a version of the strict checks tried out in #79296, but also checking number validity (under the assumption that `let _ = std::mem::uninitialized::<u32>()` is UB, which seems to be what https://github.com/rust-lang/unsafe-code-guidelines/issues/71 is leaning towards.)
2022-05-25 07:31:44 +02:00
Dylan DPC
89bdbd0294
Rollup merge of #97105 - JulianKnodt:const_dep_gen_const_expr, r=lcnr
Add tests for lint on type dependent on consts

r? `@lcnr`
2022-05-25 07:31:43 +02:00
Dylan DPC
fbb17777fe
Rollup merge of #97026 - Nilstrieb:make-atomic-debug-relaxed, r=scottmcm
Change orderings of `Debug` for the Atomic types to `Relaxed`.

This reduces synchronization between threads when debugging the atomic types.  Reducing the synchronization means that executions with and without the debug calls will be more consistent, making it easier to debug.

We discussed this on the Rust Community Discord with `@ibraheemdev` before.
2022-05-25 07:31:42 +02:00
Dylan DPC
bbb88eacea
Rollup merge of #93604 - tmandry:libunwind-fuchsia-default, r=Mark-Simulacrum
Make llvm-libunwind a per-target option

Fuchsia doesn't ship libunwind in its SDK, so we must provide it statically.
2022-05-25 07:31:41 +02:00
bors
9fadabc879 Auto merge of #97376 - compiler-errors:lazy-polymorphic, r=jackh726
Make `Lazy*<T>` types in `rustc_metadata` not care about lifetimes until decode

This allows us to remove the `'tcx` lifetime from `CrateRoot`. This is necessary because of #97287, which makes the `'tcx` lifetime on `Ty` invariant instead of covariant, so [this hack](0a437b2ca0/compiler/rustc_metadata/src/rmeta/decoder.rs (L89-92)) no longer holds under that PR.

Introduces a trait called `ParameterizedOverTcx` which has a generic associated type that allows a type to be parameterized over that lifetime. This means we can decode, for example, `Lazy<Ty<'static>>` into any `Ty<'tcx>` depending on the `TyCtxt<'tcx>` we pass into the decode function.
2022-05-25 03:53:39 +00:00
julio
84c80e7348 add aliases for current_dir 2022-05-24 19:41:40 -07:00
bors
6ac8adad1f Auto merge of #97365 - klensy:rustdoc-vs-clippy, r=notriddle
rustdoc: fix few clippy lints

Fix few clippy lints: second commit - perf ones, first - other ones.
2022-05-25 01:12:54 +00:00
Tyler Mandry
f1e3d40456 Make llvm-libunwind a per-target option 2022-05-24 15:58:45 -07:00
Michael Goulet
d1a9a95517 Make Lazy not care about lifetimes until decode 2022-05-24 15:54:44 -07:00
bors
f80e454450 Auto merge of #97372 - JohnTitor:rollup-6owv1v0, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #93966 (document expectations for Waker::wake)
 - #97266 (Make weird name lints trigger behind cfg_attr)
 - #97355 (Remove unused brush image)
 - #97358 (Update minifier-rs version to 0.1.0)
 - #97363 (Fix a small mistake in `SliceIndex`'s documentation)
 - #97364 (Fix weird indentation in continue_keyword docs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-24 22:32:57 +00:00
Yuki Okushi
c3fea09208
Rollup merge of #97364 - notriddle:continue-keyword, r=JohnTitor
Fix weird indentation in continue_keyword docs

This format was causing every line in the code examples to have a space at the start.
2022-05-25 07:08:45 +09:00
Yuki Okushi
7ed7f65bac
Rollup merge of #97363 - wackbyte:sliceindex-doc-typo, r=JohnTitor
Fix a small mistake in `SliceIndex`'s documentation

Originally, it said "`get_(mut_)unchecked`," but the method's actual name is `get_unchecked_mut`.
2022-05-25 07:08:44 +09:00
Yuki Okushi
29437d92e1
Rollup merge of #97358 - GuillaumeGomez:update-minifier, r=Dylan-DPC
Update minifier-rs version to 0.1.0

It fixes a bug with regex parsing.

r? `@notriddle`
2022-05-25 07:08:44 +09:00
Yuki Okushi
b66cf9f280
Rollup merge of #97355 - GuillaumeGomez:remove-brush, r=Dylan-DPC
Remove unused brush image

r? `@notriddle`
2022-05-25 07:08:43 +09:00
Yuki Okushi
896a59d8db
Rollup merge of #97266 - est31:unknown_lints_cfg_attr, r=lcnr
Make weird name lints trigger behind cfg_attr

The weird name lints (`unknown_lints`, `renamed_and_removed_lints`), the lints that lint the linting, were previously not firing for lint level declarations behind `cfg_attr`, as they were only running before expansion.

Now, this will give a `unknown_lints` warning:

```Rust
#[cfg_attr(all(), allow(this_lint_does_not_exist))]
fn foo() {}
```

Lint level declarations behind a `cfg_attr` whose condition is not applying are still ignored. So this still won't give a warning:

```Rust
#[cfg_attr(any(), allow(this_lint_does_not_exist))]
fn foo() {}
```

Furthermore, this PR also makes the weird name lints respect level delcarations for *them* that were hidden by `cfg_attr`, making them consistent to other lints. So this will now not issue a warning:

```Rust
#[cfg_attr(all(), allow(unknown_lints))]
mod foo {
    #[allow(does_not_exist)]
    fn foo() {
    }
}
```

Fixes #97094
2022-05-25 07:08:42 +09:00
Yuki Okushi
33f45b167e
Rollup merge of #93966 - rkuhn:patch-1, r=tmandry
document expectations for Waker::wake

fixes #93961

Opened PR for a discussion on the precise wording.
2022-05-25 07:08:41 +09:00
bors
76761db591 Auto merge of #97360 - RalfJung:rustup, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/97348
r? `@ghost` Cc `@rust-lang/miri`
2022-05-24 19:05:20 +00:00
Michael Howell
1d19462a45 Fix weird indentation in continue_keyword docs
This format was causing every line in the code examples to have a space
at the start.
2022-05-24 11:10:56 -07:00
klensy
2a326bcc74 fix clippy perf lints 2022-05-24 13:35:54 -04:00
wackbyte
ce947735c0
Fix a mistake in SliceIndex's documentation 2022-05-24 13:22:41 -04:00
klensy
678059f7d0 fix simple clippy lints 2022-05-24 12:24:41 -04:00
bors
fa70b89d19 Auto merge of #97356 - Dylan-DPC:rollup-bhceawj, r=Dylan-DPC
Rollup of 4 pull requests

Successful merges:

 - #97288 (Lifetime variance fixes for rustdoc)
 - #97298 (Parse expression after `else` as a condition if followed by `{`)
 - #97308 (Stabilize `cell_filter_map`)
 - #97321 (explain how to turn integers into fn ptrs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-24 16:23:32 +00:00
Ralf Jung
9808073674 update Miri 2022-05-24 17:44:11 +02:00
est31
2a8b60f915 Emit weird lint name lints after expansion
Previously, we were emitting weird name lints (for renamed or unknown lints)
before expansion, most importantly before cfg expansion.
This meant that the weird name lints would not fire
for lint attributes hidden inside cfg_attr. The same applied
for lint level specifications of those lints.

By moving the lints for the lint names to the post-expansion
phase, these issues are resolved.
2022-05-24 17:27:34 +02:00
Guillaume Gomez
00a380c235 Update minifier-rs version to 0.1.0 2022-05-24 16:55:29 +02:00
Dylan DPC
4bd40186db
Rollup merge of #97321 - RalfJung:int-to-fnptr, r=Dylan-DPC
explain how to turn integers into fn ptrs

(with an intermediate raw ptr, not a direct transmute)
Direct int2ptr transmute, under the semantics I am imagining, will produce a ptr with "invalid" provenance that is invalid to deref or call. We cannot give it the same semantics as int2ptr casts since those do [something complicated](https://www.ralfj.de/blog/2022/04/11/provenance-exposed.html).

To my great surprise, that is already what the example in the `transmute` docs does. :)  I still added a comment to say that that part is important, and I added a section explicitly talking about this to the `fn()` type docs.

With https://github.com/rust-lang/miri/pull/2151, Miri will start complaining about direct int-to-fnptr transmutes (in the sense that it is UB to call the resulting pointer).
2022-05-24 15:58:26 +02:00
Dylan DPC
af15e45e28
Rollup merge of #97308 - JohnTitor:stabilize-cell-filter-map, r=Mark-Simulacrum
Stabilize `cell_filter_map`

FCP has been completed: https://github.com/rust-lang/rust/issues/81061#issuecomment-1081806326
Closes #81061
2022-05-24 15:58:25 +02:00
Dylan DPC
0531521dbb
Rollup merge of #97298 - compiler-errors:if-else-stmt-braces, r=davidtwco
Parse expression after `else` as a condition if followed by `{`

Fixes #49361.

Two things:
1. This wording needs help. I can never find a natural/intuitive phrasing when I write diagnostics 😅
2. Do we even want to show the "wrap in braces" case? I would assume most of the time the "add an `if`" case is the right one.
2022-05-24 15:58:24 +02:00
Dylan DPC
3569a426b5
Rollup merge of #97288 - compiler-errors:tcxify-rustdoc, r=Dylan-DPC
Lifetime variance fixes for rustdoc

#97287 migrates rustc to a `Ty` type that is invariant over its lifetime `'tcx`, so I need to fix a bunch of places that assume that `Ty<'a>` and `Ty<'b>` can be unified by shortening both to some common lifetime.

This is doable, since everything is already `'tcx`, so all this PR does is be a bit more explicit that elided lifetimes are actually `'tcx`.

Split out from #97287 so the rustdoc team can review independently.
2022-05-24 15:58:24 +02:00
Guillaume Gomez
6920361959 Remove unused brush image 2022-05-24 15:55:01 +02:00
bors
ee9726cb10 Auto merge of #97291 - compiler-errors:lazy-is-actually-3-types-in-a-trenchcoat, r=cjgillot
Split out the various responsibilities of `rustc_metadata::Lazy`

`Lazy<T>` actually acts like three different types -- a pointer in the crate metadata to a single value, a pointer to a list/array of values, and an indexable pointer of a list of values (a table).

We currently overload `Lazy<T>` to work differently than `Lazy<[T]>` and the same for `Lazy<Table<I, T>>`. All is well with some helper adapter traits such as [`LazyQueryDecodable`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/rmeta/decoder/trait.LazyQueryDecodable.html) and [`EncodeContentsForLazy`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/rmeta/encoder/trait.EncodeContentsForLazy.html).

Well, changes in #97287 that make `Lazy` work with the now invariant lifetime `'tcx` make these adapters fall apart because of coherence reasons. So we split out these three types and rework some of the helper traits so it's both 1. more clear to understand, and 2. compatible with the changes later in that PR.

Split out from #97287 so it can be reviewed separately, since this PR stands on its own.
2022-05-24 13:42:33 +00:00
5225225
dd9f31d000 Add flag for stricter checks on uninit/zeroed 2022-05-24 14:26:52 +01:00
bors
b2eba058e6 Auto merge of #97121 - pvdrz:do-subdiagnostics-later, r=davidtwco
Avoid double binding of subdiagnostics inside `#[derive(SessionDiagnostic)]`

r? `@davidtwco`
2022-05-24 10:25:13 +00:00
bors
43d9f3859e Auto merge of #96098 - JakobDegen:always-return-place, r=oli-obk
Refactor call terminator to always include destination place

In #71117 people seemed to agree that call terminators should always have a destination place, even if the call was guaranteed to diverge. This implements that. Unsurprisingly, the diff touches a lot of code, but thankfully I had to do almost nothing interesting. The only interesting thing came up in const prop, where the stack frame having no return place was also used to indicate that the layout could not be computed (or similar). I replaced this with a ZST allocation, which should continue to do the right things.

cc `@RalfJung` `@eddyb` who were involved in the original conversation

r? rust-lang/mir-opt
2022-05-24 07:13:26 +00:00
kadmin
ee8efc5c4a Coalesce branches
Move a bunch of branches together into one if block, for easier reading.

Resolve comments

Attempt to make some branches unreachable [tmp]

Revert unreachable branches
2022-05-24 05:33:34 +00:00
bors
acb5c16fa8 Auto merge of #97342 - JohnTitor:rollup-zqxctaw, r=JohnTitor
Rollup of 5 pull requests

Successful merges:

 - #97240 (Typo suggestion for a variable with a name similar to struct fields)
 - #97289 (Lifetime variance fixes for clippy)
 - #97290 (Turn on `fast_submodules` unconditionally)
 - #97336 (typo)
 - #97337 (Fix stabilization version of `Ipv6Addr::to_ipv4_mapped`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-24 04:32:42 +00:00
Michael Goulet
9be37b2d3f Parse expression after else as a condition if followed by { 2022-05-23 21:09:35 -07:00
Yuki Okushi
a1cbf66ee4
Rollup merge of #97337 - tbu-:pr_fix_stabilization_ipv4_mapped, r=Mark-Simulacrum
Fix stabilization version of `Ipv6Addr::to_ipv4_mapped`
2022-05-24 12:18:34 +09:00
Yuki Okushi
1b59db45d4
Rollup merge of #97336 - tshepang:typo, r=cjgillot
typo
2022-05-24 12:18:33 +09:00
Yuki Okushi
9845a41233
Rollup merge of #97290 - jyn514:fast-submodules, r=Mark-Simulacrum
Turn on `fast_submodules` unconditionally

I don't know why anyone would turn this off; doing so makes builds much slower (nearly a 60x slowdown according to #49057).
Remove the option to do so, which makes bootstrap a little easier to maintain.

Bootstrap continues to allow you to manage submodules manually by setting `submodules = false`.
2022-05-24 12:18:32 +09:00
Yuki Okushi
3157e1f4bd
Rollup merge of #97289 - compiler-errors:tcxify-clippy, r=Mark-Simulacrum
Lifetime variance fixes for clippy

#97287 migrates rustc to a `Ty` type that is invariant over its lifetime `'tcx`, so I need to fix a bunch of places that assume that `Ty<'a>` and `Ty<'b>` can be shortened to some common lifetime.

This is doable, since everything is already `'tcx`, so all this PR does is be a bit more explicit that elided lifetimes are actually `'tcx`.

Split out from #97287 so the clippy team can review independently.
2022-05-24 12:18:31 +09:00
Yuki Okushi
8d9f258faa
Rollup merge of #97240 - TaKO8Ki:improve-errors-about-typos-on-variables, r=compiler-errors
Typo suggestion for a variable with a name similar to struct fields

closes #97133
2022-05-24 12:18:30 +09:00
Michael Goulet
2b5e592b7a Fix iterator implementation, add some inlines 2022-05-23 19:50:29 -07:00
Michael Goulet
14e5816f1b refine comments, disambiguate len for array and tables 2022-05-23 19:39:10 -07:00
Michael Goulet
ca5e60b7fb split out the various responsibilities of Lazy 2022-05-23 19:39:10 -07:00
Joshua Nelson
5df276eef5 Turn on fast_submodules unconditionally
I don't know why anyone would turn this off; doing so makes builds much slower (nearly a 60x slowdown according to #49057).
Remove the option to do so, which makes bootstrap a little easier to maintain.

Bootstrap continues to allow you to manage submodules manually by setting `submodules = false`.
2022-05-23 21:17:09 -05:00
bors
b8d0cd8de0 Auto merge of #97272 - jackh726:ban-compare-mode-nll, r=Mark-Simulacrum
Disallow compare-mode=nll test differences

This ensures that new tests don't get added not as revisions if they have nll output. This will make stabilization PR easier.

r? `@Mark-Simulacrum`
2022-05-24 01:52:00 +00:00
Tobias Bucher
328c84327b Fix stabilization version of Ipv6Addr::to_ipv4_mapped 2022-05-24 01:05:06 +02:00