Commit graph

165299 commits

Author SHA1 Message Date
Dylan DPC 4c8bc046b9
Rollup merge of #95397 - dtolnay:disclaimer, r=m-ou-se
Link to std::io's platform-specific behavior disclaimer

This PR adds some links in standard library documentation to point to https://doc.rust-lang.org/std/io/index.html#platform-specific-behavior.

> ### Platform-specific behavior
>
> Many I/O functions throughout the standard library are documented to indicate what various library or syscalls they are delegated to. This is done to help applications both understand what’s happening under the hood as well as investigate any possibly unclear semantics. Note, however, that this is informative, not a binding contract. The implementation of many of these functions are subject to change over time and may call fewer or more syscalls/library functions.

Many of the `std::fs` APIs already link to this disclaimer when discussing system calls.
2022-03-28 20:41:52 +02:00
Dylan DPC ce319ac1a2
Rollup merge of #95328 - DrMeepster:box_gep_err, r=oli-obk
Fix yet another Box<T, A> ICE

Fixes #95036.

This widens the special case from #94414 to make sure that boxes with a custom allocator are never directly dereferenced.
2022-03-28 20:41:51 +02:00
Dylan DPC e10d5039bc
Rollup merge of #95318 - rust-lang:notriddle/issue-95208, r=wesleywiser
diagnostics: correct generic bounds with doubled colon

Fixes #95208
2022-03-28 20:41:50 +02:00
Dylan DPC 72770efcb0
Rollup merge of #93787 - klensy:really-not-a-features, r=wesleywiser
parallel_compiler: hide dependencies behind feature

Separate dependencies for `parallel_compiler` feature, so they will not be compiled if feature not selected, reducing number of compiled crates from 238 to 224.
2022-03-28 20:41:49 +02:00
bors 600ec28483 Auto merge of #95403 - Dylan-DPC:rollup-9on30mg, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #95301 (Remove `Nonterminal::NtTT`.)
 - #95314 (Tell users that `||` operators are not currently supported in let chain expressions)
 - #95350 (resolve: Simplify some diagnostic code to avoid an ICE)
 - #95370 ([bootstrap] Don't print `Suite not skipped` unless `--verbose` is set)
 - #95390 (Ignore doc comments in a declarative macro matcher.)
 - #95401 (Remove duplicated and unused test files)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-28 16:15:17 +00:00
Dylan DPC e5afe2b107
Rollup merge of #95401 - c410-f3r:moar-tests, r=petrochenkov
Remove duplicated and unused test files

cc https://github.com/rust-lang/rust/issues/73494
r? `@petrochenkov`
2022-03-28 16:08:12 +02:00
Dylan DPC 1c8b7412d4
Rollup merge of #95390 - nnethercote:allow-doc-comments-in-macros, r=petrochenkov
Ignore doc comments in a declarative macro matcher.

Fixes #95267. Reverts to the old behaviour before #95159 introduced a
regression.

r? `@petrochenkov`
2022-03-28 16:08:11 +02:00
Dylan DPC 2f5e944322
Rollup merge of #95370 - jyn514:less-verbose-skips, r=Dylan-DPC
[bootstrap] Don't print `Suite not skipped` unless `--verbose` is set

This was so verbose before that it made it hard to see what effect the flag actually had.

Before:
```
Set({test::src/tools/tidy}) not skipped for "bootstrap::test::Tidy" -- not in [src/test/ui, src/test/mir-opt/, src/test/debuginfo, src/test/ui-fulldeps]
Skipping Suite(test::src/test/ui) because it is excluded
Suite(test::src/test/run-pass-valgrind) not skipped for "bootstrap::test::RunPassValgrind" -- not in [src/test/ui, src/test/mir-opt/, src/test/debuginfo, src/test/ui-fulldeps]
Skipping Suite(test::src/test/mir-opt) because it is excluded
Suite(test::src/test/codegen) not skipped for "bootstrap::test::Codegen" -- not in [src/test/ui, src/test/mir-opt/, src/test/debuginfo, src/test/ui-fulldeps]
Suite(test::src/test/codegen-units) not skipped for "bootstrap::test::CodegenUnits" -- not in [src/test/ui, src/test/mir-opt/, src/test/debuginfo, src/test/ui-fulldeps]
Suite(test::src/test/assembly) not skipped for "bootstrap::test::Assembly" -- not in [src/test/ui, src/test/mir-opt/, src/test/debuginfo, src/test/ui-fulldeps]
Suite(test::src/test/incremental) not skipped for "bootstrap::test::Incremental" -- not in [src/test/ui, src/test/mir-opt/, src/test/debuginfo, src/test/ui-fulldeps]
Skipping Suite(test::src/test/debuginfo) because it is excluded
Skipping Suite(test::src/test/ui-fulldeps) because it is excluded
... about 100 more lines ...
```

