Commit Graph

69877 Commits

Author SHA1 Message Date
Niko Matsakis 2520279604 test we reject equivalent signatures with more than one argument 2017-11-15 15:46:01 -05:00
Christopher Vittal b4c1aef1ca Add universal_impl_trait unstable-book entry 2017-11-15 15:46:01 -05:00
Christopher Vittal 04ad8fd7a5 Fix unclosed delimiter in sample error 2017-11-15 15:46:01 -05:00
Christopher Vittal 7d25d2e054 Remove unamed parameters 2017-11-15 15:46:01 -05:00
Christopher Vittal a23bea5479 Fix style and grammar 2017-11-15 15:46:01 -05:00
Christopher Vittal 06dff80061 Add/Modify tests for argument position impl Trait 2017-11-15 15:46:01 -05:00
Christopher Vittal bdff9463a0 Add universal_impl_trait feature gate
Move feature gate check to inside HIR lowering. Change error messages
and update tests.
2017-11-15 15:46:01 -05:00
Christopher Vittal 109f2dd36b Add new error comparision to hide desugaring
First some background:
To the compiler, the following two signatures in the trait vs the impl
are the same.

```rust
trait Foo {
    fn foo(&self, &impl Debug);
}
impl Foo for () {
    fn foo<U: Debug>(&self, x: &U) { ... }
}
```

We do not want to allow this, and so we add a new error and check.

The check just tests that all paramters 'syntheticness' match up. As
during collection, the impl Trait parameters are transformed into
anonymous synthetic generics.

Furthermore, causes a check for unused type parameters to be skipped in
check_bounds_are_used if there is already a TyError. Thus, an unused
input will not trigger `type parameter unused` errors.

Update the one test that checked for this error in the case of
a TyError.
2017-11-15 15:46:01 -05:00
Christopher Vittal f225fe43f1 Add collection of impl Trait argument lifetimes 2017-11-15 15:46:01 -05:00
Christopher Vittal 94df3c5edf Alter type collection to collect impl Trait bounds
In ast_generics extraction in generics_of and explicit_predicates_of,
also collect inputs if there are any.

Then use a Visitor to extract the necessary information from the
TyImplTraitUniversal types before extending generics and predicates with
the new information.
2017-11-15 15:46:01 -05:00
Christopher Vittal e4c7e2c99a Add bool item is_in_impl_trait to LoweringContext
This is for tracking if an ImplItem is part of a trait impl. Add
a with_trait_impl_ref method to ItemLowerer to appropriately save the
state to allow appropriate nesting of trait and non-trait impls.
2017-11-15 15:46:01 -05:00
Christopher Vittal 8fd48e7d59 Split hir::TyImplTrait, move checks to HIR lowering
Replace hir::TyImplTrait with TyImplTraitUniversal and
TyImplTraitExistential.

Add an ImplTraitContext enum to rustc::hir::lowering to track the kind
and allowedness of an impl Trait.

Significantly alter lowering to thread ImplTraitContext and one other
boolean parameter described below throughought much of lowering.

The other parameter is for tracking if lowering a function is in a trait
impl, as there is not enough information to otherwise know this
information during lowering otherwise.

