Commit Graph

107802 Commits

Author SHA1 Message Date
Dylan DPC
7aac135dd7
Rollup merge of #69728 - LeSeulArtichaut:patch-1, r=steveklabnik
Make link to `std::str` active

Closes #69726.

r? @dtolnay
2020-03-05 22:04:07 +01:00
Dylan DPC
22a743bc1c
Rollup merge of #69713 - matthiaskrgr:more_cleanup, r=cramertj
more clippy cleanups

* Don't use .ok() before unwrapping via .expect() on a Result.
* Use .map() to modify data inside Options instead of using .and_then(|x| Some(y))
* Use .as_deref() instead of .as_ref().map(Deref::deref)
* Don't use "if let" bindings to only check a value and not actually bind anything.
* Use single-char patter on {ends,starts}_with and remove clone on copy type.
2020-03-05 22:04:05 +01:00
Dylan DPC
189626672d
Rollup merge of #69711 - penelopezone:patch-1, r=steveklabnik
Update macros.rs: fix documentation typo.
2020-03-05 22:04:04 +01:00
Dylan DPC
44f184acc0
Rollup merge of #69698 - RalfJung:int_assoc, r=davidtwco
Use associated constants of integer types

Take advantage of https://github.com/rust-lang/rust/pull/68952 in the interpreter and some nearby modules :)
2020-03-05 22:04:02 +01:00
Dylan DPC
e01dc83aa8
Rollup merge of #69697 - GuillaumeGomez:explanation-e0380, r=Dylan-DPC
Add explanation for E0380

r? @Dylan-DPC
2020-03-05 22:03:58 +01:00
TrolledWoods
79bc934ff3
Fixed a typo
"vector" was used instead of "string"
2020-03-05 20:20:02 +01:00
bors
96bb8b31c8 Auto merge of #67260 - TheSamsa:const-limit, r=oli-obk
const limit for CTFE

I tried to tackle the first steps for this issue.
The active feature flag does link to the issue below, I think this has to change, because there should be a tracking issue?
1679a7647d/src/librustc_feature/active.rs (L530)

Also, I only put up the storage of the limit like "recursion_limit" but created a seperate file in the same place. Since I guess the invocation happens seperately.
https://github.com/TheSamsa/rust/blob/const-limit/src/librustc/middle/const_limit.rs

If this does not hold up for the issue and since there is a time pressure, just reject it.

hopefully this does not put more load on you than I expected...
2020-03-05 17:46:58 +00:00
Matthias Krüger
84577c86bf Don't pass &mut where immutable reference (&) is sufficient (clippy::unnecessary_mut_passed) 2020-03-05 16:39:20 +01:00
Matthias Krüger
8ba92d9ce4 Use more efficient &&str to String conversion (clippy::inefficient_to_string) 2020-03-05 16:39:20 +01:00
Matthias Krüger
a1c3eb6043 Don't always eval arguments inside .expect(), use unwrap_or_else and closure. (clippy::expect_fun_call) 2020-03-05 16:39:20 +01:00
Matthias Krüger
3fc5c118dd Use righthand '&' instead of lefthand "ref". (clippy::toplevel_ref_arg) 2020-03-05 16:39:12 +01:00
Matthias Krüger
3e70c8ec2f Use simple 'for i in x' loops instead of 'while let Some(x) = x.next()' loops on iterators. (clippy::while_let_on_iterator) 2020-03-05 16:38:48 +01:00
Matthias Krüger
c2bbe3349f Const items have by default a static lifetime, there's no need to annotate it. (clippy::redundant_static_lifetimes) 2020-03-05 16:38:24 +01:00
Matthias Krüger
edd3e175d6 Remove redundant patterns when matching ( x @ _ to x) (clippy::redundant_pattern) 2020-03-05 16:30:43 +01:00
bors
c79f5f0647 Auto merge of #69692 - matthiaskrgr:submodule_upd, r=oli-obk
submodules: update clippy from 8b7f7e66 to 74eae9dc

Changes:
````
Rustup to rust-lang/rust#69506
Revive rls integration test
use question mark operator
Add regression test
Use `try_eval_usize` over `eval_usize`
Add path for display trait
Use lang items instead of get_trait_def_id where possible
Update stderr
Don't lint debug formatting in debug impl
Whitelist unused attribute for use items.
add test for #5238
````

Makes clippy tests pass again.

