Commit Graph

95825 Commits

Author SHA1 Message Date
Ralf Jung
486720f080 fix determinig the size of foreign static allocations 2019-07-04 10:38:54 +02:00
Ralf Jung
5612feb513 add machine hook to handle calls to 'extra' function values 2019-07-04 10:38:54 +02:00
Ralf Jung
1297a274a3 Add basic support for "other" kinds of values for function pointers, determined by the machine instance.
So far, however, calling such a function will fail.
2019-07-04 10:38:54 +02:00
Ralf Jung
127610b7c4 Go back to just passing MemoryExtra to the machine-level allocation hooks
This is needed to avoid doing unnecessary global alloc_map lookups
2019-07-04 10:31:13 +02:00
Ralf Jung
8ad28cd2cb Machine: make self-like parameters come first 2019-07-04 10:10:08 +02:00
Mazdak Farrokhzad
54527db7b0
ptr::{read,write}_unaligned: use no_run and reword slightly. 2019-07-04 09:54:37 +02:00
Christian Poveda
e45bbaf48c Fix merge conflicts 2019-07-04 01:45:29 -05:00
Aleksey Kladov
3e362a4800 make unwrap_or_abort non-generic again 2019-07-04 09:12:33 +03:00
Aleksey Kladov
3035a05a74 remove unused mk_sp_and_raw 2019-07-04 09:12:33 +03:00
Aleksey Kladov
8bea334a26 don't rely on spans when checking tokens for jointness 2019-07-04 09:12:24 +03:00
Aleksey Kladov
1c6eb19d2f slightly comment lexer API 2019-07-04 09:08:45 +03:00
Aleksey Kladov
30fa99e5b8 move constructors to top 2019-07-04 09:08:45 +03:00
Aleksey Kladov
601bad86b2 cleanup lexer constructors 2019-07-04 09:08:45 +03:00
Aleksey Kladov
256df83f64 remove peek_span_src_raw from StringReader 2019-07-04 09:08:39 +03:00
Aleksey Kladov
e9dc95c86e remove peek_token from StringReader 2019-07-04 09:01:37 +03:00
Aleksey Kladov
830ff4a592 remove StringReader::peek
The reader itself doesn't need ability to peek tokens, so it's better
if clients implement this functionality.

This hopefully becomes especially easy once we use iterator interface
for lexer, but this is not too easy at the moment, because of buffered
errors.
2019-07-04 09:01:37 +03:00
Mazdak Farrokhzad
bee964c502 Clarify unaligned fields in ptr::read_unaligned. 2019-07-04 05:32:38 +02:00
bors
b43eb4235a Auto merge of - Centril:rollup-xnxtcgm, r=Centril
Rollup of 16 pull requests

Successful merges:

 -  (Remove needless lifetimes (rustc))
 -  (rename InterpretCx -> InterpCx)
 -  (wfcheck: resolve the type-vars in `AdtField` types)
 -  (Use mem::take instead of mem::replace with default)
 -  (Update mem::replace example to not be identical to mem::take)
 -  (syntax: Unsupport `foo! bar { ... }` macros in the parser)
 -  (Clean up inherent_impls)
 -  (Use link attributes on extern "C" blocks with llvm-libuwind)
 -  (miri realloc: do not require giving old size+align)
 -  (refactor check_for_substitution)
 -  (When possible without changing semantics, implement Iterator::last in terms of DoubleEndedIterator::next_back for types in liballoc and libcore.)
 -  (Migrate `compile-pass` annotations to `build-pass`)
 -  (Fix bucket in CPU usage script)
 -  (simplify Option::get_or_insert)
 -  (enable a few more tests in Miri and update the comment for others)
 -  (remove bogus example from drop_in_place)

Failed merges:

r? @ghost
2019-07-03 23:39:36 +00:00
Mazdak Farrokhzad
6363a58e9a
Rollup merge of - RalfJung:drop-in-place, r=cramertj
remove bogus example from drop_in_place