This change also removes the checks from ast_ty_to_ty for impl trait
allowedness as they are now all taking place in HIR lowering.
2017-11-15 15:46:01 -05:00
Christopher Vittal 779fc372c7 Move E0562 to librustc from librustc_typeck
With the check for impl trait moving from type checking to HIR lowering
the error needs to move too.
2017-11-15 15:46:01 -05:00
bors fa26421f56 Auto merge of #45938 - vramana:fix-ice-45698, r=arielb1
Fix End-user description not implemented for field access on `TyClosure

- [x] Add Tests
2017-11-15 20:18:13 +00:00
Laurentiu Nicola cca6cf3feb Escape doc root URLs 2017-11-15 19:33:08 +02:00
Guillaume Gomez 9338b4903a Set short-message feature unstable 2017-11-15 18:13:33 +01:00
bors 88a28ff602 Auto merge of #45936 - mikhail-m1:mir-borrowck-storage-dead, r=arielb1
add `StorageDead` handling

fix #45642
r? @arielb1
2017-11-15 16:07:48 +00:00
Michael Woerister 2f50e626e1 incr.comp.: Only save and load query result cache when -Zincremental-queries is specified. 2017-11-15 15:36:00 +01:00
Michael Woerister 13582c6b58 incr.comp.: Add missing [input] annotation for DepNode::MaybeUnusedExternCrates 2017-11-15 15:21:19 +01:00
Michael Woerister 279b6df1f2 incr.comp.: Refactor query cache serialization to be more re-usable. 2017-11-15 14:18:00 +01:00
bors ce2b8a4944 Auto merge of #45715 - oli-obk:clippy, r=kennytm
Reenable clippy testing

fixes #45680
2017-11-15 13:06:08 +00:00
Oliver Schneider 5319203aa3
Reenable clippy testing 2017-11-15 10:42:47 +01:00
Mikhail Modin 9e35fd262f fix test 2017-11-15 12:30:30 +03:00
Tom Tromey ae4cc60696 Emit debug info for trait object pointer
Emit better debugging information for a trait object pointer.  In
particular, now:

* The fields are explicitly represented in the DWARF;
* DWARF for the vtable itself is emitted; and
* The DWARF for the vtable's type has a DW_AT_containing_type which
  points to the concrete type for which the vtable was emitted.  This is
  a small DWARF extension, that allows debuggers to determine the real
  type of the object to which a trait object points.

I'll submit the gdb patch to take advantage of this new debuginfo once
this lands.

The vtable type is not currently complete -- it doesn't include members
for the pointers it contains.  This information was not needed for this
feature.

This addresses part 1 of #1563.
2017-11-15 01:48:14 -07:00
Tom Tromey a512228141 Allow minimum system LLVM version in tests
This adds a "min-system-llvm-version" directive, so that a test can
indicate that it will either work with rust-llvm or with some minimal
system LLVM.  This makes it simpler to write a test that requires an
LLVM patch that landed upstream and was then backported to rust-llvm.
2017-11-15 01:43:24 -07:00
Mikhail Modin 34be1516aa fix comment, remove redundant code 2017-11-15 11:21:05 +03:00
Mikhail Modin 830d65c1ff add `StorageDead` handling 2017-11-15 11:21:05 +03:00
bors 3707db9405 Auto merge of #45944 - eddyb:provide, r=nikomatsakis
rustc_driver: expose a way to override query providers in CompileController.

This API has been a long-time coming and will probably become the main method for custom drivers (that is, binaries other than `rustc` itself that use `librustc_driver`) to adapt the compiler's behavior.
2017-11-15 08:02:19 +00:00
bors f93a4928c2 Auto merge of #45922 - vramana:fix-45702, r=nikomatsakis
Fix MIR borrowck EndRegion not found

Fixes #45702

- [x] Add Tests
2017-11-15 04:48:16 +00:00
bors 8a98531973 Auto merge of #45913 - sinkuu:mir-inlining-closure, r=arielb1
Handle closures correctly in MIR inlining

Fixes #45894.
2017-11-15 01:32:30 +00:00
QuietMisdreavus 479b91901d examples in Cow::into_owned don't need to wrap result in Cows 2017-11-14 18:23:24 -06:00
Michael Lamparski ead9ac3b51 add NOTE: to test notes 2017-11-14 17:45:18 -05:00
Ramana Venkata 5144d3222f Fix printing of upvar in closures 2017-11-15 02:24:25 +05:30
gnzlbg 5146663602 fix linking error on i586 2017-11-14 21:35:05 +01:00
Jeff Crocker d1a83c6bd2
Remove checked arithmetic from if expression hash tests 2017-11-14 12:12:04 -08:00
Ramana Venkata a6d691b43c Fix End-user description not implemented for field access on `TyClosure
Fixes #45698
2017-11-15 01:06:05 +05:30
Michael Woerister 2c1aeddf27 incr.comp.: Cache TypeckTables and add -Zincremental-queries flag. 2017-11-14 19:52:49 +01:00
bors ff0f5de3b3 Auto merge of #45821 - djzin:unreachable-match-arms, r=nikomatsakis
always add an unreachable branch on matches to give more info to llvm

As part of https://github.com/djzin/rustc-optimization I discovered that some simple enum optimizations (src/unary/three_valued_enum.rs and src/unary/four_valued_enum.rs in the repo) are not applied - and the reason for this is that we erase the info that the discriminant of an enum is one of the options by putting the last one in an "otherwise" branch. This patch adds an extra branch so that LLVM can know what the possibilities are for the discriminant, which fixes the three- and four- valued cases.

