Mazdak Farrokhzad
e933f54793
Rollup merge of #62772 - estebank:trait-bound, r=matthewjasper
...
Suggest trait bound on type parameter when it is unconstrained
Given
```
trait Foo { fn method(&self) {} }
fn call_method<T>(x: &T) {
x.method()
}
```
suggest constraining `T` with `Foo`.
Fix #21673 , fix #41030 .
2019-07-24 16:13:14 +02:00
Mark Rousskov
ab7149bdc5
Rollup merge of #62791 - estebank:type-ascription, r=petrochenkov
...
Handle more cases of typos misinterpreted as type ascription
Fix #60933 , #54516 .
CC #47666 , #34255 , #48016 .
2019-07-23 12:51:07 -04:00
Mazdak Farrokhzad
17ddfbe49c
Rollup merge of #62810 - fakenine:normalize_use_of_backticks_compiler_messages_p10, r=Centril
...
normalize use of backticks in compiler messages for librustc_lint
https://github.com/rust-lang/rust/issues/60532
2019-07-22 15:32:18 +02:00
Vadim Petrochenkov
39d144e808
Fix or ignore regressed tests
2019-07-22 11:50:21 +03:00
Samy Kacimi
0385d64d19
normalize use of backticks in compiler messages for librustc_lint
2019-07-21 11:47:24 +02:00
Esteban Küber
f5b285906e
Handle more cases of typos misinterpreted as type ascription
2019-07-19 10:56:37 -07:00
bors
fe499a7b34
Auto merge of #62684 - petrochenkov:scopevisit, r=davidtwco
...
resolve: Improve candidate search for unresolved macro suggestions
Use same scope visiting machinery for both collecting suggestion candidates and actually resolving the names.
The PR is better read in per-commit fashion with whitespace changes ignored (the first commit in particular moves some code around).
This should be the last pre-requisite for https://github.com/rust-lang/rust/pull/62086 .
r? @davidtwco
2019-07-19 00:24:39 +00:00
Esteban Küber
f22bc2d3ff
Suggest trait bound on type parameter when it is unconstrained
...
Given
```
mented on Jan 26, 2015 •
trait Foo { fn method(&self) {} }
fn call_method<T>(x: &T) {
x.method()
}
```
suggest constraining `T` with `Foo`.
2019-07-18 11:50:50 -07:00
Mark Rousskov
0ae9048494
Rollup merge of #62764 - fakenine:normalize_use_of_backticks_compiler_messages_p7, r=alexreg
...
normalize use of backticks in compiler messages for librustc/lint
https://github.com/rust-lang/rust/issues/60532
2019-07-18 11:29:53 -04:00
Mark Rousskov
988a4bad90
Rollup merge of #62712 - limira:self-type-help, r=estebank
...
Update the help message on error for self type
Fix #62609
2019-07-18 11:29:40 -04:00
Mark Rousskov
df21a6f040
Rollup merge of #62696 - chocol4te:fix_#62194, r=estebank
...
Check that trait is exported or public before adding hint
Closes #62194 .
This PR checks the `AccessLevels` of a trait to check whether adding the intercrate ambiguity hint is valid or not.
I am unsure of both the use of `.unwrap()` as well as removing hints for [downstream *and* [upstream](92b0f52584/src/librustc/traits/select.rs (L112-L142) ).
2019-07-18 11:29:39 -04:00
Vadim Petrochenkov
a7726ce086
resolve: Attempt to resolve unresolved paths in macro namespace
2019-07-18 13:42:45 +03:00
Vadim Petrochenkov
329c05251a
resolve: Visit all scopes to collect suggestion candidates for unresolved macros
2019-07-18 13:42:45 +03:00
Vadim Petrochenkov
79f0d88de8
resolve: Use feature(custom_attribute) fallback only if the feature is enabled
...
Normally `#![feature(...)]` shouldn't change behavior, but custom attributes in particular are in the process of retirement, and we should not produce a message telling to enable them.
It also helps with unifying diagnostics for unresolved macros.
2019-07-18 13:42:45 +03:00
Samy Kacimi
e5e1397adb
normalize use of backticks in compiler messages for librustc/lint
...
https://github.com/rust-lang/rust/issues/60532
2019-07-17 22:49:48 +02:00
Mark Rousskov
94b16d4bd0
Rollup merge of #62703 - fakenine:normalize_use_of_backticks_compiler_messages_p6, r=eddyb
...
normalize use of backticks in compiler messages for libsyntax/parse
https://github.com/rust-lang/rust/issues/60532
2019-07-16 11:38:58 -04:00
Ferdia McKeogh
2ced474e80
Check that trait is exported or public before adding intercrate ambiguity hint
2019-07-16 07:53:30 +02:00
Limira
b7cbd4ec47
Update the help message on error for self type
2019-07-16 11:30:48 +07:00
Samy Kacimi
7ddafaf6f9
normalize use of backticks in compiler messages for libsyntax/parse
...
https://github.com/rust-lang/rust/issues/60532
2019-07-16 00:07:30 +02:00
nathanwhit
c221e93fcd
Add info about undefined behavior to as_ref suggestions
2019-07-14 23:05:03 -04:00
bors
83e4eed16e
Auto merge of #62638 - estebank:issue-62554, r=petrochenkov
...
Use snippet instead of pprinting statement
Fix #62554 .
2019-07-14 17:29:17 +00:00
bors
ec30876f30
Auto merge of #62468 - rust-lang:mutable-overloaded-operators, r=estebank
...
Improve diagnostics for invalid mutation through overloaded operators
Closes #58864
Closes #52941
Closes #57839
2019-07-13 13:44:40 +00:00
Esteban Küber
a86aac1a67
add tests
2019-07-12 14:31:10 -07:00
Esteban Küber
726aa1437f
Use snippet instead of pprinting statement
2019-07-12 14:01:13 -07:00
Mazdak Farrokhzad
fe4e32a4e6
Rollup merge of #62623 - pnkfelix:issue-62614-downgrade-indirect-structural-match-lint-to-allow, r=zackmdavis
...
downgrade indirect_structural_match lint to allow
This is a short-term band-aid for the regression aspect of #62614 .
2019-07-12 22:46:54 +02:00
Mazdak Farrokhzad
a7f1649fbb
Rollup merge of #62607 - estebank:this-mem-is-out-of-control, r=petrochenkov
...
Correctly break out of recovery loop
Fix #61858 .
2019-07-12 22:46:52 +02:00
Mazdak Farrokhzad
992bcd0266
Rollup merge of #62578 - JohnTitor:add-test-for-49919, r=alexcrichton
...
Add test for #49919
Closes #49919
2019-07-12 22:46:46 +02:00
Esteban Küber
8c5f6907a1
add test case
2019-07-12 11:13:03 -07:00
Felix S. Klock II
00e0d8790d
Turn indirect_structural_match lint on explicitly in ui tests.
2019-07-12 15:27:21 +02:00
bors
4bb6b4a5ed
Auto merge of #62503 - pnkfelix:dont-recur-infiitely-from-print-def-path, r=eddyb
...
Dont recur infinitely from print_def_path
Fix #61711
2019-07-11 13:34:29 +00:00
Yuki Okushi
37942c4753
Add test for #49919
2019-07-11 09:58:09 +09:00
bors
c6a9e766f9
Auto merge of #62339 - pnkfelix:issue-61188-use-visitor-for-structural-match-check, r=nikomatsakis
...
use visitor for #[structural_match] check
This changes the code so that we recur down the structure of a type of a const (rather than just inspecting at a shallow one or two levels) when we are looking to see if it has an ADT that did not derive `PartialEq` and `Eq`.
Fix #61188
Fix #62307
Cc #62336
2019-07-10 12:26:44 +00:00
Mazdak Farrokhzad
c57a223f15
Rollup merge of #62526 - fakenine:normalize_use_of_backticks_compiler_messages_p4, r=Centril
...
normalize use of backticks in compiler messages for libsyntax/feature_gate.rs
https://github.com/rust-lang/rust/issues/60532
2019-07-09 21:01:55 +02:00
Mazdak Farrokhzad
9c144335bf
Rollup merge of #62450 - nagisa:reclimit, r=pnkfelix
...
Raise the default recursion limit to 128
The previous limit of 64 is being (just) barely hit by genuine code out there, which is causing issues like https://github.com/rust-lang/rust/issues/62059 to rear their end.
Ideally, we wouldn’t have such arbitrary limits at all, but while we do, it makes a lot of sense to just raise this limit whenever genuine use-cases end up hitting it.
r? @pnkfelix
Fixes https://github.com/rust-lang/rust/issues/62059
2019-07-09 21:01:49 +02:00
Samy Kacimi
41e71b0c93
normalize use of backticks in compiler messages for libsyntax/feature_gate
...
https://github.com/rust-lang/rust/issues/60532
2019-07-09 14:13:28 +02:00
Felix S. Klock II
4c58b29285
regression test.
2019-07-08 22:27:02 +02:00
Felix S. Klock II
02714b8ba3
Regression tests and updates to existing tests.
...
The regression tests explore:
(direct | indirect | doubly-indirect | unsafe) x (embedded | param):
where:
embedded: `struct Wrapper(... NoDerive ...);`
param: `struct Wrapper<X>(... X ...);`
direct: `const A: Wrapper<...> = Wrapper(NoDerive);`
indirect: `const A: & & Wrapper<...> = Wrapper(NoDerive)`
doubly-indirect: `const A: & & Wrapper<...> = & & Wrapper(& & NoDerive)`
unsafe: `const A: UnsafeWrap<...> = UnsafeWrap(std::ptr::null())`
2019-07-08 12:12:03 +02:00
Matthew Jasper
38306adf16
Add help message for mutation though overloaded place operators
2019-07-07 15:24:19 +01:00
Simonas Kazlauskas
7e40df3f13
Raise the default recursion limit to 128
2019-07-07 00:12:35 +03:00
Samy Kacimi
7a2a17af09
normalize use of backticks/lowercase in compiler messages for librustc_mir
...
https://github.com/rust-lang/rust/issues/60532
r? @alexreg
2019-07-06 20:40:40 +02:00
bors
254f201495
Auto merge of #61988 - Centril:there-is-only-loop, r=matthewjasper
...
[let_chains, 3/6] And then there was only Loop
Here we remove `hir::ExprKind::While`.
Instead, we desugar: `'label: while $cond $body` into:
```rust
'label: loop {
match DropTemps($cond) {
true => $body,
_ => break,
}
}
```
Per https://github.com/rust-lang/rust/issues/53667#issuecomment-471583239 .
This is a follow up to https://github.com/rust-lang/rust/pull/59288 which did the same for `if` expressions.
r? @matthewjasper
2019-07-06 06:15:44 +00:00
Mazdak Farrokhzad
547735457f
Make WhileTrue into an EarlyLintPass lint.
2019-07-06 06:43:58 +02:00
Mazdak Farrokhzad
46edb516df
Rollup merge of #62377 - wesleywiser:fix_62375, r=alexcrichton
...
Add test for ICE #62375
Fixes #62375
2019-07-06 02:38:02 +02:00
Mark Rousskov
007d87f171
Permit use of mem::uninitialized via allow(deprecated)
2019-07-04 21:01:35 -04:00
Wesley Wiser
12672e2053
Add test for ICE #62375
...
Fixes #62375
2019-07-04 10:49:24 -04:00
Mazdak Farrokhzad
919349701a
Rollup merge of #62317 - JohnTitor:move-tests-to-build-pass, r=Centril
...
Migrate `compile-pass` annotations to `build-pass`
This is a part of #62277 .
As a first step, the `compile-pass` tests are migrated to `build-pass`.
r? @cramertj
cc @Centril
2019-07-04 01:38:58 +02:00
Yuki Okushi
c004451a20
Migrate compile-pass annotations to build-pass
2019-07-03 06:30:28 +09:00
Vadim Petrochenkov
3f39dc1b90
syntax: Unsupport foo! bar { ... } macros in the parser
...
Unreserve `macro_rules` as a macro name
2019-07-01 12:20:54 +03:00
bors
5748825cc8
Auto merge of #61682 - Centril:stabilize-type_alias_enum_variants, r=petrochenkov
...
Stabilize `type_alias_enum_variants` in Rust 1.37.0
Stabilize `#![feature(type_alias_enum_variants)]` which allows type-relative resolution with highest priority to `enum` variants in both expression and pattern contexts. For example, you may now write:
```rust
enum Option<T> {
None,
Some(T),
}
type OptAlias<T> = Option<T>;
fn work_on_alias(x: Option<u8>) -> u8 {
match x {
OptAlias::Some(y) => y + 1,
OptAlias::None => 0,
}
}
```
Closes https://github.com/rust-lang/rfcs/issues/2218
Closes https://github.com/rust-lang/rust/issues/52118
r? @petrochenkov
2019-07-01 03:11:19 +00:00
Mazdak Farrokhzad
6070e2e876
Rollup merge of #62085 - JohnTitor:add-test-for-issue-38591, r=Centril
...
Add test for issue-38591
Closes #38591
r? @pnkfelix
2019-06-25 17:15:34 +02:00