Fixes https://github.com/rust-lang/rust/issues/62313
2019-07-04 01:39:04 +02:00
Mazdak Farrokhzad
144ed029c5
Rollup merge of - RalfJung:miri-tests, r=Centril
enable a few more tests in Miri and update the comment for others
2019-07-04 01:39:02 +02:00
Mazdak Farrokhzad
839e89c3d1
Rollup merge of - matklad:simplify-option, r=sfackler
simplify Option::get_or_insert

I am pretty sure that the optimized result will be the same, and it's one `unsafe` less in the stdlib!
2019-07-04 01:39:01 +02:00
Mazdak Farrokhzad
cd1fa00446
Rollup merge of - Mark-Simulacrum:fix-cpu-usage-script, r=alexcrichton
Fix bucket in CPU usage script

r? @alexcrichton
2019-07-04 01:38:59 +02:00
Mazdak Farrokhzad
919349701a
Rollup merge of - JohnTitor:move-tests-to-build-pass, r=Centril
Migrate `compile-pass` annotations to `build-pass`

This is a part of .

As a first step, the `compile-pass` tests are migrated to `build-pass`.

r? @cramertj
cc @Centril
2019-07-04 01:38:58 +02:00
Mazdak Farrokhzad
4049a3cf1b
Rollup merge of - khuey:efficient_last, r=sfackler
When possible without changing semantics, implement Iterator::last in terms of DoubleEndedIterator::next_back for types in liballoc and libcore.

Provided that the iterator has finite length and does not trigger user-provided code, this is safe.

What follows is a full list of the DoubleEndedIterators in liballoc/libcore and whether this optimization is safe, and if not, why not.

src/liballoc/boxed.rs
Box: Pass through to avoid defeating optimization of the underlying DoubleIterator implementation. This has no correctness impact.

src/liballoc/collections/binary_heap.rs
Iter: Pass through to avoid defeating optimizations on slice::Iter
IntoIter: Not safe, changes Drop order
Drain: Not safe, changes Drop order

src/liballoc/collections/btree/map.rs
Iter: Safe to call next_back, invokes no user defined code.
IterMut: ditto
IntoIter: Not safe, changes Drop order
Keys: Safe to call next_back, invokes no user defined code.
Values: ditto
ValuesMut: ditto
Range: ditto
RangeMut: ditto

src/liballoc/collections/btree/set.rs
Iter: Safe to call next_back, invokes no user defined code.
IntoIter: Not safe, changes Drop order
Range: Safe to call next_back, invokes no user defined code.

src/liballoc/collections/linked_list.rs
Iter: Safe to call next_back, invokes no user defined code.
IterMut: ditto
IntoIter: Not safe, changes Drop order

src/liballoc/collections/vec_deque.rs
Iter: Safe to call next_back, invokes no user defined code.
IterMut: ditto
IntoIter: Not safe, changes Drop order
Drain: ditto

src/liballoc/string.rs
Drain: Safe because return type is a primitive (char)

src/liballoc/vec.rs
IntoIter: Not safe, changes Drop order
Drain: ditto
Splice: ditto

src/libcore/ascii.rs
EscapeDefault: Safe because return type is a primitive (u8)

src/libcore/iter/adapters/chain.rs
Chain: Not safe, invokes user defined code (Iterator impl)

src/libcore/iter/adapters/flatten.rs
FlatMap: Not safe, invokes user defined code (Iterator impl)
Flatten: ditto
FlattenCompat: ditto

src/libcore/iter/adapters/mod.rs
Rev: Not safe, invokes user defined code (Iterator impl)
Copied: ditto
Cloned: Not safe, invokes user defined code (Iterator impl and T::clone)
Map: Not safe, invokes user defined code (Iterator impl + closure)
Filter: ditto
FilterMap: ditto
Enumerate: Not safe, invokes user defined code (Iterator impl)
Skip: ditto
Fuse: ditto
Inspect: ditto

src/libcore/iter/adapters/zip.rs
Zip: Not safe, invokes user defined code (Iterator impl)

src/libcore/iter/range.rs
ops::Range: Not safe, changes Drop order, but ALREADY HAS SPECIALIZATION
ops::RangeInclusive: ditto

src/libcore/iter/sources.rs
Repeat: Not safe, calling last should iloop.
Empty: No point, iterator is at most one item long.
Once: ditto
OnceWith: ditto

