Commit graph

594 commits

Author SHA1 Message Date
LingMan
d76b80768c
Merge two almost identical match arms 2020-09-23 01:09:24 +02:00
bors
6d3acf5129 Auto merge of #76928 - lcnr:opaque-types-cache, r=tmandry
cache types during normalization

partially fixes #75992

reduces the following test from 14 to 3 seconds locally.

cc `@Mark-Simulacrum` would it make sense to add that test to `perf`?
```rust
#![recursion_limit="2048"]
#![type_length_limit="112457564"]

pub async fn h0(v: &String, x: &u64) { println!("{} {}", v, x) }
pub async fn h1(v: &String, x: &u64) { h0(v, x).await }
pub async fn h2(v: &String, x: &u64) { h1(v, x).await }
pub async fn h3(v: &String, x: &u64) { h2(v, x).await }
pub async fn h4(v: &String, x: &u64) { h3(v, x).await }
pub async fn h5(v: &String, x: &u64) { h4(v, x).await }
pub async fn h6(v: &String, x: &u64) { h5(v, x).await }
pub async fn h7(v: &String, x: &u64) { h6(v, x).await }
pub async fn h8(v: &String, x: &u64) { h7(v, x).await }
pub async fn h9(v: &String, x: &u64) { h8(v, x).await }

pub async fn h10(v: &String, x: &u64) { h9(v, x).await }
pub async fn h11(v: &String, x: &u64) { h10(v, x).await }
pub async fn h12(v: &String, x: &u64) { h11(v, x).await }
pub async fn h13(v: &String, x: &u64) { h12(v, x).await }
pub async fn h14(v: &String, x: &u64) { h13(v, x).await }
pub async fn h15(v: &String, x: &u64) { h14(v, x).await }
pub async fn h16(v: &String, x: &u64) { h15(v, x).await }
pub async fn h17(v: &String, x: &u64) { h16(v, x).await }
pub async fn h18(v: &String, x: &u64) { h17(v, x).await }
pub async fn h19(v: &String, x: &u64) { h18(v, x).await }

macro_rules! async_recursive {
    (29, $inner:expr) => { async { async_recursive!(28, $inner) }.await };
    (28, $inner:expr) => { async { async_recursive!(27, $inner) }.await };
    (27, $inner:expr) => { async { async_recursive!(26, $inner) }.await };
    (26, $inner:expr) => { async { async_recursive!(25, $inner) }.await };
    (25, $inner:expr) => { async { async_recursive!(24, $inner) }.await };
    (24, $inner:expr) => { async { async_recursive!(23, $inner) }.await };
    (23, $inner:expr) => { async { async_recursive!(22, $inner) }.await };
    (22, $inner:expr) => { async { async_recursive!(21, $inner) }.await };
    (21, $inner:expr) => { async { async_recursive!(20, $inner) }.await };
    (20, $inner:expr) => { async { async_recursive!(19, $inner) }.await };

    (19, $inner:expr) => { async { async_recursive!(18, $inner) }.await };
    (18, $inner:expr) => { async { async_recursive!(17, $inner) }.await };
    (17, $inner:expr) => { async { async_recursive!(16, $inner) }.await };
    (16, $inner:expr) => { async { async_recursive!(15, $inner) }.await };
    (15, $inner:expr) => { async { async_recursive!(14, $inner) }.await };
    (14, $inner:expr) => { async { async_recursive!(13, $inner) }.await };
    (13, $inner:expr) => { async { async_recursive!(12, $inner) }.await };
    (12, $inner:expr) => { async { async_recursive!(11, $inner) }.await };
    (11, $inner:expr) => { async { async_recursive!(10, $inner) }.await };
    (10, $inner:expr) => { async { async_recursive!(9, $inner) }.await };

    (9, $inner:expr) => { async { async_recursive!(8, $inner) }.await };
    (8, $inner:expr) => { async { async_recursive!(7, $inner) }.await };
    (7, $inner:expr) => { async { async_recursive!(6, $inner) }.await };
    (6, $inner:expr) => { async { async_recursive!(5, $inner) }.await };
    (5, $inner:expr) => { async { async_recursive!(4, $inner) }.await };
    (4, $inner:expr) => { async { async_recursive!(3, $inner) }.await };
    (3, $inner:expr) => { async { async_recursive!(2, $inner) }.await };
    (2, $inner:expr) => { async { async_recursive!(1, $inner) }.await };
    (1, $inner:expr) => { async { async_recursive!(0, $inner) }.await };
    (0, $inner:expr) => { async { h19(&String::from("owo"), &0).await; $inner }.await };
}

async fn f() {
    async_recursive!(14, println!("hello"));
}

fn main() {
    let _ = f();
}
```
r? `@eddyb` requires a perf run.
2020-09-22 22:52:07 +00:00
LingMan
c07890543d
Don't use an if guard to check equality with a constant
Match on it directly instead
2020-09-23 00:29:56 +02:00
Simon Vandel Sillesen
b6f51d6d6a cleanup cfg after optimization 2020-09-22 23:09:07 +02:00
Simon Vandel Sillesen
f472303a93 The optimization should also apply for DropAndReplace 2020-09-22 23:09:07 +02:00
Simon Vandel Sillesen
d3338dcf4d Get LocalDefId from source instead of passing in 2020-09-22 23:09:07 +02:00
Simon Vandel Sillesen
b4bdaa14f2 Suggestion from review
Co-authored-by: Andreas Jonson <andjo403@users.noreply.github.com>
2020-09-22 23:09:07 +02:00
Simon Vandel Sillesen
290dca1781 MIR pass to remove unneeded drops on types not needing drop
This is heavily dependent on MIR inlining running to actually see the drop statement
2020-09-22 23:09:07 +02:00
Dylan MacKenzie
186d148b4c Use correct feature gate for unsizing casts 2020-09-22 10:22:50 -07:00
Dylan MacKenzie
6044836284 Add #![feature(const_fn_transmute)] to rustc_ast 2020-09-22 10:22:21 -07:00
Dylan MacKenzie
08e3822d9a Replace missing comment 2020-09-22 10:05:58 -07:00
Dylan MacKenzie
d60e204e0a Use the same name everywhere for is_const_stable_const_fn 2020-09-22 10:05:58 -07:00
Dylan MacKenzie
3569bb6323 Update const-checker to replicate qualify_min_const_fn 2020-09-22 10:05:58 -07:00
Dylan MacKenzie
5ee5429e00 Add structured errors for qualify_min_const_fn checks 2020-09-22 10:05:58 -07:00
Dylan MacKenzie
bfc10a89c3 Allow errors to abort const checking when emitted
This is a hack for parity with `qualify_min_const_fn`, which only
emitted a single error.
2020-09-22 10:05:58 -07:00
Dylan MacKenzie
7fb9587a3c Return true if check_const emits an error 2020-09-22 10:05:58 -07:00
Dylan MacKenzie
a173c5c1b3 Add const-stability helpers 2020-09-22 10:05:58 -07:00
Dylan MacKenzie
3dd28c78c3 Useful derives on ops::Status 2020-09-22 10:05:58 -07:00
bors
c113030f6b Auto merge of #76906 - Nicholas-Baron:shorten_typeck_check, r=oli-obk
Split rustc_typeck::check into separate files

