Commit Graph

7018 Commits

Author SHA1 Message Date
Dan Aloni
7140c024c2 resolve: fix error title regarding private constructors
The constructor is private, not the type.

Idea credit to @petrochenkov, discussed at #65153
2019-10-11 18:09:23 +03:00
bors
898f36c83c Auto merge of #65153 - da-x:issue-58017, r=petrochenkov
Improve message when attempting to instantiate tuple structs with private fields

Fixes #58017, fixes #39703.

```
error[E0603]: tuple struct `Error` is private
  --> main.rs:22:16
   |
2  |     pub struct Error(usize, pub usize, usize);
   |                      -----             ----- field is private
   |                      |
   |                      field is private
...
22 |     let x = a::Error(3, 1, 2);
   |                ^^^^^
   |
   = note: a tuple struct constructor is private if any of its fields is private
```
2019-10-10 19:40:48 +00:00
bors
9c588c1e23 Auto merge of #65140 - petrochenkov:disapp, r=nikomatsakis
resolve: Remove an incorrect assert

Fixes https://github.com/rust-lang/rust/issues/64803.
2019-10-10 12:02:47 +00:00
bors
8ee24f6ee0 Auto merge of #65077 - estebank:mut-trait-expected, r=nikomatsakis
Note when a mutable trait object is needed

Fix https://github.com/rust-lang/rust/issues/63619, fix https://github.com/rust-lang/rust/issues/37914. CC https://github.com/rust-lang/rust/issues/64068.
2019-10-10 04:07:02 +00:00
Matthew Jasper
a0342c8965 Revert "Make into schedule drop for the destination"
This reverts commit 37026837a3.
2019-10-09 21:13:18 +01:00
Esteban Küber
faf8a2af7a Only suggest change mut if vars are resolved 2019-10-09 11:42:29 -07:00
Esteban Küber
722bb515e2 Obligation must apply modulo regions 2019-10-09 10:17:29 -07:00
Esteban Küber
acd6540a74 Tweak wording 2019-10-09 10:17:29 -07:00
Esteban Küber
6d6d978baa Note when a mutable trait object is needed 2019-10-09 10:17:29 -07:00
Vadim Petrochenkov
48f8beddd8 resolve: Use field spans for reporting the private constructor error 2019-10-09 18:07:22 +03:00
Mazdak Farrokhzad
5bbdcb6734
Rollup merge of #65166 - csmoe:async-move, r=estebank
Suggest to add `move` keyword for generator capture

 Closes #64382
r? @estebank
2019-10-09 05:31:36 +02:00
Mazdak Farrokhzad
ae5bb7e289
Rollup merge of #65037 - anp:track-caller, r=oli-obk
`#[track_caller]` feature gate (RFC 2091 1/N)

RFC text: https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md
Tracking issue: https://github.com/rust-lang/rust/issues/47809

I started with @ayosec's commit to add the feature gate with tests and rebased it onto current master. I fixed up some tidy lints and added a test.
2019-10-09 05:31:35 +02:00
Mazdak Farrokhzad
ff51611c42
Rollup merge of #65213 - estebank:peel-drop-temps, r=Centril
Ignore `ExprKind::DropTemps` for some ref suggestions

Introduce `Expr::peel_drop_temps()` to ignore `ExprKind::DropTemps` for suggestions that depend on the `ExprKind` for accuracy.
2019-10-08 23:31:28 +02:00
Mazdak Farrokhzad
4a6304fb05
Rollup merge of #65194 - estebank:remove_str, r=petrochenkov
Use structured suggestion for removal of `as_str()` call

Follow up to #64739.
2019-10-08 23:31:27 +02:00
Mazdak Farrokhzad
9b989ea298
Rollup merge of #65133 - davidtwco:issue-65035-static-with-generic-in-foreign-mod, r=petrochenkov
typeck: prohibit foreign statics w/ generics

Fixes #65035 and fixes #65025.

This PR modifies resolve to disallow foreign statics that have
generics.

