Commit Graph

69438 Commits

Author SHA1 Message Date
Niko Matsakis
11118dcf19 add some better debugs 2017-11-02 17:46:45 -04:00
Wonwoo Choi
272c2faa1d Display spans correctly when there are non-half-width characters 2017-11-03 03:15:39 +09:00
Mikhail Modin
7d87054347 replace Add by tuple 2017-11-02 20:25:38 +03:00
Sebastian Dröge
b86bba5940 Make join a link to the function's documentation 2017-11-02 19:09:31 +02:00
Sebastian Dröge
a12f511910 Mention that panics can't possibly be caught when compiling with panic=abort 2017-11-02 18:33:25 +02:00
Sebastian Dröge
283b4a1b0b Use ` instead of ' for function names 2017-11-02 18:33:25 +02:00
Sebastian Dröge
5687000979 Update the std::thread docs and clarify that panics can nowadays be caught 2017-11-02 18:33:25 +02:00
bors
e340996ff5 Auto merge of #45409 - tamird:suggest-match-default-bindings, r=nikomatsakis
typeck: suggest use of match_default_bindings feature

Fixes #45383.
Updates #42640.

r? @nikomatsakis
cc @tschottdorf

This needs a UI test, but thought I'd get some early feedback.
2017-11-02 16:28:16 +00:00
Niko Matsakis
7b4282e02b emit less info when we warn
Actually, I meant to make this use `delay_span_bug`
2017-11-02 10:34:25 -04:00
Niko Matsakis
fdcd2256f0 trace span info for constraints and report errors 2017-11-02 10:34:25 -04:00
Niko Matsakis
53e4bd44de add mir-opt/named-lifetimes-basic.rs
This lets us inspect the regions we infer around named arguments.
2017-11-02 10:34:25 -04:00
Mikhail Modin
d6dfec124f improve compiletest output for errors from mir-opt tests 2017-11-02 16:41:40 +03:00
bors
5ce3d482e2 Auto merge of #45647 - nrc:rls-bugs, r=eddyb
save-analysis: support unions

r? @eddyb
2017-11-02 12:34:13 +00:00
Lance John
0f49129fd7
Fix typo
`accomodate` -> `accommodate`
2017-11-02 20:07:22 +08:00
Oliver Schneider
6ae440e048
Make the difference between lint codes and error codes explicit 2017-11-02 10:19:41 +01:00
Oliver Schneider
88fb4c4fda
Report lint names in json diagnostics 2017-11-02 10:19:41 +01:00
Niko Matsakis
b772827350 encapsulate the Region struct within region inference 2017-11-02 04:40:50 -04:00
Niko Matsakis
bfc696ad8a add comments to region_infer, restructure a bit 2017-11-02 04:40:50 -04:00
Niko Matsakis
cafbd99c38 extend NLL regions to include free region indices and add outlives 2017-11-02 04:40:50 -04:00
Niko Matsakis
7b30e8d668 convert (lexical) region errors to warn when NLL is enabled 2017-11-02 04:40:50 -04:00
Niko Matsakis
87c0c32768 add regions_that_outlive to FreeRegionMap 2017-11-02 04:40:49 -04:00
Niko Matsakis
3db1a95a3f add/fix various comments to BitMatrix
Notably, the (hitherto unused) `less_than` method was not at all what it
purported to be. It in fact computes the opposite.
2017-11-02 04:40:49 -04:00
Niko Matsakis
de201b40c9 ignore region errors if NLL is enabled
This way, NLL can report them later.
2017-11-02 04:40:49 -04:00
Niko Matsakis
81f6ce5ce3 rename Lookup to TyContext and pass more info when visiting tys 2017-11-02 04:40:49 -04:00
bors
a7d98c7837 Auto merge of #45630 - joshleeb:iss35241, r=estebank
Improve display of error E0308

Ref. Forgetting to call a variant constructor causes a confusing error message #35241.

This PR modifies [`note_type_err`](b7041bfab3/src/librustc/infer/error_reporting/mod.rs (L669-L674)) to display a `help` message when a `TyFnPtr` or `TyFnDef` are found and the return type, of the function or function pointer, is the same as the type that is expected.

The output of compiling

```rust
struct Foo(u32);

fn test() -> Foo { Foo }

fn main() {}
```

is now

```bash
$ rustc src/test/ui/issue-35241.rs
error[E0308]: mismatched types
  --> src/test/ui/issue-35241.rs:13:20
   |
13 | fn test() -> Foo { Foo }
   |              ---   ^^^ expected struct `Foo`, found fn item
   |              |
   |              expected `Foo` because of return type
   |
   = help: did you mean `Foo { /* fields */ }`?
   = note: expected type `Foo`
              found type `fn(u32) -> Foo {Foo::{{constructor}}}`