After:
```
Skipping Suite(test::src/test/ui) because it is excluded
Skipping Suite(test::src/test/mir-opt) because it is excluded
Skipping Suite(test::src/test/debuginfo) because it is excluded
Skipping Suite(test::src/test/ui-fulldeps) because it is excluded
```
2022-03-28 16:08:10 +02:00
Dylan DPC 4dd9567cf6
Rollup merge of #95350 - petrochenkov:qpathregr, r=cjgillot
resolve: Simplify some diagnostic code to avoid an ICE

No need to resolve those paths, they are already resolved, we just need to take the results from `partial_res_map`.

Fixes https://github.com/rust-lang/rust/issues/95327
2022-03-28 16:08:09 +02:00
Dylan DPC 4651c8df02
Rollup merge of #95314 - c410-f3r:aqui-vamos-nos, r=lcnr
Tell users that `||` operators are not currently supported in let chain expressions

Tells that `||` operators are not currently supported instead of not allowed. See https://github.com/rust-lang/rust/issues/53667#issuecomment-1066075876

In other words, this PR is pretty much trivial.
2022-03-28 16:08:08 +02:00
Dylan DPC ae037a86f9
Rollup merge of #95301 - nnethercote:rm-NtTT, r=petrochenkov
Remove `Nonterminal::NtTT`.

It's only needed for macro expansion, not as a general element in the
AST. This commit removes it, adds `NtOrTt` for the parser and macro
expansion cases, and renames the variants in `NamedMatch` to better
match the new type.

r? `@petrochenkov`
2022-03-28 16:08:07 +02:00
bors 2d37f38f87 Auto merge of #95024 - koehlma:rustdoc-private-items, r=GuillaumeGomez,camelid,jsha
rustdoc: add 🔒 to items with restricted visibility

This change marks items with restricted visibility with 🔒 when building with `--document-private-items`:

<img width="278" alt="Screen Shot 2022-03-20 at 23 50 24" src="https://user-images.githubusercontent.com/509209/159189513-9e4b09bb-6785-41a5-bfe2-df02f83f8641.png">

There also appears a “Restricted Visibility” tooltip when hovering over the emoji.

---

The original PR for reference:

This change makes private items slightly transparent (similar to `unstable` items in rustc):

<img width="272" alt="Screen Shot 2022-03-16 at 22 17 43" src="https://user-images.githubusercontent.com/509209/158692627-a1f6f5ec-e043-4aa2-9352-8d2b15c31c08.png">

