Commit graph

353 commits

Author SHA1 Message Date
Bastian Kauschke
d4039c55c9 wip emit errors during AbstractConst building 2020-09-19 22:17:52 +02:00
bors
b3aae050cd Auto merge of #76880 - shepmaster:cc-rs, r=Mark-Simulacrum
Update cc crate to 1.0.60 to understand aarch64-apple-darwin with clang

r? `@Mark-Simulacrum`

/cc `@alexcrichton`
2020-09-19 13:31:23 +00:00
bors
8e9d5db839 Auto merge of #76912 - RalfJung:rollup-q9ur56h, r=RalfJung
Rollup of 14 pull requests

Successful merges:

 - #73963 (deny(unsafe_op_in_unsafe_fn) in libstd/path.rs)
 - #75099 (lint/ty: move fns to avoid abstraction violation)
 - #75502 (Use implicit (not explicit) rules for promotability by default in `const fn`)
 - #75580 (Add test for checking duplicated branch or-patterns)
 - #76310 (Add `[T; N]: TryFrom<Vec<T>>` (insta-stable))
 - #76400 (Clean up vec benches bench_in_place style)
 - #76434 (do not inline black_box when building for Miri)
 - #76492 (Add associated constant `BITS` to all integer types)
 - #76525 (Add as_str() to string::Drain.)
 - #76636 (assert ScalarMaybeUninit size)
 - #76749 (give *even better* suggestion when matching a const range)
 - #76757 (don't convert types to the same type with try_into (clippy::useless_conversion))
 - #76796 (Give a better error message when x.py uses the wrong stage for CI)
 - #76798 (Build fixes for RISC-V 32-bit Linux support)

Failed merges:

r? `@ghost`
2020-09-19 11:29:00 +00:00
Ralf Jung
4831523ac4
Rollup merge of #76757 - matthiaskrgr:clippy_try_into, r=lcnr
don't convert types to the same type with try_into (clippy::useless_conversion)
2020-09-19 11:47:52 +02:00
Ralf Jung
5631b5d684
Rollup merge of #76749 - guswynn:hir_ranges, r=estebank
give *even better* suggestion when matching a const range

notice that the err already has "constant defined here"
so this is now *exceedingly clear*

extension to #76222

r? @estebank
2020-09-19 11:47:50 +02:00
Ralf Jung
8a7cb1eac1
Rollup merge of #76636 - RalfJung:miri-size-assert, r=oli-obk
assert ScalarMaybeUninit size

I noticed most low-level Miri types have such an assert but `ScalarMaybeUninit` does not, so let's add that. Good t see that the `Option`-like optimization kicks in and this is no bigger than `Scalar`. :)

r? @oli-obk
2020-09-19 11:47:49 +02:00
Ralf Jung
fef3324043
Rollup merge of #76492 - fusion-engineering-forks:int-bits, r=dtolnay
Add associated constant `BITS` to all integer types

Recently I've regularly come across this snippet (in a few different crates, including `core` and `std`):
```rust
std::mem::size_of<usize>() * 8
```

I think it's time for a `usize::BITS`.
2020-09-19 11:47:45 +02:00
Ralf Jung
f62ba52f5c
Rollup merge of #75502 - ecstatic-morse:implicit-promotion-in-const-fn, r=RalfJung
Use implicit (not explicit) rules for promotability by default in `const fn`

For crater run. See https://github.com/rust-lang/const-eval/pull/54#discussion_r469995552.

cc #75586
2020-09-19 11:47:35 +02:00
Ralf Jung
aa25f9ebd8
Rollup merge of #75099 - davidtwco:is-zst-abstraction-violation, r=eddyb
lint/ty: move fns to avoid abstraction violation

This PR moves `transparent_newtype_field` and `is_zst` to `LateContext` where they are used, rather than being on the `VariantDef` and `TyS` types, hopefully addressing @eddyb's concern [from this comment](https://github.com/rust-lang/rust/pull/74340#discussion_r456534910).
2020-09-19 11:47:34 +02:00
bors
fd702d2919 Auto merge of #76886 - Aaron1011:fix/ensure-stack-predicate, r=Mark-Simulacrum
Wrap recursive predicate evaluation with `ensure_sufficient_stack`

I haven't been able to come up with a minimized test case for #76770,
but this fixes a stack overflow in rustc as well.
2020-09-19 09:21:22 +00:00
Mara Bos
1e2dba1e7c Use T::BITS instead of size_of::<T> * 8. 2020-09-19 06:54:42 +02:00
bors
a2c82df1f5 Auto merge of #76838 - est31:dogfood_uninit_features, r=oli-obk
Dogfood new_uninit and maybe_uninit_slice in rustc_arena

