Commit Graph

92382 Commits

Author SHA1 Message Date
David Wood
7ab1bfd692
Only make suggestion when type is Copy.
This commit makes the suggestion to dereference when a type implements
`Deref` only apply if the dereference would succeed (ie. the type is
`Copy`, otherwise a borrow check error would occur).
2019-04-22 19:26:24 +01:00
David Wood
fd95ba3574
Suggest dereferencing when Deref is implemented.
This commit suggests dereferencing a type when it implements `Deref`
with the correct `Output` associated type.
2019-04-21 20:00:32 +01:00
David Wood
c9a2616e44
Add existing behaviour test for deref suggestions.
This commit adds a test that demonstrates the current behaviour where
suggestions to add a dereference aren't given for non-references.
2019-04-21 18:49:02 +01:00
bors
06a271a6eb Auto merge of #60119 - estebank:bad-recovery, r=davidtwco
Remove assumption from recovery code

Fix #60115.
2019-04-21 10:13:27 +00:00
bors
4d9c6cd722 Auto merge of #60132 - davidtwco:issue-60075, r=estebank
Fix fn front matter parsing ICE from invalid code.

Fixes #60075.

This PR fixes an "unreachable code" ICE that results from parsing
invalid code where the compiler is expecting the next trait item
declaration in the middle of the previous trait item due to extra
closing braces.

r? @estebank (thanks for the minimized test case)
2019-04-21 07:20:14 +00:00
bors
9224be5fa3 Auto merge of #60116 - RalfJung:miri-exit, r=oli-obk
add Miri error variant for process exit

This is to support https://github.com/rust-lang/miri/pull/702

r? @oli-obk
2019-04-21 02:38:15 +00:00
bors
c3a7194354 Auto merge of #60088 - varkor:async_await-method-feature-gate, r=cramertj
Feature gate async methods

Fixes https://github.com/rust-lang/rust/issues/60069.
2019-04-20 23:44:02 +00:00
varkor
ee496057a5 Update error message in test 2019-04-20 22:32:47 +01:00
varkor
98c71c36d6 Check async in trait methods 2019-04-20 22:03:39 +01:00
varkor
93c4b1f491 Fix additional variadic typos 2019-04-20 22:03:39 +01:00
varkor
fb2af77763 Fix typo in variadic C function warning 2019-04-20 22:03:39 +01:00
varkor
c93c7e4e7c Add test for async fn methods feature gating 2019-04-20 22:03:39 +01:00
varkor
47a558ed7c Feature gate async fn methods 2019-04-20 22:03:39 +01:00
varkor
4bbd29f206 Refactor some existing methods 2019-04-20 22:03:39 +01:00
varkor
c0ad4b0a96 Add a header method to FnKind 2019-04-20 22:03:39 +01:00
bors
33fe1131ca Auto merge of #59826 - llogiq:multi-dbg, r=SimonSapin
allow multiple args to `dbg!(..)`

This closes #59763
2019-04-20 20:55:29 +00:00
bors
4530c528ba Auto merge of #59700 - matklad:simplify, r=eddyb
Simplify doc comment lexing

is_doc_comment function checks the first four chars, but this is
redundant, `doc_comment` local var has the same info.
2019-04-20 17:59:15 +00:00
Ralf Jung
79b91b7cdd improve docs 2019-04-20 18:38:39 +02:00
bors
72bc62047f Auto merge of #59987 - saleemjaffer:refactor_adjust_castkinds, r=oli-obk
Refactor Adjust and CastKind

fixes rust-lang#59588
2019-04-20 15:06:15 +00:00
bors
0d1732212f Auto merge of #59564 - bjorn3:move_link_to_cg_ssa, r=eddyb
Move back::link and debuginfo::type_names to cg ssa

r? @eddyb
2019-04-20 12:18:49 +00:00
bjorn3
3af60e09a1 Tidy 2019-04-20 13:21:40 +02:00
bjorn3
d4e7b083ce Move cg_llvm/debuginfo/type_names.rs to cg_ssa 2019-04-20 13:21:40 +02:00
bjorn3
dd4566f511 Remove cg_llvm/back/link.rs 2019-04-20 13:21:40 +02:00
bjorn3
93a3b414e3 Move almost all of cg_llvm/back/link.rs to cg_ssa 2019-04-20 13:21:40 +02:00
bjorn3
de4ee55dc7 Remove get_reloc_model and target_cpu dependency from most of link.rs 2019-04-20 13:21:40 +02:00
bjorn3
d8bce01a04 Make link functions generic over archive builder 2019-04-20 13:21:40 +02:00
bjorn3
892c88b32f Move some filename constants to cg_ssa 2019-04-20 13:21:40 +02:00
bjorn3
8a8837967f Move some function from cg_llvm/back/link.rs to cg_ssa/back/link.rs 2019-04-20 13:21:40 +02:00
David Wood
60c6ed9664
Fix fn front matter parsing ICE from invalid code.
This commit fixes an "unreachable code" ICE that results from parsing
invalid code where the compiler is expecting the next trait item
declaration in the middle of the previous trait item due to extra
closing braces.
2019-04-20 11:36:04 +01:00
bors
647a951b08 Auto merge of #60128 - jimblandy:futures-doc-fix, r=withoutboats
Doc fixes for core::future::Future.