Note that for whatever reason, this doesn't fix the case of 2 variants (most notably `Option` and `Result` have 2 variants) - a pass re-ordering might fix this or we may wish to add "assume" annotations on discriminants to force it to optimize.
2017-11-14 18:47:34 +00:00
bors dbeb5bf890 Auto merge of #45981 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 7 pull requests

- Successful merges: #45815, #45941, #45950, #45961, #45967, #45970, #45977
- Failed merges:
2017-11-14 16:18:19 +00:00
Michael Woerister 0b1438307e incr.comp.: Add 'tcx to QueryDescription. 2017-11-14 17:00:44 +01:00
Guillaume Gomez 66d0537ebe Rollup merge of #45977 - kennytm:fix-pulldown-warnings, r=steveklabnik
Fixed several pulldown warnings when documenting libstd.
2017-11-14 16:52:14 +01:00
Guillaume Gomez 0895347a49 Rollup merge of #45970 - GuillaumeGomez:from-str-docs, r=QuietMisdreavus
Add missing links in FromStr docs

r? @QuietMisdreavus
2017-11-14 16:52:13 +01:00
Guillaume Gomez 01e979f7b1 Rollup merge of #45967 - matthewjasper:array-move-types, r=arielb1
MIR-borrowck: don't ICE for cannot move from array error

Closes #45694
compile-fail test E0508 now gives
```text
error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array (Ast)
  --> .\src\test\compile-fail\E0508.rs:18:18
   |
18 |     let _value = array[0];  //[ast]~ ERROR E0508
   |                  ^^^^^^^^
   |                  |
   |                  cannot move out of here
   |                  help: consider using a reference instead: `&array[0]`

error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array (Mir)
  --> .\src\test\compile-fail\E0508.rs:18:18
   |
18 |     let _value = array[0];  //[ast]~ ERROR E0508
   |                  ^^^^^^^^ cannot move out of here

error: aborting due to 2 previous errors
```
2017-11-14 16:52:12 +01:00
Guillaume Gomez 529bb320f7 Rollup merge of #45961 - dereckson:unix-agnosticity-ci, r=Mark-Simulacrum
Use #!/usr/bin/env as shebang for Bash scripts

On some systems, the bash command could be available in another
directory than /bin. As such, to offer an env shebang is more
convenient.

This make sense even for docker scripts, as you can use Docker
on FreeBSD or SmartOS for example.
2017-11-14 16:52:11 +01:00
Guillaume Gomez d0b11b9bd1 Rollup merge of #45950 - fitzgen:update-unary-and-binary-exprs-test-to-use-incr-except, r=michaelwoerister
incr: Make `unary_and_binary_exprs.rs` use `except`-style incremental checking

Part of #44924

r? @michaelwoerister
2017-11-14 16:52:10 +01:00
Guillaume Gomez c95ef0d9d5 Rollup merge of #45941 - gaurikholkar:master, r=nikomatsakis
update match-expressions.rs with DepNode labels

As a part of #44924, I have updated the match-expressions.rs. The PR has tests verified for the following dependency nodes for let-expressions

- MirValidated
- MirOptimized
- TypeCheckTables
- TypeOfItem
- GenericsOfItem
- PredicatesOfItem
- FnSignature

cc @michaelwoerister
r? @nikomatsakis
2017-11-14 16:52:09 +01:00
Guillaume Gomez 013cd5af86 Rollup merge of #45815 - QuietMisdreavus:happy-little-notices, r=GuillaumeGomez
rustdoc: tweak notes on ignore/compile_fail examples

Part of https://github.com/rust-lang/rust/issues/44927

This is a softening of these notices to mention *why* a given example has a given callout, rather then telling viewers to be careful with an example. It also changes the character used for these samples from a warning logo to a circle-i/information logo.

![image](https://user-images.githubusercontent.com/5217170/32464361-5fbb5d9e-c305-11e7-8482-ce71b97a54df.png)
2017-11-14 16:52:07 +01:00
Michael Woerister 4bfab89aa2 incr.comp.: Store the query result index which records where query results can be found in the cached. 2017-11-14 16:15:45 +01:00
Ariel Ben-Yehuda c0f7cce96e check_unsafety: fix unused unsafe block duplication
The duplicate error message is later removed by error message
deduplication, but it still appears on beta and is still a bug
2017-11-14 16:38:34 +02:00
Michael Lamparski 4d200f6954 un-add some notes from tests 2017-11-14 09:25:09 -05:00