Commit Graph

107703 Commits

Author SHA1 Message Date
Ralf Jung
58f8cc2135 rename visit_primitive -> try_visit_primitive, and comments 2020-03-06 22:41:49 +01:00
Ralf Jung
f0586f9aea please tidy 2020-03-06 22:41:49 +01:00
Ralf Jung
4584e75c9b better error messages for invalid boxes (and a few more tests) 2020-03-06 22:41:49 +01:00
Ralf Jung
f481547622 test some more kinds of enums with uninhabited variants 2020-03-06 22:41:49 +01:00
Ralf Jung
4807e939cd test that we validate boxes 2020-03-06 22:41:49 +01:00
Ralf Jung
aa1435b0ae const validation ub tests: use transmute instead of unions 2020-03-06 22:41:49 +01:00
Ralf Jung
d47196b2ec miri value visitor: detect primitives by type, not layout 2020-03-06 22:41:49 +01:00
Ralf Jung
6548be2ba9 'fieldless enums' is not what I meant -- it's empty/uninhabited enums, really 2020-03-06 22:41:49 +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
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
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
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
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
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
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
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
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
Dylan DPC
099cd7f402
Rollup merge of #69653 - matthiaskrgr:needless_bool, r=Dylan-DPC
use conditions directly
2020-03-03 21:26:15 +01:00
Dylan DPC
8ca3e59f8a
Rollup merge of #69650 - matthiaskrgr:clnp, r=varkor
cleanup more iterator usages (and other things)

* Improve weird formatting by moving comment inside else-code block.
* Use .any(x) instead of .find(x).is_some() on iterators.
* Use .nth(x) instead of .skip(x).next() on iterators.
* Simplify conditions like  x + 1 <= y   to   x < y
* Use let instead of match to get value of enum with single variant.
2020-03-03 21:26:13 +01:00
Dylan DPC
2cfab73594
Rollup merge of #69621 - matthiaskrgr:q, r=petrochenkov
use question mark operator in a few places.
2020-03-03 21:26:12 +01:00
Dylan DPC
fab54fc34e
Rollup merge of #69565 - RalfJung:assert, r=eddyb
miri engine: turn some debug_assert into assert

@eddyb said to avoid debug assertions in rustc. These checks here look like they are probably not too expensive. Cc @oli-obk
2020-03-03 21:26:10 +01:00
bors
4ad6248825 Auto merge of #69506 - Centril:stmt-semi-none, r=petrochenkov
encode `;` stmt without expr as `StmtKind::Empty`

Instead of encoding `;` statements without a an expression as a tuple in AST, encode it as `ast::StmtKind::Empty`.

r? @petrochenkov
2020-03-03 19:57:07 +00:00
bors
3c5b1b7d63 Auto merge of #69371 - tmiasko:weak-lang-cycle, r=alexcrichton
Improve linking of crates with circular dependencies

Previously, the code responsible for handling the cycles between crates
introduces through weak lang items, would keep a set of missing language
items:

* extending it with items missing from the current crate,
* removing items provided by the current crate,
* grouping the crates when the set changed from non-empty back to empty.

This could produce incorrect results, if a lang item was missing from a
crate that comes after the crate that provides it (in the loop iteration
order). In that case the grouping would not take place.

The changes here address this specific failure scenario by keeping track
of two separate sets of crates. Those that are required to link successfully,
and those that are available for linking.

Verified using test case from #69368.
2020-03-03 16:38:02 +00:00
bors
b135c739fb Auto merge of #69482 - lqd:poloniusup, r=nikomatsakis
Polonius: update `polonius-engine` to 0.12.0

Since @albins won't have the time to finish up #68993 for a while, I'll take care of the trivial remaining tasks (rebasing, taking care of tidy/rustfmt).

I'll r? @nikomatsakis since they're assigned to #68993, but have actually [already reviewed it pre-rebase](https://github.com/rust-lang/rust/pull/68993#issuecomment-586413089).

When CI passes: I'll notify bors and close #68993, since this PR supersedes it.
2020-03-03 13:27:52 +00:00
Guillaume Gomez
c92267a863 Add explanation for E0379 2020-03-03 13:30:17 +01:00
Tomasz Miąsko
44dba79124 Add regression test for linking issue with start-group / end-group 2020-03-03 13:11:23 +01:00
Tomasz Miąsko
3ab596514a Improve linking of crates with circular dependencies
Previously, the code responsible for handling the cycles between crates
introduces through weak lang items, would keep a set of missing language
items:

* extending it with items missing from the current crate,
* removing items provided by the current crate,
* grouping the crates when the set changed from non-empty back to empty.