Fixed outdated reference to `waker` argument; now futures are passed a
`Context`, from which one can obtain a `waker`.

Cleaned up explanation of what happens when you call `poll` on a completed
future. It doesn't make sense to say that `poll` implementations can't cause
memory unsafety; no safe function is ever allowed to cause memory unsafety, so
why mention it here? It seems like the intent is to say that the `Future` trait
doesn't say what the consequences of excess polls will be, and they might be
bad; but that the usual constraints that Rust imposes on any non-`unsafe`
function still apply. It's also oddly specific to say 'memory corruption'
instead of just 'undefined behavior'; UB is a bit jargony, so the text should
provide examples.
2019-04-20 09:30:51 +00:00
Jim Blandy
f8f02debbb core::future::Future: Fix markup typo in docs. 2019-04-19 19:25:40 -07:00
Jim Blandy
d0b84e9a8b Doc fixes for core::future::Future.
Fixed outdated reference to `waker` argument; now futures are passed a
`Context`, from which one can obtain a `waker`.

Cleaned up explanation of what happens when you call `poll` on a completed
future. It doesn't make sense to say that `poll` implementations can't cause
memory unsafety; no safe function is ever allowed to cause memory unsafety, so
why mention it here? It seems like the intent is to say that the `Future` trait
doesn't say what the consequences of excess polls will be, and they might be
bad; but that the usual constraints that Rust imposes on any non-`unsafe`
function still apply. It's also oddly specific to say 'memory corruption'
instead of just 'undefined behavior'; UB is a bit jargony, so the text should
provide examples.
2019-04-19 19:10:24 -07:00
bors
7754865892 Auto merge of #60120 - matthiaskrgr:submodule_upd, r=sanxiyn
submodules: update clippy from fbb3a47b to cafbe7f2

Changes:
````
Update compiletest_rs
Typo
Fix dogfood error
Add lint PathBufPushOverwrite
Update *.stderr file
Remove code duplication
Format code
Add test for debug_assert!(false)
Don't lint debug_assert!(false)
Add run-rustfix for option_map_or_none lint
Move two cast_lossless tests to their correct files
Change naive_bytecount applicability MaybeIncorrect
Add tests for declare_lint_pass and impl_lint_pass
Use lint pass macros
Document `declare_lint_pass!`
Fix lint_without_lint_pass internal lint
Use {get,match}_def_path from LateContext
Remove uplifted functions {get,match}_def_path from Clippy
Add run-rustfix for len_zero lint
Add run-rustfix for bool_comparison lint
Add run-rustfix for deref_addrof lint
while_let_loop uses placeholders in suggestions
Remove rust-toolchain file from clippy_dev
Update adding_lints.md
Update PULL_REQUEST_TEMPLATE
Add new lint checklist
Create PULL_REQUEST_TEMPLATE
Only suggest .copied() for Option right now
Also suggest .copied() when .clone() is called on a Copy type
Suggest .copied() instead of .cloned() in map_clone when dealing with references
Deny rustc internal lints
Remove clippy::default_hash_types internal lint
Enable -Zunstable-options in .cargo/config
````

r? @oli-obk
2019-04-20 00:12:14 +00:00
bors
8aaae4294b Auto merge of #59981 - estebank:recover-struct-lit, r=petrochenkov
Emit specific error for struct literal in conditions

Fix #59962, fix #51311.
2019-04-19 20:15:11 +00:00
Andre Bogus
b641fd374e extend ui test 2019-04-19 21:12:50 +02:00
Matthias Krüger
7b959c69a2 submodules: update clippy from fbb3a47b to cafbe7f2
Changes:
````
Update compiletest_rs
Typo
Fix dogfood error
Add lint PathBufPushOverwrite
Update *.stderr file
Remove code duplication
Format code
Add test for debug_assert!(false)
Don't lint debug_assert!(false)
Add run-rustfix for option_map_or_none lint
Move two cast_lossless tests to their correct files
Change naive_bytecount applicability MaybeIncorrect
Add tests for declare_lint_pass and impl_lint_pass
Use lint pass macros
Document `declare_lint_pass!`
Fix lint_without_lint_pass internal lint
Use {get,match}_def_path from LateContext
Remove uplifted functions {get,match}_def_path from Clippy
Add run-rustfix for len_zero lint
Add run-rustfix for bool_comparison lint
Add run-rustfix for deref_addrof lint
while_let_loop uses placeholders in suggestions
Remove rust-toolchain file from clippy_dev
Update adding_lints.md
Update PULL_REQUEST_TEMPLATE
Add new lint checklist
Create PULL_REQUEST_TEMPLATE
Only suggest .copied() for Option right now
Also suggest .copied() when .clone() is called on a Copy type
Suggest .copied() instead of .cloned() in map_clone when dealing with references
Deny rustc internal lints
Remove clippy::default_hash_types internal lint
Enable -Zunstable-options in .cargo/config
````
2019-04-19 20:43:22 +02:00
Esteban Küber
30b779f398 Remove assumption from recovery code 2019-04-19 11:04:41 -07:00
Vadim Petrochenkov
aa393b0cde Some cleanup to maybe_parse_struct_expr 2019-04-19 10:32:44 -07:00
Esteban Küber
4c4ca60edd remove duplicated code and simplify logic 2019-04-19 10:13:45 -07:00
Esteban Küber
f1be8d16c5 Identify missing ambiguous case with best effort suggestion 2019-04-19 10:13:45 -07:00
Esteban Küber
2f36b54f0f Emit specific error for struct literal in conditions 2019-04-19 10:13:44 -07:00
bors
130dc3e7da Auto merge of #60072 - RalfJung:linked-list, r=shepmaster
fix LinkedList invalidating mutable references

