104112 Commits

Author SHA1 Message Date
Ralf Jung
3ddc0278d3 validation: avoid some intermediate allocations 2019-12-12 16:21:57 +01:00
bors
e9469a6aec Auto merge of #66886 - mark-i-m:simplify-borrow_check-2, r=matthewjasper
Remove the borrow check::nll submodule

NLL is the only borrow checker now, so no need to have a separate submodule.

@rustbot modify labels: +S-blocked

Waiting on #66815
2019-12-12 15:04:36 +00:00
Ralf Jung
b2392aa2fc dont ICE in case of invalid drop fn 2019-12-12 15:23:27 +01:00
Elichai Turkel
0cc8fe5d43
Change fmt docs for more delegations 2019-12-12 16:03:23 +02:00
bors
3eebe058e5 Auto merge of #67079 - nnethercote:optimize-shallow_resolve_changed, r=nikomatsakis
Optimize `shallow_resolve_changed`

r? @nikomatsakis
2019-12-12 11:51:26 +00:00
Oliver Scherer
0b1e08a9f4 Require allow_internal_unstable for stable min_const_fn using unstable features 2019-12-12 10:22:09 +01:00
Nicholas Nethercote
ffd214299e Remove the DelimSpan from NamedMatch::MatchedSeq.
Because it's unused. This then allows the removal of
`MatcherPos::sp_open`. It's a tiny perf win, reducing instruction counts
by 0.1% - 0.2% on a few benchmarks.
2019-12-12 17:36:03 +11:00
Mark Mansi
bc9582a953 fix imports after rebase 2019-12-11 21:35:51 -06:00
Mark Mansi
02d93bd703 more private 2019-12-11 21:35:51 -06:00
Mark Mansi
78ecf86291 fix imports 2019-12-11 21:35:51 -06:00
Mark Mansi
cee2c28ee8 tidy 2019-12-11 21:35:51 -06:00
Mark Mansi
697853117f fix imports 2019-12-11 21:35:50 -06:00
Mark Mansi
52a9eff7ad get rid of nll submod 2019-12-11 21:35:50 -06:00
Andrea Canciani
1f6d0234db Prefer encoding the char when checking for string prefix/suffix
This enables constant folding when matching a literal char.

Fixes #41993.
2019-12-12 03:33:46 +01:00
Esteban Küber
8c4f1d5f87 review comments 2019-12-11 18:21:52 -08:00
Yuki Okushi
fa199c5f27 Don't suggest wrong snippet in closure 2019-12-12 11:13:13 +09:00
bors
f284f8b4be Auto merge of #67246 - JohnTitor:rollup-nfa7skn, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #62514 (Clarify `Box<T>` representation and its use in FFI)
 - #66983 (Fix `unused_parens` triggers on macro by example code)
 - #67215 (Fix `-Z print-type-sizes`'s handling of zero-sized fields.)
 - #67230 (Remove irelevant comment on `register_dtor`)
 - #67236 (resolve: Always resolve visibilities on impl items)
 - #67237 (Some small readability improvements)
 - #67238 (Small std::borrow::Cow improvements)
 - #67239 (Make TinyList::remove iterate instead of recurse)

Failed merges:

r? @ghost
2019-12-12 02:11:31 +00:00
Esteban Küber
3980342f31 Use structured suggestion for disambiguating method calls
Fix #65635.
2019-12-11 17:42:28 -08:00
Esteban Küber
da023c0c6f Add more context for type parameters 2019-12-11 17:18:43 -08:00
Yuki Okushi
685d4cc746
Rollup merge of #67239 - llogiq:tiny-list-iterative-remove, r=Mark-Simulacrum
Make TinyList::remove iterate instead of recurse

Most of the diff is from from rustfmt, the actual change is in line 91..79 (or 79..89 in the "after" diff).

I had converted the other methods to iterate instead of recurse already, so this is the last recursive function on `TinyList`.
2019-12-12 10:09:29 +09:00
Yuki Okushi
60ebeda94f
Rollup merge of #67238 - llogiq:moo-and-improved, r=Dylan-DPC
Small std::borrow::Cow improvements