r? @oli-obk
2020-03-05 13:40:57 +00:00
Guillaume Gomez
6b28a8c46f Clean E0382 and E0384 explanations 2020-03-05 13:05:08 +01:00
LeSeulArtichaut
6ed4829c17
Make link to std::str active 2020-03-05 08:52:46 +01:00
Christoph Schmidler
527456e219 Bumped version number for const_eval_limit in active.rs
and renamed 'recursion_limit' in limits.rs to simple 'limit' because it does handle other limits too.
2020-03-05 08:10:39 +01:00
Christoph Schmidler
c94c74e2d9 Opt out of CTFE if the 'const_eval_limit' is set to 0 2020-03-05 08:09:52 +01:00
Christoph Schmidler
288e142737 Add a new test to reach const_limit setting, although with wrong WARNINGs yet
rename feature to const_eval_limit
2020-03-05 08:09:52 +01:00
Christoph Schmidler
ff38babc31 Disable CTFE if const_limit was set to 0, otherwise use the value set, which defaults to 1_000_000 2020-03-05 08:09:52 +01:00
Christoph Schmidler
337af5ef7a Prepare const_limit feature gate and attribute 2020-03-05 08:09:52 +01:00
bors
1e179690f8 Auto merge of #69717 - estebank:correctly-probe, r=varkor
Correctly reject `TraitCandidate` in all cases

Follow up to #69255, addresses #69629.

When `self.select_trait_candidate(trait_ref)` returned `Err(_)`, `result` wasn't being set to `NoMatch`, causing invalid methods to be selected.
2020-03-05 03:44:53 +00:00
Esteban Küber
8a3272985b Correctly reject TraitCandidate in all cases
Follow up to #69255, fix #69629.
2020-03-04 13:59:51 -08:00
Matthias Krüger
80ed505c41 Use single-char patter on {ends,starts}_with and remove clone on copy type.
These were introduced since I last fixed most of these occurences. (clippy::clone_on_copy, clippy::single_char_pattern)
2020-03-04 20:47:05 +01:00
Matthias Krüger
d8d2004c6f Don't use "if let" bindings to only check a value and not actually bind anything.
For example:  `if let Some(_) = foo() {}`	can be reduced to	`if foo().is_some() {}`   (clippy::redundant_pattern_matching)
2020-03-04 20:41:03 +01:00
Matthias Krüger
38f5db7268 Use .as_deref() instead of .as_ref().map(Deref::deref) (clippy::option_as_ref_deref) 2020-03-04 20:39:22 +01:00
Matthias Krüger
569676b9b0 Use .map() to modify data inside Options instead of using .and_then(|x| Some(y)) (clippy::option_and_then_some) 2020-03-04 20:35:11 +01:00
Matthias Krüger
07168f9cdc Don't use .ok() before unwrapping via .expect() on a Result.
The Result can be expect-unwrapped directly. (clippy::ok_expect)
2020-03-04 20:33:47 +01:00
Penelope Phippen
729d49d7f2
Update macros.rs: fix documentation typo. 2020-03-04 14:18:31 -05:00
Esteban Küber
81f435dd37 On mismatched delimiters, only point at empty blocks that are in the same line 2020-03-04 11:05:17 -08:00
Matthias Krüger
c3bceb1bac submodules: update clippy from 8b7f7e66 to 329923ed
Changes:
````
Apply suggestions from code review
Simplify if_chain.
Move NumericLiteral to its own module.
Included binary and octal cases.
Resolve false positives for hex int cast.
Test for unnecessary_cast of hex int literal.
run-rustfix
Lint `if let Some` in question_mark lint
Add restrictive pat use in full binded struct
Update test case answers to match cargo dev fmt
Ran cargo dev fmt
Rustup to rust-lang/rust#69506
Recommended changes from flip1995
Revive rls integration test
use question mark operator
Add regression test
Use `try_eval_usize` over `eval_usize`
Add path for display trait
Use lang items instead of get_trait_def_id where possible
Update stderr
Don't lint debug formatting in debug impl
Whitelist unused attribute for use items.
Fix one last test issue
Refactor suggested by krishna-veerareddy
Fixed compile error from merging
Changed test output to reflect cargo fmt
Run cargo dev fmt
Finished checking for cases of absolute values
add test for #5238
Some bugfixing
Created floating point abs lint and test, but not yet run
````
2020-03-04 19:56:10 +01:00
Josh Stone
53be0ccbc9 Use subslice patterns in slice methods
For all of the methods that pick off the first or last element, we can
use subslice patterns to implement them directly, rather than relying on
deeper indexing function calls. At a minimum, this means the generated
code will rely less on inlining for performance, but in some cases it
also optimizes better.
2020-03-04 10:34:24 -08:00
bors
75cf41afb4 Auto merge of #69576 - matthiaskrgr:nightly_bootstrap_from_beta, r=Centril
nightly: bootstrap from 1.42.0-beta.5 (4e1c5f0e9 2020-02-28)