`improper_ctypes` is not written to support type parameters, as these
are normally disallowed before the lint is run. Thus, type parameters in
foreign statics must be prohibited before the lint.

The only other case where this *could* have occured is in functions,
but typeck prohibits this with a "foreign items may not have type
parameters" error - a similar error did not exist for statics, because
statics cannot have type parameters, but they can use any
type parameters that are in scope (which isn't the case for functions).
2019-10-08 23:31:22 +02:00
Mazdak Farrokhzad
fc068222d0
Rollup merge of #64284 - Mark-Simulacrum:include-warn, r=petrochenkov
Warn if include macro fails to include entire file

This currently introduces an error, mainly because that was just simpler, and I'm not entirely certain if we can introduce a lint without an RFC and such.

This is primarily to get feedback on the approach and overall aim -- in particular, do we think this is helpful? If so, we probably will need lang-team sign off and decide if it should be an error (as currently introduced by this PR), a lint, or a warning.

r? @petrochenkov

cc https://github.com/rust-lang/rust/issues/35560
2019-10-08 23:31:19 +02:00
David Wood
ccbf2b76a6
resolve: prohibit foreign statics w/ generics
This commit modifies resolve to disallow foreign statics that use
parent generics.

`improper_ctypes` is not written to support type parameters, as these
are normally disallowed before the lint is run. Thus, type parameters in
foreign statics must be prohibited before the lint.

The only other case where this *could* have occured is in functions,
but typeck prohibits this with a "foreign items may not have type
parameters" error - a similar error did not exist for statics, because
statics cannot have type parameters, but they can use any
type parameters that are in scope (which isn't the case for functions).

Signed-off-by: David Wood <david@davidtw.co>
2019-10-08 18:46:24 +01:00
Esteban Küber
ac9025c197 Call Expr::peel_drop_temps() from more places for more accurate suggestions 2019-10-08 08:42:26 -07:00
Esteban Küber
d84c4cd718 Ignore ExprKind::DropTemps for some ref suggestions 2019-10-08 08:26:42 -07:00
Mazdak Farrokhzad
3246ab2427
Rollup merge of #65179 - GuillaumeGomez:long-err-explanation-E0567, r=davidtwco
Add long error explanation for E0567

Part of #61137.
2019-10-08 15:45:34 +02:00
Mazdak Farrokhzad
58bfe3b0ec
Rollup merge of #65145 - estebank:turbofish-assoc-fn-call, r=varkor
When suggesting assoc function with type params, include turbofish

Fix https://github.com/rust-lang/rust/issues/61412, fix https://github.com/rust-lang/rust/issues/61411.
2019-10-08 15:45:29 +02:00
Mazdak Farrokhzad
7153c9262a
Rollup merge of #64918 - GuillaumeGomez:long-err-explanation-E0551, r=oli-obk
Add long error explanation for E0551

Part of #61137
2019-10-08 15:45:25 +02:00
Mazdak Farrokhzad
6f211f1539
Rollup merge of #64404 - GuillaumeGomez:err-E0495, r=Dylan-DPC
Add long error explanation for E0495

Part of #61137.
2019-10-08 15:45:23 +02:00
Guillaume Gomez
6608e4af1b Update ui tests 2019-10-08 13:57:40 +02:00
csmoe
d1d256592b suggest to add move keyword for generator 2019-10-08 11:13:48 +00:00
Mazdak Farrokhzad
ecdb5e98cb
Rollup merge of #65154 - skinny121:const-arg-diagnostic, r=varkor
Fix const generic arguments not displaying in types mismatch diagnostic

Fixes #61395
2019-10-08 05:02:41 +02:00
Mazdak Farrokhzad
5422ed7834
Rollup merge of #65150 - XiangQingW:master, r=estebank
Suggest dereferencing boolean reference when used in 'if' or 'while'

Implements #64557
2019-10-08 05:02:39 +02:00
Mazdak Farrokhzad
73685ec56f
Rollup merge of #65098 - GuillaumeGomez:long-err-explanation-E0561, r=Centril
Add long error explanation for E0561

Part of #61137
2019-10-08 05:02:38 +02:00
Mazdak Farrokhzad
4737095416
Rollup merge of #65040 - Centril:items-cleanup, r=estebank
syntax: more cleanups in item and function signature parsing

Follow up to https://github.com/rust-lang/rust/pull/64910.

Best read commit-by-commit.

r? @estebank
2019-10-08 05:02:35 +02:00
Mark Rousskov
e068cec13e Warn if include macro fails to include entire file 2019-10-07 19:47:53 -04:00
Esteban Küber
5aa37a9c9b Use structured suggestion for removal of as_str() call 2019-10-07 16:18:02 -07:00
bors
f3c9cece7b Auto merge of #61430 - matthewjasper:drop-on-into-panic, r=oli-obk
Make `into` schedule drop for the destination

closes #47949
2019-10-07 17:47:10 +00:00
Guillaume Gomez
96efaad342 update ui tests 2019-10-07 17:12:54 +02:00
Adam Perry
190212c6bf Prohibit #[track_caller] within trait impls as well as decls. 2019-10-07 08:05:33 -07:00
Adam Perry
f70ed29fbd Update expected error output. 2019-10-07 08:05:33 -07:00
Adam Perry
130be6d4b8 Expand E0738 to cover different cases. 2019-10-07 08:05:33 -07:00
Adam Perry
8992c30db4 E0735 -> E0739
Prevents number collision with another approved PR.
2019-10-07 08:05:33 -07:00
Adam Perry
53096c575d track_caller tests account for incomplete feature warning. 2019-10-07 08:05:33 -07:00
Adam Perry
9900211ea0 track_caller error numbers and text. 2019-10-07 08:05:33 -07:00
Adam Perry
6c04c8eb8e track_caller run-pass test, lint cleanup, PR review. 2019-10-07 08:05:22 -07:00
Ayose
543449d4fd [RFC 2091] Add #[track_caller] attribute.
- The attribute is behind a feature gate.
- Error if both #[naked] and #[track_caller] are applied to the same function.
- Error if #[track_caller] is applied to a non-function item.
- Error if ABI is not "rust"
- Error if #[track_caller] is applied to a trait function.

Error codes and descriptions are pending.
2019-10-07 08:05:21 -07:00
bors
e3cb9ea15a Auto merge of #65178 - Centril:rollup-ep1zztj, r=Centril
Rollup of 4 pull requests

Successful merges:

 - #63948 (Add feature gate for raw_dylib.)
 - #65137 (remove event that causes panics in measureme tools)
 - #65164 (Add long error explanation for E0566)
 - #65173 (Update reference)

Failed merges:

r? @ghost
2019-10-07 09:21:30 +00:00
Guillaume Gomez
8dd00088c1 Update ui tests 2019-10-07 11:20:10 +02:00
Mazdak Farrokhzad
4db77a4c58
Rollup merge of #65164 - GuillaumeGomez:long-err-explanation-E0566, r=estebank
Add long error explanation for E0566

Part of #61137.
2019-10-07 10:36:48 +02:00
ben
74eac929c2 Test diagnostic output of type mismatches for types that have const
generics arguments.
2019-10-07 20:39:08 +13:00
bors
f92f3c4bc6 Auto merge of #64739 - guanqun:remove-as-str, r=estebank
Remove as_str if the type is already &str

Fix https://github.com/rust-lang/rust/issues/62642

r? @estebank

do you think the suggestion tip is good enough?
2019-10-07 05:35:17 +00:00
Charles Lew
dda10f2a2a Add more tests, fix span issue, improve diagnostics. 2019-10-07 12:01:57 +08:00
Charles Lew
eb492455f2 Address review comments. 2019-10-07 12:01:56 +08:00
Charles Lew
e70ffed9cd Add feature gate for raw_dylib. 2019-10-07 12:01:54 +08:00
Mazdak Farrokhzad
a7ba754b6c syntax: unify and simplify fn signature parsing. 2019-10-07 06:01:38 +02:00