Commit Graph

95843 Commits

Author SHA1 Message Date
Wesley Wiser
12672e2053 Add test for ICE #62375
Fixes #62375
2019-07-04 10:49:24 -04:00
Alex Gaynor
e4f250e405 Implement mem::{zeroed,uninitialized} in terms of MaybeUninit.
Refs #62061
2019-07-04 09:33:15 -04:00
Wim Looman
55bd2140a2 Add tracking issue for Box::into_pin 2019-07-04 12:57:34 +02:00
ljedrz
a6030ff699 infer: fix a Region-related debug message 2019-07-04 12:53:12 +02:00
ljedrz
675bfb6d16 fix a dep_graph doc regarding type_of_item 2019-07-04 12:53:12 +02:00
ljedrz
01e0d83336 infer::error_reporting: adjust 2 debug messages 2019-07-04 12:53:12 +02:00
ljedrz
c6131b23ae rename hir::map::opt_local_def_id* 2019-07-04 12:53:12 +02:00
ljedrz
37d7e1f22a rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-04 12:53:12 +02:00
ljedrz
4f7ba515c2 rename hir::map::local_def_id to local_def_id_from_node_id 2019-07-04 12:29:26 +02:00
ljedrz
7987719dbe remove FIXMEs for functions that won't go away 2019-07-04 12:29:26 +02:00
Ralf Jung
ceb496cf59 improve validity error range printing for singleton ranges 2019-07-04 10:47:23 +02:00
Ralf Jung
d9d6b3bb28 turns out that dangling pointer branch is dead code; remove it and improve the error that actually gets shown a bit 2019-07-04 10:47:23 +02:00
Ralf Jung
317c6ac129 use get_size_and_align to test if an allocation is live 2019-07-04 10:45:31 +02:00
Jeremy Stucki
fc67e5774d
Add missing lifetime specifier
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-07-04 10:42:24 +02:00
Ralf Jung
52e6f859f1 organize methods a bit better 2019-07-04 10:39:05 +02:00
Ralf Jung
956a3ef3bb more inlining 2019-07-04 10:39:05 +02:00
Ralf Jung
842bbd2764 make Memory::get_fn take a Scalar like most of the Memory API surface 2019-07-04 10:38:54 +02:00
Ralf Jung
b4be08a666 fix for tidy 2019-07-04 10:38:54 +02:00
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 #62355 - Centril:rollup-xnxtcgm, r=Centril
Rollup of 16 pull requests

Successful merges:

 - #62039 (Remove needless lifetimes (rustc))
 - #62173 (rename InterpretCx -> InterpCx)
 - #62240 (wfcheck: resolve the type-vars in `AdtField` types)
 - #62249 (Use mem::take instead of mem::replace with default)
 - #62252 (Update mem::replace example to not be identical to mem::take)
 - #62258 (syntax: Unsupport `foo! bar { ... }` macros in the parser)
 - #62268 (Clean up inherent_impls)
 - #62287 (Use link attributes on extern "C" blocks with llvm-libuwind)
 - #62295 (miri realloc: do not require giving old size+align)
 - #62297 (refactor check_for_substitution)
 - #62316 (When possible without changing semantics, implement Iterator::last in terms of DoubleEndedIterator::next_back for types in liballoc and libcore.)
 - #62317 (Migrate `compile-pass` annotations to `build-pass`)
 - #62337 (Fix bucket in CPU usage script)
 - #62344 (simplify Option::get_or_insert)
 - #62346 (enable a few more tests in Miri and update the comment for others)
 - #62351 (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 #62351 - 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 #62346 - 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 #62344 - 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 #62337 - 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 #62317 - JohnTitor:move-tests-to-build-pass, r=Centril
Migrate `compile-pass` annotations to `build-pass`

This is a part of #62277.

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 #62316 - 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 #60130.

r? @sfackler
2019-07-04 01:38:56 +02:00
Mazdak Farrokhzad
c0ec567214
Rollup merge of #62297 - 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 #62295 - 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 #62287 - 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 #62088.
2019-07-04 01:38:52 +02:00
Mazdak Farrokhzad
d7e42cc61c
Rollup merge of #62268 - 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 #62258 - 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 #62252 - 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 #62249 - 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 #62240 - 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 #61402.

Closes #62212 - this PR fixes the root cause.
2019-07-04 01:38:44 +02:00