Commit graph

25797 commits

Author SHA1 Message Date
Vadim Petrochenkov
319f0debd4 resolve: Address FIXME from the previous commit
Make the `is_import` flag in `ScopeSet` independent from namespace
Fix rebase
2019-08-10 13:48:17 +03:00
Vadim Petrochenkov
8cc8133973 Fix calls to resolver from rustdoc and HIR lowering
Cleanup some surrounding code.
Support resolution of intra doc links in unnamed block scopes.
(Paths from rustdoc now use early resolution and no longer need results of late resolution like all the built ribs.)

Fix one test hitting file path limits on Windows.
2019-08-10 13:16:06 +03:00
Vadim Petrochenkov
e2e8746acc resolve: Move late resolution into a separate visitor
Move `Resolver` fields specific to late resolution to the new visitor.
The `current_module` field from `Resolver` is replaced with two `current_module`s in `LateResolutionVisitor` and `BuildReducedGraphVisitor`.
Outside of those visitors `current_module` is replaced by passing `parent_scope` to more functions and using the parent module from it.

Visibility resolution no longer have access to later resolution methods and has to use early resolution, so its diagnostics in case of errors regress slightly.
2019-08-10 13:15:15 +03:00
Mazdak Farrokhzad
019f6fed28
Rollup merge of #63423 - estebank:priv-tuple, r=zackmdavis
Mention that tuple structs are private if any of their fields are

CC #39703
2019-08-10 08:13:25 +02:00
Mazdak Farrokhzad
a029ce80a6
Rollup merge of #63419 - RalfJung:typeid, r=alexcrichton
check against more collisions for TypeId of fn pointer

Cc https://github.com/rust-lang/rfcs/pull/2738#issuecomment-519923318
2019-08-10 08:13:24 +02:00
Mazdak Farrokhzad
9e613c74be
Rollup merge of #63399 - estebank:vec-in-pat, r=Centril
More explicit diagnostic when using a `vec![]` in a pattern

