120724 Commits

Author SHA1 Message Date
bors
5f472813df Auto merge of #72248 - petrochenkov:codemodel, r=Amanieu
Cleanup and document `-C code-model`

r? @Amanieu
2020-05-17 21:22:48 +00:00
Nicholas Nethercote
c2abf8f9c3 Tweak partition, unzip, try_find.
Many default iterator methods use `try_fold` or `fold`, and these ones
can too.
2020-05-18 05:41:59 +10:00
Nicholas Nethercote
4b7c3d88c6 Make fold standalone.
`fold` is currently implemented via `try_fold`, but implementing it
directly results in slightly less LLVM IR being generated, speeding up
compilation of some benchmarks.

(And likewise for `rfold`.)

The commit adds `fold` implementations to all the iterators that lack
one but do have a `try_fold` implementation. Most of these just call the
`try_fold` implementation directly.
2020-05-18 05:41:59 +10:00
Nadrieril
c6f0947ddb Improve comments 2020-05-17 18:28:27 +01:00
Dylan MacKenzie
856cd6609f Test that NRVO elides the call to memcpy 2020-05-17 10:24:06 -07:00
Dylan MacKenzie
1deaaa610c Don't unleash NRVO const-eval test 2020-05-17 10:23:44 -07:00
Nadrieril
aff073ec91 Cache len in Fields 2020-05-17 18:17:11 +01:00
Nadrieril
4f7a3784a5 typo 2020-05-17 17:38:24 +01:00
Nadrieril
079400c74b Fix bug just discovered
Suggested by matthewjasper here:
https://github.com/rust-lang/rust/pull/71930#issuecomment-626022502
I have no idea what this does but it seems to work.
2020-05-17 17:38:24 +01:00
Nadrieril
e5a2cd526a We don't use tyerr anymore
This however unearthed a bug, hence the FIXME and the workaround.
2020-05-17 17:38:23 +01:00
Nadrieril
8f08b16c03 Small allocation improvement 2020-05-17 17:38:23 +01:00
Nadrieril
59fa40a5a0 Filter out fields that should not be seen
This was previously done by giving those fields the type tyerr. This was
a hack.
2020-05-17 17:38:23 +01:00
Nadrieril
70b3872a12 Make all field-handling go through Fields 2020-05-17 17:38:23 +01:00
Nadrieril
c3d3727046 Clarify specialize_one_pattern
Using a more error-oriented approache to `Option`.
2020-05-17 17:38:23 +01:00
Nadrieril
3551f1a0f6 Use Fields as output to specialize_one_pattern 2020-05-17 17:38:20 +01:00
Nadrieril
76dea86df4 Factor out a struct that holds subfields of a pattern 2020-05-17 17:38:20 +01:00
Nadrieril
160eebec21 Only need TyErr for uninhabited types 2020-05-17 17:38:19 +01:00
Nadrieril
a5294b6486 We already handle arrays of unknown length correctly 2020-05-17 17:38:19 +01:00
Nadrieril
4a1772ea92 Factor the code that generates TyErrs 2020-05-17 17:38:19 +01:00
Nadrieril
e65d49d338 Fix incorrect ordering
I introduced this mistake in 175976e2a2b03c3f347d4eff28661445c3c58372
and I can't quite remember what the reasoning was back then. I think I
modeled it on `apply_constructor`, not realizing there was an important
difference in the order in which fields were stored.
2020-05-17 17:38:19 +01:00
bors
d79f1bd31a Auto merge of #72295 - RalfJung:rollup-icmhbs7, r=RalfJung
Rollup of 3 pull requests

Successful merges:

 - #72259 (Disallow forbidden usage of non-ascii identifiers.)
 - #72261 (Break out early on empty span when generate_fn_span)
 - #72291 (bootstrap: fix typo)

Failed merges:

r? @ghost
2020-05-17 16:20:19 +00:00
flip1995
4dc83a74fd
Merge commit 'e214ea82ad0a751563acf67e1cd9279cf302db3a' into clippyup 2020-05-17 17:36:26 +02:00
Steve Klabnik
aea0186fe5 make many ptr functions must_use
https://djugei.github.io/bad-at-unsafe/ describes an error a user had when trying to use offset:

> At first I just assumed that the .add() and .offset() methods on pointers would mutate the pointer. They do not. Instead they return a new pointer, which gets dropped silently if you don't use it. Unlike for example Result, which is must_use annotated.
2020-05-17 10:35:57 -05:00
Ralf Jung
2b3d99d31a
Rollup merge of #72291 - RalfJung:format-typo, r=jonas-schievink
bootstrap: fix typo
2020-05-17 16:24:29 +02:00
Ralf Jung
65833dcd3d
Rollup merge of #72261 - csmoe:issue-72095, r=estebank
Break out early on empty span when generate_fn_span