This could produce incorrect results, if a lang item was missing from a
crate that comes after the crate that provides it (in the loop iteration
order). In that case the grouping would not take place.

The changes here address this specific failure scenario by keeping track
of two separate sets of crates. Those that are required to link successfully,
and those that are available for linking.

Verified using test case from 69368.
2020-03-03 13:11:19 +01:00
Matthias Krüger
ecae6e4260 use question mark operator in a few places. 2020-03-03 11:52:14 +01:00
bors
a5de254862 Auto merge of #69666 - JohnTitor:rollup-6nt3op0, r=JohnTitor
Rollup of 9 pull requests

Successful merges:

 - #69213 (Improve documentation on iterators length)
 - #69609 (Remove `usable_size` APIs)
 - #69619 (more cleanups)
 - #69620 (doc(librustc_error_codes): add long error explanation for E0719)
 - #69626 (Toolstate: don't duplicate nightly tool list.)
 - #69628 (Fix a leak in `DiagnosticBuilder::into_diagnostic`.)
 - #69633 (Update my mailmap entry)
 - #69634 (clean up E0378 explanation)
 - #69637 (Don't convert Results to Options just for matching.)

Failed merges:

r? @ghost
2020-03-03 10:18:57 +00:00
Yuki Okushi
e453a0cc49
Rollup merge of #69637 - matthiaskrgr:if_let_some_result, r=ecstatic-morse
Don't convert Results to Options just for matching.
2020-03-03 17:50:17 +09:00
Yuki Okushi
9be7932d35
Rollup merge of #69634 - GuillaumeGomez:clean-up-e0378, r=Dylan-DPC
clean up E0378 explanation

r? @Dylan-DPC
2020-03-03 17:50:16 +09:00
Yuki Okushi
017a2f4ce6
Rollup merge of #69633 - XAMPPRocky:master, r=Dylan-DPC
Update my mailmap entry

superceding #68891
2020-03-03 17:50:14 +09:00
Yuki Okushi
ef311d5ab4
Rollup merge of #69628 - nnethercote:fix-DiagnosticBuilder-into_diagnostic-leak, r=Centril
Fix a leak in `DiagnosticBuilder::into_diagnostic`.

Fixes #69600.

r? @Centril
2020-03-03 17:50:13 +09:00
Yuki Okushi
c9d421f5c0
Rollup merge of #69626 - ehuss:toolstate-nightly-cleanup, r=Mark-Simulacrum
Toolstate: don't duplicate nightly tool list.

Just some cleanup, seems good to avoid duplicating this list.
2020-03-03 17:50:11 +09:00
Yuki Okushi
9f3a192327
Rollup merge of #69620 - thekuom:doc/61137-add-long-error-code-e0719, r=davidtwco
doc(librustc_error_codes): add long error explanation for E0719

Reference issue #61137

- Updated error_codes.rs
- Added E0719.md in error_codes
- Updated necessary test .stderr files
2020-03-03 17:50:10 +09:00
Yuki Okushi
f19684c7cf
Rollup merge of #69619 - matthiaskrgr:misc, r=eddyb
more cleanups

* use starts_with() instead of chars().next() == Some(x)
* use subsec_micros() instead of subsec_nanos() / 1000
* use for (idx, item) in iter.enumerate() instead of manually counting loop iterations with variables
* use values() or keys() respectively when iterating only over keys or values of maps.
2020-03-03 17:50:08 +09:00
Yuki Okushi
4699b29a04
Rollup merge of #69609 - TimDiekmann:excess, r=Amanieu
Remove `usable_size` APIs

This removes the usable size APIs:
- remove `usable_size` (obv)
- change return type of allocating methods to include the allocated size
- remove `_excess` API

r? @Amanieu
closes rust-lang/wg-allocators#17
2020-03-03 17:50:06 +09:00
Yuki Okushi
dfacdda649
Rollup merge of #69213 - LeSeulArtichaut:improve-doc-iter, r=steveklabnik
Improve documentation on iterators length

Attempts to resolve #66491. @the8472 does this help?

r? @steveklabnik
2020-03-03 17:50:04 +09:00
Tomasz Miąsko
b0e288d9f1 Fix check for __msan_keep_going in sanitizer-recover test
Match `@__msan_keep_going = weak_odr constant i32 1`.
2020-03-03 08:41:16 +01:00
Tomasz Miąsko
52c5f2a577 Add test for -Znew-llvm-pass-manager -Clto=thin -Zsanitizer=...
Additionally verify that the current implementation of LLVM version
check (which uses lexicographic ordering) is good enough to exclude
versions before LLVM 9, where the new LLVM pass manager is unsupported.
2020-03-03 08:41:08 +01:00