Commit Graph

51108 Commits

Author SHA1 Message Date
Steve Klabnik
be506b256f Rollup merge of #31772 - nodakai:patch-1, r=steveklabnik
Clarify the semantics of enum discriminants

cf. https://doc.rust-lang.org/error-index.html#E0082

> The default type for enum discriminants is isize, but it can be adjusted by adding the repr attribute to the enum declaration.

It would be great if anyone could check my English.
2016-03-08 21:44:10 +03:00
bors
eabfc160f8 Auto merge of #32009 - alexcrichton:trim-fulldeps, r=brson
mk: Distribute fewer TARGET_CRATES

Right now everything in TARGET_CRATES is built by default for all non-fulldeps
tests and is distributed by default for all target standard library packages.
Currenly this includes a number of unstable crates which are rarely used such as
`graphviz` and `rbml`>

This commit trims down the set of `TARGET_CRATES`, moves a number of tests to
`*-fulldeps` as a result, and trims down the dependencies of libtest so we can
distribute fewer crates in the `rust-std` packages.
2016-03-08 07:34:28 -08:00
bors
8f0479b2a5 Auto merge of #31995 - alexcrichton:fix-make-clena-empty, r=brson
rustbuild: Fix building from an empty directory

A stray shutil.rmtree happened when it shouldn't have happened, causing the
entire build to fail.
2016-03-08 05:34:37 -08:00
bors
81e0323610 Auto merge of #31957 - GuillaumeGomez:error_display, r=brson
Add error file for E0152

It completes #31818.

However it is not complete yet:
 * test will need to be updated
 * the file name displayed is a bit too unclear.

I'm not sure yet what's the "correct" file name to display. If anyone has an idea on this, it'd be very appreciated.

r? @brson
2016-03-08 03:31:30 -08:00
bors
3af60f831f Auto merge of #31954 - japaric:rfc243, r=nikomatsakis
implement the `?` operator

The `?` postfix operator is sugar equivalent to the try! macro, but is more amenable to chaining:
`File::open("foo")?.metadata()?.is_dir()`.

`?` is accepted on any *expression* that can return a `Result`, e.g. `x()?`, `y!()?`, `{z}?`,
`(w)?`, etc. And binds more tightly than unary operators, e.g. `!x?` is parsed as `!(x?)`.

cc #31436

---

cc @aturon @eddyb
2016-03-08 01:31:04 -08:00
bors
a9ffe67f98 Auto merge of #31606 - Ms2ger:ClosureKind, r=eddyb
Rename ClosureKind variants and stop re-exporting them.
2016-03-07 22:57:38 -08:00
Tang Chenglong
dc829e2b93 Update a spelling inconsistency
L26: "zero cost" -> "zero-cost"
2016-03-08 13:42:05 +08:00
bors
8b7c3f20e8 Auto merge of #29734 - Ryman:whitespace_consistency, r=Aatch
libsyntax: be more accepting of whitespace in lexer

Fixes #29590.

Perhaps this may need more thorough testing?

r? @Aatch
2016-03-07 20:06:17 -08:00
Jorge Aparicio
2de4932453 update error messages in parse-fail tests 2016-03-07 21:17:31 -05:00
bors
4352a8554f Auto merge of #31986 - ashleysommer:emscripten_fixes, r=alexcrichton
Fix building libstd on emscripten targets.

The main cause of the problem is that libstd/os/mod.rs treats emscripten targets as an alias of linux targets, whereas liblibc treats emscripten targets as musl-compliant, so it gets a slightly different struct stat64 defined.
This commit adds conditional compilation checks to use the correct timestamp format on fs metadata functions in the case of compiling to emscripten targets.

This commit also depends needs f1575cff2d applied in order to successfully build libstd with emscripten target.
2016-03-08 01:04:36 +00:00
NODA, Kai
790178f6e5
reference.md: clarify the limitation of type alias on an enum
Cf. rust-lang/rust#26264

Signed-off-by: NODA, Kai <nodakai@gmail.com>
2016-03-08 08:46:49 +08:00
Jeffrey Seyfried
4dc4cae79a Add a comment 2016-03-07 22:43:56 +00:00
Alex Crichton
0d5cfd9117 mk: Distribute fewer TARGET_CRATES
Right now everything in TARGET_CRATES is built by default for all non-fulldeps
tests and is distributed by default for all target standard library packages.
Currenly this includes a number of unstable crates which are rarely used such as
`graphviz` and `rbml`>

