Commit Graph

92341 Commits

Author SHA1 Message Date
Philipp Hansch
c9ae68812f
Deny rust_2018_idioms in libcore tests 2019-04-20 18:44:29 +02:00
Philipp Hansch
110a73d6c6
Deny rust_2018_idioms in liballoc tests 2019-04-20 16:05:25 +02:00
Philipp Hansch
d5d1ee86bb
Deny rust_2018_idioms globally 2019-04-20 13:45:46 +02: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
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
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
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
Mazdak Farrokhzad
3ad9fcccbb
Rollup merge of #60098 - Centril:libcore-deny-more, r=varkor
libcore: deny `elided_lifetimes_in_paths`

r? @varkor
2019-04-19 06:03:30 +02:00
Mazdak Farrokhzad
c0ea0d8c31
Rollup merge of #60097 - cuviper:llvm8-mergefunc-use-aliases, r=rkruppe
Use -mergefunc-use-aliases for any LLVM >= 8

This functionality is not specific to Rust's LLVM, but any starting in LLVM 8.0,
as noted in <https://github.com/rust-lang/rust/pull/56358#discussion_r237702197>.

cc @nikic
r? @rkruppe
2019-04-19 06:03:29 +02:00
Mazdak Farrokhzad
c88b87294d
Rollup merge of #60082 - TimDiekmann:master, r=RalfJung
Update miri

r? @RalfJung
2019-04-19 06:03:27 +02:00
Mazdak Farrokhzad
af6d3f8fc3
Rollup merge of #60080 - nathankleyn:fix-issue-60068, r=Centril
Fix small errors in docs for `rchunks_exact` and `rchunks_exact_mut`.

The documentation for `rchunks_exact` said it started at the beginning
of the slice, bit it actually starts at the end of the slice.

In addition, there were a couple of "of the slice of the slice"
duplicate phrases going on for `rchunks_exact` and `rchunks_exact_mut`.

This fixes #60068.
2019-04-19 06:03:26 +02:00
Mazdak Farrokhzad
08ee04e71e
Rollup merge of #60078 - matklad:patch-1, r=shepmaster
Use more realistic example for thread builder

Stack size of 10 **bytes** does not make any sense: the minimal possible stack size is greater anyway.
2019-04-19 06:03:24 +02:00
Mazdak Farrokhzad
37f835cd18
Rollup merge of #60064 - estebank:issue-59980, r=varkor
Point at try `?` on errors affecting the err match arm of the desugared code

Fix #59980.
2019-04-19 06:03:23 +02:00
Mazdak Farrokhzad
aa58242b28
Rollup merge of #60061 - estebank:field-sugg, r=davidtwco
Change suggestion of field when not in self context

Fix #60057.
2019-04-19 06:03:21 +02:00
Mazdak Farrokhzad
dd9f9b4b9d
Rollup merge of #60060 - mtak-:rtm-x86-feature, r=petrochenkov
whitelist RTM x86 target cpu feature

This PR adds support for intels restricted transactional memory cpu feature. I mostly copied what was done for the [movbe](https://github.com/rust-lang/rust/pull/57999) feature.

https://github.com/rust-lang-nursery/stdsimd/issues/718
2019-04-19 06:03:20 +02:00
Mazdak Farrokhzad
34f1c1fff1
Rollup merge of #60056 - topecongiro:rustfmt-1.2.1, r=alexcrichton
Update rustfmt to 1.2.1
2019-04-19 06:03:19 +02:00
Mazdak Farrokhzad
2d6150a762
Rollup merge of #60052 - varkor:unused-parameter-diagnostic, r=estebank
Correct unused parameter diagnostic

The message was incorrect for unused lifetime parameters. There's no need to be specific.
2019-04-19 06:03:17 +02:00
Mazdak Farrokhzad
bd0d097a33
Rollup merge of #60045 - estebank:suggest-std, r=petrochenkov
Suggest appropriate path when calling associated item on bare types

When looking at the documentation for `std::f32` or `std::str`, for
example, it is easy to get confused and assume `std::f32` and `f32`
are the same thing. Because of this, it is not uncommon to attempt
writing `f32::consts::PI` instead of the correct
`std::f32::consts::PI`. When encountering the former, which results
in an access error due to it being an inexistent path, try to access
the same path under `std`. If this succeeds, this information is
stored for later tweaking of the final E0599 to provide an
appropriate suggestion.

Fix #26760, fix #46660.
2019-04-19 06:03:16 +02:00
Mazdak Farrokhzad
2171250ca4
Rollup merge of #60041 - jnferner:patch-1, r=shepmaster
Simplify the returning of a Result a bit
2019-04-19 06:03:14 +02:00
Mazdak Farrokhzad
ee511f2b92
Rollup merge of #60032 - rust-lang:remove-unwanted-z-index, r=QuietMisdreavus
Remove unwanted z-index change

Fixes #60031.

r? @QuietMisdreavus
2019-04-19 06:03:13 +02:00
Mazdak Farrokhzad
291e44b381
Rollup merge of #60023 - koalatux:nth-back, r=scottmcm
implement specialized nth_back() for Bytes, Fuse and Enumerate

Hi,

After my first PR has been successfully merged, here is my second pull request :-)