The test `test_insert_prev` failed in Miri due to what I consider a bug in `LinkedList`: in various places, `NonNull::as_mut` got called to modify the `prev`/`next` pointers of existing nodes. In particular, the unstable `insert_next` has to modify the `next` pointer of the node that was last handed out by the iterator; to this end it creates a mutable reference to the *entire node* that overlaps with the mutable reference to the node's content that was handed out by the iterator! Thus, the next use if said mutable reference is UB.

In code:
```rust
            loop {
                match it.next() { // mutable reference handed to us
                    None => break,
                    Some(elt) => {
                        it.insert_next(*elt + 1); // this invalidates `elt` because it creates an overlapping mutable reference
                        match it.peek_next() {
                            Some(x) => assert_eq!(*x, *elt + 2), // this use of `elt` now is a use of an invalid pointer
                            None => assert_eq!(8, *elt),
                        }
                    }
                }
            }
```

This PR fixes that by using `as_ptr` instead of `as_mut`. This avoids invalidating the mutable reference that was handed to the user.  I did this in all methods called by iterators, just to be sure.

Cc @Gankro
2019-04-19 17:12:17 +00:00
Ralf Jung
dec24471be add Miri error variant for process exit 2019-04-19 18:48:02 +02:00
Ralf Jung
8b09d046fe fix LinkedList invalidating mutable references 2019-04-19 18:33:08 +02:00
bors
a2bbf7deba Auto merge of #60077 - RalfJung:miri-alloc-tests, r=joshtriplett
make liballoc internal test suite mostly pass in Miri

I discovered, to my surprise, that liballoc has two test suites: `liballoc/tests`, and a bunch of stuff embedded directly within liballoc.  The latter was not covered by [miri-test-libstd](https://github.com/RalfJung/miri-test-libstd) yet.  This disables in Miri the tests that Miri cannot support or runs too slowly.
2019-04-19 12:52:02 +00:00
bors
22fa4bb0eb Auto merge of #60063 - spastorino:place2_2, r=oli-obk
Convert Place unroll to a proper iterator

r? @oli-obk
2019-04-19 09:57:26 +00:00
Ralf Jung
2bc8c547cd move variable down to where it is used 2019-04-19 09:06:08 +02:00
bors
6c22051411 Auto merge of #60073 - rchaser53:issue-60049, r=estebank
avoid type-check body of DefId

fix: #60049
related: PR #59798
2019-04-19 07:03:12 +00:00
rchaser53
0ce131b192 avoid type-check body of DefId 2019-04-19 04:34:54 +00:00
bors
316a391dcb Auto merge of #60104 - Centril:rollup-7vmae1a, r=Centril
Rollup of 16 pull requests

Successful merges:

 - #59915 (Implement event filtering for self-profiler.)
 - #59933 (Make clear that format padding doesn't work for Debug)
 - #60023 (implement specialized nth_back() for Bytes, Fuse and Enumerate)
 - #60032 (Remove unwanted z-index change)
 - #60041 (Simplify the returning of a Result a bit)
 - #60045 (Suggest appropriate path when calling associated item on bare types)
 - #60052 (Correct unused parameter diagnostic)
 - #60056 (Update rustfmt to 1.2.1)
 - #60060 (whitelist RTM x86 target cpu feature)
 - #60061 (Change suggestion of field when not in self context)
 - #60064 (Point at try `?` on errors affecting the err match arm of the desugared code)
 - #60078 (Use more realistic example for thread builder)
 - #60080 (Fix small errors in docs for `rchunks_exact` and `rchunks_exact_mut`.)
 - #60082 (Update miri)
 - #60097 (Use -mergefunc-use-aliases for any LLVM >= 8)
 - #60098 (libcore: deny `elided_lifetimes_in_paths`)

Failed merges:

r? @ghost
2019-04-19 04:04:02 +00:00