I found myself using `--document-private-items` a lot recently because I find the documentation of private internals quite helpful when working on a larger project. However, not being able to distinguish private from public items (see #87785) when looking at the documentation makes this somewhat cumbersome.

This PR addresses the third suggestion of issue #87785 by marking private items typographically. It seems to me that the other suggestions are more involved but this is at least a first step.

A private item is also made slightly transparent in the path displayed in the header of a page:

<img width="467" alt="Screen Shot 2022-03-16 at 22 19 51" src="https://user-images.githubusercontent.com/509209/158692885-0bbd3417-3c0b-486f-b8ab-99c05c6fa7ca.png">

I am looking forward to feedback and suggestions.
2022-03-28 13:49:22 +00:00
Caio 6947a772dd Remove duplicated and unused test files 2022-03-28 10:16:32 -03:00
bors 0e4524e5b4 Auto merge of #94789 - compiler-errors:fatal-never, r=eddyb
Make fatal DiagnosticBuilder yield `!`

Fatal errors should really be fatal, so emitting them should cause us to exit at the same time.

Fine with just throwing away these changes if they're not worthwhile. Also, maybe we want to use an uninhabited enum instead of `!`.

r? `@eddyb` who has been working on `DiagnosticBuilder` stuff, feel free to reassign.
2022-03-28 11:08:23 +00:00
bors b3e46a9763 Auto merge of #95396 - TaKO8Ki:suggest-replacing-field-when-using-the-same-type, r=compiler-errors
Suggest replacing a field when using the same type

closes #89166
2022-03-28 08:40:25 +00:00
bors 13c9fc38c9 Auto merge of #95300 - workingjubilee:less-bitsets, r=eddyb
Skip needless bitset for debuginfo

Found this while digging around looking at the inlining logic.
Seemed obvious enough so I decided to try to take care of it.
Is this what you had in mind, `@eddyb?`
2022-03-28 05:48:25 +00:00
klensy 008fc79dcd Propagate parallel_compiler feature through rustc crates. Turned off feature gives change of builded crates: 238 -> 224. 2022-03-28 08:41:12 +03:00
klensy 78fbcca3e1 use cfg attribute instead of macro 2022-03-28 08:37:32 +03:00
Michael Goulet 928388bad2 Make fatal DiagnosticBuilder yield never 2022-03-27 22:25:32 -07:00
Takayuki Maeda c26cfd1c53 use can_coerce instead of same_type_modulo_infer 2022-03-28 13:43:33 +09:00
David Tolnay d55854d484
Link to std::io's platform-specific behavior disclaimer 2022-03-27 21:01:28 -07:00
Takayuki Maeda 9e4d019fee suggest replacing field when using the same type 2022-03-28 12:38:10 +09:00
bors 93313d108f Auto merge of #95393 - Dylan-DPC:rollup-l72f39g, r=Dylan-DPC
Rollup of 4 pull requests

Successful merges:

 - #88375 (Clarify that ManuallyDrop<T> has same layout as T)
 - #93755 (Allow comparing `Vec`s with different allocators using `==`)
 - #95016 (Docs: make Vec::from_raw_parts documentation less strict)
 - #95098 (impl From<&[T; N]> and From<&mut [T; N]> for Vec<T>)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-28 02:29:06 +00:00
Dylan DPC 8bfc03fde0
Rollup merge of #95098 - shepmaster:vec-from-array-ref, r=dtolnay
impl From<&[T; N]> and From<&mut [T; N]> for Vec<T>

I really wanted to write:

```rust
fn example(a: impl Into<Vec<u8>>) {}

fn main() {
    example(b"raw");
}
```
2022-03-28 04:12:11 +02:00
Dylan DPC d88c03c0f1
Rollup merge of #95016 - janpaul123:patch-1, r=dtolnay
Docs: make Vec::from_raw_parts documentation less strict

This is my first PR; be gentle!

In https://users.rust-lang.org/t/why-does-vec-from-raw-parts-require-same-size-and-not-same-size-capacity/73036/2?u=janpaul123 it was suggested to me that I should make a PR to make the documentation of `Vec::from_raw_parts` less strict, since we don't require `T` to have the same size, just `size_of::<T>() * capacity` to be the same, since that is what results in `Layout::size` being the same in `dealloc`, which is really what matters.

Also in https://users.rust-lang.org/t/why-does-vec-from-raw-parts-require-same-size-and-not-same-size-capacity/73036/8?u=janpaul123 it was suggested that it's better to use `slice::from_raw_parts`, which I think is useful advise that could also be mentioned in the docs, so I added that too.

Let me know what you think! :)
2022-03-28 04:12:10 +02:00
Dylan DPC 6ed1a67b38
Rollup merge of #93755 - ChayimFriedman2:allow-comparing-vecs-with-different-allocators, r=dtolnay
Allow comparing `Vec`s with different allocators using `==`

See https://stackoverflow.com/q/71021633/7884305.