Dogfoods a few cool `MaybeUninit` related features in the compiler's rustc_arena crate.

Split off from #76821

r? `@oli-obk`
2020-09-19 02:21:19 +00:00
bors
9f8ac718f4 Auto merge of #76575 - lcnr:abstract-const, r=oli-obk
compare generic constants using `AbstractConst`s

This is a MVP of rust-lang/compiler-team#340. The changes in this PR should only be relevant if `feature(const_evaluatable_checked)` is enabled.

~~currently based on top of #76559, so blocked on that.~~

r? `@oli-obk` cc `@varkor` `@eddyb`
2020-09-18 16:59:50 +00:00
Aaron Hill
6a96aea36a
Wrap recursive predicate evaluation with ensure_sufficient_stack
I haven't been able to come up with a minimized test case for #76770,
but this fixes a stack overflow in rustc as well.
2020-09-18 12:24:42 -04:00
Bastian Kauschke
b7641209d7 add const-evaluatable_checked check back in 2020-09-18 17:36:11 +02:00
Bastian Kauschke
09e6254496 review, small cleanup 2020-09-18 17:11:34 +02:00
Bastian Kauschke
1b275d08ad document const_evaluatable 2020-09-18 17:11:34 +02:00
Bastian Kauschke
7fff155d2a remove allow(warnings) 2020-09-18 17:11:34 +02:00
Bastian Kauschke
30ff1ef3d0 support const_evaluatable_checked across crate boundaries 2020-09-18 17:11:34 +02:00
Bastian Kauschke
82ebbd7d6b add test for let-bindings 2020-09-18 17:11:34 +02:00
Bastian Kauschke
c7d16df1d8 add function calls 2020-09-18 17:11:34 +02:00
Bastian Kauschke
d1294e0ce2 allow unary operations and ignore StorageLive/Dead stmts 2020-09-18 17:11:34 +02:00
Bastian Kauschke
5a277822a5 use newtype_index for abstract_const::NodeId 2020-09-18 17:11:34 +02:00
Bastian Kauschke
f24d532749 refactor AbstractConstBuilder 2020-09-18 17:11:34 +02:00
Bastian Kauschke
c3a772f55f use abstract consts when unifying ConstKind::Unevaluated 2020-09-18 17:11:34 +02:00
Bastian Kauschke
d327fa112b initial working state 2020-09-18 16:25:25 +02:00
bors
fdc3405c20 Auto merge of #72412 - VFLashM:issue-72408-nested-closures-exponential, r=tmandry
Issue 72408 nested closures exponential

This fixes #72408.

Nested closures were resulting in exponential compilation time.

This PR is enhancing asymptotic complexity, but also increasing the constant, so I would love to see perf run results.
2020-09-18 14:08:39 +00:00
Jake Goulding
9803c9b252 Update cc crate to understand aarch64-apple-darwin with clang 2020-09-18 09:22:07 -04:00
bors
2c69266c06 Auto merge of #76837 - wesleywiser:disable_consideredequal, r=oli-obk
[mir-opt] Disable the `ConsideredEqual` logic in SimplifyBranchSame opt

