Commit Graph

55169 Commits

Author SHA1 Message Date
Manish Goregaokar
26e22b8e2e Rollup merge of #35080 - jonathandturner:fix_numeric_expected_found, r=nikomatsakis
Rename _ to {integer} and {float} for unknown numeric types

This PR renames _ to {integer} or {float} for unknown numeric types, to help people parse error messages that have numeric types that haven't been nailed down.

Example:
```rust
fn main() {
    let x: String = 4;
}
```

Before:
```
error[E0308]: mismatched types
 --> quicktest.rs:2:21
  |
2 |     let x: String = 4;
  |                     ^ expected struct `std::string::String`, found integral variable
  |
  = note: expected type `std::string::String`
  = note:    found type `_`

error: aborting due to previous error
```

after:
```
error[E0308]: mismatched types
 --> quicktest.rs:2:21
  |
2 |     let x: String = 4;
  |                     ^ expected struct `std::string::String`, found integral variable
  |
  = note: expected type `std::string::String`
  = note:    found type `{integer}`

error: aborting due to previous error
```
```
2016-07-30 13:44:46 +05:30
Manish Goregaokar
8c6421fb17 Rollup merge of #35063 - jseyfried:avoid_importing_inaccessible_names, r=nrc
resolve: Exclude inaccessible names from single imports

If a single import resolves to an inaccessible name in some but not all namespaces, avoid importing the name in the inaccessible namespaces.

Currently, the inaccessible namespaces are imported but cause a privacy error when used.

r? @nrc
2016-07-30 13:44:46 +05:30
Manish Goregaokar
6234610252 Rollup merge of #35058 - jethrogb:no_panic_abs, r=alexcrichton
Add non-panicking abs() functions to all signed integer types.

Currently, calling abs() on one of the signed integer types might panic (in
debug mode at least) because the absolute value of the largest negative value
can not be represented in that signed type. Unlike all other integer
operations, there is currently not a non-panicking version on this function.
This seems to just be an oversight in the design, therefore just adding it now.
2016-07-30 13:44:46 +05:30
Manish Goregaokar
96e3972707 Rollup merge of #35049 - knight42:add-test, r=alexcrichton
Add a test for AddAssign on String

Fix #35047
2016-07-30 13:44:46 +05:30
bors
2ad98a0b42 Auto merge of #35032 - vadimcn:rusty-ehabi, r=alexcrichton
Implement ARM personality routine in Rust.

Remove the `eh_personality_catch` lang item.
Use a simplified version of `cfg_if!` in libunwind.

Closes #34786
2016-07-29 20:29:43 -07:00
bors
f164cf5d64 Auto merge of #34842 - cgswords:attr_enc, r=nrc
Better attribute and metaitem encapsulation throughout the compiler

This PR refactors most (hopefully all?) of the `MetaItem` interactions outside of `libsyntax` (and a few inside) to interact with MetaItems through the provided traits instead of directly creating / destruct / matching against them. This is a necessary first step to eventually converting `MetaItem`s to internally use `TokenStream` representations (which will make `MetaItem` interactions much nicer for macro writers once the new macro system is in place).

r? @nrc
2016-07-29 16:26:38 -07:00
bors
5a7773a180 Auto merge of #35100 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 7 pull requests

- Successful merges: #34258, #34894, #35050, #35062, #35066, #35072, #35087
- Failed merges:
2016-07-29 03:28:01 -07:00
Guillaume Gomez
5f5fdf64f1 Rollup merge of #35103 - brettcannon:patch-1, r=Manishearth
Try to clear up some awkward wording
2016-07-29 11:57:54 +02:00
Guillaume Gomez
d69161c119 Rollup merge of #35087 - GuillaumeGomez:fs_docs, r=steveklabnik
Fs docs

Fixes #29356.

r? @steveklabnik
2016-07-29 11:57:54 +02:00
Guillaume Gomez
3f06bf9afb Rollup merge of #35072 - munyari:assert_debug, r=steveklabnik
Update docs for assert! and debug_assert!

Refer to #34455
2016-07-29 11:57:54 +02:00
Guillaume Gomez
01505a3311 Rollup merge of #35066 - vadimcn:fix-typos, r=apasel422
Fix typos

r? @steveklabnik
2016-07-29 11:57:54 +02:00
Guillaume Gomez
41c8d3f630 Rollup merge of #35062 - frewsxcv:chars-as-str, r=GuillaumeGomez
Add documentation example for `str::Chars::as_str`.

None
2016-07-29 11:57:53 +02:00
Guillaume Gomez
72d1d06692 Rollup merge of #35050 - knight42:improve-fmt-doc, r=steveklabnik
More intuitive explantion of strings formatting
2016-07-29 11:57:53 +02:00
Guillaume Gomez
679f88d345 Rollup merge of #34258 - durka:patch-25, r=steveklabnik
book/ffi: nullable pointer cleanup

Expand the "nullable pointer optimization" section with a code example. Fixes #34250.

I also noticed that many of the examples use the libc crate just for types such as `c_char` and `c_int`, which are now available through `std::os::raw`. I changed the ones that don't need to rely on libc. I'm glad to revert that part of the commit if it's unwanted churn.
2016-07-29 11:57:53 +02:00
bors
1523a5480a Auto merge of #34980 - cardoe:expose-target-options, r=alexcrichton
Convert built-in targets to JSON

Convert the built-in targets to JSON to ensure that the JSON parser is always fully featured. This follows on #32988 and #32847. The PR includes a number of extra commits that are just intermediate changes necessary for bisectibility and the ability to prove correctness of the change.
2016-07-28 23:18:52 -07:00
Brett Cannon
3563e400cc Try to clear up some awkward wording 2016-07-28 19:02:25 -07:00
bors
d9a911d236 Auto merge of #34967 - TimNN:mipsel-musl-soft-float, r=alexcrichton
switch mipsel-musl to soft float

Closes #34922.

r? @alexcrichton
2016-07-28 18:31:54 -07:00
bors
54c0dcfd63 Auto merge of #34956 - nikomatsakis:incr-comp-o-files, r=mw
Enable reuse of `.o` files if nothing has changed

This PR completes a first "spike" for incremental compilation by enabling us to reuse `.o` files when nothing has changed. When in incr. mode, we will save `.o` files into the temporary directory, then copy them back out again if they are still valid. The code is still a bit rough but it does seem to work. =)

r? @michaelwoerister

Fixes #34036
Fixes #34037
Fixes #34038
2016-07-28 14:17:54 -07:00
Niko Matsakis
42cd5d4ee2 make it possible to track where hash diverges 2016-07-28 15:39:34 -04:00
Niko Matsakis
e359147d12 hash def-path's better
actually we shouldn't even hash nested items at all, but that is
addressed in a followup PR
2016-07-28 15:39:02 -04:00
bors
d1df3fecdf Auto merge of #34485 - tbu-:pr_unicode_debug_str, r=alexcrichton
Escape fewer Unicode codepoints in `Debug` impl of `str`

Use the same procedure as Python to determine whether a character is
printable, described in [PEP 3138]. In particular, this means that the
following character classes are escaped:

- Cc (Other, Control)
- Cf (Other, Format)
- Cs (Other, Surrogate), even though they can't appear in Rust strings
- Co (Other, Private Use)
- Cn (Other, Not Assigned)
- Zl (Separator, Line)
- Zp (Separator, Paragraph)
- Zs (Separator, Space), except for the ASCII space `' '` `0x20`

This allows for user-friendly inspection of strings that are not
English (e.g. compare `"\u{e9}\u{e8}\u{ea}"` to `"éèê"`).

Fixes #34318.
CC #34422.

[PEP 3138]: https://www.python.org/dev/peps/pep-3138/
2016-07-28 11:20:33 -07:00
Jonathan Turner
ea77049cfa Move to {integer} and {float} 2016-07-28 09:49:31 -07:00
Niko Matsakis
2f9fff2191 Keep multiple files per work-product
In the older version, a `.o` and ` .bc` file were separate
work-products.  This newer version keeps, for each codegen-unit, a set
of files of different kinds. We assume that if any kinds are available
then all the kinds we need are available, since the precise set of
switches will depend on attributes and command-line switches.

Should probably test this: the effect of changing attributes in
particular might not be successfully tracked?
2016-07-28 12:05:45 -04:00
Niko Matsakis
ceeb158e0a Address mw nits 2016-07-28 12:05:45 -04:00
Niko Matsakis
08a72d20c9 Add a testing mechanism and a simple spike test 2016-07-28 12:05:45 -04:00
Niko Matsakis
58d4b8edd3 Modify trans to skip generating .o files
This checks the `previous_work_products` data from the dep-graph and
tries to simply copy a `.o` file if possible.  We also add new
work-products into the dep-graph, and create edges to/from the dep-node
for a work-product.
2016-07-28 12:05:45 -04:00
Jethro Beekman
cdc6afed38 Add non-panicking abs() functions to all signed integer types.
Currently, calling abs() on one of the signed integer types might panic (in
debug mode at least) because the absolute value of the largest negative value
can not be represented in that signed type. Unlike all other integer
operations, there is currently not a non-panicking version on this function.
This seems to just be an oversight in the design, therefore just adding it now.
2016-07-28 09:05:43 -07:00
Niko Matsakis
cca4804251 Code to save/load the work-products map from disk
Work products are deleted if any of their inputs are dirty.
2016-07-28 12:05:04 -04:00
Niko Matsakis
ffc13b2f80 Store crate_disambiguator as an InternedString
We used to use `Name`, but the session outlives the tokenizer, which
means that attempts to read this field after trans has complete
otherwise panic. All reads want an `InternedString` anyhow.
2016-07-28 12:05:04 -04:00
Niko Matsakis
2b38c4bdea Extend DepGraph so it can track "work-products"
A work product right now is just a `.o` file. In the future it probably
includes other kinds of files, such as `.bc` files saving the
unoptimized LLVM IR.

However, because WorkProductIds must be independent of DefIds, so that
they don't need translation, this system may not be suitable *as is* for
storing fine-grained information (such as the MIR for individual defs),
as it was originally intended. We will want to refactor some for that.
2016-07-28 12:05:04 -04:00
Jonathan Turner
cfdaca049a Rename _ to {numerics} for unknown numeric types 2016-07-28 08:58:25 -07:00
bors
748ecb1235 Auto merge of #35086 - Manishearth:rollup, r=Manishearth
Rollup of 7 pull requests

- Successful merges: #34951, #34963, #34969, #35013, #35037, #35040, #35058
- Failed merges:
2016-07-28 08:19:33 -07:00
Manish Goregaokar
bc283bb8ae Rollup merge of #35040 - soltanmm:couple-is-a-pun, r=nikomatsakis
Use &mut for `CombineFields` in inference relations

Because dropping obligations on the floor makes a mess.

r? @nikomatsakis
2016-07-28 20:33:07 +05:30
Manish Goregaokar
22297bdf98 Rollup merge of #35037 - ollie27:rustdoc_tuple_struct_where, r=alexcrichton
rustdoc: Fix tuple struct where clause rendering

For tuple structs the where clause comes after the definition.

Fixes #34928
2016-07-28 20:33:07 +05:30
Manish Goregaokar
be6b73f19d Rollup merge of #35013 - tamird:coerce-match-valgrind, r=alexcrichton
move coerce-match{,-calls} into run-pass-valgrind

Closes #21696.
2016-07-28 20:33:07 +05:30
Manish Goregaokar
f540f5d453 Rollup merge of #34969 - jseyfried:fix_cfg_feature, r=nrc
Avoid processing `feature`s on unconfigured crates

Fixes #34932, a regression caused by #34272.
r? @nrc
2016-07-28 20:33:06 +05:30
Manish Goregaokar
43bcada397 Rollup merge of #34963 - petrochenkov:useerr, r=jseyfried
resolve: Fix ICE and extra diagnostics happening when unresolved imports are used in patterns

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

r? @jseyfried
2016-07-28 20:33:06 +05:30
Manish Goregaokar
80c998d0f1 Rollup merge of #34951 - tomgarcia:covariant-vec, r=brson
Make vec::Drain and binary_heap::Drain covariant

I removed all mutable pointers/references, and added covariance tests similar to the ones in #32635. It builds and passes the tests, but I noticed that there weren't any tests of Drain's behaviour (at least not in libcollectionstest), so I'm not sure if my changes accidently broke Drain's behaviour. Should I add some tests for that (and if so, what should the tests include)?
2016-07-28 20:33:06 +05:30
Corey Farwell
f98c55d933 Add documentation example for str::Chars::as_str. 2016-07-28 08:54:48 -04:00
bors
cec262e55a Auto merge of #34951 - tomgarcia:covariant-vec, r=brson
Make vec::Drain and binary_heap::Drain covariant

I removed all mutable pointers/references, and added covariance tests similar to the ones in #32635. It builds and passes the tests, but I noticed that there weren't any tests of Drain's behaviour (at least not in libcollectionstest), so I'm not sure if my changes accidently broke Drain's behaviour. Should I add some tests for that (and if so, what should the tests include)?
2016-07-28 05:24:31 -07:00
Guillaume Gomez
123bf1e95d Add OpenOptionsExt doc examples 2016-07-28 13:04:24 +02:00
Guillaume Gomez
8d3f20f906 Add doc examples for std::fs::unix::OpenOptionsExt 2016-07-28 12:55:58 +02:00
bors
1895bf760d Auto merge of #34908 - jseyfried:improve_tt_matchers, r=nrc
macros: Improve `tt` matchers

Fixes #5846, fixes #22819.
r? @nrc
2016-07-28 00:01:54 -07:00
Jeffrey Seyfried
448550223b Add regression test 2016-07-28 02:16:11 +00:00
bors
f5d79521ae Auto merge of #34946 - alexcrichton:fix-cfg, r=brson
std: Fix usage of SOCK_CLOEXEC

This code path was intended to only get executed on Linux, but unfortunately the
`cfg!` was malformed so it actually never got executed.
2016-07-27 18:58:04 -07:00
Guillaume Gomez
52c50ba276 Add doc examples for std::fs::Metadata 2016-07-28 02:53:34 +02:00
Tobias Bucher
3d09b4a0d5 Rename char::escape to char::escape_debug and add tracking issue 2016-07-28 02:20:49 +02:00
Knight
6ac83de691 Add test for string AddAssign 2016-07-28 06:08:56 +08:00
bors
f2e59cc6aa Auto merge of #34907 - arielb1:found-parse-error, r=nikomatsakis
Centralize and clean type error reporting

Refactors the code that handles type errors to be cleaner and fixes various edge cases.

This made the already-bad "type mismatch resolving" error message somewhat uglier. I want to fix that in another commit before this PR is merged.

Fixes #31173

r? @jonathandturner, cc @nikomatsakis
2016-07-27 14:28:06 -07:00
Panashe M. Fundira
9a7367b960
Mention debug_assert! in assert! doc 2016-07-27 15:16:11 -04:00