This is a small set of improvements (+ one more tested code path) for `Cow`.
2019-12-12 10:09:28 +09:00
Yuki Okushi
59eed49115
Rollup merge of #67237 - llogiq:improve-str, r=Dylan-DPC
Some small readability improvements
2019-12-12 10:09:26 +09:00
Yuki Okushi
0f286e855f
Rollup merge of #67236 - petrochenkov:docerr2, r=matthewjasper
resolve: Always resolve visibilities on impl items

Fixes https://github.com/rust-lang/rust/issues/64705.

Similarly to https://github.com/rust-lang/rust/pull/67106 this was an issue with visitor discipline.
Impl items were visited as a part of visiting `ast::ItemKind::Impl`, but they should be visit-able in isolation  from their parents as well, because that's how they are visited when they are expanded from macros.

I've checked that all the remaining `resolve_visibility` calls are used correctly.

r? @matthewjasper
2019-12-12 10:09:24 +09:00
Yuki Okushi
3cf799640f
Rollup merge of #67230 - chansuke:remove-irrelevant-passage, r=Dylan-DPC
Remove irelevant comment on `register_dtor`

Fixes #66572.
2019-12-12 10:09:23 +09:00
Yuki Okushi
a82390407a
Rollup merge of #67215 - nnethercote:fix-Zprint-type-size-zero-sized-fields, r=pnkfelix
Fix `-Z print-type-sizes`'s handling of zero-sized fields.

Currently, the type `struct S { x: u32, y: u32, tag: () }` is
incorrectly described like this:
```
print-type-size type: `S`: 8 bytes, alignment: 4 bytes
print-type-size     field `.x`: 4 bytes
print-type-size     field `.tag`: 0 bytes, offset: 0 bytes, alignment: 1 bytes
print-type-size     padding: 4 bytes
print-type-size     field `.y`: 4 bytes, alignment: 4 bytes
```
Specifically:
- The `padding` line is wrong. (There is no padding.)
- The `offset` and `alignment` on the `.tag` line shouldn't be printed.

The problem is that multiple fields can end up with the same offset, and
the printing code doesn't handle this correctly.

This commit fixes it by adjusting the field sorting so that zero-sized fields
are dealt with before non-zero-sized fields. With that in place, the
printing code works correctly.

The commit also corrects the "something is very wrong" comment.

The new output looks like this:
```
print-type-size type: `S`: 8 bytes, alignment: 4 bytes
print-type-size     field `.tag`: 0 bytes
print-type-size     field `.x`: 4 bytes
print-type-size     field `.y`: 4 bytes
```
r? @pnkfelix
2019-12-12 10:09:21 +09:00
Yuki Okushi
f642dc4124
Rollup merge of #66983 - weiznich:bugfix/issue_66295, r=estebank
Fix `unused_parens` triggers on macro by example code

Fix #66295

Unfortunately this does also break [an existing test](4787e97475/src/test/ui/lint/issue-47775-nested-macro-unnecessary-parens-arg.rs (L22)). I'm not sure how to handle that, because that seems to be quite similar to the allowed cases

If this gets accepted it would be great to backport this fix to beta.
2019-12-12 10:09:19 +09:00
Yuki Okushi
9860a4eeb7
Rollup merge of #62514 - stephaneyfx:box-ffi, r=nikomatsakis
Clarify `Box<T>` representation and its use in FFI

