Commit Graph

124840 Commits

Author SHA1 Message Date
Matthias Krüger
15dcda36e6 fix clippy::map_clone: use .cloned() instead of .map(|x| x.clone()) 2020-08-08 00:57:21 +02:00
Matthias Krüger
4ba1a19463 fix clippy::into_iter_on_ref: use .iter() instead of into_iter() on references. 2020-08-08 00:57:15 +02:00
Matthias Krüger
ea9ccfa42c fix clippy::while_let_loop: use while let{} instead of loop { if ... break; } 2020-08-08 00:57:09 +02:00
Matthias Krüger
f95cfe573a fix clippy::redundant_closure: remove redundant closures and call functions directly 2020-08-08 00:57:03 +02:00
Gary Guo
505d157814 Display elided lifetime for external paths 2020-08-07 23:41:07 +01:00
Gary Guo
63c0d9ca51 Display elided lifetime for non-reference type in doc 2020-08-07 23:35:07 +01:00
bors
c2d1b0d980 Auto merge of #75071 - ssomers:btree_cleanup_5, r=Mark-Simulacrum
BTreeMap: enforce the panic rule imposed by `replace`

Also, reveal the unsafe parts in the closures fed to it.

r? @Mark-Simulacrum
2020-08-07 21:48:32 +00:00
Josh Stone
a2cfc74c5f Simplify array::IntoIter
- Initialization can use `transmute_copy` to do the bitwise copy.
- `as_slice` can use `get_unchecked` and `MaybeUninit::slice_get_ref`,
  and `as_mut_slice` can do similar.
- `next` and `next_back` can use the corresponding `Range` methods.
- `Clone` doesn't need any unsafety, and we can dynamically update the
  new range to get partial drops if `T::clone` panics.
2020-08-07 13:51:46 -07:00
Matthias Krüger
057730c4b1 fix clippy::len_zero: use is_empty() instead of comparing .len() to zero 2020-08-07 22:47:32 +02:00
Matthias Krüger
eccc2fe503 fix clippy::unneeded_wildcard_pattern: remove redundant wildcard pattern 2020-08-07 22:47:32 +02:00
Matthias Krüger
f6b1857353 fix clippy::unnecessary_mut_passed: function arg is not required to be mutable 2020-08-07 22:47:32 +02:00
Matthias Krüger
a1c22122da fix clippy::unit_arg: make it explicit that Ok(()) is being returned 2020-08-07 22:47:32 +02:00
Matthias Krüger
f3ec5be849 fix clippy::single_char_pattern: use char instead of string single-char pattern 2020-08-07 22:47:32 +02:00
Matthias Krüger
09e29e7e43 fix clippy::redundant_pattern_matching: use .is_some() instead of if let Some(_) = .. 2020-08-07 22:47:32 +02:00
Matthias Krüger
27bb68927d fix clippy::redundant_clone: remove redundant clones 2020-08-07 22:47:32 +02:00
Matthias Krüger
fb975cd6fb fix clippy::map_identity: remove redundant .map(|x| x) call 2020-08-07 22:47:32 +02:00
Matthias Krüger
fca81fa3cd fix clippy::iter_next_slice: use .get(0) instead of .iter().next() 2020-08-07 22:47:32 +02:00
Matthias Krüger
8bc1f91822 fix clippy::filter_next: use .find(..) instead of .filter(..).next() 2020-08-07 22:47:32 +02:00
Matthias Krüger
3ef8c72577 fix clippy::expect_fun_call: use unwrap_or_else to prevent panic message from always being evaluated 2020-08-07 22:47:31 +02:00
Esteban Küber
7e9a8483f4 Small cleanup
* Add docstring to `Parser` field
* Remove unnecessary `unwrap`
* Remove unnecessary borrow
* Fix indentation of some `teach`text output
2020-08-07 11:52:02 -07:00
Alan Egerton
5792840bf5 Prevent __rust_begin_short_backtrace frames from being tail-call optimised away 2020-08-07 19:31:25 +01:00
bors
09f4c9f508 Auto merge of #75255 - davidtwco:polymorphisation-symbol-mangling-v0-upvar-closures, r=lcnr
instance: polymorphize upvar closures/generators