This commit trims down the set of `TARGET_CRATES`, moves a number of tests to
`*-fulldeps` as a result, and trims down the dependencies of libtest so we can
distribute fewer crates in the `rust-std` packages.
2016-03-07 13:05:12 -08:00
Ulrik Sverdrup
55671a0290 Clarify documentation for string slicing (Index impls)
- Mention the sugared syntax for the implementations, since it's not
  apparent from the docs that `Index<Range<usize>>` corresponds to
  `&self[a..b]`.
- Be specific in that start <= end and end <= len
2016-03-07 21:05:06 +01:00
Jorge Aparicio
210dd611aa implement the ? operator
The `?` postfix operator is sugar equivalent to the try! macro, but is more amenable to chaining:
`File::open("foo")?.metadata()?.is_dir()`.

`?` is accepted on any *expression* that can return a `Result`, e.g. `x()?`, `y!()?`, `{z}?`,
`(w)?`, etc. And binds more tightly than unary operators, e.g. `!x?` is parsed as `!(x?)`.

cc #31436
2016-03-07 14:39:39 -05:00
Tim Montague
150b1c9217 Fixed link
Changed "[vector]" to a link to the vector documentation.
2016-03-07 10:30:25 -08:00
bors
388ccda455 Auto merge of #32081 - cmbrandenburg:spell_fix, r=apasel422 2016-03-07 15:45:11 +00:00
bors
2f34986eb0 Auto merge of #32078 - japaric:rustbuild-i686-musl, r=alexcrichton
- make sure we copy the third party objects (crt*.o) to the target stage directory.
- apply the x86_64-musl logic also to the i686-musl target.

---

r? @alexcrichton
2016-03-07 13:46:11 +00:00
Jeffrey Seyfried
162fa8642b Add regression test 2016-03-07 11:24:23 +00:00
Jeffrey Seyfried
a0efd7ebdb Deduce that a name resolution fails (as opposed to being indeterminte) in more cases. 2016-03-07 11:24:23 +00:00
Jeffrey Seyfried
61f1f4d21e Add a field pub_outstanding_references to NameResolution.
Add an argument `allow_private_imports` to some methods.
2016-03-07 11:24:20 +00:00
bors
e079afa00b Auto merge of #31664 - nodakai:reference-negation, r=steveklabnik
It would be great if someone could check my English.
2016-03-07 09:55:36 +00:00
ashleysommer
660bbf4f6f Fix building libstd on on emscripten targets.
Squashed 10 commits:
1) The main cause of the problem is that libstd/os/mod.rs treats emscripten targets as an alias of linux targets, whereas liblibc treats emscripten targets as musl-compliant, so it gets a slightly different struct stat64 defined.
This commit adds conditional compilation checks to use the correct timestamp format on fs metadata functions in the case of compiling to emscripten targets.

2) Update previous commit to comply with rust formatting standards.
Removed tab characters, remove trailing whitespaces.

3) Move emscripten changes into their own file under libstd/os/emscripten
Put libstd/os/linux/fs back to the way it was.

4) Cannot use stat.st_ctim on emscripten to get created time.

5) Remove compile-time conditionals for target_env = musl, it looks like musl builds compile fine already.

6) Undone some formatting changes that are no longer needed,
Removed some more target_env="musl" compilation checks that I missed from my previous commit.

7) upgrade to liblibc e19309c, it fixes the differences in the musl stat and stat64 definitions.

8) Undo the compile-time checks to check for emscripten (or musl targets) in the FileAttr struct.
No longer needed after updating liblibc to e19309c.

9) Change the MetadataExt implementation of emscripten fs.rs module to match the changes in new liblibc.