src/libcore/option.rs
Item: No point, iterator is at most one item long.
Iter: ditto
IterMut: ditto
IntoIter: ditto

src/libcore/result.rs
Iter: No point, iterator is at most one item long
IterMut: ditto
IntoIter: ditto

src/libcore/slice/mod.rs
Split: Not safe, invokes user defined closure
SplitMut: ditto
RSplit: ditto
RSplitMut: ditto
Windows: Safe, already has specialization
Chunks: ditto
ChunksMut: ditto
ChunksExact: ditto
ChunksExactMut: ditto
RChunks: ditto
RChunksMut: ditto
RChunksExact: ditto
RChunksExactMut: ditto

src/libcore/str/mod.rs
Chars: Safe, already has specialization
CharIndices: ditto
Bytes: ditto
Lines: Safe to call next_back, invokes no user defined code.
LinesAny: Deprecated
Everything that is generic over P: Pattern: Not safe because Pattern invokes user defined code.
SplitWhitespace: Safe to call next_back, invokes no user defined code.
SplitAsciiWhitespace: ditto

This is attempt 2 of .

r? @sfackler
2019-07-04 01:38:56 +02:00
Mazdak Farrokhzad
c0ec567214
Rollup merge of - matklad:peek-delimited, r=petrochenkov
refactor check_for_substitution

No behavior change, just flatter and simpler code.

r? @petrochenkov
2019-07-04 01:38:55 +02:00
Mazdak Farrokhzad
44f22e694c
Rollup merge of - RalfJung:miri-realloc, r=cramertj
miri realloc: do not require giving old size+align
2019-07-04 01:38:53 +02:00
Mazdak Farrokhzad
d93b52fd18
Rollup merge of - petrhosek:libunwind-link-attribute, r=tmandry
Use link attributes on extern "C" blocks with llvm-libuwind

When llvm-libunwind feature is enabled, we need to use link attribute on
extern "C" blocks to make sure that symbols provided by LLVM's libunwind
that's built as part of Rust's libunwind crate are re-exported.

This addresses issue .
2019-07-04 01:38:52 +02:00
Mazdak Farrokhzad
d7e42cc61c
Rollup merge of - Zoxc:inherent_impls, r=eddyb
Clean up inherent_impls

Split out from https://github.com/rust-lang/rust/pull/61923.

r? @eddyb
2019-07-04 01:38:50 +02:00
Mazdak Farrokhzad
8867ba19de
Rollup merge of - petrochenkov:idclean, r=Centril
syntax: Unsupport `foo! bar { ... }` macros in the parser

Their support in expansion was removed in https://github.com/rust-lang/rust/pull/61606.

Also un-reserve `macro_rules` as a macro name, there's no ambiguity between `macro_rules` definitions and macro calls (it also wasn't reserved correctly).

cc https://github.com/rust-lang-nursery/wg-grammar/issues/51
2019-07-04 01:38:49 +02:00
Mazdak Farrokhzad
944bda9abb
Rollup merge of - czipperz:change-mem-replace-doc-example, r=dtolnay
Update mem::replace example to not be identical to mem::take

This also adds assertions that the operations work as expected.
2019-07-04 01:38:47 +02:00
Mazdak Farrokhzad
88c007cd04
Rollup merge of - czipperz:use-mem-take-instead-of-replace-default, r=dtolnay,Centril
Use mem::take instead of mem::replace with default
2019-07-04 01:38:46 +02:00
Mazdak Farrokhzad
6cfd474e33
Rollup merge of - arielb1:resolve-wf-fields, r=pnkfelix
wfcheck: resolve the type-vars in `AdtField` types

Normalization can leave some type-vars unresolved in its return type.
Make sure to resolve them so we have an infcx-independent type that can
be used with `needs_drop`.

Fixes .

Closes  - this PR fixes the root cause.
2019-07-04 01:38:44 +02:00
Mazdak Farrokhzad
740d5bd157
Rollup merge of - RalfJung:miri-interp, r=oli-obk
rename InterpretCx -> InterpCx

That's more consistent with InterpResult and InterpError.

