Commit Graph

55305 Commits

Author SHA1 Message Date
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
Stefan Schindler
ca259666a5 Reduce git clone --depth from 50 to 1 2016-07-28 11:48:43 +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
Aravind Gollakota
4ffbb5dd63 rustbuild: Ensure PATH does not contain invalid character " 2016-07-27 21:19:51 -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
Panashe M. Fundira
8760b1dd26
Revert section about panic! in assert! doc 2016-07-27 15:03:23 -04:00
Panashe M. Fundira
91acc3977b
Correct minor typo in debug_assert doc 2016-07-27 15:01:43 -04:00
Alex Burka
29546dd06d remove claim about searching through nested fields for the nullable type, even though that is how it works 2016-07-27 13:58:51 -04:00
Alex Burka
1319b293c6 fix typo 2016-07-27 13:58:51 -04:00
Alex Burka
8e7abea93e revert libc changes 2016-07-27 13:58:51 -04:00
Alex Burka
54ecc210ec hack to make example compile 2016-07-27 13:58:51 -04:00
Alex Burka
5276b29670 change confusing wording about discriminant 2016-07-27 13:58:51 -04:00
Alex Burka
fae3335272 extern fns require named parameters
Not sure the example is going to stay, but I can try to pass Travis for the bragging rights.
2016-07-27 13:58:51 -04:00
Alex Burka
1cceca8dfd foreign function interface interface 2016-07-27 13:58:51 -04:00
Alex Burka
0016af5f13 not just a single field 2016-07-27 13:58:51 -04:00
Alex Burka
84366b6f28 recursion 2016-07-27 13:58:51 -04:00
Alex Burka
cc2fc48dec expand nullable pointer example 2016-07-27 13:58:51 -04:00
Alex Burka
48ce20653a generics-agnostic description 2016-07-27 13:58:51 -04:00
Alex Burka
032ea41e99 book/ffi: nullable pointer, libc cleanups
Expand the "nullable pointer optimization" section with a code example.

Change examples to use std::os::raw instead of libc, when applicable.
2016-07-27 13:58:51 -04:00
Wesley Wiser
2dbf00e2bb Only export #[no_mangle] extern symbols during LTO
Previously, all extern symbols were exported even when performing LTO.
Now, we only export symbols that are also marked #[no_mangle].

Fixes #34985
2016-07-27 13:58:22 -04:00
Jonathan Creekmore
54c61ff959 librustc_back: filter targets for only valid ones
Since we can know which targets are instantiable on a particular host,
it does not make sense to list invalid targets in the target print code.
Filter the list of targets to only include the targets that can be
instantiated.
2016-07-27 10:29:43 -07:00
Jonathan Creekmore
bd194a77d5 librustc_back: json tests for builtin targets
Expand the supported_targets!() macro to also generate a set of
JSON encode/decode tests to verify that the parser will encode
and decode all of the fields needed for all of the builtin targets.
Additionally, add PartialEq to Target and TargetOptions in support
of the tests.
2016-07-27 10:29:43 -07:00
Doug Goldstein
eafecbf868 librustc_back: convert fn target() to return Result
Change all the target generation functions to return a Result<Target,
String> so that targets that are unable to be instantiated can be
expressed as an Err instead of a panic!(). This should improve #33497 as
well.
2016-07-27 10:28:40 -07:00
Doug Goldstein
c7b6ed27bc librustc_back: add ToJson trait to Target
Target's can already be built up from JSON files as well as built into
librustc_back so this adds the ability to convert any Target back into
JSON.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
2016-07-27 10:24:36 -07:00
Doug Goldstein
9c83fa41b0 librustc_back: expose all target options via JSON
Not all TargetOptions are exposed via the JSON interface to create
different targets. This exposes all the missing items and reorders them
to match the structure so that it is easier in the future to identify
missing items.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
2016-07-27 10:24:36 -07:00
bors
29abe5ec71 Auto merge of #34856 - jseyfried:refactor_reset_tls, r=nrc
Avoid reseting the thread local interner at the beginning of `phase_1_parse_input`

The thread local interner is used before `phase_1_parse_input` to create `InternedString`s, which currently wrap `Rc<String>`s. Once `InternedString` is refactored to be an interned string id (like `Name`), resetting will invalidate everything that was interned before `phase_1_parse_input`.

The resets were only useful for the `rusti` project, which can now use `driver::reset_thread_local_state`.

r? @nrc
2016-07-27 10:16:36 -07:00
Panashe M. Fundira
a72767970a
Update docs for assert! and debug_assert! 2016-07-27 13:12:35 -04:00
Paul Woolcock
ac73335f2f implement From<Vec<char>> and From<&'a [char]> for String
Though there are ways to convert a slice or vec of chars into a string,
it would be nice to be able to just do `String::from(['a', 'b', 'c'])`,
so this PR implements `From<Vec<char>>` and `From<&'a [char]>` for
String.
2016-07-27 12:07:49 -04:00
bors
a373b8437b Auto merge of #33363 - japaric:target, r=japaric
fix built-in target detection

previously the logic was accepting wrong triples (like
`x86_64_unknown-linux-musl`) as valid ones (like `x86_64-unknown-linux-musl`) if
they contained an underscore instead of a dash.

fixes #33329

---

r? @brson

I wanted to use a compile-fail test at first. But, you can't pass an extra `--target` flag to `rustc` for those because they already call `rustc --target $HOST` so you get a `error: Option 'target' given more than once.`. The run-make test used here works fine though.
2016-07-27 05:50:27 -07:00