Commit Graph

123 Commits

Author SHA1 Message Date
Mazdak Farrokhzad 2c3e5d3de0 - remove syntax::{span_warn!, span_err!, span_fatal!. struct_err!}
- remove syntax::{help!, span_help!, span_note!}
- remove unused syntax::{struct_span_fatal, struct_span_err_or_warn!, span_err_or_warn!}
- lintify check_for_bindings_named_same_as_variants + conflicting_repr_hints
- inline syntax::{struct_span_warn!, diagnostic_used!}
- stringify_error_code! -> error_code! & use it more.
- find_plugin_registrar: de-fatalize an error
- de-fatalize metadata errors
- move type_error_struct! to rustc_typeck
- struct_span_err! -> rustc_errors
2020-01-08 04:25:33 +01:00
Mazdak Farrokhzad ebfd8673a7 Remove rustc_hir reexports in rustc::hir. 2020-01-05 12:49:22 +01:00
Mazdak Farrokhzad 62ac10ffde simplify reexports in rustc::hir 2020-01-05 12:47:11 +01:00
Mazdak Farrokhzad 7901c7f707 canonicalize FxHash{Map,Set} imports 2020-01-04 18:57:22 +01:00
Mazdak Farrokhzad 4ff12ce4c1 Normalize `syntax::symbol` imports. 2020-01-02 13:57:04 +01:00
Mazdak Farrokhzad 75e4783f63 Normalize `syntax::source_map` imports. 2020-01-02 13:57:04 +01:00
Vadim Petrochenkov 70f1d57048 Rename `syntax_pos` to `rustc_span` in source code 2020-01-01 09:15:18 +03:00
Camille GILLOT 36f95ab3fa Fallout in other crates. 2019-12-27 19:20:28 +01:00
Camille GILLOT 8284035372 Fallout in other crates. 2019-12-26 23:38:46 +01:00
Mazdak Farrokhzad a75968a782
Rollup merge of #67551 - ldm0:E0627, r=Dylan-DPC
Add long error code explanation message for E0627

Part of #61137.

r? @GuillaumeGomez
2019-12-24 04:39:58 +01:00
Donough Liu 587d03bea8 Yield is an expression form, not a statement. 2019-12-23 21:07:13 +08:00
varkor 9e5081394c Fix reformatting rebase issues 2019-12-23 12:39:48 +00:00
varkor 9a602243c4 Add new folder for destructuring assignment tests 2019-12-23 11:20:13 +00:00
varkor 35979a92bf Add span information to `ExprKind::Assign` 2019-12-23 11:20:13 +00:00
varkor 5ab4735559 Recognise nested tuples/arrays/structs 2019-12-23 11:17:55 +00:00
varkor 5fa02ecc29 Add note about destructuring assignments 2019-12-23 11:17:55 +00:00
varkor b7bfdbe681 Improve invalid assignment error 2019-12-23 11:16:51 +00:00
Mark Rousskov a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
Mazdak Farrokhzad 97bee3a793
Rollup merge of #66877 - skinny121:const-eval-entry-points, r=oli-obk
Add simpler entry points to const eval for common usages.

I found the `tcx.const_eval` API to be complex/awkward to work with, because of the inherent complexity from all of the different situations it is called from. Though it mainly used in one of the following ways:
- Evaluates the value of a constant without any substitutions, e.g. evaluating a static, discriminant, etc.
- Evaluates the value of a resolved instance of a constant. this happens when evaluating unevaluated constants or normalising trait constants.
- Evaluates a promoted constant.

This PR adds three new functions `const_eval_mono`, `const_eval_resolve`, and `const_eval_promoted` to `TyCtxt`, which each cater to one of the three ways `tcx.const_eval`
 is normally used.
2019-12-22 19:46:07 +01:00
Ben Lewis c010d843aa Add simpler entry points to const eval for common usages. 2019-12-22 11:15:16 +13:00
Mazdak Farrokhzad a7aec3f207 1. ast::Mutability::{Mutable -> Mut, Immutable -> Not}.
2. mir::Mutability -> ast::Mutability.
2019-12-20 22:22:44 +01:00
Mazdak Farrokhzad f0eb4b4752
Rollup merge of #67127 - estebank:disambiguate-suggestion, r=varkor
Use structured suggestion for disambiguating method calls