Contributing to #60302.
2020-09-22 08:11:07 +00:00
Ralf Jung
731113b8ee Miri: more informative deallocation error messages 2020-09-22 09:05:12 +02:00
Ishi Tatsuyuki
01a771a7d8 Add debug assertions against slow path reference results 2020-09-22 14:40:44 +09:00
ecstatic-morse
0863f9a965
Rollup merge of #77032 - lcnr:visit-all-the-item-likes, r=davidtwco
lint missing docs for extern items

fixes #76991
2020-09-21 20:41:01 -07:00
ecstatic-morse
359615b852
Rollup merge of #77022 - Juici:master, r=lcnr
Reduce boilerplate for BytePos and CharPos

Reduces boilerplate code for BytePos and CharPos by using a macro to implement shared traits.
2020-09-21 20:40:59 -07:00
ecstatic-morse
50d4aebc7a
Rollup merge of #76914 - lcnr:path-no-more, r=ecstatic-morse
extend `Ty` and `TyCtxt` lints to self types

blocked on #76891

r? @ecstatic-morse cc @Aaron1011
2020-09-21 20:40:57 -07:00
ecstatic-morse
dcf4d1f2be
Rollup merge of #76888 - matthiaskrgr:clippy_single_match_2, r=Dylan-DPC
use if let instead of single match arm expressions

use if let instead of single match arm expressions to compact code and reduce nesting (clippy::single_match)
2020-09-21 20:40:55 -07:00
ecstatic-morse
60b99015e9
Rollup merge of #76807 - ecstatic-morse:const-checking-staged-api, r=oli-obk
Use const-checking to forbid use of unstable features in const-stable functions