The logic is currently broken and we need to disable it to fix a beta
regression (see #76803)

r? `@oli-obk`
2020-09-18 10:54:14 +00:00
Tyler Mandry
3ccb1c37e6 Remove redundancy in cache key 2020-09-18 09:03:53 +00:00
est31
2805a05154 Add bench_typed_arena_clear_100 bench 2020-09-18 05:52:45 +02:00
est31
daccd1709e Replace loop with drop_in_place call 2020-09-18 04:49:02 +02:00
est31
5acfcceb47 Dogfood new_uninit and maybe_uninit_slice in rustc_arena 2020-09-18 04:49:02 +02:00
Valerii Lashmanov
f583513dc2 Intorduced MiniMap - a tiny small storage optimized map implementation
This makes everything about 1% faster in rustc-perf,
mostly negating performance hit of previous commit.
2020-09-17 20:44:11 -05:00
Valerii Lashmanov
17d2e3b5d2 Better handling for exponential-sized types in misc places
Mostly to fix ui/issues/issue-37311-type-length-limit/issue-37311.rs.

Most parts of the compiler can handle deeply nested types with a lot
of duplicates just fine, but some parts still attempt to naively
traverse type tree.

Before such problems were caught by type length limit check,
but now these places will have to be changed to handle
duplicated types gracefully.
2020-09-17 20:44:11 -05:00
Valerii Lashmanov
2f3296192b Only visit types once when walking the type tree
This fixes #72408.

Nested closures were resulting in exponential compilation time.

As a performance optimization this change introduces MiniSet,
which is a simple small storage optimized set.
2020-09-17 20:44:11 -05:00
Dylan MacKenzie
e03f4164d9 Default to implicit (not explicit) rules for promotability in const fn 2020-09-17 08:39:11 -07:00
Wesley Wiser
dbd7226d29 [mir-opt] Disable the ConsideredEqual logic in SimplifyBranchSame opt
The logic is currently broken and we need to disable it to fix a beta
regression (see #76803)
2020-09-17 09:36:50 -04:00
bors
7bdb5dee7b Auto merge of #76634 - RalfJung:miri-guaranteed-eq-ne, r=oli-obk
move guaranteed{ne,eq} implementation to compile-time machine

Currently, Miri needs a special hack to avoid using the core engine implementation of these intrinsics. That seems silly, so let's move them to the CTFE machine, which is the only machine that wants to use them.

I also added a reference to https://github.com/rust-lang/rust/issues/73722 as a warning to anyone who wants to adjust `guaranteed_eq`.
2020-09-17 12:15:57 +00:00
bors
95386b656e Auto merge of #76028 - aticu:improve_e0118, r=estebank,jyn514,GuillaumeGomez
Improve E0118

- Changes the "base type" terminology to "nominal type" (according to the [reference](https://doc.rust-lang.org/stable/reference/items/implementations.html#inherent-implementations)).
- Suggests removing a reference, if one is present on the type.
- Clarify what is meant by a "nominal type".

closes #69392

This is my first not-entirely-trivial PR, so please let me know if I missed anything or if something could be improved. Though I probably won't be able to fix anything in the upcoming week.
2020-09-17 03:56:38 +00:00
Matthias Krüger
0e3414248a don't lazily evaulate some trivial values for Option::None replacements (clippy::unnecessary_lazy_evaluations) 2020-09-17 01:37:35 +02:00
Gus Wynn
230355f25f comments and factor to own method 2020-09-16 12:32:10 -07:00
Tyler Mandry
3bf66ae25f
Rollup merge of #76794 - richkadel:graphviz-font, r=ecstatic-morse
Make graphviz font configurable

Alternative to PR #76776.

To change the graphviz output to use an alternative `fontname` value,
add a command line option like: `rustc --graphviz-font=monospace`.

r? @ecstatic-morse
2020-09-16 12:24:30 -07:00
Tyler Mandry
cd766c9d09
Rollup merge of #76775 - ecstatic-morse:dataflow-extra-tab-diff, r=Mark-Simulacrum
Strip a single leading tab when rendering dataflow diffs

The `fmt_diff_with` formatter uses a tab to separate additions from subtractions. Strip it when rendering those diffs on separate lines.

r? @Mark-Simulacrum (since you're speedy)
2020-09-16 12:24:27 -07:00
Tyler Mandry
6e0131cd5b
Rollup merge of #76760 - matthiaskrgr:clippy_lazy_eval, r=varkor
don't lazily evaluate some trivial values for Option::None replacements (clippy::unnecessary_lazy_evaluations)
2020-09-16 12:24:23 -07:00
Tyler Mandry
a6c4d30c7b
Rollup merge of #76756 - matthiaskrgr:cl123ppy, r=Dylan-DPC
fix a couple of stylistic clippy warnings

namely:

clippy::redundant_pattern_matching
clippy::redundant_pattern
clippy::search_is_some
clippy::filter_next
clippy::into_iter_on_ref
clippy::clone_on_copy
clippy::needless_return
2020-09-16 12:24:17 -07:00
Tyler Mandry
a63f8c1cac
Rollup merge of #76719 - hameerabbasi:min-const-generics-ty, r=lcnr
Change error message for ty param in const

This PR introduces the following changes:

* Change error message for type param in a const expression when using
`min_const_generics`
* Change `ParamInNonTrivialAnonConst` to contain an extra `bool` used for
distinguishing whether the passed-in symbol is a type or a value.

Fixes #76701
2020-09-16 12:24:06 -07:00
Rich Kadel
3875abe32f Added RUSTC_GRAPHVIZ_FONT environment variable
Overrides the debugging_opts.graphviz_font setting.
2020-09-16 11:27:17 -07:00
Gus Wynn
1d93048324 give better suggestion when matching a const range 2020-09-16 10:13:11 -07:00
Rich Kadel
5c29332ace Make graphviz font configurable
Alternative to PR ##76776.

To change the graphviz output to use an alternative `fontname` value,
add a command line option like: `rustc --graphviz-font=monospace`.
2020-09-16 08:10:06 -07:00