Commit Graph

69348 Commits

Author SHA1 Message Date
leonardo.yvens
00be060daf Teach typeck about auto trait 2017-11-03 16:13:20 -02:00
leonardo.yvens
1f4b630899 add auto keyword, parse auto trait, lower to HIR
Adds an `IsAuto` field to `ItemTrait` which flags if the trait was
declared as an `auto trait`.

Auto traits cannot have generics nor super traits.
2017-11-03 16:13:20 -02:00
leonardo.yvens
06506bb751 [Syntax Breaking] Rename DefaultImpl to AutoImpl
DefaultImpl is a highly confusing name for what we now call auto impls,
as in `impl Send for ..`. The name auto impl is not formally decided
but for sanity anything is better than `DefaultImpl` which refers
neither to `default impl` nor to `impl Default`.
2017-11-03 16:13:20 -02:00
matt rice
aa9d0aae99 issue #45357 set clippy build condition to extended. 2017-11-03 10:52:36 -07:00
Guillaume Gomez
765153e6a4 Add tests for methods listing in rust docs 2017-11-03 18:39:00 +01:00
gnzlbg
549ab77e23 [jemalloc] set correct excess in alloc_excess 2017-11-03 17:44:58 +01:00
bors
59d484575a Auto merge of #45569 - zackmdavis:unexported_pub_lint, r=petrochenkov
`unreachable-pub` lint (as authorized by RFC 2126)

To whom it may concern:

RFC 2126 commissions the creation of a lint for `pub` items that are not visible from crate root (#45521). We understand (but seek confirmation from more knowledgable compiler elders) that this can be implemented by linting HIR items that are _not_ ~~`cx.access_levels.is_exported`~~ `cx.access_levels.is_reachable` but have a `vis` (-ibility) field of `hir::Visibility::Public`.

The lint, tentatively called ~~`unexported-pub`~~ `unreachable-pub` (with the understanding that much could be written on the merits of various names, as it is said of the colors of bicycle-sheds), suggests `crate` as a replacement for `pub` if the `crate_visibility_modifier` feature is enabled (see #45388), and `pub(crate)` otherwise. We also use help messaging to suggest the other potential fix of exporting the item; feedback is desired as to whether this may be confusing or could be worded better.

As a preview of what respecting the proposed lint would look like (and to generate confirmatory evidence that this implementation doesn't issue false positives), ~~we take its suggestions for `libcore`~~ (save one, which is deferred to another pull request because it brings up an unrelated technical matter). I remain your obedient servant.

![unexported_pub](https://user-images.githubusercontent.com/1076988/32089794-fbd02420-baa0-11e7-87e5-3ec01f18924a.png)

r? @petrochenkov
2017-11-03 16:28:24 +00:00
Oliver Schneider
e5c1d512e7
Update config.rs 2017-11-03 16:32:03 +01:00
Oliver Schneider
d1d9cfc722
Don't add a new -Z flag, reuse -Zunstable-options 2017-11-03 16:22:19 +01:00
Rolf Karp
ce3f0719e6 Fix std compile error for windows-gnu targets without backtrace feature 2017-11-03 15:22:13 +01:00
Oliver Schneider
c7cb2cf8b5
Pretty print json in ui tests 2017-11-03 13:38:26 +01:00
bors
525b81d570 Auto merge of #45734 - kennytm:ci-fix-centos-broken-link, r=alexcrichton
ci: Fix broken link in `build-powerpc64le-toolchain.sh`

r? @rust-lang/infra

This is just an emergency fix to keep bors running for another week. I think the numbers will be broken soon. Can we verify if this statement is still true later?

> First, download the CentOS7 glibc.ppc64le and relevant header files.
> (upstream ppc64le support wasn't added until 2.19, which el7 backported.)
2017-11-03 12:30:09 +00:00
Oliver Schneider
65c899edfe
Remove outdated documentation 2017-11-03 12:37:11 +01:00
kennytm
1f95c6de3c
Fix broken link in build-powerpc64le-toolchain.sh 2017-11-03 15:53:36 +08:00
Zack M. Davis
085ec6d528 unreachable-pub lint for pub items not reachable from crate root
This is with deepest thanks to Vadim Petrochenkov for thorough review, and
resolves #45521.
2017-11-02 20:50:17 -07:00
bors
9f3b09116b Auto merge of #45484 - oli-obk:lint_names, r=nikomatsakis
Report lint names in json diagnostics

This allows tools like `rustfix` to have whitelists for what to automatically apply and what not.
2017-11-03 00:42:11 +00:00
Amanieu d'Antras
ad1bb2e465 Cache the TLS model in the crate context 2017-11-03 00:29:54 +00:00
Amanieu d'Antras
b233a6e096 Add support for specifying the TLS model 2017-11-03 00:29:54 +00:00
Amanieu d'Antras
37b015fb91 Fix error message for invalid code/reloc models 2017-11-03 00:28:50 +00:00
Niko Matsakis
e8a96c97f4 fallback to provided signature in the event of a type error
This prevents regressions on some annoying cases.
2017-11-02 18:38:24 -04:00
Niko Matsakis
053383dbef new rules for merging expected/supplied types in closure signatures
Also, fix numbering in mir-opt tests. We are now anonymizing more
consistently, I think, and hence some of the `TyAnon` indices shifted.
2017-11-02 17:47:17 -04:00
Niko Matsakis
ea4db3521e move ty_of_closure into check/closure.rs, its only caller 2017-11-02 17:46:45 -04:00
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
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