Commit graph

165267 commits

Author SHA1 Message Date
Caio 6947a772dd Remove duplicated and unused test files 2022-03-28 10:16:32 -03: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
Takayuki Maeda c26cfd1c53 use can_coerce instead of same_type_modulo_infer 2022-03-28 13:43:33 +09: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
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
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
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
David Tolnay 1431c76c56
Bump the ripgrep commit exercised by cargotest 2022-03-26 21:55:19 -07:00
bors 185a3f0a11 Auto merge of #95351 - Dylan-DPC:rollup-o1il7tx, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #91981 (Recover suggestions and useful information lost in previous PR)
 - #93469 (Skip pointing out ambiguous impls in alloc/std crates too in inference errors)
 - #95335 (Move resolve_path to rustc_builtin_macros and make it private)
 - #95340 (interpret: with enforce_number_validity, ensure integers are truly Scalar::Int (i.e., no pointers))
 - #95341 (ARMv6K Horizon OS has_thread_local support)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-27 04:20:07 +00:00
David Tolnay 333756f1c5
Bump const_ptr_offset stabilization to 1.61 2022-03-26 21:15:16 -07:00
Dylan DPC 2ab4ad5f26
Rollup merge of #95341 - Meziu:armv6k-3ds-target, r=nagisa
ARMv6K Horizon OS has_thread_local support

cc. ```@ian-h-chamberlain```
cc. ```@AzureMarker```

Being an ARM target, it has always had built-in support for `#[thread_local]`. This PR comes in just now because we were testing `std::thread` support with `thread_local_dtor`s. This will hopefully be the last PR for the target specification, unless anymore features will be needed as time goes on.
2022-03-27 05:36:11 +02:00
Dylan DPC 178a09e672
Rollup merge of #95340 - RalfJung:pnvi, r=oli-obk
interpret: with enforce_number_validity, ensure integers are truly Scalar::Int (i.e., no pointers)

This is required for https://github.com/rust-lang/miri/pull/2040

r? ```@oli-obk```
2022-03-27 05:36:10 +02:00
Dylan DPC 979c8e885e
Rollup merge of #95335 - Badel2:resolve-path, r=Dylan-DPC
Move resolve_path to rustc_builtin_macros and make it private

Fixing a FIXME introduced by `@jyn514` in #85457
2022-03-27 05:36:09 +02:00
Dylan DPC c6bb219fc4
Rollup merge of #93469 - compiler-errors:issue-93450, r=estebank
Skip pointing out ambiguous impls in alloc/std crates too in inference errors

This generalizes the logic in `annotate_source_of_ambiguity` to skip printing ambiguity errors traits in `alloc` and `std` as well, not just `core`.

While this does spot-fix the issue mentioned below, it would be nicer to generalize this logic, for example to detect when the trait predicate's `self_ty` has any numerical inference variables. Is it worthwhile to scrap this solution for one like that?

Fixes #93450

r? `@estebank`
feel free to reassign
2022-03-27 05:36:08 +02:00
Dylan DPC 4435bb0704
Rollup merge of #91981 - estebank:tweakaroo, r=lcnr
Recover suggestions and useful information lost in previous PR

Follow up to #91898.
2022-03-27 05:36:08 +02:00
Esteban Kuber 6874bd27f5 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 02:50:04 +00:00
Esteban Kuber f479e262d6 review comments and rebase 2022-03-27 02:40:07 +00:00
Esteban Kuber 1db02b8a43 Change wording of missing return type suggestion 2022-03-27 02:20:17 +00:00
Esteban Kuber b09420f95a Drive by: handle references in same_type_modulo_infer 2022-03-27 02:20:17 +00:00
Esteban Kuber 1c85987274 Point (again) to more expressions with their type, even if not fully resolved 2022-03-27 02:20:17 +00:00
Esteban Kuber c4d741fa16 Also resolve const param suggestion 2022-03-27 02:20:17 +00:00
Esteban Kuber 474626af50 Eagerly replace {integer}/{float} with i32/f64 for suggestion 2022-03-27 02:20:16 +00:00
bors 06c3c62a52 Auto merge of #95338 - bjorn3:sync_cg_gcc-2022-03-26, r=antoyo
Sync rustc_codegen_gcc

r? `@ghost`

`@rustbot` label +A-codegen +A-gcc +T-compiler

cc `@antoyo`
2022-03-27 01:55:15 +00:00
Guillaume Gomez bd51f174ed Remove SelectionContext::allow_negative_impls field 2022-03-27 03:01:34 +02:00
bors 551b4fa395 Auto merge of #92472 - petrochenkov:nowrapident, r=Aaron1011
proc-macro: Stop wrapping `ident` matchers into groups

`ident` is always a single token and can be treated in the same way as `tt`.
r? `@Aaron1011`
2022-03-26 23:01:12 +00:00
bors 1d9c262eea Auto merge of #95274 - jendrikw:slice-must-use, r=Dylan-DPC
add #[must_use] to functions of slice and its iterators.

Continuation of #92853.

Tracking issue: #89692.
2022-03-26 20:17:04 +00:00
Meziu 419b6309a9
Merge pull request #16 from ian-h-chamberlain/feature/target-thread-local
Enable #[thread_local] on armv6k-nintendo-3ds
2022-03-26 20:49:19 +01:00
Ralf Jung 3bbcf64fb3 interpret: with enforce_number_validity, ensure integers are truly Scalar::Int (i.e., no pointers) 2022-03-26 14:35:36 -04:00