121030 Commits

Author SHA1 Message Date
Nathan West
526dbd3d97 Clarified the documentation for Formatter::precision 2020-05-21 23:45:43 -04:00
Dylan MacKenzie
d24ba6d124 Perform MIR NRVO even if types don't match 2020-05-21 19:31:16 -07:00
csmoe
7cdc897234 only try to suggest for try trait_ref 2020-05-22 10:11:52 +08:00
csmoe
47cc221e98 add mcve for issue 72442 2020-05-22 10:11:17 +08:00
bors
458a3e7629 Auto merge of #71956 - ecstatic-morse:remove-requires-storage-analysis, r=tmandry
Clean up logic around live locals in generator analysis

Resolves #69902. Requires #71893.

I've found it difficult to make changes in the logic around live locals in `generator/transform.rs`. It uses a custom dataflow analysis, `MaybeRequiresStorage`, that AFAICT computes whether a local is either initialized or borrowed. That analysis is using `before` effects, which we should try to avoid if possible because they are harder to reason about than ones only using the unprefixed effects. @pnkfelix has suggested removing "before" effects entirely to simplify the dataflow framework, which I might pursue someday.

This PR replaces `MaybeRequiresStorage` with a combination of the existing `MaybeBorrowedLocals` and a new `MaybeInitializedLocals`. `MaybeInitializedLocals` is just `MaybeInitializedPlaces` with a coarser resolution: it works on whole locals instead of move paths. As a result, I was able to simplify the logic in `compute_storage_conflicts` and `locals_live_across_suspend_points`.

This is not exactly equivalent to the old logic; some generators are now smaller than before. I believe this was because the old logic was too conservative, but I'm not as familiar with the constraints as the original implementers were, so I could be wrong. For example, I don't see a reason the size of the `mixed_sizes` future couldn't be 5K. It went from 7K to 6K in this PR.

r? @jonas-schievink @tmandry
2020-05-22 01:32:42 +00:00
David Tolnay
5a4bf448c7
Add test for proc_macro::LineColumn 2020-05-21 17:15:13 -07:00
David Tolnay
e9fed696b5
Impl Ord for proc_macro::LineColumn 2020-05-21 17:05:36 -07:00
bors
d9417b3851 Auto merge of #72433 - RalfJung:rollup-srft8nx, r=RalfJung
Rollup of 7 pull requests

Successful merges:

 - #72055 (Intern predicates)
 - #72149 (Don't `type_of` on trait assoc ty without default)
 - #72347 (Make intra-link resolve links for both trait and impl items)
 - #72350 (Improve documentation of `slice::from_raw_parts`)
 - #72382 (Show default values for debug-assertions & debug-assertions-std)
 - #72421 (Fix anchor display when hovering impl)
 - #72425 (fix discriminant_value sign extension)

Failed merges:

r? @ghost
2020-05-21 22:14:26 +00:00
Mahmut Bulut
4a10f6cd08 Enable ARM TME (Transactional Memory Extensions) 2020-05-21 23:20:57 +02:00
Santiago Pastorino
93abdd7511
Add some teams to prioritization exclude_labels 2020-05-21 17:40:07 -03:00
Ralf Jung
74b5c50214
Rollup merge of #72425 - RalfJung:discr-sign-ext, r=nikomatsakis
fix discriminant_value sign extension

Fixes a regression introduced in https://github.com/rust-lang/rust/pull/70705
r? @nikomatsakis Cc @lcnr @oli-obk
2020-05-21 21:10:47 +02:00
Ralf Jung
fc729d0c60
Rollup merge of #72421 - GuillaumeGomez:fix-impl-hover-anchor, r=kinnison
Fix anchor display when hovering impl

A little gif for the fixed behaviour:

![hover-anchor](https://user-images.githubusercontent.com/3050060/82549808-cfdf4080-9b5d-11ea-9495-2b1d90b2a791.gif)

r? @kinnison
2020-05-21 21:10:45 +02:00
Ralf Jung
503a2fde94
Rollup merge of #72382 - tmiasko:config-toml-debug-assertions, r=nikomatsakis
Show default values for debug-assertions & debug-assertions-std
2020-05-21 21:10:43 +02:00
Ralf Jung
261505a0cf
Rollup merge of #72350 - danielhenrymantilla:doc_warn_against_adjacent_slice_concat, r=RalfJung
Improve documentation of `slice::from_raw_parts`

This is to provide a more explicit statement against a code pattern that
many people end up coming with, since the reason of it being unsound
comes from the badly known single-allocation validity rule.

Providing that very pattern as a counter-example could help mitigate that.

See also: https://internals.rust-lang.org/t/pre-rfc-add-join-seq-method-to-slices-and-strs/11936/13

r? @RalfJung
2020-05-21 21:10:41 +02:00
Ralf Jung
3d5f130aae
Rollup merge of #72347 - xliiv:72340-impl-for-default, r=GuillaumeGomez
Make intra-link resolve links for both trait and impl items

Closes #72340
2020-05-21 21:10:40 +02:00
Ralf Jung
dc65fd4f6a
Rollup merge of #72149 - estebank:icemation, r=eddyb
Don't `type_of` on trait assoc ty without default

Fix #72076.
2020-05-21 21:10:38 +02:00
Ralf Jung
22438fc22b
Rollup merge of #72055 - lcnr:predicate-kind, r=nikomatsakis
Intern predicates

Implements the first step of https://github.com/rust-lang/compiler-team/issues/285

Renames `ty::Predicate` to `ty::PredicateKind`, which is now interned.
To ease the transition, `ty::Predicate` is now a struct containing a reference
to `ty::PredicateKind`.

r? @ghost
2020-05-21 21:10:36 +02:00
Vadim Petrochenkov
d0a48d19f5 rustllvm: Fix warnings about unused function parameters 2020-05-21 22:05:19 +03:00
bors
9310e3bd4f Auto merge of #71930 - Nadrieril:exhaustiveness-remove-tyerr, r=varkor
De-abuse TyKind::Error in exhaustiveness checking

Replaces https://github.com/rust-lang/rust/pull/71074. Context: https://github.com/rust-lang/rust/issues/70866.

In order to remove the use of `TyKind::Error`, I had to make sure we skip over those fields whose inhabitedness should not be observed. This is potentially error-prone however, since we must be careful not to mix filtered and unfiltered lists of patterns. I managed to hide away most of the filtering behind a new `Fields` struct, that I used everywhere relevant. I quite like the result; I think the twin concepts of `Constructor` and `Fields` make a good mental model.

As usual, I tried to separate commits that shuffle code around from commits that require more thought to review.

cc @varkor @Centril
2020-05-21 18:52:46 +00:00
CAD97
b1d1f256ef Add a test for char ranges 2020-05-21 13:56:49 -04:00
CAD97
27d1cd857e Add safety annotations in iter::range 2020-05-21 13:44:54 -04:00
Ralf Jung
67e075589b
Typo 2020-05-21 19:07:59 +02:00
Daniel Henry-Mantilla
a81e9a781b Improve documentation of slice::from_raw_parts
This is to provide a more explicit statement against a code pattern that
many people end up coming with, since the reason of it being unsound
comes from the badly known single-allocation validity rule.

Providing that very pattern as a counter-example could help mitigate that.

Co-authored-by: Ralf Jung <post@ralfj.de>
2020-05-21 18:38:41 +02:00
marmeladema
f31e076d98 Replace unecessary calls to .clone() by argument binding pattern for Copy types 2020-05-21 17:34:54 +01:00
marmeladema
4c4cb46491 Use collect() instead of manually inserting elements into maps 2020-05-21 17:07:48 +01:00
marmeladema
8ff6ffd888 Use DefId in ResolverOutputs::extern_crate_map instead of NodeId 2020-05-21 17:07:48 +01:00
marmeladema
21f65ae9db Use DefId in ResolverOutputs::glob_map instead of NodeId 2020-05-21 17:07:48 +01:00
marmeladema
25f575b29f Use DefId in ResolverOutputs::maybe_unused_extern_crates instead of NodeId 2020-05-21 17:07:48 +01:00
marmeladema
13c86f289b Use LocalDefId in ResolverOutputs::maybe_unused_trait_imports instead of NodeId 2020-05-21 17:07:47 +01:00
marmeladema
52359f7c60 Use HirId in ResolverOutputs::export_map instead of NodeId 2020-05-21 17:07:47 +01:00
marmeladema
3c5dba7c62 Use HirId in value of ResolverOutputs::trait_map instead of NodeId 2020-05-21 17:07:47 +01:00
marmeladema
5728c5371d Use HirId as key for ResolverOutputs::trait_map instead of NodeId 2020-05-21 17:07:47 +01:00
bors
148c125b1b Auto merge of #71718 - NeoRaider:ffi_const_pure, r=Amanieu
Experimentally add `ffi_const` and `ffi_pure` extern fn attributes

Add FFI function attributes corresponding to clang/gcc/... `const` and `pure`.

Rebased version of #58327 by @gnzlbg with the following changes:

- Switched back from the `c_ffi_const` and `c_ffi_pure` naming to `ffi_const` and `ffi_pure`, as I agree with https://github.com/rust-lang/rust/pull/58327#issuecomment-462718772 and this nicely aligns with `ffi_returns_twice`
- (Hopefully) took care of all of @hanna-kruppe's change requests in the original PR

r? @hanna-kruppe
2020-05-21 15:02:08 +00:00
Ralf Jung
94aa02855d fix discriminant sign extension 2020-05-21 16:49:11 +02:00
bors
780572bc8d Auto merge of #5614 - ebroto:test_cargo_lints, r=flip1995
Test cargo lints

changelog: Add infrastructure to test cargo lints

Closes #5603
2020-05-21 14:43:56 +00:00
Eduardo Broto
f9013ff197 Relax fs layout so that multiple pass/fail manifests are possible 2020-05-21 15:34:48 +02:00
Stanislav Tkach
34b51187ce Suggest using std::mem::drop function instead of explicit destructor call 2020-05-21 16:21:02 +03:00
Eduardo Broto
1a04686fc0 Avoid triggering match_wildcard_for_single_variants 2020-05-21 14:47:13 +02:00
Eduardo Broto
7ff71199df Address comments from PR review 2020-05-21 14:46:04 +02:00
Eduardo Broto
5d0135e222 Add documentation for testing cargo lints 2020-05-21 14:11:11 +02:00
Eduardo Broto
1eb6adf475 Adapt cargo dev new_lint to create tests for cargo lints 2020-05-21 14:11:11 +02:00
Eduardo Broto
7a0eccbd8a Add test for multiple_crate_versions
Make the output of the lint deterministic by sorting the versions
2020-05-21 14:11:11 +02:00
Eduardo Broto
bc93f7052e Add test for cargo_common_metadata
Fix missing `authors` entry in the provided example
2020-05-21 14:11:11 +02:00
Eduardo Broto
96af3e8360 Add test for wildcard_dependencies 2020-05-21 14:11:11 +02:00
Eduardo Broto
bd9b09e293 Adapt compile-test to run tests for cargo lints 2020-05-21 14:11:11 +02:00
bors
06c9fef822 Auto merge of #72422 - RalfJung:rollup-u81z4mw, r=RalfJung
Rollup of 7 pull requests

Successful merges:

 - #71854 (Make `std::char` functions and constants associated to `char`.)
 - #72111 (rustc-book: Document `-Z strip=val` option)
 - #72272 (Fix going back in history to a search result page on firefox)
 - #72296 (Suggest installing VS Build Tools in more situations)
 - #72365 (Remove unused `StableHashingContext::node_to_hir_id` method)
 - #72371 (FIX - Char documentation for unexperienced users)
 - #72397 (llvm: Expose tiny code model to users)

Failed merges:

r? @ghost
2020-05-21 11:46:51 +00:00
Ralf Jung
e5a4550869
Rollup merge of #72397 - petrochenkov:tiny, r=Amanieu
llvm: Expose tiny code model to users

This model is relevant to embedded AArch64 targets and was added to LLVM relatively recently (https://reviews.llvm.org/D49673, mid 2018), so rustc frontend didn't provide access to it with `-C code-model`. The gcc analogue is [`-mcmodel=tiny`](https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html).
(This is one of the options that are passed directly to LLVM without being interpreted by rustc.)

Follow up to https://github.com/rust-lang/rust/pull/72248.
2020-05-21 13:12:24 +02:00
Ralf Jung
0e887129ad
Rollup merge of #72371 - Elrendio:char_documentation, r=steveklabnik
FIX - Char documentation for unexperienced users

This is my first PR on rust and even if I've read [CONTRIBUTING.md](https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#pull-requests) I'm ensure everything is perfect. Sorry if I didn't follow the exact procedure.

**What it does:**
- Add an example in the char documentation

**Explanation**
Unexperienced users might not know that punctuation is `Case_Ignorable` and not `Uppercase` and `Lowercase` which mean that when checking if a string is uppercase one might be tempted to write:
```rust
my_string.chars().all(char::is_uppercase)
```

However this will return false for `"HELLO WORLD"` which is not intuitive. Since the function `is_case_ignorable` doesn't exists I believe the correct way to check is:
```rust
!my_string.chars().any(char::is_lowercase)
```

The aim of this example is to prevent unexperienced users to make an error which punctuation chars.
2020-05-21 13:12:22 +02:00
Ralf Jung
4f9fe914e2
Rollup merge of #72365 - marmeladema:remove-node_to_hir_id, r=ecstatic-morse
Remove unused `StableHashingContext::node_to_hir_id` method

cc #50928
2020-05-21 13:12:20 +02:00
Ralf Jung
85d712c115
Rollup merge of #72296 - ChrisDenton:msvc-link-check, r=petrochenkov
Suggest installing VS Build Tools in more situations

When MSVC's `link.exe` wasn't found but another `link.exe` was, the error message given can be [impenetrable](https://pastebin.com/MRMCr7HM) to many users. The usual suspect is GNU's `link` tool. In this case, inform the user that they may need to install VS build tools.

This only applies when Microsoft's link tool is expected.
2020-05-21 13:12:19 +02:00