This PR modifies how instances are polymorphized so that closures and generators have any closures or generators captured within their upvars also polymorphized.

With the new symbol mangling, a fully polymorphised closure will produce the same symbol regardless of what it was instantiated with. However, when that polymorphised closure captures another closure as an upvar, then the type of that other closure in the upvar substitution wouldn't have been polymorphised. The other closure will still refer to the initial substitutions. Therefore, the polymorphised closure will end up hashing differently but producing the same symbol - triggering `assert_symbols_are_distinct` in MIR partitioning. The old mangling scheme had a hash at the end that meant this didn't happen (this would still have been an issue, we just didn't have a way to notice).

See [this Zulip discussion for further elaboration](https://rust-lang.zulipchat.com/#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/symbol.20mangling.20v0.20.E2.9C.95.20polymorphisation/near/206152008).

r? @eddyb
cc @lcnr
2020-08-07 17:57:30 +00:00
Stein Somers
734fc0477c BTreeMap: enforce the panic rule imposed by replace 2020-08-07 19:51:26 +02:00
David Wood
ac50d61785
instance: polymorphize FnDef substs
This commit extends previous polymorphization of substs to polymorphize
`FnDef`.

Signed-off-by: David Wood <david@davidtw.co>
2020-08-07 18:41:45 +01:00
David Wood
4ccaf6f38c
instance: avoid unnecessary mk_ calls
This commit avoids unnecessary calls to `mk_closure` and `mk_generator`
by checking if the polymorphized substs match the original substs.

Signed-off-by: David Wood <david@davidtw.co>
2020-08-07 18:41:43 +01:00
David Wood
5827b5a4bd
ty: add MAY_POLYMORPHIZE flag
This commit adds a `MAY_POLYMORPHIZE` which checks for closures and
generators so that polymorphization of substs does not need to traverse
every substs.

Signed-off-by: David Wood <david@davidtw.co>
2020-08-07 18:41:42 +01:00
David Wood
0d9924a87b
instance: always polymorphize substs
By always polymorphizing substitutions, functions which take closures as
arguments (e.g. `impl Fn()`) can have fewer mono items when some of the
argument closures can be polymorphized.

Signed-off-by: David Wood <david@davidtw.co>
2020-08-07 18:41:41 +01:00
David Wood
d9decede35
instance: polymorphize upvar closures/generators
This commit modifies how instances are polymorphized so that closures
and generators have any closures or generators captured within their
upvars also polymorphized - this avoids symbol clashes with the new
symbol mangling scheme.

Signed-off-by: David Wood <david@davidtw.co>
2020-08-07 18:41:39 +01:00
Ivan Tham
06cf40f8a1
Show multi extension example for Path in doctests 2020-08-08 00:48:12 +08:00
David Wood
d97f89b1a6
polymorphize: non-promoted unevaluated constants
This commit makes polymorphization visit non-promoted unevaluated
constants rather than visit their substs directly.

Signed-off-by: David Wood <david@davidtw.co>
2020-08-07 17:07:25 +01:00
bors
4d4342347b Auto merge of #74821 - oli-obk:const_eval_read_uninit_fast_path, r=wesleywiser
Check whether locals are too large instead of whether accesses into them are too large

Essentially this stops const prop from attempting to optimize

```rust
let mut x = [0_u8; 5000];
x[42] = 3;
```

I don't expect this to be a perf improvement without #73656 (which is also where the lack of this PR will be a perf regression).

r? @wesleywiser
2020-08-07 15:28:07 +00:00
David Wood
659d44a3b4
polymorphize: visit promoted MIR
This commit makes polymorphization visited the MIR of unevaluated
constants with available promoted MIR instead of visiting the
substitutions of that constant - which will mark all of the generic
parameters as used.

Signed-off-by: David Wood <david@davidtw.co>
2020-08-07 15:59:29 +01:00
Takayuki Nakata
7d4565bf02 Add missing backtick 2020-08-07 23:25:47 +09:00
Aaron Hill
c34c77c764
Apply extern "C" calling convention
Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
2020-08-07 09:51:50 -04:00
Aaron Hill
91dda2c24e
Only test function-arguments-naked.rs on x86_64
We need to use inline assembly, which is inherently platform-specific.
2020-08-07 09:46:47 -04:00
bors
64f99b4cfb Auto merge of #74627 - petrochenkov:docbeauty2, r=Aaron1011
rustc_ast: Stop using "string typing" for doc comment tokens

Explicitly store their kind and style retrieved during lexing in the `token::DocComment`.

Also don't "beautify" doc comments before converting them to `#[doc]` attributes when passing them to macros (both declarative and procedural).
The trimming of empty lines, lines containing only `*`s, etc is purely a rustdoc's job as a part of its presentation of doc strings to users, rustc must not do this and must pass tokens as precisely as possible internally.
2020-08-07 13:29:25 +00:00
Stein Somers
85a7879341 BTreeMap: better way to postpone root access in DrainFilter 2020-08-07 15:02:56 +02:00
Nazım Can Altınova
16a5217141
Change the comment of BTreeMap::into_values 2020-08-07 14:10:12 +02:00
Nazım Can Altınova
25545ed180
Only print the fields that are relevant to iterators for Debug of IntoKeys and IntoValues 2020-08-07 13:47:04 +02:00
Ralf Jung
a530934951 clean up const-hacks in int endianess conversion functions 2020-08-07 13:45:55 +02:00
bors
1e0e618cfb Auto merge of #73842 - euclio:doctest-expn, r=GuillaumeGomez
Use outermost invocation span for doctest names

Fixes #70090.

This PR also allows using aux-build files in rustdoc-ui tests.
2020-08-07 11:38:17 +00:00
Nazım Can Altınova
29d9233cf6
Add unit tests for new BTreeMap::into_{keys,values} methods 2020-08-07 13:13:42 +02:00
Nazım Can Altınova
41dd4ee7ff
Add unit tests for new HashMap::into_{keys,values} methods 2020-08-07 13:13:41 +02:00
Nazım Can Altınova
13529f22ba
Add into_{keys,values} methods for BTreeMap 2020-08-07 13:13:41 +02:00
Nazım Can Altınova
e31116af50
Add into_{keys,values} methods for HashMap 2020-08-07 13:13:37 +02:00
Ralf Jung
ec5d78d350 fix feature gate and tracking issue 2020-08-07 12:38:55 +02:00
Ralf Jung
0aee186723 make MaybeUninit::as_(mut_)ptr const 2020-08-07 12:24:28 +02:00
bors
8b26609481 Auto merge of #70052 - Amanieu:hashbrown7, r=Mark-Simulacrum
Update hashbrown to 0.8.1

This update includes:
- https://github.com/rust-lang/hashbrown/pull/146, which improves the performance of `Clone` and implements `clone_from`.
- https://github.com/rust-lang/hashbrown/pull/159, which reduces the size of `HashMap` by 8 bytes.
- https://github.com/rust-lang/hashbrown/pull/162, which avoids creating small 1-element tables.

Fixes #28481
2020-08-07 08:36:15 +00:00
bors
d4c940f082 Auto merge of #75244 - Manishearth:rollup-dzfyjva, r=Manishearth
Rollup of 4 pull requests

Successful merges:

 - #74774 (adds [*mut|*const] ptr::set_ptr_value)
 - #75079 (Disallow linking to items with a mismatched disambiguator)
 - #75203 (Make `IntoIterator` lifetime bounds of `&BTreeMap` match with `&HashMap` )
 - #75227 (Fix ICE when using asm! on an unsupported architecture)

Failed merges:

r? @ghost
2020-08-07 06:40:53 +00:00
Amanieu d'Antras
e46bb17936 Fix natvis tests 2020-08-07 07:19:13 +01:00