Fix #65635.
2019-12-20 12:17:20 +01:00
Esteban Küber 3980342f31 Use structured suggestion for disambiguating method calls
Fix #65635.
2019-12-11 17:42:28 -08:00
Esteban Küber 45550ef2ff Reuse existing HirId → DefId table 2019-12-11 15:33:45 -08:00
Esteban Küber 5d1adbb629 Use `generics_of` instead of incorrectly inspecting `FnSig` arguments 2019-12-10 12:02:18 -08:00
Esteban Küber 33b06362fa Use the appropriate number of type arguments in suggestion 2019-12-10 12:02:18 -08:00
Ömer Sinan Ağacan 6857c93183 Check break target availability when checking breaks with values
Fixes #66702
2019-12-03 11:16:37 +03:00
Brian Wignall 16fabd8efd Fix spelling typos 2019-11-26 22:19:54 -05:00
Matthew Jasper a8efd31f2b Add raw address of expressions to the AST and HIR 2019-11-24 18:06:13 +00:00
Mazdak Farrokhzad 44cebe5970 reduce size of hir::ExprKind 2019-11-21 01:23:29 +01:00
Guillaume Gomez 798e389e57 Update to use new librustc_error_codes library 2019-11-14 13:05:42 +01:00
Camille GILLOT ed640c6a27 Merge hir::Mutability into ast::Mutability. 2019-11-10 12:21:05 +01:00
Esteban Küber a12a32ab65 review comments 2019-11-06 10:04:23 -08:00
Esteban Küber f545a50ee4 Suggest missing item from `trait` in `impl` 2019-11-06 10:00:59 -08:00
Mazdak Farrokhzad 4f9651b854
Rollup merge of #66139 - euclio:pluralize, r=nagisa
use American spelling for `pluralize!`
2019-11-06 07:03:14 +01:00
Esteban Küber b0f258b2c4 Tweak type mismatch caused by break on tail expr
When `break;` has a type mismatch because the `Destination` points at a tail
expression with an obligation flowing from a return type, point at the
return type.

Fix #39968.
2019-11-05 14:50:18 -08:00
Andy Russell ad550b8ef3
use American spelling for `pluralize!` 2019-11-05 15:10:24 -05:00
Mazdak Farrokhzad 6bb7449fdb
Rollup merge of #65518 - estebank:i-want-to-break-free, r=eddyb
Avoid ICE when checking `Destination` of `break` inside a closure

Fix #65383, fix #62480. This is a `[regression-from-stable-to-stable]` and a fairly small change to avoid the ICE by properly handling this case.
2019-10-23 22:19:13 +02:00
ben 9cefcd3051 Rename resolve_type_vars_with_obligations to
resolve_vars_with_obligations, as it now also resolves const variables.
2019-10-20 09:17:40 +13:00
Esteban Küber 0585475efd Avoid ICE when checking `Destination` of `break` inside a closure 2019-10-17 18:18:29 -07: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
wangxiangqing 0b0aeaca43 Suggest dereferencing boolean reference when used in 'if' or 'while'
Change-Id: I0c5c4d767be2647e6f017ae7bf83558c56dbca97
2019-10-06 12:03:53 +08:00
Alex Zatelepin 75fdb95932 change .node -> .kind after rebase 2019-10-01 20:04:41 +03:00
Alex Zatelepin ffa526937e address review comments 2019-10-01 17:49:19 +03:00
Alex Zatelepin 057569e2c2 fix spurious unreachable_code lints for try{} block ok-wrapping 2019-10-01 17:48:37 +03:00
Mazdak Farrokhzad 8109332a4c
Rollup merge of #64825 - estebank:match-unit, r=Centril
Point at enclosing match when expecting `()` in arm

When encountering code like the following:

```rust
fn main() {
    match 3 {
        4 => 1,
        3 => {
            println!("Yep it maches.");
            2
        }
        _ => 2
    }
    println!("Bye!")
}
```

point at the enclosing `match` expression and suggest ignoring the
returned value:

```
error[E0308]: mismatched types
  --> $DIR/match-needing-semi.rs:8:13
   |
LL | /     match 3 {
LL | |         4 => 1,
LL | |         3 => {
LL | |             2
   | |             ^ expected (), found integer
LL | |         }
LL | |         _ => 2
LL | |     }
   | |     -- help: consider using a semicolon here
   | |_____|
   |       expected this to be `()`
   |
   = note: expected type `()`
              found type `{integer}
```

Fix #40799.
2019-09-29 20:34:15 +02:00
Mazdak Farrokhzad 6145757a26
Rollup merge of #64852 - Baranowski:param_note_52082, r=estebank
Print ParamTy span when accessing a field (#52082)
2019-09-28 22:12:07 +02:00
Esteban Küber 8a167edbca Point at enclosing match when expecting `()` in arm
When encountering code like the following:

```rust
fn main() {
    match 3 {
        4 => 1,
        3 => {
            println!("Yep it maches.");
            2
        }
        _ => 2
    }
    println!("Bye!")
}
```

point at the enclosing `match` expression and suggest ignoring the
returned value:

```
error[E0308]: mismatched types
  --> $DIR/match-needing-semi.rs:8:13
   |
LL | /     match 3 {
LL | |         4 => 1,
LL | |         3 => {
LL | |             2
   | |             ^ expected (), found integer
LL | |         }
LL | |         _ => 2
LL | |     }
   | |     -- help: consider using a semicolon here
   | |_____|
   |       expected this to be `()`
   |
   = note: expected type `()`
              found type `{integer}
```

Fix #40799.
2019-09-28 09:56:28 -07:00
Wojciech Baranowski 9ad99c30cb Refactor into ban_nonexisting_field method 2019-09-28 15:49:51 +03:00
Wojciech Baranowski f3744a1b3d Implement CRs 2019-09-28 14:39:19 +03:00