10) remove a stray return statement, should have been removed in the previous commit.
2016-03-07 17:22:55 +10:00
bors
79f914fdb9 Auto merge of #32051 - steveklabnik:gh9447, r=bluss
Fixes #9447
2016-03-07 06:54:36 +00:00
bors
6d262db448 Auto merge of #32066 - ruud-v-a:fma, r=alexcrichton
This adds support for fused multiply-add and multiply-subtract vector intrinsics for 128 and 256-bit vectors of `f32` and `f64`. These correspond to the intrinsics [listed here](https://software.intel.com/en-us/node/523929) except for the `_ss` and `_sd` variants. The intrinsics added are:

 * `fmadd`
 * `fmaddsub`
 * `fmsub`
 * `fmsubadd`
 * `fnmadd`
 * `fnmsub`

The “fma” target feature must be enabled by passing `-C target-feature=+fma` to rustc when using these, otherwise LLVM will complain.

I verified locally that the `x86_mm256_fmadd_ps` and `x86_mm256_fmsub_ps` work.
2016-03-07 04:25:27 +00:00
Ulrik Sverdrup
63933375e8 book: Update syntax index with OpAssign traits 2016-03-07 05:17:27 +01:00
bors
6eb81a1f3b Auto merge of #32064 - bluss:str-slice-panic, r=alexcrichton
Fix panic on string slicing error to truncate the string

The string may be arbitrarily long, but we want to limit the panic
message to a reasonable length. Truncate the string if it is too long
(simply to char boundary).

Also add details to the start <= end message. I think it's ok to flesh
out the code here, since it's in a cold function.

Fixes #32063
2016-03-07 02:28:09 +00:00
bors
998a6720b6 Auto merge of #32061 - infinity0:master, r=alexcrichton
Adding -Wno-error is more reliable and simple than trying to modify existing
flags. We've been using this in Debian already for the past few releases.
Making this change also encourages future maintainers towards "best practises".
Also take the opportunity to use the same method at all places in the file.
2016-03-07 00:30:09 +00:00
bors
3340cb3df9 Auto merge of #32060 - inrustwetrust:patch-1, r=alexcrichton
Using spaces in the install path causes the issue in #31293.
2016-03-06 22:32:35 +00:00
Gökhan Karabulut
2f6f714d85 Fix typos - mismatching parentheses in comments 2016-03-06 22:50:53 +02:00
NODA, Kai
559683cded
reference.md: clarify negation.
Signed-off-by: NODA, Kai <nodakai@gmail.com>
2016-03-07 04:42:14 +08:00
Jorge Aparicio
f164433a11 update the src/liblibc submodule 2016-03-06 15:34:20 -05:00
bors
979aaafc51 Auto merge of #32056 - nikomatsakis:rustfmt-data-structures, r=alexcrichton 2016-03-06 19:06:56 +00:00
Kai Noda
969d027e35
Clarify the semantics of enum discriminants
cf. https://doc.rust-lang.org/error-index.html#E0082
2016-03-07 02:45:10 +08:00
bors
72d588a620 Auto merge of #32055 - mitaa:rdoc-strip-priv-imports, r=alexcrichton
fixes #27104

r? @alexcrichton
2016-03-06 17:08:36 +00:00
Craig M. Brandenburg
b517256941 Spelling fix for "because" 2016-03-06 08:37:30 -07:00
bors
71f4658c14 Auto merge of #32048 - bluss:overloaded-assign-op, r=eddyb
Do not trigger unused_assignments for overloaded AssignOps

If `v` were a type with some kind of indirection, so that `v += 1` would
have an effect even if `v` were not used anymore, the unused_assignments lint
would mark a false positive.

This exempts overloaded (non-primitive) assign ops from being treated as
assignments (they are method calls).

The previous compile-fail tests that ensure x += 1 can trigger for
primitive types continue to pass. Added a representative test for the
"view" indirection.

Fixes #31895
2016-03-06 15:10:44 +00:00
Jorge Aparicio
0b7fc0653b rustbuild: fix cross compilation of libstd to i686-unknown-linux-musl
- make sure we copy the third party objects (crt*.o) to the target stage directory.
- apply the x86_64-musl logic also to the i686-musl target.
2016-03-06 08:19:51 -05:00
bors
80922a7ad8 Auto merge of #32041 - arielb1:multiply-inexhaustive, r=eddyb
the assert was invalidated by PR #31020

Fixes #31561

r? @eddyb
2016-03-06 13:13:14 +00:00
bors
c116ae35cf Auto merge of #32020 - alexcrichton:stabilize-into-ascii, r=brson
These were intended to land in stable 1.8 but were just waiting for the
implementation PR, so now they're landing. Specifically this PR stabilizes:

* `AsciiExt::into_ascii_uppercase`
* `AsciiExt::into_ascii_lowercase`
* `AsciiExt for Vec<u8>`
* `AsciiExt for String`
2016-03-06 11:16:15 +00:00
bors
21fb3ce71b Auto merge of #31967 - mitaa:rdoc-refactor, r=alexcrichton
This is mostly cleanup of individual code bits and code reuse for `clean::Attribute` handling.

The only change in behaviour should be that emitted sources are now being recorded and queried when trying to create src-links to local source-files.

r? @alexcrichton
2016-03-06 09:16:32 +00:00
mitaa
688e52201e Split out rustdoc pass to strip private imports 2016-03-06 08:18:58 +01:00
bors
8484831d29 Auto merge of #30884 - durka:inclusive-ranges, r=aturon
This PR implements [RFC 1192](https://github.com/rust-lang/rfcs/blob/master/text/1192-inclusive-ranges.md), which is triple-dot syntax for inclusive range expressions. The new stuff is behind two feature gates (one for the syntax and one for the std::ops types). This replaces the deprecated functionality in std::iter. Along the way I simplified the desugaring for all ranges.

This is my first contribution to rust which changes more than one character outside of a test or comment, so please review carefully! Some of the individual commit messages have more of my notes. Also thanks for putting up with my dumb questions in #rust-internals.

- For implementing `std::ops::RangeInclusive`, I took @Stebalien's suggestion from https://github.com/rust-lang/rfcs/pull/1192#issuecomment-137864421. It seemed to me to make the implementation easier and increase type safety. If that stands, the RFC should be amended to avoid confusion.
- I also kind of like @glaebhoerl's [idea](https://github.com/rust-lang/rfcs/pull/1254#issuecomment-147815299), which is unified inclusive/exclusive range syntax something like `x>..=y`. We can experiment with this while everything is behind a feature gate.
- There are a couple of FIXMEs left (see the last commit). I didn't know what to do about `RangeArgument` and I haven't added `Index` impls yet. Those should be discussed/finished before merging.

cc @Gankro since you [complained](https://www.reddit.com/r/rust/comments/3xkfro/what_happened_to_inclusive_ranges/cy5j0yq)
cc #27777 #30877 rust-lang/rust#1192 rust-lang/rfcs#1254
relevant to #28237 (tracking issue)
2016-03-06 07:16:41 +00:00
Jeffrey Seyfried
b06a1cc760 Add regression test 2016-03-06 05:54:58 +00:00
Jeffrey Seyfried
2998564615 Refactor away ExternalExports 2016-03-06 05:46:49 +00:00
Jeffrey Seyfried
cbae67aea7 Fix #21670 2016-03-06 05:46:47 +00:00
Jeffrey Seyfried
c63054d632 Add method visibility to CrateStore 2016-03-06 05:37:30 +00:00
bors
45f0ce71c1 Auto merge of #31920 - jseyfried:fix_spurious_privacy_error, r=nikomatsakis
This PR allows using methods from traits that are visible but are defined in an inaccessible module (fixes #18241). For example,
```rust
mod foo {
    pub use foo::bar::Tr;
    mod bar { // This module is inaccessible from `g`
        pub trait Tr { fn f(&self) {} }
    }
}
fn g<T: foo::Tr>(t: T) {
    t.f(); // Currently, this is a privacy error even though `foo::Tr` is visible
}
```

After this PR, it will continue to be a privacy error to use a method from a trait that is not visible. This can happen when a public trait inherits from a private trait (in violation of the `public_in_private` lint) -- see @petrochenkov's example in #28504.
r? @nikomatsakis
2016-03-06 02:29:34 +00:00
Jeffrey Seyfried
498059bb65 Update tests 2016-03-06 00:31:43 +00:00
Jeffrey Seyfried
a904ba2dd2 Refactor away ParsePub and make errors for unnecessary visibility qualifiers consistent 2016-03-06 00:30:53 +00:00