This officializes what was only shown as a code example in [the unsafe code guidelines](https://rust-lang.github.io/unsafe-code-guidelines/layout/function-pointers.html?highlight=box#use) and follows [the discussion](https://github.com/rust-lang/unsafe-code-guidelines/issues/157) in the corresponding repository.

It is also related to [the issue](https://github.com/rust-lang/rust/issues/52976) regarding marking `Box<T>` `#[repr(transparent)]`.

If the statement this PR adds is incorrect or a more in-depth discussion is warranted, I apologize. Should it be the case, the example in the unsafe code guidelines should be amended and some document should make it clear that it is not sound/supported.
2019-12-12 10:09:15 +09:00
Jonas Schievink
82c09b75d7 Add comment to Dropper 2019-12-12 00:39:29 +01:00
Esteban Küber
45550ef2ff Reuse existing HirId → DefId table 2019-12-11 15:33:45 -08:00
Jonas Schievink
5e32da1849 LinkedList: drop remaining items when drop panics 2019-12-12 00:14:09 +01:00
bors
de0abf7599 Auto merge of #66650 - matthewjasper:nonuniform-array-move, r=pnkfelix
Remove uniform array move MIR passes

This PR fixes a number of bugs caused by limitations of this pass

* Projections from constant indexes weren't being canonicalized
* Constant indexes from the start weren't being canonicalized (they could have different min_lengths)
* It didn't apply to non-moves

This PR makes the following changes to support removing this pass:

* ConstantIndex of arrays are now generated in a canonical form (from the start, min_length is the actual length).
* Subslices are now split when generating move paths and when checking subslices have been moved.

Additionally

* The parent move path of a projection from an array element is now calculated correctly

closes #66502
2019-12-11 23:00:38 +00:00
Andrea Canciani
cc863f02a3 Improve str prefix/suffix comparison
The comparison can be performed on the raw bytes, as the chars can
only match if their UTF8 encoding matches.

This avoids the `is_char_boundary` checks and translates to a straight
`u8` slice comparison which is optimized to a memcmp or inline
comparison where appropriate.
2019-12-11 21:24:35 +01:00
Andre Bogus
ab3afc0f04 Make TinyList::remove iterate instead of recurse 2019-12-11 21:05:28 +01:00
Andre Bogus
2422797785 Small Cow improvements 2019-12-11 21:01:33 +01:00
Andre Bogus
7f87dd1bc0 Some small readability improvements 2019-12-11 20:49:46 +01:00
bors
27d6f55f47 Auto merge of #65345 - davidtwco:issue-64130-async-send-sync-error-improvements, r=nikomatsakis
async/await: improve not-send errors, part 2

Part of #64130. Fixes #65667.

This PR improves the errors introduced in #64895 so that they have specialized messages for `Send` and `Sync`.

r? @nikomatsakis
2019-12-11 19:39:06 +00:00
Vadim Petrochenkov
914c9aa78d resolve: Always resolve visibilities on impl items 2019-12-11 22:10:09 +03:00
Jonas Schievink
189ccf20a2 VecDeque: drop remaining items on destructor panic 2019-12-11 19:38:45 +01:00
Nicholas Matsakis
5cd9f22464 erase regions instead of using builtin_deref
The reason we were invoking `builtin_deref` was to enable comparisons
when the type was `&T`. For the reasons outlined in the comment, those
comparisons failed because the regions disagreed.
2019-12-11 13:23:07 -05:00
Nadrieril
fbd2cd09e6 Revert a diagnostic change in the case of integer ranges 2019-12-11 18:17:58 +00:00
chansuke
e4852da576 Remove irelevant comment on register_dtor 2019-12-12 01:00:37 +09:00
Nicholas Matsakis
fafa489798 clarify that Box<T> should only be used when defined *in Rust* 2019-12-11 10:33:36 -05:00
Aaron Hill
150d328d2e
Update Cargo.lock 2019-12-11 09:50:46 -05:00
Aaron Hill
9245182420
Add comment explaining original maybe_install_llvm_dylib call 2019-12-11 09:50:12 -05:00
Aaron Hill
a7de090e35
Remove unused import 2019-12-11 09:50:12 -05:00
Aaron Hill
8b9c5396ca
Fix missing libLLVM.so in stage0 sysroot.
When we dynamically link against libLLVM.so (as opposed to statically
linking LLVM), we need libLLVM.so to be present in the stage0 sysroot,
so that stage1 tools (which are built against the stage0
compiler+sysroot) can see it at build time (when the linker is run)

See the comment in the commit for more details
2019-12-11 09:50:12 -05:00
Aaron Hill
1aa34d4dec
Remove extern crate declarations 2019-12-11 09:50:12 -05:00
Aaron Hill
fca192cca2
Fix fallout from rebase 2019-12-11 09:50:12 -05:00
Alex Crichton
f94b0e6af3
Fix a test in the bootstrap test suite 2019-12-11 09:50:12 -05:00
Alex Crichton
91b25a84df
Fix some linking of LLVM's dynamic library
Ensure it shows up in the same places it did before so tools can find it
at runtime.
2019-12-11 09:50:11 -05:00