Commit Graph

64679 Commits

Author SHA1 Message Date
Ariel Ben-Yehuda
3bcd6fa571 use Eq instead of Lt in loop 2017-05-28 10:43:24 +03:00
Ariel Ben-Yehuda
68b7475dc0 move "ADT master drop flag" logic to open_drop_for_adt_contents
Fixes #41888.
2017-05-28 10:43:24 +03:00
Ariel Ben-Yehuda
c6d0b5bdd8 address review comments 2017-05-28 10:43:24 +03:00
Ariel Ben-Yehuda
24c1a07c72 refactor trans::mir::block to trans all calls through the same code 2017-05-28 10:43:24 +03:00
Ariel Ben-Yehuda
9da2aaccfe translate array drop glue using MIR
This fixes leakage on panic with arrays & slices. I am using a C-style
for-loop instead of a pointer-based loop because that would be ugly-er
to implement.
2017-05-28 10:43:24 +03:00
Mark Simulacrum
1128fabb33 Rollup merge of #42266 - rkruppe:clean-trans-api, r=arielb1
Remove unused APIs from rustc_trans

There were public re-exports of some rustc modules dating back to 2011 or so. While I was at it, some functions and modules were public but never used outside the crate. I made them private or `pub(crate)` as appropriate and in one case removed an unused function.
2017-05-27 20:54:05 -06:00
Mark Simulacrum
423b410fce Rollup merge of #42260 - stjepang:document-cmp-traits-agreement, r=alexcrichton
Docs: impls of PartialEq/PartialOrd/Ord must agree

Fixes #41270.

This PR brings two improvements to the docs:

1. Docs for `PartialEq`, `PartialOrd`, and `Ord` clarify that their implementations must agree.
2. Fixes a subtle bug in the Dijkstra example for `BinaryHeap`, where the impls are inconsistent.
Thanks @Rufflewind for spotting the bug!

r? @alexcrichton
cc @frankmcsherry
2017-05-27 20:54:04 -06:00
Mark Simulacrum
906c9bcfb9 Rollup merge of #42251 - nikomatsakis:issue-42210-regr-unsized-tail, r=eddyb
extend `struct_tail` to operate over tuples

Not 100% sure why this got exposed when it wasn't before, but this struct definitely seems wrong.

Fixes #42110

r? @eddyb
2017-05-27 20:54:03 -06:00
Mark Simulacrum
4e5812cee4 Rollup merge of #42249 - Mark-Simulacrum:issue-40244, r=eddyb
Allow variadic functions with cdecl calling convention.

Fixes #40244.
2017-05-27 20:54:02 -06:00
Mark Simulacrum
04a3b47087 Rollup merge of #42217 - venkatagiri:issue_39974, r=Mark-Simulacrum
regression test for #39974

closes #39974

r? @Mark-Simulacrum
2017-05-27 20:54:01 -06:00
Mark Simulacrum
f35ec6153b Rollup merge of #42207 - Nashenas88:remove_fragment_info, r=eddyb
Remove all instances of fragment_infos and fragment sets