```
error: unexpected `(` after qualified path
  --> $DIR/vec-macro-in-pattern.rs:3:14
   |
LL |         Some(vec![x]) => (),
   |              ^^^^^^^
   |              |
   |              unexpected `(` after qualified path
   |              in this macro invocation
   |              use a slice pattern here instead
   |
   = help: for more information, see https://doc.rust-lang.org/edition-guide/rust-2018/slice-patterns.html
   = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
```

Fix #61933.
2019-08-10 08:13:22 +02:00
Mazdak Farrokhzad
5ed195baaa
Rollup merge of #63394 - jackh726:issue-36804, r=jonas-schievink
Add test for issue 36804

I slightly reduced the repro that ICEs on nightly-2017-01-20.

Closes #36804
2019-08-10 08:13:21 +02:00
Mazdak Farrokhzad
52f9e80e5f
Rollup merge of #63337 - estebank:break-ee0308, r=Centril
Tweak mismatched types error

- Change expected/found for type mismatches in `break`
- Be more accurate when talking about diverging match arms
- Tweak wording of function without a return value
- Suggest calling bare functions when their return value can be coerced to the expected type
- Give more parsing errors when encountering `foo(_, _, _)`

Fix #51767, fix #62677, fix #63136, cc #37384, cc #35241, cc #51669.
2019-08-10 08:13:17 +02:00
Vadim Petrochenkov
cbcc7dd182 Give built-in macros stable addresses in the standard library 2019-08-10 00:05:37 +03:00
Esteban Küber
b9865d9e3f Mention that tuple structs are private if their fields are 2019-08-09 12:52:02 -07:00
Ralf Jung
4dd96d2b0f check against more collisions for TypeId of fn pointer 2019-08-09 20:10:39 +02:00
Esteban Küber
75c5ad2e82 review comments: use structured suggestion 2019-08-09 09:40:26 -07:00
Esteban Küber
7c96d90c20 More explicit diagnostic when using a vec![] in a pattern
```
error: unexpected `(` after qualified path
  --> $DIR/vec-macro-in-pattern.rs:3:14
   |
LL |         Some(vec![x]) => (),
   |              ^^^^^^^
   |              |
   |              unexpected `(` after qualified path
   |              in this macro invocation
   |              use a slice pattern here instead
   |
   = help: for more information, see https://doc.rust-lang.org/edition-guide/rust-2018/slice-patterns.html
   = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
```
2019-08-09 08:20:13 -07:00
Esteban Küber
45a5bc7619 fix tests 2019-08-09 07:57:16 -07:00
Esteban Küber
bc1a4f52e3 review comments: typo and rewording 2019-08-09 07:18:05 -07:00
Esteban Küber
33d1082d6e review comment: review wording or missing return error 2019-08-09 07:18:05 -07:00
Esteban Küber
5a54945b6f Extend suggestion support for traits and foreign items 2019-08-09 07:18:05 -07:00
Esteban Küber
52da091ee6 Differentiate between tuple structs and tuple variants 2019-08-09 07:18:05 -07:00
Esteban Küber
efa62d66e3 Tweak wording of fn without explicit return 2019-08-09 07:18:05 -07:00
Esteban Küber
b7f7756566 Recover parser from foo(_, _) 2019-08-09 07:18:05 -07:00
Esteban Küber
195d837f18 When suggesting fn call use an appropriate number of placeholder arguments 2019-08-09 07:18:05 -07:00
Esteban Küber
94fe8a3c17 Suggest calling function on type error when finding bare fn 2019-08-09 07:18:05 -07:00
Esteban Küber
01a61394f8 Change wording for function without return value
Fix #62677
2019-08-09 07:18:05 -07:00
Esteban Küber
4fbbf99c50 Be more accurate when mentioning type of found match arms 2019-08-09 07:18:05 -07:00
Esteban Küber
799b13ada5 Do not suggest using ! with break 2019-08-09 07:18:05 -07:00
Esteban Küber
c076392143 Tweak mismatched types error on break expressions 2019-08-09 07:18:05 -07:00
Mazdak Farrokhzad
7a251629a2
Rollup merge of #63397 - JohnTitor:add-tests-for-ices, r=Centril
Add tests for some ICEs

Closes #43623
Closes #44405

r? @Centril
2019-08-09 14:07:31 +02:00
Mazdak Farrokhzad
714c8ea9b5
Rollup merge of #63114 - matthewjasper:hygienic-format-args, r=petrochenkov
Remove gensym in format_args

This also fixes some things to allow us to export opaque macros from libcore:

* Don't consider items that are only reachable through opaque macros as public/exported (so they aren't linted as needing docs)
* Mark private items reachable from the root of libcore as unstable - they are now reachable (in principle) in other crates via macros in libcore

r? @petrochenkov
2019-08-09 14:07:29 +02:00
Mazdak Farrokhzad
03c524e0f5
Rollup merge of #62672 - lzutao:deprecated-try-macro, r=Centril
Deprecate `try!` macro

Replaces #62077

Fixes rust-lang/rust-clippy#1361
Fixes #61000
2019-08-09 14:07:26 +02:00
Lzu Tao
6842316f6f Allow deprecated try macro in test crates 2019-08-09 02:29:44 +00:00
BO41
fd7ac6b17e Deprecate try! macro
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
Co-Authored-By: Oliver Middleton <olliemail27@gmail.com>
2019-08-09 02:29:44 +00:00
Mazdak Farrokhzad
87fb0ad485
Rollup merge of #63387 - Centril:async-block-control-flow-tests, r=cramertj
Test interaction between `async { ... }` and `?`, `return`, and `break`

Per the second checkbox in https://github.com/rust-lang/rust/issues/62121#issuecomment-506884048, test that `async { .. }` blocks:
1. do not allow `break` expressions.
2. get targeted by `return` and not the parent function.
3. get targeted by `?` and not the parent function.

Works towards resolving blockers in #63209.

r? @cramertj
2019-08-09 01:38:36 +02:00
Mazdak Farrokhzad
74b22c9007
Rollup merge of #63289 - kornelski:missingcrate, r=zackmdavis
Don't recommend `extern crate` syntax

`extern crate` syntax is not a good recommendation any more, so I've changed it to just print a suggested crate name.
2019-08-09 01:38:30 +02:00
Yuki Okushi
55f15d7655 Add test for issue-44405 2019-08-09 08:37:55 +09:00
Yuki Okushi
642ee70942 Add test for issue-43623 2019-08-09 08:37:40 +09:00
Jack
322a7d6387 Add test for issue 36804 2019-08-08 19:16:08 -04:00
Mazdak Farrokhzad
48fbf4891a Test interaction btw async blocks and ?, return, break. 2019-08-09 00:21:21 +02:00
Mazdak Farrokhzad
3de450b686
Rollup merge of #63379 - jackh726:issue-53096, r=Centril,oli-obk
Add test for issue 53096

Closes #53096

r? @oli-obk
2019-08-08 16:33:44 +02:00
Mazdak Farrokhzad
499887ffb9
Rollup merge of #63370 - JohnTitor:fix-ice-63364, r=varkor
Fix ICE #63364

Fixes #63364

r? @estebank cc @varkor
2019-08-08 16:33:41 +02:00
Jack
25a2cf6744 Move test 2019-08-08 10:13:55 -04:00
Jack
b8b8008254 Add test for issue 53096 2019-08-08 09:41:39 -04:00
Mazdak Farrokhzad
4f415fca37
Rollup merge of #63331 - gorup:conditionalinit, r=cramertj
Test conditional initialization validation in async fns

r? @cramertj

Per [paper doc](https://paper.dropbox.com/doc/async.await-Call-for-Tests--AiWF2Nt8tgDiA70qFI~oiLOOAg-nMyZGrra7dz9KcFRMLKJy) calling for async/.await tests, tests are desired for conditionally initialized local variables. This PR hopes to provide tests for that.

#63294 seems to be tracking the items from the paper doc that this PR is related to
#62121 is an open issue asking for more async/.await tests that this relates to

---
👍 executed 2 new tests
👍 tidy
2019-08-08 07:35:35 +02:00
Mazdak Farrokhzad
5277c71e84
Rollup merge of #63259 - JohnTitor:add-tests-for-some-issues, r=Centril
Add tests for some issues

Closes #29265
Closes #37433
Closes #49544

r? @Centril
2019-08-08 07:35:32 +02:00
Mazdak Farrokhzad
3a84c9db5f
Rollup merge of #62994 - iluuu1994:test-for-43398, r=nikomatsakis
Add test for #43398

Closes #43398
2019-08-08 07:35:30 +02:00
Yuki Okushi
e2b3543eab Return early to avoid failing assertion 2019-08-08 13:38:23 +09:00
bors
476af31d59 Auto merge of #62457 - zackmdavis:minimax_search_and_the_structure_of_cognition, r=varkor
pretty-pretty extremal constants!

(A resurrection of the defunct #57073.)

While many programmers may intuitively appreciate the significance of "magic numbers" like −2147483648, Rust is about empowering everyone to build reliable and efficient software! It's a bit more legible to print the constant names (even noisy fully-qualified-paths thereof).

The bit-manipulation methods mirror those in `librustc_mir::hair::pattern::_match::all_constructors`; thanks to the immortal Varkor for guidance.

Resolves #56393.

r? @varkor
2019-08-07 22:07:24 +00:00
bors
d4abb08be6 Auto merge of #61919 - alexreg:fix-atb-1, r=nikomatsakis
Fix for "ambiguous associated type" issue with ATBs

Fixes #61752.

r? @nikomatsakis

CC @Centril
2019-08-07 09:33:34 +00:00
bors
5421d94960 Auto merge of #63152 - estebank:big-array, r=oli-obk
Always error on `SizeOverflow` during mir evaluation

Fix #55878, fix #25116.

r? @oli-obk
2019-08-07 04:28:08 +00:00
Zack M. Davis
d1cdb02e4d pretty-pretty extremal constants!
While many programmers may intuitively appreciate the significance of
"magic numbers" like −2147483648, Rust is about empowering everyone to
build reliable and efficient software! It's a bit more legible to
print the constant names (even noisy fully-qualified-paths thereof).

The bit-manipulation methods mirror those in
`librustc_mir::hair::pattern::_match::all_constructors`; thanks to the
immortal Varkor for guidance.

Resolves #56393.
2019-08-06 21:00:46 -07:00
Esteban Küber
3144b0aa04 review comment: reword test comment 2019-08-06 16:51:17 -07:00