This beta snapshot has the llvm miscompilation fix included and is bootstrapped from a stable version that also has it included.
2020-03-04 18:34:21 +00:00
Eric Huss
8ea676ecca Update books 2020-03-04 08:12:24 -08:00
Ralf Jung
f0c3cf2b1b cover some more nearby cases 2020-03-04 13:18:08 +01:00
Ralf Jung
6db7e34ab5 use integer assoc consts instead of methods 2020-03-04 13:12:04 +01:00
Guillaume Gomez
c745b4a184 Add explanation for E0380 2020-03-04 13:01:19 +01:00
bors
2b0cfa5b4c Auto merge of #69636 - RalfJung:miri, r=nikomatsakis
update miri

Let's make that toolstate green again. :D

This bumps serde in the lockfile, so r? @oli-obk

Fixes https://github.com/rust-lang/rust/issues/69462
2020-03-04 10:44:55 +00:00
Ralf Jung
faf3a5ea72 update miri 2020-03-04 11:03:08 +01:00
Ralf Jung
0a6f45e2e5 point cargo-miri to the right xargo binary 2020-03-04 10:31:00 +01:00
Matthew Kuo
ea7b3c3c7b fix tidy error 2020-03-04 02:05:23 -06:00
Matthew Kuo
b4788a739b test(pattern): harden tests for or-patterns with slice-patterns
Some of the nested OR paths were being missed
2020-03-04 01:33:32 -06:00
bors
7a3700c371 Auto merge of #68952 - faern:stabilize-assoc-int-consts, r=dtolnay
Stabilize assoc_int_consts associated int/float constants

The next step in RFC https://github.com/rust-lang/rfcs/pull/2700 (tracking issue #68490). Stabilizing the associated constants that were added in #68325.

* Stabilize all constants under the `assoc_int_consts` feature flag.
* Update documentation on old constants to say they are soft-deprecated and the new ones should be preferred.
* Update documentation examples to use new constants.
* Remove `uint_macro` and use `int_macro` for all integer types since the macros were identical anyway.

r? @LukasKalbertodt
2020-03-04 07:29:32 +00:00
Matthew Kuo
5456114858 test(pattern): add tests for combinations of pattern features
Reference issue #67311

Tests combinations of the following pattern features:
- bindings_after_at
- or_patterns
- slice_patterns
- box_patterns
2020-03-04 01:17:41 -06:00
bors
4d71c164a8 Auto merge of #69550 - RalfJung:scalar, r=oli-obk
interpret engine: Scalar cleanup

* Remove `to_ptr`
* Make `to_bits` private

r? @oli-obk
2020-03-04 04:10:58 +00:00
Mazdak Farrokhzad
cc9aad452a resolve, inconsistent binding mode: tweak wording. 2020-03-04 03:58:52 +01:00
bors
592e9c3700 Auto merge of #69678 - Dylan-DPC:rollup-yoaueud, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #69565 (miri engine: turn some debug_assert into assert)
 - #69621 (use question mark operator in a few places.)
 - #69650 (cleanup more iterator usages (and other things))
 - #69653 (use conditions directly)
 - #69665 (Invoke OptimizerLastEPCallbacks in PreLinkThinLTO)
 - #69670 (Add explanation for E0379)

Failed merges:

r? @ghost
2020-03-03 23:26:38 +00:00
Dylan DPC
f8c026b479
Rollup merge of #69670 - GuillaumeGomez:explain-e0379, r=Dylan-DPC
Add explanation for E0379

r? @Dylan-DPC
2020-03-03 21:26:18 +01:00
Dylan DPC
587ca17cdb
Rollup merge of #69665 - tmiasko:new-pass-manager-thin-lto-opt, r=nikic
Invoke OptimizerLastEPCallbacks in PreLinkThinLTO

The default ThinLTO pre-link pipeline does not include optimizer last
extension points. Thus, when using the new LLVM pass manager & ThinLTO
& sanitizers on any opt-level different from zero, the sanitizer
function passes would be omitted from the pipeline.

Add optimizer last extensions points manually to the pipeline, but guard
registration with stage check in the case this behaviour changes in the
future.
2020-03-03 21:26:16 +01:00