I did not changed the `PartialOrd` impl too because it was not generic already (didn't support `Vec<T> <=> Vec<U> where T: PartialOrd<U>`).

Does it needs tests?

I don't think this will hurt type inference much because the default allocator is usually not inferred (`new()` specifies it directly, and even with other allocators, you pass the allocator to `new_in()` so the compiler usually knows the type).

I think this requires FCP since the impls are already stable.
2022-03-28 04:12:10 +02:00
Dylan DPC 9412316ac3
Rollup merge of #88375 - joshlf:patch-3, r=dtolnay
Clarify that ManuallyDrop<T> has same layout as T

This PR implements the documentation change under discussion in https://github.com/rust-lang/unsafe-code-guidelines/issues/302. It should not be approved or merged until the discussion there is resolved.
2022-03-28 04:12:09 +02:00
bors 3badf5c51c Auto merge of #95333 - GuillaumeGomez:auto-trait-perf-issue, r=oli-obk
Fix perf issue for auto trait selection

Follow-up of https://github.com/rust-lang/rust/pull/95069 which fixes the perf issue introduced by it.

r? `@oli-obk`
2022-03-28 00:01:01 +00:00
Nicholas Nethercote 9967594346 Ignore doc comments in a declarative macro matcher.
Fixes #95267. Reverts to the old behaviour before #95159 introduced a
regression.
2022-03-28 10:45:24 +11:00
Nicholas Nethercote 364b908d57 Remove Nonterminal::NtTT.
It's only needed for macro expansion, not as a general element in the
AST. This commit removes it, adds `NtOrTt` for the parser and macro
expansion cases, and renames the variants in `NamedMatch` to better
match the new type.
2022-03-28 10:03:02 +11:00
bors 62523045ec Auto merge of #95382 - Dylan-DPC:rollup-bebyfd1, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #94939 (diagnostics: suggest missing comma in bad FRU syntax)
 - #95120 (Implement `apply_switch_int_edge_effects` for backward analyses)
 - #95364 (Add long error explanation for E0667)
 - #95366 (Remove test files with duplicated checksums)
 - #95368 (Fix typo in `String::try_reserve_exact` docs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-27 21:36:42 +00:00
Dylan DPC eca2531155
Rollup merge of #95368 - lopopolo:lopopolo/string-try-reserve-exact-doc-typo, r=Dylan-DPC
Fix typo in `String::try_reserve_exact` docs

Copying the pattern from `Vec::try_reserve_exact` and `String::try_reserve`,
it looks like this doc comment is intending to refer to the currently-being-documented
function.
2022-03-27 22:51:42 +02:00
Dylan DPC 1367ede625
Rollup merge of #95366 - c410-f3r:moar-tests, r=petrochenkov
Remove test files with duplicated checksums

cc https://github.com/rust-lang/rust/issues/73494
r? `@petrochenkov`
2022-03-27 22:51:41 +02:00
Dylan DPC dafc29dd72
Rollup merge of #95364 - GuillaumeGomez:long-error-explanation-e0667, r=Dylan-DPC
Add long error explanation for E0667

Part of #61137.
2022-03-27 22:51:40 +02:00
Dylan DPC a8be562bdf
Rollup merge of #95120 - smoelius:backward-switch-int, r=ecstatic-morse
Implement `apply_switch_int_edge_effects` for backward analyses

See #94576 for some discussion.

r? `@ecstatic-morse`
2022-03-27 22:51:39 +02:00
Dylan DPC 726cd737d6
Rollup merge of #94939 - notriddle:notriddle/fru-comma-suggestion, r=cjgillot
diagnostics: suggest missing comma in bad FRU syntax

Fixes #51103
2022-03-27 22:51:38 +02:00
DrMeepster 09ccc63624 fix other source of box deref 2022-03-27 13:35:29 -07:00
bors ab0c2e18dc Auto merge of #94495 - estebank:missing-closing-gt, r=jackh726
Provide suggestion for missing `>` in a type parameter list

When encountering an inproperly terminated type parameter list, provide
a suggestion to close it after the last non-constraint type parameter
that was successfully parsed.

Fix #94058.
2022-03-27 18:55:58 +00:00
Dylan MacKenzie 241ec5b3b3
Nit 2022-03-27 10:58:55 -07:00
Guillaume Gomez 81f24c1f77 Update ui test output 2022-03-27 19:21:50 +02:00
Michael Howell 301fc070ff diagnostics: suggest missing comma in bad FRU syntax
Fixes #51103
2022-03-27 10:01:29 -07:00
bors d7aca22e7f Auto merge of #95345 - dtolnay:escape0, r=Dylan-DPC
Debug print char 0 as '\0' rather than '\u{0}'

```rust
println!("{:?}", "foo\0");
```

- **Before:** `"foo\u{0}"`
- **After:** `"foo\0"`

```rust
println!("{:?}", '\0');
```

- **Before:** `'\u{0}'`
- **After:** `'\0'`

`'\0'` will be more recognizable to everyone than `'\u{0}'` because it's how we talk about character 0 in all of our docs and example code, such as https://doc.rust-lang.org/std/ffi/index.html, https://doc.rust-lang.org/std/ffi/struct.CStr.html, https://doc.rust-lang.org/std/ffi/struct.CString.html.
2022-03-27 16:36:05 +00:00
Joshua Nelson be8ce35cf7 [bootstrap] Don't print Suite not skipped unless --verbose is set
This was so verbose before that it made it hard to see what effect the flag actually had.

Before:
```
Set({test::src/tools/tidy}) not skipped for "bootstrap::test::Tidy" -- not in [src/test/ui, src/test/mir-opt/, src/test/debuginfo, src/test/ui-fulldeps]
Skipping Suite(test::src/test/ui) because it is excluded
Suite(test::src/test/run-pass-valgrind) not skipped for "bootstrap::test::RunPassValgrind" -- not in [src/test/ui, src/test/mir-opt/, src/test/debuginfo, src/test/ui-fulldeps]
Skipping Suite(test::src/test/mir-opt) because it is excluded
Suite(test::src/test/codegen) not skipped for "bootstrap::test::Codegen" -- not in [src/test/ui, src/test/mir-opt/, src/test/debuginfo, src/test/ui-fulldeps]
Suite(test::src/test/codegen-units) not skipped for "bootstrap::test::CodegenUnits" -- not in [src/test/ui, src/test/mir-opt/, src/test/debuginfo, src/test/ui-fulldeps]
Suite(test::src/test/assembly) not skipped for "bootstrap::test::Assembly" -- not in [src/test/ui, src/test/mir-opt/, src/test/debuginfo, src/test/ui-fulldeps]
Suite(test::src/test/incremental) not skipped for "bootstrap::test::Incremental" -- not in [src/test/ui, src/test/mir-opt/, src/test/debuginfo, src/test/ui-fulldeps]
Skipping Suite(test::src/test/debuginfo) because it is excluded
Skipping Suite(test::src/test/ui-fulldeps) because it is excluded
... about 100 more lines ...
```

After:
```
Skipping Suite(test::src/test/ui) because it is excluded
Skipping Suite(test::src/test/mir-opt) because it is excluded
Skipping Suite(test::src/test/debuginfo) because it is excluded
Skipping Suite(test::src/test/ui-fulldeps) because it is excluded
```
2022-03-27 10:13:13 -05:00
Ryan Lopopolo 1ba885113a
Fix typo in String::try_reserve_exact docs
Copying the pattern from `Vec::try_reserve_exact` and `String::try_reserve`,
it looks like this doc comment is intending to refer to the currently-being-documented
function.
2022-03-27 06:53:55 -07:00
Caio 3a5102986d Remove duplicated test files 2022-03-27 09:19:34 -03:00
Guillaume Gomez eae2903150 Add long error explanation for E0667 2022-03-27 14:09:52 +02:00
David Tolnay 2ac9efbe95
Debug print char 0 as '\0' rather than '\u{0}' 2022-03-27 04:49:10 -07:00
bors 100f12d170 Auto merge of #95355 - dtolnay:ripgreptest, r=Dylan-DPC
Bump the ripgrep commit exercised by cargotest

This update goes from 3de31f7527 (Aug 1, 2019) to current master, ced5b92aa9 (March 21, 2022).

I need this in order to pick up https://github.com/BurntSushi/ripgrep/pull/1722, which picked up https://github.com/BurntSushi/bstr/pull/58, which unblocks https://github.com/rust-lang/rust/pull/95345. Ripgrep uses the Debug representation of a `BStr` in some of its tests. In old versions of bstr, that used to just use the standard library's `escape_debug()` implementation, so the output ends up being sensitive to whether the standard library renders character 0 as `\u{0}` or as `\0`. The newer bstr always renders character 0 as `\0` and ripgrep's test suite has been correspondingly updated.
2022-03-27 09:19:50 +00:00
bors 223b58e484 Auto merge of #93957 - SaltyKitkat:stablize_const_ptr_offset, r=dtolnay
Stabilize const_ptr_offset

Close #71499
2022-03-27 07:01:29 +00:00
Esteban Kuber 157c67b7a8 Handle , to ; substitution in arg params 2022-03-27 06:05:18 +00:00