Closes #72095
r? @oli-obk
cc @estebank @tmandry
2020-05-17 16:24:27 +02:00
Ralf Jung
49b81cae86
Rollup merge of #72259 - crlf0710:ascii_only_check, r=petrochenkov
Disallow forbidden usage of non-ascii identifiers.

Part of RFC2457, this tightens allowed identifiers back to ascii only in two situations.

r? @petrochenkov
2020-05-17 16:24:26 +02:00
bors
34cce58d81 Auto merge of #72204 - RalfJung:abort, r=Mark-Simulacrum
make abort intrinsic safe, and correct its documentation

Turns out `std::process::abort` is not the same as the intrinsic, the comment was just wrong. Quoting from the unix implementation:
```
// On Unix-like platforms, libc::abort will unregister signal handlers
// including the SIGABRT handler, preventing the abort from being blocked, and
// fclose streams, with the side effect of flushing them so libc buffered
// output will be printed.  Additionally the shell will generally print a more
// understandable error message like "Abort trap" rather than "Illegal
// instruction" that intrinsics::abort would cause, as intrinsics::abort is
// implemented as an illegal instruction.
```
2020-05-17 12:49:01 +00:00
bors
e214ea82ad Auto merge of #5568 - ThibsG:RenameIdentityConversionLint, r=flip1995
Rename lint `identity_conversion` to `useless_conversion`

Lint name `identity_conversion` was misleading, so this PR renames it to `useless_conversion`.

As decision has not really came up in the issue comments, this PR will probably need discussion.

fixes #3106

changelog: Rename lint `identity_conversion` to `useless_conversion`
2020-05-17 11:29:04 +00:00
bors
6ae0643d1a Auto merge of #5529 - alex-700:improve-option-and-then-some-lint, r=phansch
Improve `option_and_then_some` lint

fixed #5492

changelog: Improve and generalize `option_and_then_some` and rename it to `bind_instead_of_map`.
2020-05-17 10:58:56 +00:00
Bastian Kauschke
9da8a5ba68 update tests 2020-05-17 11:42:41 +02:00
Ralf Jung
4caddaeeea bootstrap: fix typo 2020-05-17 11:41:20 +02:00
Ralf Jung
5980d972d1 make abort intrinsic safe, and correct its documentation 2020-05-17 11:23:42 +02:00
bors
7faeae0d38 Auto merge of #72135 - oli-obk:const_prop_deaggregates, r=wesleywiser
Propagate locals, even if they have unpropagatable assignments somewhere

Second try for https://github.com/rust-lang/rust/pull/71946#discussion_r422967292

r? @wesleywiser

cc @rust-lang/wg-mir-opt @RalfJung
2020-05-17 09:18:12 +00:00
Aleksei Latyshev
07f1edf2d4
improve and generalize option_and_then_some lint
- rename it to bind_instead_of_map
2020-05-17 12:17:03 +03:00
Elichai Turkel
15911963ec
Update linker-plugin-lto.md to contain up to rust 1.43 2020-05-17 12:16:43 +03:00
Bastian Kauschke
6a72ba4c33 Logically seperate lazy norm from const_generics 2020-05-17 11:06:35 +02:00
Bastian Kauschke
752d8a24d8 the best way to fix bugs is by ignoring them 2020-05-17 11:06:35 +02:00
Bastian Kauschke
c71439791c chalk 2020-05-17 11:06:35 +02:00
Bastian Kauschke
3d7637e66d correctly handle escaping bound variables 2020-05-17 11:06:35 +02:00
Bastian Kauschke
0f7bf5d9e1 add docs 2020-05-17 11:06:35 +02:00
Bastian Kauschke
443ae83874 merge lazy_normalization_consts into const_generics 2020-05-17 11:06:35 +02:00
Bastian Kauschke
479968b812 explicitly handle errors in select 2020-05-17 11:05:05 +02:00
Bastian Kauschke
e873eef1e3 explicitly handle errors in fulfill 2020-05-17 11:05:05 +02:00
Bastian Kauschke
afd7ea88fb update tests and add relevant feature gate test 2020-05-17 11:05:05 +02:00
Bastian Kauschke
e1a8d322d0 keep the good old lazy_normalization hack alive 2020-05-17 11:05:04 +02:00
Bastian Kauschke
c3a0cba1c1 initial cleanup 2020-05-17 11:05:04 +02:00
Ben Lewis
93d15b9480 Put lazy normalization behind a feature gate 2020-05-17 11:05:04 +02:00
Ben Lewis
3ef831069a Add lazy normalization tests 2020-05-17 11:01:23 +02:00
Ben Lewis
4cfdd2178e Emit ConstEquate obligation after checking/unifying for inference variables. This means
a inference variable can be unified with an unevaluated const.
2020-05-17 11:01:02 +02:00
Ben Lewis
8b14b84933 Assume unevaluated consts are equal to the other consts and add ConstEquate obligation. This delays
the need to evaluate consts eagerly and therefore gets around const eval query cycles.
2020-05-17 11:01:02 +02:00