Commit Graph

97696 Commits

Author SHA1 Message Date
Esteban Küber
b8708e2c9a When needing type annotations in local bindings, account for impl Trait and closures
Do not suggest nonsensical types when the type inference is failing on
`impl Trait` or anonymous closures.
2019-08-12 16:50:46 -07:00
Niko Matsakis
ad214fe470 fix README.md 2019-08-12 19:23:21 -04:00
Niko Matsakis
948739f2ee revamp comment 2019-08-12 19:21:13 -04:00
Niko Matsakis
a02a171e6a add edition to regression test 2019-08-12 18:33:53 -04:00
Niko Matsakis
cbe8518407 use modern everywhere 2019-08-12 18:14:48 -04:00
Josh Stone
c4189a0bd9 Move run-pass/iterators/* to ui/iterators/ 2019-08-12 15:03:45 -07:00
Josh Stone
9c53396dde Move run-pass/iter-map-fold-type-length.rs to iterators/ 2019-08-12 15:03:44 -07:00
Josh Stone
fc4d037169 Reduce genericity in Inspect 2019-08-12 15:03:44 -07:00
Josh Stone
f1003546db Reduce genericity in Scan 2019-08-12 15:03:44 -07:00
Josh Stone
0f82c0c210 Reduce genericity in Take 2019-08-12 15:03:44 -07:00
Josh Stone
46a62ca9a4 Reduce genericity in Skip 2019-08-12 15:03:44 -07:00
Josh Stone
2d7fc4dd49 Reduce genericity in TakeWhile 2019-08-12 15:03:44 -07:00
Josh Stone
5902522c04 Reduce genericity in SkipWhile 2019-08-12 15:03:44 -07:00
Josh Stone
ff60eca7a1 Avoid closures in Peekable 2019-08-12 15:03:44 -07:00
Josh Stone
df3d686598 Reduce genericity in Enumerate 2019-08-12 15:03:44 -07:00
Josh Stone
ac113f01fb Reduce genericity in Filter and FilterMap 2019-08-12 15:03:44 -07:00
Josh Stone
b1fd3d024d Remove genericity in StepBy::size_hint 2019-08-12 15:03:44 -07:00
Josh Stone
d940ddf8f5 Reduce genericity in Copied and Cloned 2019-08-12 15:03:44 -07:00
Josh Stone
27ddbf4d16 Avoid closures in the default <Zip as ZipImpl>::next 2019-08-12 15:03:44 -07:00
Josh Stone
9ef95ff4a6 Reduce genericity in FlattenCompat 2019-08-12 15:03:44 -07:00
Josh Stone
40ecbc7b7d Avoid closures in OnceWith and Successors 2019-08-12 15:03:44 -07:00
Josh Stone
7539fc69d5 Reduce genericity in Iterator::last 2019-08-12 15:03:44 -07:00
Josh Stone
0e300e4380 Reduce the genericity of Map folds 2019-08-12 15:03:44 -07:00
Josh Stone
755c091b71 Add codegen tests for the genericity of fold closures 2019-08-12 15:03:44 -07:00
Josh Stone
6a04c762ff Explicitly test Iterator::position overflows 2019-08-12 15:03:44 -07:00
Josh Stone
af1bfbebe3 Explicitly test Iterator::count overflows 2019-08-12 15:03:44 -07:00
Josh Stone
95e2a4f23d Use if-let in is_sorted_by 2019-08-12 15:03:44 -07:00
Josh Stone
e67620afc4 Reduce the genericity of closures in the iterator traits
By default, closures inherit the generic parameters of their scope,
including `Self`. However, in most cases, the closures used to implement
iterators don't need to be generic on the iterator type, only its `Item`
type. We can reduce this genericity by redirecting such closures through
local functions.

This does make the closures more cumbersome to write, but it will
hopefully reduce duplication in their monomorphizations, as well as
their related type lengths.
2019-08-12 15:03:44 -07:00
Niko Matsakis
03e7b96281 revamp how we handle elision in async fn
We now always make fresh lifetimne parameters for all elided
lifetimes, whether they are in the inputs or outputs. But then
we generate `'_` in the case of elided lifetimes from the outputs.

Example:

```rust
async fn foo<'a>(x: &'a u32) -> &u32 { .. }
```

becomes

```rust
type Foo<'a, 'b> = impl Future<Output = &'b u32>;
fn foo<'a>(x: &'a u32) -> Foo<'a, '_>
```
2019-08-12 17:18:26 -04:00
Niko Matsakis
18e54539ca use ParamName to track in-scope lifetimes instead of Ident
This allows us to record "fresh" lifetime names for cases like `impl
Foo<'_>`.
2019-08-12 15:19:30 -04:00
David Wood
861d1bb365
typeck: Prohibit RPIT types that inherit lifetimes
This commit prohibits return position `impl Trait` types that "inherit
lifetimes" from the parent scope. The intent is to forbid cases that are
challenging until they can be addressed properly.
2019-08-12 19:04:11 +01:00
Nathan
76a1345242 Update tests for excess semicolon lint 2019-08-12 10:14:07 -04:00
Nathan
2f6cb5f75e Add lint for excess trailing semicolons 2019-08-12 10:14:07 -04:00
nathanwhit
71415ef9bd Parse excess semicolons as empty stmts for linting 2019-08-12 10:14:07 -04:00
Martin Finkel
c9da160aad review feedback: move uwp link code to get_linker 2019-08-12 15:07:23 +02:00
bors
60960a260f Auto merge of #63483 - RalfJung:invalid-value, r=Centril
Improve invalid_value lint message

The lint now explains which type is involved and why it cannot be initialized this way. It also points at the innermost struct/enum field that has an offending type, if any.

See https://github.com/erlepereira/x11-rs/issues/99#issuecomment-520311911 for how this helps in some real-world code hitting this lint.
2019-08-12 12:43:33 +00:00
Eduard-Mihai Burtescu
34dcca20e5 syntax: account for CVarArgs being in the argument list. 2019-08-12 15:28:10 +03:00
Mazdak Farrokhzad
c8fc4c106c extract parse_pat_{tuple_}struct + recover_one_fewer_dotdot 2019-08-12 12:50:44 +02:00
Mazdak Farrokhzad
ddf734deb2 extract fatal_unexpected_non_pat 2019-08-12 12:50:44 +02:00
Mazdak Farrokhzad
37f37a5df1 parser/pat: minor misc cleanup 2019-08-12 12:50:44 +02:00
Mazdak Farrokhzad
49740b792d extract parse_pat_range_starting_with_lit 2019-08-12 12:50:44 +02:00
Mazdak Farrokhzad
e6f980f9b8 extract parse_pat_range_starting_with_path 2019-08-12 12:50:44 +02:00
Mazdak Farrokhzad
e32bd69d0f extract parse_pat_mac_invoc 2019-08-12 12:50:44 +02:00
Mazdak Farrokhzad
231da7e044 extract ban_pat_range_if_ambiguous 2019-08-12 12:50:44 +02:00
Mazdak Farrokhzad
3b651330e0 extract recover_pat_ident_mut_first 2019-08-12 12:50:44 +02:00
Observer42
e30480ca86
Apply suggestions from code review
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-08-12 18:07:14 +08:00
Ralf Jung
0499923b18 more informative error message from invalid_value lint 2019-08-12 11:23:56 +02:00
bors
c01be67ea4 Auto merge of #63489 - Centril:rollup-uuf6z1s, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #62108 (Use sharded maps for queries)
 - #63297 (Improve pointer offset method docs)
 - #63406 (Suggest using a qualified path in patterns with inconsistent bindings)
 - #63431 (Revert "Simplify MIR generation for logical ops")
 - #63449 (resolve: Remove remaining special cases from built-in macros)
 - #63461 (docs: add stdlib env::var(_os) panic)
 - #63473 (Regression test for #56870)
 - #63474 (Add tests for issue #53598 and #57700)
 - #63480 (Fixes #63477)

Failed merges:

r? @ghost
2019-08-12 08:58:48 +00:00
Mazdak Farrokhzad
9d297190c8
Rollup merge of #63480 - OptimisticPeach:patch-1, r=Centril
Fixes #63477

Adds a closing parenthesis.
2019-08-12 10:58:24 +02:00
Mazdak Farrokhzad
7bdff66d35
Rollup merge of #63474 - adamAndMath:master, r=Centril
Add tests for issue #53598 and #57700

Closes #53598 and #57700
2019-08-12 10:58:22 +02:00