Nadrieril
1fab669f8d
Be honest about being able to list constructors
...
The test change is because we used to treat `&str` like other `&T`s, ie
as having a single constructor. That's not quite true though since we
consider `&str` constants as atomic instead of refs to `str` constants.
2020-10-27 03:09:55 +00:00
Nadrieril
db9a8480c4
Simplify specialize_constructor
...
Also removes the ugly caching that was introduced in #76918 . It was
bolted on without deeper knowledge of the workings of the algorithm.
This commit manages to be more performant without any of the complexity.
It should be better on representative workloads too.
2020-10-27 03:08:38 +00:00
Nathan Whitaker
39941e6281
Fix bootstrap doctest failure
2020-10-26 22:09:47 -04:00
bors
28f03ac4c0
Auto merge of #78421 - JohnTitor:rollup-bq2d7fo, r=JohnTitor
...
Rollup of 16 pull requests
Successful merges:
- #76635 (Add [T]::as_chunks(_mut))
- #77703 (add system-llvm-libunwind config option)
- #78219 (Prefer to use `print_def_path`)
- #78298 (Add test for bad NLL higher-ranked subtype)
- #78332 (Update description for error E0308)
- #78342 (Use check-pass in single-use-lifetime ui tests)
- #78347 (Add lexicographical comparison doc)
- #78348 (Make some functions private that don't have to be public)
- #78349 (Use its own `TypeckResults` to avoid ICE)
- #78375 (Use ? in core/std macros)
- #78377 (Fix typo in debug statement)
- #78388 (Add some regression tests)
- #78394 (fix(docs): typo in BufWriter documentation)
- #78396 (Add compiler support for LLVM's x86_64 ERMSB feature)
- #78405 (Fix typo in lint description)
- #78412 (Improve formatting of hash collections docs)
Failed merges:
r? `@ghost`
2020-10-27 01:36:12 +00:00
Nadrieril
54fa70290d
Unify the paths through is_useful
2020-10-27 00:49:32 +00:00
Nadrieril
c96bd28ab3
Recompute MissingConstructors
when needed
...
This only happens in a slow (diagnostics) path, so the code clarity gain
is worth it.
2020-10-27 00:46:33 +00:00
Nadrieril
b49f90760d
Pass more things through PatCtxt
...
This is even a perf improvement on the match-heavy benchmarks.
2020-10-27 00:46:33 +00:00
Nadrieril
cdafd1e1bd
Let MissingConstructors handle the subtleties of missing constructors
2020-10-27 00:46:32 +00:00
Nadrieril
1190e7275c
Cache head constructor in PatStack
...
Since the constructor is recomputed a lot, caching is worth it.
2020-10-27 00:46:32 +00:00
Nadrieril
833089fbc9
Unify the two kinds of specialization by adding a Wildcard ctor
2020-10-27 00:46:32 +00:00
Nadrieril
41e7ca499d
Inline specialize_one_pattern
2020-10-27 00:46:32 +00:00
Nadrieril
c511955a9f
Factor out the two specialization steps
2020-10-27 00:46:32 +00:00
Nadrieril
6ad9f44a50
Clarify specialization into two steps
...
First is checking for constructor overlap, second is extracting the
resulting fields.
2020-10-27 00:46:32 +00:00
Nadrieril
7c4f94be48
Use pat_constructor to simplify specialize_one_pattern
2020-10-27 00:46:32 +00:00
Nadrieril
feb1e13960
Split split_grouped_constructor
into smaller functions
2020-10-27 00:46:32 +00:00
Yuki Okushi
4236d27c9b
Rollup merge of #78412 - camelid:cleanup-hash-docs, r=jonas-schievink
...
Improve formatting of hash collections docs
2020-10-27 08:45:30 +09:00
Yuki Okushi
7824d9abbd
Rollup merge of #78405 - notriddle:patch-3, r=lcnr
...
Fix typo in lint description
2020-10-27 08:45:27 +09:00
Yuki Okushi
46b8e46fe1
Rollup merge of #78396 - josephlr:ermsb, r=petrochenkov
...
Add compiler support for LLVM's x86_64 ERMSB feature
This change is needed for compiler-builtins to check for this feature
when implementing memcpy/memset. See:
https://github.com/rust-lang/compiler-builtins/pull/365
Without this change, the following code compiles, but does nothing:
```rust
#[cfg(target_feature = "ermsb")]
pub unsafe fn ermsb_memcpy() { ... }
```
The change just does compile-time detection. I think that runtime
detection will have to come in a follow-up CL to std-detect.
Like all the CPU feature flags, this just references #44839
Signed-off-by: Joe Richey <joerichey@google.com>
2020-10-27 08:45:24 +09:00
Yuki Okushi
f6f8764b25
Rollup merge of #78394 - rubik:master, r=m-ou-se
...
fix(docs): typo in BufWriter documentation
This PR fixes a small typo in the BufWriter documentation. The current documentation looks like this:
![2020-10-26-111501_438x83_scrot](https://user-images.githubusercontent.com/238549/97160357-83d3a000-177c-11eb-8a35-3cdd3a7d89de.png )
The `<u8>` at the end is mangled by Markdown. This PR makes the `BufWriter` documentation like the `BufReader` one:
https://github.com/rust-lang/rust/blob/master/library/std/src/io/buffered/bufreader.rs#L16
I'm tagging Steve as per the Rustc dev guide.
r? @steveklabnik
2020-10-27 08:45:20 +09:00
Yuki Okushi
98e2a9564f
Rollup merge of #78388 - camelid:regression-tests, r=lcnr
...
Add some regression tests
Closes #75763 .
Closes #76179 .
2020-10-27 08:45:17 +09:00
Yuki Okushi
b72d70ef61
Rollup merge of #78377 - LeSeulArtichaut:patch-docs, r=jonas-schievink
...
Fix typo in debug statement
2020-10-27 08:45:14 +09:00
Yuki Okushi
5a33fa5179
Rollup merge of #78375 - taiki-e:question-in-macros, r=kennytm
...
Use ? in core/std macros
2020-10-27 08:45:10 +09:00
Yuki Okushi
6abd2a59e7
Rollup merge of #78349 - JohnTitor:issue-75962, r=davidtwco
...
Use its own `TypeckResults` to avoid ICE
Fixes #75962
2020-10-27 08:45:07 +09:00
Yuki Okushi
ae5442582d
Rollup merge of #78348 - jyn514:pub-crate, r=GuillaumeGomez
...
Make some functions private that don't have to be public
r? @GuillaumeGomez
2020-10-27 08:45:04 +09:00
Yuki Okushi
727e93dc74
Rollup merge of #78347 - Rustin-Liu:rustin-patch-doc, r=kennytm
...
Add lexicographical comparison doc
close https://github.com/rust-lang/rust/issues/72255
2020-10-27 08:45:01 +09:00
Yuki Okushi
afdd148c03
Rollup merge of #78342 - oliviacrain:checkmate-pass, r=Mark-Simulacrum
...
Use check-pass in single-use-lifetime ui tests
Rationale: the `single_use_lifetimes` lint is used during late name resolution, which is within the scope of `check-pass` and does not require codegen or linking.
Helps remove some FIXMES associated with #62277 . Additionally tidies touched test files.
2020-10-27 08:44:57 +09:00
Yuki Okushi
0b72ca6ea6
Rollup merge of #78332 - PoignardAzur:doc_E0308, r=camelid
...
Update description for error E0308
Fixes #76462
r? @camelid
2020-10-27 08:44:54 +09:00
Yuki Okushi
9d7db4891b
Rollup merge of #78298 - Aaron1011:fix/nll-ranked-test, r=Mark-Simulacrum
...
Add test for bad NLL higher-ranked subtype
Fixes #57642
2020-10-27 08:44:51 +09:00
Yuki Okushi
f3c94374b9
Rollup merge of #78219 - JohnTitor:print-def-path, r=estebank
...
Prefer to use `print_def_path`
Follow-up of https://github.com/rust-lang/rust/pull/71310#discussion_r415438577
2020-10-27 08:44:47 +09:00
Yuki Okushi
2c307fab49
Rollup merge of #77703 - Keruspe:system-libunwind, r=Mark-Simulacrum
...
add system-llvm-libunwind config option
allows using the system-wide llvm-libunwind as the unwinder
Workaround for #76020
2020-10-27 08:44:44 +09:00
Yuki Okushi
13e88d6366
Rollup merge of #76635 - scottmcm:slice-as-chunks, r=LukasKalbertodt
...
Add [T]::as_chunks(_mut)
Allows getting the slices directly, rather than just through an iterator as in `array_chunks(_mut)`. The constructors for those iterators are then written in terms of these methods, so the iterator constructors no longer have any `unsafe` of their own.
Unstable, of course. #74985
2020-10-27 08:44:41 +09:00
bors
a4d30a7b49
Auto merge of #77876 - tmiasko:simplify-locals, r=wesleywiser
...
Remove unused set-discriminant statements and assignments regardless of rvalue
* Represent use counts with u32
* Unify use count visitors
* Change RemoveStatements visitor into a function
* Remove unused set-discriminant statements
* Use exhaustive match to clarify what is being optimized
* Remove unused assignments regardless of rvalue kind
2020-10-26 23:22:39 +00:00
Nathan Whitaker
cb8b9012db
Address review comments
2020-10-26 19:19:06 -04:00
Anthony Ramine
056942215c
Implement -Z function-sections=yes|no
...
This lets rustc users tweak whether all functions should be put in their own
TEXT section, using whatever default value the target defines if the flag
is missing.
2020-10-26 23:26:43 +01:00
Nathan Whitaker
6ba127d3f0
Fix doctest
2020-10-26 18:19:49 -04:00
Nathan Whitaker
5ac1688f4b
Remove lint from clippy
2020-10-26 18:19:48 -04:00
Nathan Whitaker
576eb2a30c
Write docs for lint / fix review nit
2020-10-26 18:19:48 -04:00
Nathan Whitaker
1bcd2452fe
Address review comments
2020-10-26 18:19:48 -04:00
Nathan Whitaker
737bfeffd2
Change to warn by default / fix typo
2020-10-26 18:19:48 -04:00
Nathan Whitaker
5643a0662a
Tweak diagnostic
2020-10-26 18:19:47 -04:00
Nathan Whitaker
ce95122e95
Update doctest
2020-10-26 18:19:47 -04:00
Nathan Whitaker
8b65df06ce
Address review comments
2020-10-26 18:19:47 -04:00
Nathan Whitaker
a2f4afe0f6
Add basic test
2020-10-26 18:19:46 -04:00
Nathan Whitaker
8cf1b0e1ad
Uplift temporary-cstring-as-ptr into rustc
2020-10-26 18:19:40 -04:00
varkor
ac1454001c
Suggest expressions that look like const generic arguments should be enclosed in brackets
...
Co-Authored-By: Esteban Kuber <github@kuber.com.ar>
2020-10-26 21:54:45 +00:00
Sergio Benitez
7c4fe00213
Ignore threaded capture tests on WASM w/o threads
2020-10-26 14:35:38 -07:00
bors
fd542592f0
Auto merge of #77187 - TimDiekmann:box-alloc, r=Amanieu
...
Support custom allocators in `Box`
r? `@Amanieu`
This pull request requires a crater run.
### Prior work:
- #71873
- #58457
- [`alloc-wg`](https://github.com/TimDiekmann/alloc-wg )-crate
Currently blocked on:
- ~#77118~
- ~https://github.com/rust-lang/chalk/issues/615 (#77515 )~
2020-10-26 21:16:33 +00:00
Camelid
59f108885e
Improve formatting of hash collections docs
2020-10-26 14:05:06 -07:00
Camelid
4641d2e6aa
Add FIXME note to const generics test
...
Co-authored-by: lcnr <bastian_kauschke@hotmail.de>
2020-10-26 13:56:31 -07:00
Camelid
94ed9455e8
Add some regression tests
2020-10-26 13:55:37 -07:00