First step towards #76618.

Currently this code isn't ever hit because `qualify_min_const_fn` runs first and catches pretty much everything. One exception is `const_precise_live_drops`, which does not use the newly added code since it runs as part of a separate pass.

Also contains some unrelated refactoring, which is split into separate commits.

r? @oli-obk
2020-09-21 20:40:53 -07:00
ecstatic-morse
30f1bab7e6
Rollup merge of #76581 - lcnr:bound-too-generic, r=eddyb
do not ICE on bound variables, return `TooGeneric` instead

fixes #73260, fixes #74634, fixes #76595

r? @nikomatsakis
2020-09-21 20:40:47 -07:00
ecstatic-morse
ef6c3a7bca
Rollup merge of #76489 - GuillaumeGomez:add-explanation-e0756, r=jyn514
Add explanation for E0756

r? @pickfire
2020-09-21 20:40:46 -07:00
ecstatic-morse
dc42aa8cd4
Rollup merge of #76131 - Aaron1011:fix/pretty-print-zip, r=lcnr
Don't use `zip` to compare iterators during pretty-print hack

If the right-hand iterator has exactly one more element than the
left-hand iterator, then both iterators will be fully consumed, but
the extra element will never be compared.

Split out from https://github.com/rust-lang/rust/pull/76130
2020-09-21 20:40:39 -07:00
bors
45198456be Auto merge of #76913 - vandenheuvel:performance_debug, r=lcnr
Fixing the performance regression of #76244

Issue https://github.com/rust-lang/rust/issues/74865 suggested that removing the `def_id` field from `ParamEnv` would improve performance. PR https://github.com/rust-lang/rust/pull/76244 implemented this change.