error: aborting due to previous error
```
2017-11-02 08:30:03 +00:00
Mikhail Modin
d9e64ebaaa change mir stage in test 2017-11-02 10:21:36 +03:00
Mikhail Modin
59d3184624 add one more sample 2017-11-02 09:43:36 +03:00
Mikhail Modin
cb2867da88 fix pre binding false edges 2017-11-02 09:43:36 +03:00
Mikhail Modin
a954dcc72e fix opt-mir test and remove false edge if no guard 2017-11-02 09:43:36 +03:00
Mikhail Modin
2d71c5f10c add TerminatorKind::FalseEdges and use it in matches 2017-11-02 09:43:36 +03:00
bors
2379faa933 Auto merge of #45468 - Xanewok:crate-source, r=nrc
Emit crate disambiguators in save-analysis data

Needed for https://github.com/nrc/rls-analysis/issues/93.
Blocked by https://github.com/nrc/rls-data/pull/11. (For now, this pulls my branch [rls-data/crate-source](https://github.com/Xanewok/rls-data/tree/crate-source))

This will allow to disambiguate different crates types/versions when indexing resulting save-analysis data (most importantly allow to support bin+lib and different crate versions).

r? @nrc
2017-11-02 03:36:50 +00:00
Nick Cameron
5d3be12a4d save-analysis: fix issue with sub-exprs in for loops
Fixes https://github.com/nrc/rls-analysis/issues/78
2017-11-02 14:35:39 +13:00
Paul Daniel Faria
97692afda9 newindex_type macro: make index private by default and allow pub through config 2017-11-01 21:25:37 -04:00
Paul Daniel Faria
bf1198eb1f newtype_index: Support simpler serializable override, custom derive, and fix mir_opt tests 2017-11-01 20:12:53 -04:00
Paul Daniel Faria
b46e42fe2a Clean up macro argument matches so they satisfy tidy checks 2017-11-01 20:12:10 -04:00
Paul Daniel Faria
4e496de26d Add derive and doc comment capabilities to newtype_index macro 2017-11-01 20:12:10 -04:00
bors
d5b69d4670 Auto merge of #45306 - whitequark:ref_slice, r=alexcrichton
Bring back slice::ref_slice as slice::from_ref.

These functions were deprecated and removed in 1.5, but such simple
functionality shouldn't require using unsafe code, and it isn't
cluttering libstd too much.

The original removal was quite contentious (see #27774), since then
we've had precedent for including such nuggets of functionality (see rust-lang/rfcs#1789),
and @nikomatsakis has provided a lot of use cases in https://github.com/rust-lang/rfcs/pull/1789#issuecomment-314640034.
Hence this PR.

I'm not too sure what to do with stability, feel free to correct me.
It seems pointless to go through stabilization for these functions though.

cc @aturon
2017-11-02 00:06:16 +00:00
laurent
ed20f3b5c0 Remove the redundant span_label. 2017-11-01 23:43:32 +00:00
Nick Cameron
20c64e8155 save-analysis: corrects reference for tuple struct and unit struct literals
Fixes https://github.com/nrc/rls-analysis/issues/77
2017-11-02 11:28:56 +13:00
whitequark
1cc88be2eb De-stabilize core::slice::{from_ref, from_ref_mut}. 2017-11-01 22:21:29 +00:00
Nick Cameron
82a8968ce0 save-analysis: handle types in turbofish
fixes https://github.com/nrc/rls-analysis/issues/52
2017-11-02 09:22:44 +13:00
Nick Cameron
c1d3e441a8 save-analysis: handle function types in bounds
This special cases the function type sugar in paths and deals with traits bounds as just the path parts. That required refactoring the path collector to distinguish between variable decls and references in patterns, basically just to please the borrow checker.

cc https://github.com/nrc/rls-analysis/issues/37
2017-11-02 08:12:05 +13:00
bors
2be4cc0402 Auto merge of #45538 - nikomatsakis:nll-liveness, r=pnkfelix
enable non-lexical lifetimes in the MIR borrow checker

This PR, joint work with @spastorino, fills out the NLL infrastructure and integrates it with the borrow checker. **Don't get too excited:** it includes still a number of hacks (the subtyping code is particularly hacky). However, it *does* kinda' work. =)

The final commit demonstrates this by including a test that -- with both the AST borrowck and MIR borrowck -- reports an error by default. But if you pass `-Znll`, you only get an error from the AST borrowck, demonstrating that the integration succeeds:

```
struct MyStruct {
    field: String
}

fn main() {
    let mut my_struct = MyStruct { field: format!("Hello") };

    let value = &my_struct.field;
    if value.is_empty() {
        my_struct.field.push_str("Hello, world!");
        //~^ ERROR cannot borrow (Ast)
    }
}
```
2017-11-01 18:14:13 +00:00
bors
a3f990dc08 Auto merge of #45472 - michaelwoerister:incr-comp-caching-base, r=nikomatsakis
incr.comp.: Implement compiler diagnostic persistence.

This PR implements storing and loading diagnostics that the compiler generates and thus allows for emitting warnings during incremental compilation without actually re-evaluating the thing the warning originally came from. It also lays some groundwork for storing and loading type information and MIR in the incr. comp. cache.

~~It is still work in progress:~~
- ~~There's still some documentation to be added.~~
- ~~The way anonymous queries are handled might lead to duplicated emissions of warnings. Not sure if there is a better way or how frequent such duplication would be in practice.~~

Diagnostic message duplication is addressed separately in #45519.

r? @nikomatsakis
2017-11-01 14:28:11 +00:00
Lance John
bf95f9f185
Fix typo. 2017-11-01 21:02:08 +08:00
Guillaume Gomez
ee7e372bbf Remove duplicated results in the search 2017-11-01 13:41:43 +01:00
Guillaume Gomez
e8db5adcce fix function not appearing in first tab when appearing in another one. Thanks to @Seeker14491 for this one! 2017-11-01 13:41:43 +01:00
Guillaume Gomez
f6a546e14d Be more flexible when looking for something by using levenshtein method 2017-11-01 13:41:43 +01:00
Guillaume Gomez
6f21008aba Better check for returned value 2017-11-01 13:41:43 +01:00
Guillaume Gomez
56dbb3e32d Keep displaying good information when query is made 2017-11-01 13:41:43 +01:00