Also this PR contains some specializations for the problem discussed in #54054.
2019-04-19 06:03:12 +02:00
Mazdak Farrokhzad
7f450bd3ca
Rollup merge of #59933 - sourcefrog:doc-fmt, r=shepmaster
Make clear that format padding doesn't work for Debug

As mentioned in
https://github.com/rust-lang/rust/issues/46006#issuecomment-345260633
2019-04-19 06:03:10 +02:00
Mazdak Farrokhzad
1669f53dbb
Rollup merge of #59915 - michaelwoerister:sp-event-filters-1, r=wesleywiser
Implement event filtering for self-profiler.

This is a first sketch for event filtering in the self-profiler, something that we'll want in order to keep profiling overhead low in the common case. The PR contains the commits from https://github.com/rust-lang/rust/pull/59515 and, for the moment, is meant for performance testing.

r? @wesleywiser
2019-04-19 06:03:09 +02:00
Esteban Küber
6aa4c992bc Suggest appropriate path when calling associated item on bare types
When looking at the documentation for `std::f32` or `std::str`, for
example, it is easy to get confused and assume `std::f32` and `f32`
are the same thing. Because of this, it is not uncommon to attempt
writing `f32::consts::PI` instead of the correct
`std::f32::consts::PI`. When encountering the former, which results
in an access error due to it being an inexistent path, try to access
the same path under `std`. If this succeeds, this information is
stored for later tweaking of the final E0599 to provide an
appropriate suggestion.

This suggestion applies to both E0233 and E0599 and is only checked
when the first ident of a path corresponds to a primitive type.
2019-04-18 19:18:26 -07:00
Esteban Küber
2f4035d27e Fix rebase 2019-04-18 18:57:16 -07:00
Esteban Küber
7b050fe831 review comments: change wording 2019-04-18 18:39:56 -07:00
Esteban Küber
248fe949af Change suggestion of field when not in self context 2019-04-18 18:39:56 -07:00
Mazdak Farrokhzad
dbfbadeac4 libcore: deny more... 2019-04-19 01:37:12 +02:00
Josh Stone
a1099ae73e Remove the unused LLVMRustIsRustLLVM 2019-04-18 15:28:18 -07:00
Josh Stone
eed3619f8d Use -mergefunc-use-aliases for any LLVM >= 8 2019-04-18 15:01:10 -07:00
bors
e928e94411 Auto merge of #60046 - euclio:missing-error-code-descriptions, r=estebank
hide `--explain` hint if error has no extended info

Fixes #59848.

r? @estebank
2019-04-18 21:26:53 +00:00
bors
5d20ff4d27 Auto merge of #58702 - taiki-e:libcore-2018, r=Centril
libcore => 2018

Transitions `libcore` to Rust 2018; cc #58099

r? @Centril
2019-04-18 17:48:21 +00:00
varkor
048ba28ad1 Update tests 2019-04-18 18:35:18 +01:00
Andy Russell
b6f148c8bd
hide --explain hint if error has no extended info 2019-04-18 13:29:28 -04:00
Tim Diekmann
ae1f2b571a
Update miri 2019-04-18 18:06:39 +02:00
Michael Woerister
08efbac758 Implement event filtering for self-profiler. 2019-04-18 17:03:53 +02:00
bors
d6f513ec7d Auto merge of #60025 - JohnTitor:rename-files, r=petrochenkov
Rename files about error codes

fixes #60017

This PR will be failed in tidy.

<details>
<summary>The log is here:</summary>

```
tidy check
tidy error: duplicate error code: 411
tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:83:             __diagnostic_used!(E0411);
tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:84:             err.code(DiagnosticId::Error("E0411".to_owned()));
tidy error: duplicate error code: 424
tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:90:             debug!("smart_resolve_path_fragment: E0424, source={:?}", source);
tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:92:             __diagnostic_used!(E0424);
tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:93:             err.code(DiagnosticId::Error("E0424".to_owned()));
some tidy checks failed
```

</details>

I'd like to fix this but I don't know what to do.
I will work on later. Please let me know if you have any solutions.

r? @petrochenkov
2019-04-18 14:52:45 +00:00
Nathan Kleyn
d98afc51dc
Fix small errors in docs for rchunks_exact and rchunks_exact_mut.
The documentation for `rchunks_exact` said it started at the beginning
of the slice, bit it actually starts at the end of the slice.

In addition, there were a couple of "of the slice of the slice"
duplicate phrases going on for `rchunks_exact` and `rchunks_exact_mut`.

This fixes #60068.
2019-04-18 14:48:15 +01:00
Aleksey Kladov
be69785ea2
Use more realistic example for thread builder
Stack size of 10 **bytes** does not make any sense: the minimal possible stack size is greater anyway.
2019-04-18 14:58:38 +03:00