Generally, [results](https://perf.rust-lang.org/compare.html?start=80fc9b0ecb29050d45b17c64af004200afd3cfc2&end=5ef250dd2ad618ee339f165e9b711a1b4746887d) were as expected: an instruction count decrease of about a percent. The instruction count for the unicode crates increased by about 3%, which `@nnethercote` speculated to be caused by a quirk of inlining or codegen. As the results were generally positive, and for chalk integration, this was also a step in the right direction, the PR was r+'d regardless.

However, [wall-time performance results](https://perf.rust-lang.org/compare.html?start=a055c5a1bd95e029e9b31891db63b6dc8258b472&end=7402a394471a6738a40fea7d4f1891666e5a80c5&stat=task-clock) show a much larger performance degradation: 25%, as [mentioned](https://github.com/rust-lang/rust/pull/76244#issuecomment-694459840) by `@Mark-Simulacrum.`

This PR, for now, reverts #76244 and attempts to find out, which change caused the regression.
2020-09-22 00:22:24 +00:00
Bastian Kauschke
d452744100 lint missing docs for extern items 2020-09-22 00:02:46 +02:00
Bastian Kauschke
2f893e458a review 2020-09-21 23:25:52 +02:00
Simon Vandel Sillesen
2bb3844820 Add optimization to avoid load of address 2020-09-21 22:08:27 +02:00
Aaron Hill
f5d71a9b3c
Don't use zip to compare iterators during pretty-print hack
If the right-hand iterator has exactly one more element than the
left-hand iterator, then both iterators will be fully consumed, but
the extra element will never be compared.
2020-09-21 15:11:59 -04:00
Aaron Hill
e734733a9e
Record tcx.def_span instead of item.span in crate metadata
This was missed in PR #75465. As a result, a few places have been using
the full body span of functions, instead of just the header span.
2020-09-21 15:10:16 -04:00
Guillaume Gomez
63195ecb45 Add explanation for E0756 2020-09-21 21:04:56 +02:00
Mara Bos
9e3f94dabc Don't unwrap but report a fatal error for TargetDataLayout::parse. 2020-09-21 20:43:44 +02:00
James Whaley
9a1f1777d3
Remove cast to usize for BytePos and CharPos
The case shouldn't be necessary and implicitly truncating BytePos is not
desirable.
2020-09-21 19:42:43 +01:00
Mara Bos
db74e1f1e3 Add cfg(target_has_atomic_equal_alignment).
This is needed for Atomic::from_mut.
2020-09-21 20:42:25 +02:00
Bastian Kauschke
8fc782afc2 add test 2020-09-21 20:36:05 +02:00
bors
b01326ab03 Auto merge of #76680 - Julian-Wollersberger:nongeneric_ensure_sufficient_stack, r=jyn514
Make `ensure_sufficient_stack()` non-generic, using cargo-llvm-lines

Inspired by [this blog post](https://blog.mozilla.org/nnethercote/2020/08/05/how-to-speed-up-the-rust-compiler-some-more-in-2020/) from `@nnethercote,` I used [cargo-llvm-lines](https://github.com/dtolnay/cargo-llvm-lines/) on the rust compiler itself, to improve it's compile time. This PR contains only one low-hanging fruit, but I also want to share some measurements.

The function `ensure_sufficient_stack()` was monomorphized 1500 times, and with it the `stacker` and `psm` crates, for a total of 1.5% of all llvm IR lines. With some trickery I convert the generic closure into a dynamic one, and thus all that code is only monomorphized once.

# Measurements
Getting these numbers took some fiddling with CLI flags and I [modified](https://github.com/Julian-Wollersberger/cargo-llvm-lines/blob/master/src/main.rs#L115) cargo-llvm-lines to read from a folder instead of invoking cargo. Commands I used:
```
./x.py clean
RUSTFLAGS="--emit=llvm-ir -C link-args=-fuse-ld=lld -Z self-profile=profile" CARGOFLAGS_BOOTSTRAP="-Ztimings" RUSTC_BOOTSTRAP=1 ./x.py build -i --stage 1 library/std

# Then manually copy all .ll files into a folder I hardcoded in cargo-llvm-lines in main.rs#L115
cd ../cargo-llvm-lines
cargo run llvm-lines
```

The result is this list (see [first 500 lines](https://github.com/Julian-Wollersberger/cargo-llvm-lines/blob/master/llvm-lines-rustc-before.txt) ), before the change:
```
  Lines            Copies        Function name
  -----            ------        -------------
  16894211 (100%)  58417 (100%)  (TOTAL)
   2223855 (13.2%)   502 (0.9%)  rustc_query_system::query::plumbing::get_query_impl::{{closure}}
   1331918 (7.9%)   1287 (2.2%)  hashbrown::raw::RawTable<T>::reserve_rehash
    774434 (4.6%)  12043 (20.6%) core::ptr::drop_in_place
    294170 (1.7%)    499 (0.9%)  rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
    245410 (1.5%)   1552 (2.7%)  psm::on_stack::with_on_stack
    210311 (1.2%)      1 (0.0%)  rustc_target::spec::load_specific
    200962 (1.2%)    513 (0.9%)  rustc_query_system::query::plumbing::get_query_impl
    190704 (1.1%)      1 (0.0%)  rustc_middle::ty::query::<impl rustc_middle::ty::context::TyCtxt>::alloc_self_profile_query_strings
    180272 (1.1%)    468 (0.8%)  rustc_query_system::query::plumbing::load_from_disk_and_cache_in_memory
    177396 (1.1%)    114 (0.2%)  rustc_query_system::query::plumbing::force_query_impl
    161134 (1.0%)    445 (0.8%)  rustc_query_system::dep_graph::graph::DepGraph<K>::with_anon_task
    141551 (0.8%)    186 (0.3%)  rustc_query_system::query::plumbing::incremental_verify_ich
    110191 (0.7%)      7 (0.0%)  rustc_middle::ty::context::_DERIVE_rustc_serialize_Decodable_D_FOR_TypeckResults::<impl rustc_serialize::serialize::Decodable<__D> for rustc_middle::ty::context::TypeckResults>::decode::{{closure}}
    108590 (0.6%)    420 (0.7%)  core::ops::function::FnOnce::call_once
     88488 (0.5%)     21 (0.0%)  rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green
     86368 (0.5%)      1 (0.0%)  rustc_middle::ty::query::stats::query_stats
     85654 (0.5%)   3973 (6.8%)  <&T as core::fmt::Debug>::fmt
     84475 (0.5%)      1 (0.0%)  rustc_middle::ty::query::Queries::try_collect_active_jobs
     81220 (0.5%)    862 (1.5%)  <hashbrown::raw::RawIterHash<T> as core::iter::traits::iterator::Iterator>::next
     77636 (0.5%)     54 (0.1%)  core::slice::sort::recurse
     66484 (0.4%)    461 (0.8%)  <hashbrown::raw::RawIter<T> as core::iter::traits::iterator::Iterator>::next
```

All `.ll` files together had 4.4GB. After my change they had 4.2GB. So a few percent less code LLVM has to process. Hurray!
Sadly, I couldn't measure an actual wall-time improvement. Watching YouTube while compiling added to much noise...

Here is the top of the list after the change:
```
  16460866 (100%)  58341 (100%)  (TOTAL)
   1903085 (11.6%)   504 (0.9%)  rustc_query_system::query::plumbing::get_query_impl::{{closure}}
   1331918 (8.1%)   1287 (2.2%)  hashbrown::raw::RawTable<T>::reserve_rehash
    777796 (4.7%)  12031 (20.6%) core::ptr::drop_in_place
    551462 (3.4%)   1519 (2.6%)  rustc_data_structures::stack::ensure_sufficient_stack::{{closure}}
```
Note that the total was reduced by 430 000 lines and `psm::on_stack::with_on_stack` has disappeared. Instead `rustc_data_structures::stack::ensure_sufficient_stack::{{closure}}` appeared. I'm confused about that one, but it seems to consist of inlined calls to `rustc_query_system::*` stuff.

Further note the other two big culprits in this list: `rustc_query_system` and `hashbrown`. These two are monomorphized many times, the query system summing to more than 20% of all lines, not even counting code that's probably inlined elsewhere.
Assuming compile times scale linearly with llvm-lines, that means a possible 20% compile time reduction.

Reducing eg. `get_query_impl` would probably need a major refactoring of the qery system though. _Everything_ in there is generic over multiple types, has associated types and passes generic Self arguments by value. Which means you can't simply make things `dyn`.

---------------------------------------
This PR is a small step to make rustc compile faster and thus make contributing to rustc less painful. Nonetheless I love Rust and I find the work around rustc fascinating :)
2020-09-21 17:32:57 +00:00
James Whaley
b4b4a2f092
Reduce boilerplate for BytePos and CharPos 2020-09-21 18:27:43 +01:00
Nicholas-Baron
ccd218d04c Added back the '// ignore-file-length' with an explanation 2020-09-21 09:16:55 -07:00
bors
4eff9b0b29 Auto merge of #77013 - RalfJung:rollup-84ut0xq, r=RalfJung
Rollup of 10 pull requests

Successful merges:

 - #76439 (Add error explanation for E0755)
 - #76521 (Fix segfault if pthread_getattr_np fails)
 - #76835 (make replace_prefix only take &str as arguments )
 - #76967 (Revert adding Atomic::from_mut.)
 - #76977 (Add a regression test for copy propagation miscompilation)
 - #76981 (liballoc bench use imported path Bencher)
 - #76983 (BTreeMap: extra testing & fixed comments)
 - #76996 (Fix typo in rustc_lexer docs)
 - #77009 (Dogfood total_cmp in the test crate)
 - #77012 (update Miri for another bugfix)

Failed merges:

 - #76489 (Add explanation for E0756)

r? `@ghost`
2020-09-21 15:06:20 +00:00
Tomasz Miąsko
c7e887c64a DroplessArena: Allocate objects from the end of memory chunk
Allocating from the end of memory chunk simplifies the alignment code
and reduces the number of checked arithmetic operations.
2020-09-21 15:36:45 +02:00
Ralf Jung
48fc20cc47
Rollup merge of #76996 - LingMan:patch-1, r=ecstatic-morse
Fix typo in rustc_lexer docs

Also add an Oxford comma while we're editing that line.
2020-09-21 15:30:47 +02:00
Ralf Jung
982c4a9c25
Rollup merge of #76835 - matthiaskrgr:replace_prefix, r=lcnr
make replace_prefix only take &str as arguments

included the clippy::manual strip commit to not run into merge conflicts later.

r? @lcnr
2020-09-21 15:30:39 +02:00
Ralf Jung
670e204ace
Rollup merge of #76439 - GuillaumeGomez:add-error-explanation-e0755, r=pickfire,jyn514
Add error explanation for E0755

r? @pickfire
2020-09-21 15:30:34 +02:00
bors
e0bf356f9e Auto merge of #74040 - lcnr:const-occurs-check, r=nikomatsakis
fix unification of const variables

r? `@nikomatsakis` `@varkor` `@eddyb` let's just ping everyone here 😅
2020-09-21 12:52:09 +00:00
Ishi Tatsuyuki
f95e4f3ca9 Improve code and documentation clarity 2020-09-21 20:29:12 +09:00
Bastian Kauschke
073127a04f check for cycles when unifying const variables 2020-09-21 12:27:55 +02:00
bors
956e06c6c8 Auto merge of #77004 - RalfJung:rollup-usac4nv, r=RalfJung
Rollup of 13 pull requests

Successful merges:

 - #76135 (Stabilize some Option methods as const)
 - #76628 (Add sample defaults for config.toml )
 - #76846 (Avoiding unnecesary allocations at rustc_errors)
 - #76867 (Use intra-doc links in core/src/iter when possible)
 - #76868 (Finish moving to intra doc links for std::sync)
 - #76872 (Remove DeclareMethods)
 - #76936 (Add non-`unsafe` `.get_mut()` for `Unsafecell`)
 - #76958 (Replace manual as_nanos and as_secs_f64 reimplementations)
 - #76959 (Replace write_fmt with write!)
 - #76961 (Add test for issue #34634)
 - #76962 (Use const_cstr macro in consts.rs)
 - #76963 (Remove unused static_assert macro)
 - #77000 (update Miri)

Failed merges:

r? `@ghost`
2020-09-21 10:26:59 +00:00
Bastian Kauschke
39245400c5 fix InterpCx resolve 2020-09-21 12:09:08 +02:00
Oliver Scherer
c160bf3c3e Cache eval_to_allocation_raw on disk 2020-09-21 11:38:39 +02:00
Ralf Jung
e177757a04
Rollup merge of #76963 - est31:remove_static_assert, r=oli-obk
Remove unused static_assert macro
2020-09-21 10:40:47 +02:00
Ralf Jung
9aba4962f5
Rollup merge of #76962 - est31:const_cstr, r=oli-obk
Use const_cstr macro in consts.rs
2020-09-21 10:40:45 +02:00
Ralf Jung
048866bd6b
Rollup merge of #76958 - est31:ns, r=oli-obk
Replace manual as_nanos and as_secs_f64 reimplementations
2020-09-21 10:40:39 +02:00
Ralf Jung
02d787bef8
Rollup merge of #76872 - khyperia:remove_declare_methods, r=eddyb
Remove DeclareMethods

Most of the `DeclareMethods` API was only used internally by rustc_codegen_llvm. As such, it makes no sense to require other backends to implement them.

(`get_declared_value` and `declare_cfn` were used, in one place, specific to the `main` symbol, which I've replaced with a more specialized function to allow more flexibility in implementation - the intent is that `declare_c_main` can go away once we do something more clever, e.g. @eddyb has ideas around having a MIR shim or somesuch we can explore in a follow-up PR)
2020-09-21 10:40:35 +02:00
Ralf Jung
c2d9af68a0
Rollup merge of #76846 - botika:master, r=davidtwco
Avoiding unnecesary allocations at rustc_errors

Simplify the code avoiding allocations with easy alternative
2020-09-21 10:40:30 +02:00
bors
0433fdf93b Auto merge of #76843 - kornelski:longtypetofile, r=ecstatic-morse
Let user see the full type of type-length limit error

Seeing the full type of the error is sometimes essential to diagnosing the problem, but the type itself is too long to be displayed in the terminal in a useful fashion. This change solves this dilemma by writing the full offending type name to a file, and displays this filename as a note.

> note: the full type name been written to '$TEST_BUILD_DIR/issues/issue-22638/issue-22638.long-type.txt'

Closes #76777
2020-09-21 08:20:38 +00:00
Bram van den Heuvel
ab83d372ed Add an unused field of type Option<DefId> to ParamEnv struct. 2020-09-21 09:39:26 +02:00
LingMan
fc20b7841c
Fix typo in rustc_lexer docs
Also add an Oxford comma while we're editing that line.
2020-09-21 05:43:39 +02:00
yuk1ty
16047d46a1 fix typo in docs and comments 2020-09-21 12:14:28 +09:00
Nicholas-Baron
99e2e7075c Moved all functions prefixed with 'check' to a separate file 2020-09-20 19:00:31 -07:00
Nicholas-Baron
f896ddfc73 Moved the Expectation enum to its own file 2020-09-20 18:58:32 -07:00
Nicholas-Baron
428a8c6eae Moved the Diverges struct to its own file 2020-09-20 18:58:32 -07:00
Nicholas-Baron
b1e9379679 Formatted use statements for fewer lines 2020-09-20 18:58:32 -07:00
Nicholas-Baron
7995d5cda4 Moved Inherited struct to own file 2020-09-20 18:58:30 -07:00
Nicholas-Baron
45fdf97d11 Removed util.rs
Per suggestion of @oli-obk.
This file was rather short and joining it did not cause mod.rs to become
significantly bigger.
2020-09-20 18:56:09 -07:00
Nicholas-Baron
c8162c22eb Moved the FnCtxt struct to its own file 2020-09-20 18:56:01 -07:00
Nicholas-Baron
c190f66060 Moved GatherLocalsVisitor to its own file 2020-09-20 18:48:31 -07:00
Nicholas-Baron
3e770645aa Moved a struct only need by util into util 2020-09-20 18:48:31 -07:00
Nicholas-Baron
6fd80e35e0 Moved another struct and used pub(super) to be explicit 2020-09-20 18:48:31 -07:00
Nicholas-Baron
bfe5bc9cb9 Formatter moved one use statement 2020-09-20 18:48:31 -07:00
Nicholas-Baron
63dbfb3c30 Start of moving some functionality to separate files 2020-09-20 18:48:31 -07:00
bors
0f9f0b384a Auto merge of #76295 - mati865:remove-mmx, r=Amanieu,oli-obk
Remove MMX from Rust

Follow-up to https://github.com/rust-lang/stdarch/pull/890
This removes most of MMX from Rust (tests pass with small changes), keeping stable `is_x86_feature_detected!("mmx")` working.
2020-09-21 00:43:26 +00:00
Kornel Lesiński
34d3c7df80 Let user see the full type of type-length limit error 2020-09-21 00:39:58 +01:00
bors
2e0edc0f28 Auto merge of #75119 - simonvandel:early-otherwise, r=oli-obk
New MIR optimization pass to reduce branches on match of tuples of enums

Fixes #68867 by adding a new pass that turns something like
```rust
let x: Option<()>;
let y: Option<()>;
match (x,y) {
    (Some(_), Some(_)) => {0},
    _ => {1}
}
```
into something like
```rust
let x: Option<()>;
let y: Option<()>;
let discriminant_x = // get discriminant of x
let discriminant_y = // get discriminant of x
if discriminant_x != discriminant_y {1} else {0}
```

The opt-diffs still have the old basic blocks like
```
bb3: {
          _8 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early-otherwise-branch-68867.rs:21:21: 21:30
          switchInt(move _8) -> [1_isize: bb7, otherwise: bb2]; // scope 0 at $DIR/early-otherwise-branch-68867.rs:21:21: 21:30
      }

      bb4: {
          _9 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early-otherwise-branch-68867.rs:22:23: 22:34
          switchInt(move _9) -> [2_isize: bb8, otherwise: bb2]; // scope 0 at $DIR/early-otherwise-branch-68867.rs:22:23: 22:34
      }

      bb5: {
          _10 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early-otherwise-branch-68867.rs:23:23: 23:34
          switchInt(move _10) -> [3_isize: bb9, otherwise: bb2]; // scope 0 at $DIR/early-otherwise-branch-68867.rs:23:23: 23:34
      }
```

These do get removed on later passes. I'm not sure if I should include those passes in the test to make it clear?
2020-09-20 17:54:44 +00:00
Julian Wollersberger
53aaa1e532 To avoid monomorphizing psm::on_stack::with_on_stack 1500 times, I made a change in stacker to wrap the callback in dyn. 2020-09-20 19:07:52 +02:00
Lzu Tao
4387480dea Add unstably const support for assume intrinsic 2020-09-20 14:00:40 +00:00
Ralf Jung
fc58224b79
Rollup merge of #76940 - Aaron1011:fix/trait-on-tait, r=oli-obk
Don't allow implementing trait directly on type-alias-impl-trait

This is specifically disallowed by the RFC, but we never added a check
for it.

Fixes #76202
2020-09-20 15:52:09 +02:00
Ralf Jung
7ff17c13bc
Rollup merge of #76910 - lcnr:foreign-item-like, r=oli-obk
transmute: use diagnostic item

closes #66075, we now have no remaining uses of `match_def_path`  in the compiler while some uses still remain in `clippy`.

cc @RalfJung
2020-09-20 15:52:04 +02:00
Ralf Jung
9567b5a9f5
Rollup merge of #76891 - lcnr:less-ref, r=ecstatic-morse
don't take `TyCtxt` by reference

small cleanup
2020-09-20 15:52:03 +02:00
Ralf Jung
8405d50e12
Rollup merge of #76890 - matthiaskrgr:matches_simpl, r=lcnr
use matches!() macro for simple if let conditions
2020-09-20 15:52:01 +02:00
Ralf Jung
c847eaa91d
Rollup merge of #76832 - khyperia:backend_target_override, r=eddyb
Let backends define custom targets

Add a target_override hook that takes priority over builtin targets.
2020-09-20 15:51:48 +02:00
Ralf Jung
39b9a25e60
Rollup merge of #76732 - camelid:mir-basic-block-docs, r=RalfJung
Add docs for `BasicBlock`

Fixes #76715.

---

@rustbot modify labels: A-mir T-doc C-enhancement
2020-09-20 15:51:46 +02:00
Lzu Tao
3e08354fb0 Correct file path after some restructures in compiler 2020-09-20 13:48:16 +00:00
Mateusz Mikuła
5de2c95e6e Remove MMX from Rust 2020-09-20 15:13:11 +02:00
Simon Vandel Sillesen
e25738f529 enable on mir-opt-level=1 to test perf 2020-09-20 14:45:47 +02:00
Simon Vandel Sillesen
27068cbfdc add cleanup of cfg 2020-09-20 14:45:47 +02:00
Simon Vandel Sillesen
118aae2af1 insert storageDead for not equal temp 2020-09-20 14:45:47 +02:00
Simon Vandel Sillesen
2530274023 correct comment 2020-09-20 14:45:46 +02:00
Simon Vandel Sillesen
5cc93950ac Update src/librustc_mir/transform/early_otherwise_branch.rs
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-09-20 14:45:46 +02:00
Simon Vandel Sillesen
5fb32c2e33 New MIR optimization pass to reduce branches on match of tuples of enums 2020-09-20 14:45:46 +02:00
bors
41507ed0d5 Auto merge of #76964 - RalfJung:rollup-ybn06fs, r=RalfJung
Rollup of 15 pull requests

Successful merges:

 - #76722 (Test and fix Send and Sync traits of BTreeMap artefacts)
 - #76766 (Extract some intrinsics out of rustc_codegen_llvm)
 - #76800 (Don't generate bootstrap usage unless it's needed)
 - #76809 (simplfy condition in ItemLowerer::with_trait_impl_ref())
 - #76815 (Fix wording in mir doc)
 - #76818 (Don't compile regex at every function call.)
 - #76821 (Remove redundant nightly features)
 - #76823 (black_box: silence unused_mut warning when building with cfg(miri))
 - #76825 (use `array_windows` instead of `windows` in the compiler)
 - #76827 (fix array_windows docs)
 - #76828 (use strip_prefix over starts_with and manual slicing based on pattern length (clippy::manual_strip))
 - #76840 (Move to intra doc links in core/src/future)
 - #76845 (Use intra docs links in core::{ascii, option, str, pattern, hash::map})
 - #76853 (Use intra-doc links in library/core/src/task/wake.rs)
 - #76871 (support panic=abort in Miri)

Failed merges:

r? `@ghost`
2020-09-20 11:02:36 +00:00
Ralf Jung
bfa1904765
Rollup merge of #76828 - matthiaskrgr:clippy_manual_strip, r=lcnr
use strip_prefix over starts_with and manual slicing based on pattern length (clippy::manual_strip)
2020-09-20 12:08:29 +02:00
Ralf Jung
50d56bc774
Rollup merge of #76825 - lcnr:array-windows-apply, r=varkor
use `array_windows` instead of `windows` in the compiler

I do think these changes are beautiful, but do have to admit that using type inference for the window length
can easily be confusing. This seems like a general issue with const generics, where inferring constants adds an additional
complexity which users have to learn and keep in mind.
2020-09-20 12:08:26 +02:00
Ralf Jung
4322e1b92d
Rollup merge of #76821 - est31:remove_redundant_nightly_features, r=oli-obk,Mark-Simulacrum
Remove redundant nightly features

Removes a bunch of redundant/outdated nightly features. The first commit removes a `core_intrinsics` use for which a stable wrapper has been provided since. The second commit replaces the `const_generics` feature with `min_const_generics` which might get stabilized this year. The third commit is the result of a trial/error run of removing every single feature and then adding it back if compile failed. A bunch of unused features are the result that the third commit removes.
2020-09-20 12:08:22 +02:00
Ralf Jung
3268e33199
Rollup merge of #76818 - hbina:dont_compile_regex_all_the_time, r=ecstatic-morse
Don't compile regex at every function call.

Use `SyncOnceCell` to only compile it once.
I believe this still adds some kind of locking mechanism?

Related issue: https://github.com/rust-lang/rust/issues/76817
2020-09-20 12:08:20 +02:00
Ralf Jung
c12feb35db
Rollup merge of #76815 - pickfire:patch-6, r=jonas-schievink
Fix wording in mir doc
2020-09-20 12:08:19 +02:00