r? @oli-obk
2019-07-04 01:38:42 +02:00
Mazdak Farrokhzad
e8a88f7d43
Rollup merge of - jeremystucki:needless_lifetimes, r=eddyb
Remove needless lifetimes (rustc)
2019-07-04 01:38:41 +02:00
Mazdak Farrokhzad
3eef0cbfe2 Reduce reliance on feature(await_macro). 2019-07-04 00:25:14 +02:00
Mazdak Farrokhzad
43315bc15e Adjust tests wrt. 'async_closure' feature gate. 2019-07-03 23:59:36 +02:00
Mazdak Farrokhzad
bb7fbb99a2 Add separate 'async_closure' feature gate. 2019-07-03 23:59:36 +02:00
Ralf Jung
2e47fc3bcd fix unused-import error on android 2019-07-03 22:48:17 +02:00
Ralf Jung
6225607e67 remove bogus example from drop_in_place 2019-07-03 20:14:59 +02:00
Ralf Jung
4dd5edc76d enable a few more tests in Miri and update the comment for others 2019-07-03 19:58:59 +02:00
Aleksey Kladov
c51802ac60 simplify Option::get_or_insert 2019-07-03 20:17:05 +03:00
Andre Bogus
ee05fc8104 First question mark in doctest 2019-07-03 17:54:58 +02:00
bors
088b987307 Auto merge of - Mark-Simulacrum:rollup-0pcaz5a, r=Mark-Simulacrum
Rollup of 15 pull requests

Successful merges:

 -  (MSVC link output improve)
 -  (nth_back for chunks_exact)
 -  (Adjust warning of -C extra-filename with -o.)
 -  (Add missing links for TryFrom docs)
 -  (std: Move a process test out of libstd)
 -  (Add missing type urls in Into trait)
 -  (Add Vec::leak)
 -  (import gdb for explicit access to gdb.current_objfile())
 -  (Enable intptrcast for explicit casts)
 -  (Improve box clone doctests to ensure the documentation is valid)
 -  (Switch tracking issue for `#![feature(slice_patterns)]`)
 -  (Fix michaelwoerister's mailmap)
 -  (HashMap is UnwindSafe)
 -  (Fix mismatching Kleene operators)
 -  (Fixed document bug, those replaced each other)

Failed merges:

r? @ghost
2019-07-03 14:29:08 +00:00
Mark Rousskov
b4712f0410 Fix bucket in CPU usage script 2019-07-03 10:19:59 -04:00
Mark Rousskov
6b43b50f0b
Rollup merge of - Flast:patch-1, r=Mark-Simulacrum
Fixed document bug, those replaced each other

Originally reported by , introduced by 
2019-07-03 09:59:31 -04:00
Mark Rousskov
08e8c41904
Rollup merge of - ia0:fix_kleene, r=petrochenkov
Fix mismatching Kleene operators
2019-07-03 09:59:30 -04:00
Mark Rousskov
a0fcf5e6aa
Rollup merge of - SimonSapin:safe, r=eddyb
HashMap is UnwindSafe

Fixes https://github.com/rust-lang/rust/issues/62301, a regression in 1.36.0-pre which was caused by hashbrown using `NonZero<T>` where the older hashmap used `Unique<T>`.
2019-07-03 09:59:28 -04:00
Mark Rousskov
7a033aad9d
Rollup merge of - Mark-Simulacrum:mailmap-mw, r=Centril
Fix michaelwoerister's mailmap

Noticed while going through some changes to thanks.

cc @michaelwoerister
r? @Centril
2019-07-03 09:59:27 -04:00
Mark Rousskov
ea6c1fcf34
Rollup merge of - Centril:slice-patterns-change-issue, r=varkor
Switch tracking issue for `#![feature(slice_patterns)]`

Switches the tracking issue for `#![feature(slice_patterns)]` to a fresh one in https://github.com/rust-lang/rust/issues/62254 due to new RFCs.

Closes https://github.com/rust-lang/rust/issues/23121.

r? @varkor
2019-07-03 09:59:25 -04:00
Mark Rousskov
8ca4a6a486
Rollup merge of - czipperz:improve-box-clone-doctests, r=GuillaumeGomez
Improve box clone doctests to ensure the documentation is valid
2019-07-03 09:59:24 -04:00