Commit Graph

169341 Commits

Author SHA1 Message Date
Yuki Okushi
2c1990d0b8
Rollup merge of #97605 - estebank:suggestion-filename, r=oli-obk
Mention filename in suggestion when it differs from primary span
2022-06-02 06:44:28 +09:00
Yuki Okushi
d126de111b
Rollup merge of #97166 - nnethercote:move-conditions-out, r=estebank
Move conditions out of recover/report functions.

`Parser` has six recover/report functions that are passed a boolean, and
nothing is done if the boolean has a particular value.

This PR moves the tests outside the functions. This has the following effects.
- The number of lines of code goes down.
- Some `use` items become shorter.
- Avoids the strangeness whereby 11 out of 12 calls to
  `maybe_recover_from_bad_qpath` pass `true` as the second argument.
- Makes it clear at the call site that only one of
  `maybe_recover_from_bad_type_plus` and `maybe_report_ambiguous_plus` will be
  run.

r? `@estebank`
2022-06-02 06:44:27 +09:00
Yuki Okushi
9fc3fc3a0c
Rollup merge of #97130 - notriddle:notriddle/collect-trait-impls-dup, r=GuillaumeGomez
rustdoc: avoid including impl blocks with filled-in generics

Fixes #94937

# Before

![image](https://user-images.githubusercontent.com/1593513/168933282-02ccc4ae-9c89-4836-ba34-e2bd83946105.png)

# After

![image](https://user-images.githubusercontent.com/1593513/168933255-4c17407d-d8d1-406e-87f5-9ea809437173.png)
2022-06-02 06:44:26 +09:00
Yuki Okushi
3ed9bbe970
Rollup merge of #95594 - the8472:raw_slice_methods, r=yaahc
Additional `*mut [T]` methods

Split out from #94247

This adds the following methods to raw slices that already exist on regular slices

* `*mut [T]::is_empty`
* `*mut [T]::split_at_mut`
* `*mut [T]::split_at_mut_unchecked`

These methods reduce the amount of unsafe code needed to migrate `ChunksMut` and related iterators
to raw slices (#94247)

r? `@m-ou-se`
2022-06-02 06:44:25 +09:00
bors
12cd71f4d3 Auto merge of #97612 - ehuss:update-cargo, r=ehuss
Update cargo

5 commits in 39ad1039d9e3e1746177bf5d134af4c164f95528..38472bc19f2f76e245eba54a6e97ee6821b3c1db
2022-05-25 00:50:02 +0000 to 2022-05-31 02:03:24 +0000
- Emit warning upon encountering multiple packages with the same name (rust-lang/cargo#10701)
- Guide new users to add use `super::*;` to `mod test` (rust-lang/cargo#10706)
- Document how to debug change detection events (rust-lang/cargo#10708)
- fix(publish): add more check when use `publish -p <SPEC>` (rust-lang/cargo#10677)
- fix key formatting when switching to a dotted `WorkspaceSource` (rust-lang/cargo#10705)
2022-06-01 20:06:14 +00:00
Esteban Küber
196a30ebff Fix typo 2022-06-01 13:04:35 -07:00
Santiago Pastorino
15a82d6917
Always assert that impl_trait_def|bounds are empty at start 2022-06-01 15:38:37 -03:00
lcnr
79c3011d9d update explicit impls error msg 2022-06-01 20:36:20 +02:00
Ralf Jung
4dc5d457d8 rename PointerAddress → PointerExposeAddress 2022-06-01 14:08:17 -04:00
Santiago Pastorino
67deaf9fea
instrument lower_fn_decl 2022-06-01 15:02:15 -03:00
Michael Howell
434adfff42 rustdoc: add test case for auto traits on slice primitive 2022-06-01 11:00:25 -07:00
Santiago Pastorino
2de2520e94
Split extend + inner chain into to extend calls 2022-06-01 14:48:14 -03:00
Santiago Pastorino
b3bc438f56
Add debug_assert comment
Co-authored-by: Camille Gillot <gillot.camille@gmail.com>
2022-06-01 14:43:16 -03:00
Esteban Küber
3d60691996 Fix test 2022-06-01 10:41:50 -07:00
Esteban Küber
532671b8ee More accurately handle suggestions
* Confirm the path segment being modified is an `enum`
* Check whether type has type param before suggesting changing `Self`
* Wording changes
* Add clarifying comments
* Suggest removing args from `Self` if the type doesn't have type params
2022-06-01 10:41:50 -07:00
Esteban Küber
9b2d80a197 Provide more context when denying invalid type params 2022-06-01 10:41:50 -07:00
Esteban Küber
f023b920b1 Rework prohibit_generics 2022-06-01 10:41:50 -07:00
bors
b5a2d27f8f Auto merge of #97624 - matthiaskrgr:rollup-rtcqjx9, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #96271 (suggest `?` when method is missing on `Result<T, _>` but found on `T`)
 - #97264 (Suggest `extern crate foo` when failing to resolve `use foo`)
 - #97592 (rustdoc: also index impl trait and raw pointers)
 - #97621 (update Miri)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-01 17:25:29 +00:00
Michael Howell
57450c637c Update src/librustdoc/passes/collect_trait_impls.rs
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2022-06-01 09:55:33 -07:00
Esteban Küber
310b1a9062 Mention filename in suggestion when it differs from primary span 2022-06-01 09:52:03 -07:00
Jacob Hoffman-Andrews
37d363879e Improve calculation of "Impls on Foreign Types" 2022-06-01 09:11:50 -07:00
Matthias Krüger
89e765fb56
Rollup merge of #97621 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/97563
Cc ``@rust-lang/miri`` r? ``@ghost``
2022-06-01 17:11:07 +02:00
Matthias Krüger
1730b62c45
Rollup merge of #97592 - notriddle:notriddle/impl-trait, r=GuillaumeGomez
rustdoc: also index impl trait and raw pointers

Revives #92339
2022-06-01 17:11:06 +02:00
Matthias Krüger
daedae7b23
Rollup merge of #97264 - TaKO8Ki:suggest-extern-crate-when-failing-to-resolve-use-crate, r=estebank
Suggest `extern crate foo` when failing to resolve `use foo`

closes #97095

r? ``@estebank``
2022-06-01 17:11:05 +02:00
Matthias Krüger
7d4cf710e2
Rollup merge of #96271 - compiler-errors:suggest-question-mark, r=estebank
suggest `?` when method is missing on `Result<T, _>` but found on `T`

The wording needs help, I think.

Fixes #95729
2022-06-01 17:11:04 +02:00
bors
8256e97231 Auto merge of #97622 - JohnTitor:rollup-4qoxrjn, r=JohnTitor
Rollup of 9 pull requests

Successful merges:

 - #94647 (Expose `get_many_mut` and `get_many_unchecked_mut` to HashMap)
 - #97216 (Ensure we never consider the null pointer dereferencable)
 - #97399 (simplify code of finding arg index in `opt_const_param_of`)
 - #97470 (rustdoc: add more test coverage)
 - #97498 (Corrected EBNF grammar for from_str)
 - #97562 (Fix comment in `poly_project_and_unify_type`)
 - #97580 (Add regression test for #71546)
 - #97611 (Tweak insert docs)
 - #97616 (Remove an unnecessary `Option`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-01 14:44:20 +00:00
Yuki Okushi
85fdef087c
Rollup merge of #97616 - TaKO8Ki:remove-unnecessary-option, r=Dylan-DPC
Remove an unnecessary `Option`
2022-06-01 23:36:53 +09:00
Yuki Okushi
2c3a8cf0a4
Rollup merge of #97611 - azdavis:master, r=Dylan-DPC
Tweak insert docs

For `{Hash, BTree}Map::insert`, I always have to take a few extra seconds to think about the slight weirdness about the fact that if we "did not" insert (which "sounds" false), we return true, and if we "did" insert, (which "sounds" true), we return false.

This tweaks the doc comments for the `insert` methods of those types (as well as what looks like a rustc internal data structure that I found just by searching the codebase for "If the set did") to first use the "Returns whether _something_" pattern used in e.g. `remove`, where we say that `remove` "returns whether the value was present".
2022-06-01 23:36:52 +09:00
Yuki Okushi
a7bd0d0e07
Rollup merge of #97580 - JohnTitor:issue-71546, r=compiler-errors
Add regression test for #71546

Closes #71546
r? `@compiler-errors`
2022-06-01 23:36:51 +09:00
Yuki Okushi
2f99f1b3a4
Rollup merge of #97562 - compiler-errors:comment-poly_project_and_unify_type, r=lcnr
Fix comment in `poly_project_and_unify_type`

Renamed some variants to match `ProjectAndUnifyResult`
2022-06-01 23:36:50 +09:00
Yuki Okushi
e1d2e65463
Rollup merge of #97498 - ijchen:master, r=Mark-Simulacrum
Corrected EBNF grammar for from_str

Hello! This is my first time contributing to an open-source project. I'm excited to have the chance to contribute to the rust community 🥳

I noticed an issue with the documentation for `from_str` in `f32` and `f64`. It states that "All strings that adhere to the following [EBNF](https://www.w3.org/TR/REC-xml/#sec-notation) grammar when lowercased will result in an `Ok` being returned. I believe this is incorrect for the string `"."`, which is valid for the given EBNF grammar, but does not result in an `Ok` being returned ([playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=09f891aa87963a56d3b0d715d8cbc2b4)). I have simplified the grammar in a way which fixes that, but is otherwise identical.

Previously, the `Number` part of the EBNF grammar had an option for `'.' Digit*`, which would include the string `"."`. This is not valid, and does not return an Ok as stated. The corrected version removes this, and still allows for the `'.' Digit+` case with the already existing `Digit* '.' Digit+` case.
2022-06-01 23:36:49 +09:00
Yuki Okushi
a1dc541c69
Rollup merge of #97470 - notriddle:notriddle/test-cases, r=GuillaumeGomez
rustdoc: add more test coverage

https://github.com/rust-lang/rust/issues/91113
2022-06-01 23:36:48 +09:00
Yuki Okushi
9c61f817eb
Rollup merge of #97399 - SparrowLii:arg_index, r=oli-obk
simplify code of finding arg index in `opt_const_param_of`

From the FIXME in the impl of `opt_const_param_of`. Part of the code is simplified by blending two iterator statements and using `let...else` statement.
2022-06-01 23:36:47 +09:00
Yuki Okushi
2ab919ad9c
Rollup merge of #97216 - RalfJung:null-ptr-check, r=oli-obk
Ensure we never consider the null pointer dereferencable

This replaces the checks that are being removed in https://github.com/rust-lang/rust/pull/97188. Those checks were too early and hence incorrect.
2022-06-01 23:36:46 +09:00
Yuki Okushi
9ddae15532
Rollup merge of #94647 - Urgau:hash-map-many-mut, r=Amanieu
Expose `get_many_mut` and `get_many_unchecked_mut` to HashMap

This pull-request expose the function [`get_many_mut`](https://docs.rs/hashbrown/0.12.0/hashbrown/struct.HashMap.html#method.get_many_mut) and [`get_many_unchecked_mut`](https://docs.rs/hashbrown/0.12.0/hashbrown/struct.HashMap.html#method.get_many_unchecked_mut) from `hashbrown` to the standard library `HashMap` type. They obviously keep the same API and are added under the (new) `map_many_mut` feature.

- `get_many_mut`: Attempts to get mutable references to `N` values in the map at once.
- `get_many_unchecked_mut`: Attempts to get mutable references to `N` values in the map at once, without validating that the values are unique.
2022-06-01 23:36:45 +09:00
Ralf Jung
9f2b69d344 update Miri 2022-06-01 09:31:04 -04:00
Christian Poveda
0fa70a8e2a
rename sp to span 2022-06-01 07:14:33 -05:00
Dylan DPC
f81269f508
Update sync.rs 2022-06-01 14:12:36 +02:00
Dylan DPC
31ece0c850
Update sync.rs 2022-06-01 13:47:39 +02:00
Yuki Okushi
ea50d773e3
Add regression test for #71546 2022-06-01 20:04:57 +09:00
Guillaume Gomez
e160882721 Hide anonymous reexports in generated documentation 2022-06-01 12:24:39 +02:00
Takayuki Maeda
8d007aa06d remove an unnecessary Option 2022-06-01 17:06:07 +09:00
Eric Huss
3fb5df026f Update cargo 2022-05-31 22:50:43 -07:00
Ariel Davis
b02146a370 Tweak insert docs 2022-05-31 22:08:14 -07:00
bors
395a09c3da Auto merge of #97553 - nbdd0121:lib, r=Mark-Simulacrum
Add `#[inline]` to `Vec`'s `Deref/DerefMut`

This should help #97552 (although I haven't verified).
2022-06-01 04:52:11 +00:00
yifei
1446bce35e use 128 cache align for m1 mac 2022-06-01 12:07:30 +08:00
bors
02916c4c75 Auto merge of #97435 - Patryk27:bump-compiler-builtins, r=Dylan-DPC
library/std: Bump compiler_builtins

Some neat changes include faster float conversions & fixes for AVR 🙂

(note that's it's my first time upgrading `compiler_builtins`, so I'm not 100% sure if bumping `library/std/Cargo.toml` is enough; certainly seems to be so, though.)
2022-06-01 01:49:04 +00:00
est31
0a24b9493b Remove #[rustc_box] attr during lowering 2022-06-01 02:44:12 +02:00
Nicholas Nethercote
0b81d7cdc6 Lazify SourceFile::lines.
`SourceFile::lines` is a big part of metadata. It's stored in a compressed form
(a difference list) to save disk space. Decoding it is a big fraction of
compile time for very small crates/programs.

This commit introduces a new type `SourceFileLines` which has a `Lines`
form and a `Diffs` form. The latter is used when the metadata is first
read, and it is only decoded into the `Lines` form when line data is
actually needed. This avoids the decoding cost for many files,
especially in `std`. It's a performance win of up to 15% for tiny
crates/programs where metadata decoding is a high part of compilation
costs.

A `Lock` is needed because the methods that access lines data (which can
trigger decoding) take `&self` rather than `&mut self`. To allow for this,
`SourceFile::lines` now takes a `FnMut` that operates on the lines slice rather
than returning the lines slice.
2022-06-01 10:36:39 +10:00
est31
535e28b6c6 Use #[rustc_box] in alloc instead of box syntax 2022-06-01 02:28:34 +02:00