Remove unused fragment structs. This was suggested by @eddyb in IRC: [botbot link](https://botbot.me/mozilla/rustc/2017-05-23/?msg=86016574&page=2).
2017-05-27 20:54:00 -06:00
bors
5d2512ec5b Auto merge of #42162 - est31:closure-to-fn-coercion, r=aturon
Stabilize non capturing closure to fn coercion

Stabilisation PR for non capturing closure to fn coercion.

closes #39817
2017-05-27 23:02:44 +00:00
bors
28fd1e519a Auto merge of #42137 - nical:doc-clone, r=BurntSushi
Update to Rc and Arc documentation to favor the Rc::clone(&ptr) syntax.

This is a followup of the discussion in https://github.com/rust-lang/rfcs/pull/1954.

The solution chosen by the core team to address the problem tackled by the [the RFC](https://github.com/rust-lang/rfcs/pull/1954) was to make the function call syntax Rc::clone(&foo) the idiomatic way to clone a reference counted pointer (over the method call syntax foo.clone()).
This change updates the documentation of Rc, Arc and their respective Weak pointers to reflect this decision and bring more exposure to the existence of the function call syntax.
2017-05-27 20:35:25 +00:00
Guillaume Gomez
2969137a72 Add invalid unary operator usage error code 2017-05-27 21:34:59 +02:00
Robin Kruppe
6fec17ee15 Remove trans-internal re-exports of rustc modules
The previous commit removed them from the public API, this rewrites the use statements to get rid of the non-standard re-exports.
2017-05-27 21:09:29 +02:00
Robin Kruppe
493cd6b6e2 Reduce API surface of rustc_trans
Mark various items and fields as private or pub(crate), and remove a function that turns out to be unused.
These are not used anywhere in-tree, but I guess it's a [breaking-change] for plugins.
2017-05-27 21:08:13 +02:00
Mark Simulacrum
918875f32d Fix ICE on inner enum in missing docs lint.
This also simplifies the lint by not storing variant depth or the struct
def stack, because we no longer need them.
2017-05-27 12:13:43 -06:00
Guillaume Gomez
998b19740c Add new error codes and update tests 2017-05-27 19:58:52 +02:00
bors
9337ad5bae Auto merge of #42103 - jorendorff:master, r=estebank
trace_macro: Show both the macro call and its expansion. #42072.

See #42072 for the initial motivation behind this.

The change is not the minimal fix, but I want this behavior almost every time I use `trace_macros`.
2017-05-27 17:38:11 +00:00
Stjepan Glavina
f5421367a2 Docs: impls of PartialEq/PartialOrd/Ord must agree 2017-05-27 17:15:32 +02:00
Guillaume Gomez
8be89f534a Add new error codes 2017-05-27 16:31:43 +02:00
Mark Simulacrum
bf87e17cd6 Allow variadic functions with cdecl calling convention. 2017-05-27 06:03:50 -06:00
bors
a11c26f6ac Auto merge of #42109 - Keruspe:master, r=alexcrichton
rustbuild: don't create a source tarball when installing

This splits Install out of Dist as it is not a full dist anymore, and creates the source tarball only for the Dist command.
This will allow splitting install in a few rules if we want as it's done for other phases.
2017-05-27 11:23:45 +00:00
bors
3e7908f616 Auto merge of #42068 - petrochenkov:ustab, r=nikomatsakis
Stabilize unions with `Copy` fields and no destructor

What else is needed:
- [x] Documentation (https://github.com/rust-lang-nursery/reference/pull/57).
- [x] Making assignments to `Copy` union fields safe (https://github.com/rust-lang/rust/pull/42083).
- [ ] Backport? (The "stabilization decision" is from [Apr 13](https://github.com/rust-lang/rust/issues/32836#issuecomment-294018091), it's just this PR is late.)

cc https://github.com/rust-lang/rust/issues/32836
r? @nikomatsakis
2017-05-27 05:28:24 +00:00
Stjepan Glavina
b559507680 Clarify the docs for align_of and its variants 2017-05-27 00:49:38 +02:00
Vadim Petrochenkov
73c73e4a95 Stabilize unions with Copy fields and no destructor 2017-05-27 00:52:20 +03:00
Niko Matsakis
9d018400ed extend struct_tail to operate over closures 2017-05-26 16:36:40 -04:00
bors
557967766b Auto merge of #42081 - ishitatsuyuki:submodule-better, r=aidanhs
Use the improved submodule handling

r? @alexcrichton

That was a crap...
```
Updating submodules
Traceback (most recent call last):
  File "./x.py", line 20, in <module>
    bootstrap.main()
  File "/home/ishitatsuyuki/Documents/rust/src/bootstrap/bootstrap.py", line 684, in main
    bootstrap()
  File "/home/ishitatsuyuki/Documents/rust/src/bootstrap/bootstrap.py", line 662, in bootstrap
    rb.update_submodules()
  File "/home/ishitatsuyuki/Documents/rust/src/bootstrap/bootstrap.py", line 566, in update_submodules
    path = line[1:].split(' ')[1]
TypeError: a bytes-like object is required, not 'str'
```

Maybe we need to confirm the compatibility of git options, such as `git config` or `git -C` (I believe they existed long before, though). This is tested locally.
2017-05-26 18:11:54 +00:00
Venkata Giri Reddy
7acc999b42 ci: move musl install into their own scripts 2017-05-26 12:50:52 -04:00
bors
256e497fe6 Auto merge of #42245 - frewsxcv:rollup, r=frewsxcv
Rollup of 7 pull requests

- Successful merges: #42169, #42215, #42216, #42224, #42230, #42236, #42241
- Failed merges:
2017-05-26 15:31:49 +00:00
Corey Farwell
252a286383 Rollup merge of #42241 - king6cong:master, r=steveklabnik
doc rewording
2017-05-26 10:20:30 -04:00
Corey Farwell
854196a0ed Rollup merge of #42236 - citizen428:docs/unchecked-indexing-slicing, r=GuillaumeGomez
Update documentation for indexing/slicing methods

See #39911

r? @steveklabnik
2017-05-26 10:20:29 -04:00
Corey Farwell
2c3aa9154d Rollup merge of #42230 - venkatagiri:ice_regression_tests, r=Mark-Simulacrum
regression tests for ICEs

closes #36379
closes #37550
closes #37665
closes #38160
closes #38954
closes #39362

r? @Mark-Simulacrum
2017-05-26 10:20:28 -04:00
Corey Farwell
2451f65c5c Rollup merge of #42224 - brson:lockfile, r=nikomatsakis
Remove stray lockfile
2017-05-26 10:20:27 -04:00
Corey Farwell
b872097931 Rollup merge of #42216 - charliesome:associate-type-typo, r=petrochenkov
Fix 'associate type' typo

I came across an error message mentioning an 'associate type'.

Since this is the only instance of this term in rustc (it's 'associated type' everywhere else), I think this might be a typo.
2017-05-26 10:20:26 -04:00
Corey Farwell
21882103d4 Rollup merge of #42215 - callahad:remove-superfluous-semis, r=Mark-Simulacrum
Remove superfluous `;;` sequences

Ran across a doubled `;;` in the docstring for `str::split`. Grep found a few more. :)
2017-05-26 10:20:25 -04:00
Corey Farwell
7e47327d90 Rollup merge of #42169 - scottmcm:new-step-trait-issue, r=alexcrichton
Give step_trait a distinct tracking issue from step_by

iterator_step_by has decoupled their futures, so the tracking issue should split.

Old issue: https://github.com/rust-lang/rust/issues/27741
New issue: https://github.com/rust-lang/rust/issues/42168

r? @alexcrichton (another follow-up to closed PR https://github.com/rust-lang/rust/pull/42110#issuecomment-303176049)
2017-05-26 10:20:25 -04:00
Masaki Hara
99993780dc
Add warning cycle #42238. 2017-05-26 22:21:46 +09:00
bors
c732446edd Auto merge of #42014 - tbu-:pr_scan_not_fused, r=alexcrichton
Remove `FusedIterator` implementation of `iter::Scan`

Fixes #41964.

This is a breaking change.
2017-05-26 12:54:11 +00:00
king6cong
e66388d21f doc rewording 2017-05-26 19:22:25 +08:00
bors
2f278c57ff Auto merge of #42083 - petrochenkov:safeassign, r=nikomatsakis
Make assignments to `Copy` union fields safe

This is an accompanying PR to PR https://github.com/rust-lang/rust/pull/42068 stabilizing FFI unions.

This was first proposed in https://github.com/rust-lang/rust/issues/32836#issuecomment-281296416, see subsequent comments as well.
Assignments to `Copy` union fields do not read any data from the union and are [equivalent](https://github.com/rust-lang/rust/issues/32836#issuecomment-281660298) to whole union assignments, which are safe, so they should be safe as well. This removes a significant number of "false positive" unsafe blocks, in code dealing with FFI unions in particular.

It desirable to make this change now, together with stabilization of FFI unions, because now it affecfts only unstable code, but later it will cause warnings/errors caused by `unused_unsafe` lint in stable code.

cc #32836
r? @nikomatsakis
2017-05-26 10:17:51 +00:00
Michael Kohl
bbf1dc4fad Update documentation for indexing/slicing methods
See #39911
2017-05-26 15:49:35 +07:00
bors
2db17c86e3 Auto merge of #42058 - froydnj:thiscall-support, r=nikomatsakis
add thiscall calling convention support

This support is needed for bindgen to work well on 32-bit Windows, and also enables people to begin experimenting with C++ FFI support on that platform.

Fixes #42044.
2017-05-26 07:36:25 +00:00
Venkata Giri Reddy
2160b4ae58 regression test for #37550 2017-05-25 21:34:16 -04:00
Venkata Giri Reddy
95436c6d89 regression test for #37665
regression test for #37550
2017-05-25 21:33:58 -04:00
bors
4f9c9ed1a5 Auto merge of #40847 - jseyfried:decl_macro, r=nrc
Initial implementation of declarative macros 2.0

Implement declarative macros 2.0 (rust-lang/rfcs#1584) behind `#![feature(decl_macro)]`.
Differences from `macro_rules!` include:
 - new syntax: `macro m(..) { .. }` instead of `macro_rules! m { (..) => { .. } }`
 - declarative macros are items:
```rust
// crate A:
pub mod foo {
    m!(); // use before definition; declaration order is irrelevant
    pub macro m() {} // `pub`, `pub(super)`, etc. work
}
fn main() {
    foo::m!(); // named like other items
    { use foo::m as n; n!(); } // imported like other items
}
pub use foo::m; // re-exported like other items

// crate B:
extern crate A; // no need for `#[macro_use]`
A::foo::m!(); A::m!();
```
 - Racket-like hygiene for items, imports, methods, fields, type parameters, privacy, etc.
   - Intuitively, names in a macro definition are resolved in the macro definition's scope, not the scope in which the macro is used.
   - This [explaination](http://beautifulracket.com/explainer/hygiene.html) of hygiene for Racket applies here (except for the "Breaking Hygiene" section). I wrote a similar [explanation](https://github.com/jseyfried/rfcs/blob/hygiene/text/0000-hygiene.md) for Rust.
   - Generally speaking, if `fn f() { <body> }` resolves, `pub macro m() { <body> } ... m!()` also resolves, even if `m!()` is in a separate crate.
   - `::foo::bar` in a `macro` behaves like `$crate::foo::bar` in a `macro_rules!`, except it can access everything visible from the `macro` (thus more permissive).
   - See [`src/test/{run-pass, compile-fail}/hygiene`](afe7d89858) for examples. Small example:
```rust
mod foo {
    fn f() { println!("hello world"); }
    pub macro m() { f(); }
}
fn main() { foo::m!(); }
```

Limitations:
 - This does not address planned changes to matchers (`expr`,`ty`, etc.), c.f. #26361.
 - Lints (including stability and deprecation) and `unsafe` are not hygienic.
   - adding hygiene here will be mostly or entirely backwards compatible
 - Nested macro definitions (a `macro` inside another `macro`) don't always work correctly when invoked from external crates.
   - pending improvements in how we encode macro definitions in crate metadata
 - There is no way to "escape" hygiene without using a procedural macro.

r? @nrc
2017-05-25 22:31:34 +00:00
Venkata Giri Reddy
9ee9abcdbd regression test for #38160 2017-05-25 17:43:25 -04:00
Venkata Giri Reddy
04ac7c3345 regression test for #39362 2017-05-25 17:36:59 -04:00
Jeffrey Seyfried
dc34ea0929 Fix merge conflicts. 2017-05-25 21:07:45 +00:00
Venkata Giri Reddy
6b151ef841 regression test for #38954 2017-05-25 16:55:25 -04:00