]> git.lizzy.rs Git - rust.git/log
rust.git
8 years agoRollup merge of #31830 - frewsxcv:assoc-func, r=steveklabnik
Steve Klabnik [Thu, 10 Mar 2016 11:01:53 +0000 (14:01 +0300)]
Rollup merge of #31830 - frewsxcv:assoc-func, r=steveklabnik

Prefer 'associated function' over 'static method' in msg.

TRPL seems to refer to 'static functions' as 'associated functions'.
This terminology should be used consistently.

8 years agoAuto merge of #32097 - jseyfried:fix_resolution_regression, r=nikomatsakis
bors [Thu, 10 Mar 2016 06:41:48 +0000 (22:41 -0800)]
Auto merge of #32097 - jseyfried:fix_resolution_regression, r=nikomatsakis

Fix a regression in import resolution

This fixes #32089 (caused by #31726) by deducing that name resolution has failed (as opposed to being determinate) in more cases.

r? @nikomatsakis

8 years agoPrefer 'associated function' over 'static method' in msg.
Corey Farwell [Tue, 23 Feb 2016 05:04:30 +0000 (00:04 -0500)]
Prefer 'associated function' over 'static method' in msg.

TRPL seems to refer to 'static functions' as 'associated functions'.
This terminology should be used consistently.

8 years agoAuto merge of #31710 - eddyb:reify, r=nikomatsakis
bors [Thu, 10 Mar 2016 04:16:20 +0000 (20:16 -0800)]
Auto merge of #31710 - eddyb:reify, r=nikomatsakis

Distinguish fn item types to allow reification from nothing to fn pointers.

The first commit is a rebase of #26284, except for files that have moved since.

This is a [breaking-change], due to:
* each FFI function has a distinct type, like all other functions currently do
* all generic parameters on functions are recorded in their item types, e.g.:
`size_of::<u8>` & `size_of::<i8>`'s types differ despite their identical signature.
* function items are zero-sized, which will stop transmutes from working on them

The first two cases are handled in most cases with the new coerce-unify logic,
which will combine incompatible function item types into function pointers,
at the outer-most level of if-else chains, match arms and array literals.

The last case is specially handled during type-checking such that transmutes
from a function item type to a pointer or integer type will continue to work for
another release cycle, but are being linted against. To get rid of warnings and
ensure your code will continue to compile, cast to a pointer before transmuting.

8 years agoAuto merge of #31618 - alexcrichton:no-thread-spawns, r=brson
bors [Thu, 10 Mar 2016 02:18:10 +0000 (18:18 -0800)]
Auto merge of #31618 - alexcrichton:no-thread-spawns, r=brson

Optimize some functions in std::process

* Be sure that `read_to_end` gets directed towards `read_to_end_uninitialized` for all handles
* When spawning a child that guaranteed doesn't need a stdin, don't actually create a stdin pipe for that process, instead just redirect it to /dev/null
* When calling `wait_with_output`, don't spawn threads to read out the pipes of the child. Instead drain all pipes on the calling thread and *then* wait on the process.

Functionally, it is intended that nothing changes as part of this PR

---

Note that this was the same as #31613, and even after that it turned out that fixing Windows was easier than I thought! To copy a comment from over there:

> As some rationale for this as well, it's always bothered me that we've spawned threads in the standard library for this (seems a bit overkill), and I've also been curious lately as to our why our build times for Windows are so much higher than Unix (on the buildbots we have). I have done basically 0 investigation into why, but I figured it can't help to try to optimize Command::output which I believe is called quite a few times during the test suite.

8 years agoAuto merge of #32165 - alexcrichton:fix-broken-master, r=alexcrichton
bors [Thu, 10 Mar 2016 00:21:32 +0000 (16:21 -0800)]
Auto merge of #32165 - alexcrichton:fix-broken-master, r=alexcrichton

collections: Fix broken doc example

PR #32135 was accidentally merged without tests passing, and unfortunately one
of the tests added was broken, so this fixes that.

8 years agocollections: Fix broken doc example
Alex Crichton [Thu, 10 Mar 2016 00:20:32 +0000 (16:20 -0800)]
collections: Fix broken doc example

PR #32135 was accidentally merged without tests passing, and unfortunately one
of the tests added was broken, so this fixes that.

8 years agoMerge pull request #32135 from nathankleyn/improve-docs-for-btreemap
Steve Klabnik [Wed, 9 Mar 2016 22:14:40 +0000 (01:14 +0300)]
Merge pull request #32135 from nathankleyn/improve-docs-for-btreemap

Add missing documentation examples for BTreeMap.

8 years agostd: Don't spawn threads in `wait_with_output`
Alex Crichton [Fri, 12 Feb 2016 18:29:25 +0000 (10:29 -0800)]
std: Don't spawn threads in `wait_with_output`

Semantically there's actually no reason for us to spawn threads as part of the
call to `wait_with_output`, and that's generally an incredibly heavyweight
operation for just reading a few bytes (especially when stderr probably rarely
has bytes!). An equivalent operation in terms of what's implemented today would
be to just drain both pipes of all contents and then call `wait` on the child
process itself.

On Unix we can implement this through some convenient use of the `select`
function, whereas on Windows we can make use of overlapped I/O. Note that on
Windows this requires us to use named pipes instead of anonymous pipes, but
they're semantically the same under the hood.

8 years agoAdd missing "basic usage" sections to docs, fix review comments.
Nathan Kleyn [Wed, 9 Mar 2016 16:39:23 +0000 (16:39 +0000)]
Add missing "basic usage" sections to docs, fix review comments.

8 years agotrans: Keep transmutes from fn item types working, but lint them.
Eduard Burtescu [Wed, 9 Mar 2016 16:35:27 +0000 (18:35 +0200)]
trans: Keep transmutes from fn item types working, but lint them.

8 years agoAuto merge of #32073 - jseyfried:fix_another_trait_privacy_error, r=nikomatsakis
bors [Wed, 9 Mar 2016 15:14:05 +0000 (07:14 -0800)]
Auto merge of #32073 - jseyfried:fix_another_trait_privacy_error, r=nikomatsakis

Fix incorrect trait privacy error

This PR fixes #21670 by using the crate metadata instead of `ExternalExports` to determine if an external item is public.

r? @nikomatsakis

8 years agotypeck: Unify if-else blocks, match arms and array elements by coercing where possible.
Eduard Burtescu [Sun, 6 Mar 2016 15:33:30 +0000 (17:33 +0200)]
typeck: Unify if-else blocks, match arms and array elements by coercing where possible.

8 years agotypeck: Remove the redundant "unifier" from check_expr_with_unifier.
Eduard Burtescu [Mon, 22 Feb 2016 19:39:57 +0000 (21:39 +0200)]
typeck: Remove the redundant "unifier" from check_expr_with_unifier.

8 years agotypeck: Support multiple expressions getting coerced at the same type.
Eduard Burtescu [Mon, 22 Feb 2016 12:06:19 +0000 (14:06 +0200)]
typeck: Support multiple expressions getting coerced at the same type.

8 years agotypeck: don't wastefully clone expressions for cast checks.
Eduard Burtescu [Sun, 21 Feb 2016 19:39:32 +0000 (21:39 +0200)]
typeck: don't wastefully clone expressions for cast checks.

8 years agotypeck: Remove Coerce::unpack_actual_value.
Eduard Burtescu [Sun, 21 Feb 2016 16:58:08 +0000 (18:58 +0200)]
typeck: Remove Coerce::unpack_actual_value.

8 years agoinfer: Take the origin in report_mismatched_types.
Eduard Burtescu [Sun, 21 Feb 2016 16:57:30 +0000 (18:57 +0200)]
infer: Take the origin in report_mismatched_types.

8 years agotypeck: rename mk_assignty to coercion::try.
Eduard Burtescu [Sun, 21 Feb 2016 16:56:35 +0000 (18:56 +0200)]
typeck: rename mk_assignty to coercion::try.

8 years agoinfer: Remove redundant commit_if_ok calls.
Eduard Burtescu [Sun, 21 Feb 2016 16:53:53 +0000 (18:53 +0200)]
infer: Remove redundant commit_if_ok calls.

8 years agoTest that function types are actually zero-sized.
Eduard Burtescu [Sun, 21 Feb 2016 11:52:41 +0000 (13:52 +0200)]
Test that function types are actually zero-sized.

8 years agotests: Avoid transmuting from fn item types.
Eduard Burtescu [Thu, 18 Feb 2016 13:19:38 +0000 (15:19 +0200)]
tests: Avoid transmuting from fn item types.

8 years agotypeck: Use TyFnDef for methods.
Eduard Burtescu [Thu, 18 Feb 2016 13:19:11 +0000 (15:19 +0200)]
typeck: Use TyFnDef for methods.

8 years agotypeck: Introduce reification for fn ptr casts.
Eduard Burtescu [Thu, 18 Feb 2016 13:18:46 +0000 (15:18 +0200)]
typeck: Introduce reification for fn ptr casts.

8 years agotrans: Reify functions & methods to fn ptrs only where necessary.
Eduard Burtescu [Sun, 6 Mar 2016 15:32:47 +0000 (17:32 +0200)]
trans: Reify functions & methods to fn ptrs only where necessary.

8 years agotrans: Remove unused ref_id from monomorphic_fn.
Eduard Burtescu [Wed, 17 Feb 2016 07:11:46 +0000 (09:11 +0200)]
trans: Remove unused ref_id from monomorphic_fn.

8 years agotrans: Move type_of_fn_from_ty callers to type_of.
Eduard Burtescu [Wed, 17 Feb 2016 09:10:46 +0000 (11:10 +0200)]
trans: Move type_of_fn_from_ty callers to type_of.

8 years agoPrint fn type parameters for TyFnDef.
Eduard Burtescu [Tue, 16 Feb 2016 16:37:32 +0000 (18:37 +0200)]
Print fn type parameters for TyFnDef.

8 years agoTrack fn type and lifetime parameters in TyFnDef.
Eduard Burtescu [Tue, 16 Feb 2016 16:36:41 +0000 (18:36 +0200)]
Track fn type and lifetime parameters in TyFnDef.

8 years agoSplit TyBareFn into TyFnDef and TyFnPtr.
Eli Friedman [Sat, 13 Jun 2015 20:15:03 +0000 (13:15 -0700)]
Split TyBareFn into TyFnDef and TyFnPtr.

There's a lot of stuff wrong with the representation of these types:
TyFnDef doesn't actually uniquely identify a function, TyFnPtr is used to
represent method calls, TyFnDef in the sub-expression of a cast isn't
correctly reified, and probably some other stuff I haven't discovered yet.
Splitting them seems like the right first step, though.

8 years agoAuto merge of #31631 - jonas-schievink:agoraphobia, r=nrc
bors [Wed, 9 Mar 2016 13:25:48 +0000 (05:25 -0800)]
Auto merge of #31631 - jonas-schievink:agoraphobia, r=nrc

[breaking-batch] Move more uses of `panictry!` out of libsyntax

8 years agoAuto merge of #30804 - shssoichiro:deny-warnings-msg, r=nrc
bors [Wed, 9 Mar 2016 11:34:55 +0000 (03:34 -0800)]
Auto merge of #30804 - shssoichiro:deny-warnings-msg, r=nrc

Show clearer error message when #![deny(warnings)] escalates a warning

Addresses #30730

8 years agoAuto merge of #32071 - jseyfried:parse_pub, r=nikomatsakis
bors [Wed, 9 Mar 2016 09:45:33 +0000 (01:45 -0800)]
Auto merge of #32071 - jseyfried:parse_pub, r=nikomatsakis

Make errors for unnecessary visibility qualifiers consistent

This PR refactors away `syntax::parse::parser::ParsePub` so that unnecessary visibility qualifiers on variant fields are reported not by the parser but by `privacy::SanePrivacyVisitor` (thanks to @petrochenkov's drive-by improvements in #31919).

r? @nikomatsakis

8 years agoAuto merge of #32023 - matklad:diamonds-and-rust, r=nikomatsakis
bors [Wed, 9 Mar 2016 07:34:34 +0000 (23:34 -0800)]
Auto merge of #32023 - matklad:diamonds-and-rust, r=nikomatsakis

tests: add test for empty <>

Rust allows to specify an empty list of type and lifetime parameters, but there are no tests for it:

```
user@UNIT-326 [12:53:45] [~/projects/rust] [diamonds-and-rust]
-> % grep "<>" -R src/test
src/test/compile-fail/generic-type-params-name-repr.rs:    // And don't print <> at all when there's just defaults.
src/test/debuginfo/issue22656.rs:// when trying to handle a Vec<> or anything else that contains zero-sized
```

So let's add them! Besides it's such a wonderful opportunity to put a reference to Judas Priest band into the branch name ;)

8 years agoAuto merge of #31981 - achanda:unspecified-ip, r=alexcrichton
bors [Wed, 9 Mar 2016 05:13:29 +0000 (21:13 -0800)]
Auto merge of #31981 - achanda:unspecified-ip, r=alexcrichton

Exclude 0.0.0.0 from the list of globally routable addresses

8 years agostd: Don't always create stdin for children
Alex Crichton [Fri, 12 Feb 2016 18:28:03 +0000 (10:28 -0800)]
std: Don't always create stdin for children

For example if `Command::output` or `Command::status` is used then stdin is just
immediately closed. Add an option for this so as an optimization we can avoid
creating pipes entirely.

This should help reduce the number of active file descriptors when spawning
processes on Unix and the number of active handles on Windows.

8 years agostd: Funnel read_to_end through to one location
Alex Crichton [Fri, 12 Feb 2016 08:17:24 +0000 (00:17 -0800)]
std: Funnel read_to_end through to one location

This pushes the implementation detail of proxying `read_to_end` through to
`read_to_end_uninitialized` all the way down to the `FileDesc` and `Handle`
implementations on Unix/Windows. This way intermediate layers will also be able
to take advantage of this optimized implementation.

This commit also adds the optimized implementation for `ChildStdout` and
`ChildStderr`.

8 years agoAuto merge of #32126 - steveklabnik:rollup, r=steveklabnik
bors [Wed, 9 Mar 2016 00:13:19 +0000 (16:13 -0800)]
Auto merge of #32126 - steveklabnik:rollup, r=steveklabnik

Rollup of 7 pull requests

- Successful merges: #31772, #32083, #32084, #32092, #32099, #32103, #32115
- Failed merges:

8 years agoAdd missing documentation examples for BTreeMap.
Nathan Kleyn [Tue, 8 Mar 2016 22:44:40 +0000 (22:44 +0000)]
Add missing documentation examples for BTreeMap.

As part of the ongoing effort to document all methods with examples,
this commit adds the missing examples for the `BTreeMap` collection
type.

This is part of issue #29348.

8 years agoRollup merge of #32115 - tclfs:patch-1, r=apasel422
Steve Klabnik [Tue, 8 Mar 2016 18:44:12 +0000 (21:44 +0300)]
Rollup merge of #32115 - tclfs:patch-1, r=apasel422

Update a spelling inconsistency

L26: "zero cost" -> "zero-cost"

8 years agoRollup merge of #32103 - timmontague:patch-1, r=alexcrichton
Steve Klabnik [Tue, 8 Mar 2016 18:44:11 +0000 (21:44 +0300)]
Rollup merge of #32103 - timmontague:patch-1, r=alexcrichton

Fixed link in ownership documentation

Changed "[vector]" to a link to the vector documentation.

8 years agoRollup merge of #32099 - bluss:doc-string-slicing, r=alexcrichton
Steve Klabnik [Tue, 8 Mar 2016 18:44:11 +0000 (21:44 +0300)]
Rollup merge of #32099 - bluss:doc-string-slicing, r=alexcrichton

Clarify documentation for string slicing (Index impls)

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

This is just one fix in response to #32057

8 years agoRollup merge of #32092 - bluss:operator-overload, r=steveklabnik
Steve Klabnik [Tue, 8 Mar 2016 18:44:11 +0000 (21:44 +0300)]
Rollup merge of #32092 - bluss:operator-overload, r=steveklabnik

Update syntax index with OpAssign traits

book: Update syntax index with OpAssign traits

The traits are stable from Rust 1.8.

8 years agoRollup merge of #32084 - gokhanettin:typo-in-comment, r=alexcrichton
Steve Klabnik [Tue, 8 Mar 2016 18:44:11 +0000 (21:44 +0300)]
Rollup merge of #32084 - gokhanettin:typo-in-comment, r=alexcrichton

Fix typos - mismatching parentheses in comments

Fixes mismatching parentheses in the comments of precision example.

r? @steveklabnik

8 years agoRollup merge of #32083 - nodakai:reference-scoped-enum-alias, r=nikomatsakis
Steve Klabnik [Tue, 8 Mar 2016 18:44:11 +0000 (21:44 +0300)]
Rollup merge of #32083 - nodakai:reference-scoped-enum-alias, r=nikomatsakis

reference.md: clarify the limitation of type alias on an enum

Tentatively define the current behavior as the specification.

Cf. rust-lang/rust#26264, rust-lang/rust#28556, rust-lang/rust#30936

8 years agoRollup merge of #31772 - nodakai:patch-1, r=steveklabnik
Steve Klabnik [Tue, 8 Mar 2016 18:44:10 +0000 (21:44 +0300)]
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.

8 years agoAuto merge of #32009 - alexcrichton:trim-fulldeps, r=brson
bors [Tue, 8 Mar 2016 15:34:28 +0000 (07:34 -0800)]
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.

8 years agoAuto merge of #31995 - alexcrichton:fix-make-clena-empty, r=brson
bors [Tue, 8 Mar 2016 13:34:37 +0000 (05:34 -0800)]
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.

8 years agoAuto merge of #31957 - GuillaumeGomez:error_display, r=brson
bors [Tue, 8 Mar 2016 11:31:30 +0000 (03:31 -0800)]
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

8 years agoAuto merge of #31954 - japaric:rfc243, r=nikomatsakis
bors [Tue, 8 Mar 2016 09:31:04 +0000 (01:31 -0800)]
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

8 years agoAuto merge of #31606 - Ms2ger:ClosureKind, r=eddyb
bors [Tue, 8 Mar 2016 06:57:38 +0000 (22:57 -0800)]
Auto merge of #31606 - Ms2ger:ClosureKind, r=eddyb

Rename ClosureKind variants and stop re-exporting them.

8 years agoUpdate a spelling inconsistency
Tang Chenglong [Tue, 8 Mar 2016 05:42:05 +0000 (13:42 +0800)]
Update a spelling inconsistency

L26: "zero cost" -> "zero-cost"

8 years agoAuto merge of #29734 - Ryman:whitespace_consistency, r=Aatch
bors [Tue, 8 Mar 2016 04:06:17 +0000 (20:06 -0800)]
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

8 years agoupdate error messages in parse-fail tests
Jorge Aparicio [Tue, 8 Mar 2016 02:17:31 +0000 (21:17 -0500)]
update error messages in parse-fail tests

8 years agoAuto merge of #31986 - ashleysommer:emscripten_fixes, r=alexcrichton
bors [Tue, 8 Mar 2016 01:04:36 +0000 (01:04 +0000)]
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 https://github.com/ashleysommer/rust/commit/f1575cff2d631e977038fdba3fa3422ba5f8f2fe applied in order to successfully build libstd with emscripten target.

8 years agoreference.md: clarify the limitation of type alias on an enum
NODA, Kai [Mon, 15 Feb 2016 00:13:08 +0000 (08:13 +0800)]
reference.md: clarify the limitation of type alias on an enum

Cf. rust-lang/rust#26264

Signed-off-by: NODA, Kai <nodakai@gmail.com>
8 years agoAdd a comment
Jeffrey Seyfried [Mon, 7 Mar 2016 22:43:56 +0000 (22:43 +0000)]
Add a comment

8 years agomk: Distribute fewer TARGET_CRATES
Alex Crichton [Wed, 2 Mar 2016 06:00:18 +0000 (22:00 -0800)]
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.

8 years agoClarify documentation for string slicing (Index impls)
Ulrik Sverdrup [Mon, 7 Mar 2016 14:38:02 +0000 (15:38 +0100)]
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

8 years agoimplement the `?` operator
Jorge Aparicio [Sun, 28 Feb 2016 22:38:48 +0000 (17:38 -0500)]
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

8 years agoFixed link
Tim Montague [Mon, 7 Mar 2016 18:30:25 +0000 (10:30 -0800)]
Fixed link

Changed "[vector]" to a link to the vector documentation.

8 years agoAuto merge of #32081 - cmbrandenburg:spell_fix, r=apasel422
bors [Mon, 7 Mar 2016 15:45:11 +0000 (15:45 +0000)]
Auto merge of #32081 - cmbrandenburg:spell_fix, r=apasel422

8 years agoAuto merge of #32078 - japaric:rustbuild-i686-musl, r=alexcrichton
bors [Mon, 7 Mar 2016 13:46:11 +0000 (13:46 +0000)]
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

8 years agoAdd regression test
Jeffrey Seyfried [Mon, 7 Mar 2016 10:03:53 +0000 (10:03 +0000)]
Add regression test

8 years agoDeduce that a name resolution fails (as opposed to being indeterminte) in more cases.
Jeffrey Seyfried [Mon, 7 Mar 2016 10:00:22 +0000 (10:00 +0000)]
Deduce that a name resolution fails (as opposed to being indeterminte) in more cases.

8 years agoAdd a field `pub_outstanding_references` to `NameResolution`.
Jeffrey Seyfried [Mon, 7 Mar 2016 09:59:08 +0000 (09:59 +0000)]
Add a field `pub_outstanding_references` to `NameResolution`.
Add an argument `allow_private_imports` to some methods.

8 years agoAuto merge of #31664 - nodakai:reference-negation, r=steveklabnik
bors [Mon, 7 Mar 2016 09:55:36 +0000 (09:55 +0000)]
Auto merge of #31664 - nodakai:reference-negation, r=steveklabnik

It would be great if someone could check my English.

8 years agoFix building libstd on on emscripten targets.
ashleysommer [Tue, 1 Mar 2016 10:48:03 +0000 (20:48 +1000)]
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.

8 years agoAuto merge of #32051 - steveklabnik:gh9447, r=bluss
bors [Mon, 7 Mar 2016 06:54:36 +0000 (06:54 +0000)]
Auto merge of #32051 - steveklabnik:gh9447, r=bluss

Fixes #9447

8 years agoAuto merge of #32066 - ruud-v-a:fma, r=alexcrichton
bors [Mon, 7 Mar 2016 04:25:27 +0000 (04:25 +0000)]
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.

8 years agobook: Update syntax index with OpAssign traits
Ulrik Sverdrup [Wed, 23 Dec 2015 23:20:12 +0000 (00:20 +0100)]
book: Update syntax index with OpAssign traits

8 years agoAuto merge of #32064 - bluss:str-slice-panic, r=alexcrichton
bors [Mon, 7 Mar 2016 02:28:09 +0000 (02:28 +0000)]
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

8 years agoAuto merge of #32061 - infinity0:master, r=alexcrichton
bors [Mon, 7 Mar 2016 00:30:09 +0000 (00:30 +0000)]
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.

8 years agoAuto merge of #32060 - inrustwetrust:patch-1, r=alexcrichton
bors [Sun, 6 Mar 2016 22:32:35 +0000 (22:32 +0000)]
Auto merge of #32060 - inrustwetrust:patch-1, r=alexcrichton

Using spaces in the install path causes the issue in #31293.

8 years agoFix typos - mismatching parentheses in comments
Gökhan Karabulut [Sun, 6 Mar 2016 20:37:52 +0000 (22:37 +0200)]
Fix typos - mismatching parentheses in comments

8 years agoreference.md: clarify negation.
NODA, Kai [Mon, 15 Feb 2016 00:05:07 +0000 (08:05 +0800)]
reference.md: clarify negation.

Signed-off-by: NODA, Kai <nodakai@gmail.com>
8 years agoupdate the src/liblibc submodule
Jorge Aparicio [Sun, 6 Mar 2016 20:34:20 +0000 (15:34 -0500)]
update the src/liblibc submodule

8 years agoAuto merge of #32056 - nikomatsakis:rustfmt-data-structures, r=alexcrichton
bors [Sun, 6 Mar 2016 19:06:56 +0000 (19:06 +0000)]
Auto merge of #32056 - nikomatsakis:rustfmt-data-structures, r=alexcrichton

8 years agoClarify the semantics of enum discriminants
Kai Noda [Fri, 19 Feb 2016 08:54:21 +0000 (16:54 +0800)]
Clarify the semantics of enum discriminants

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

8 years agoAuto merge of #32055 - mitaa:rdoc-strip-priv-imports, r=alexcrichton
bors [Sun, 6 Mar 2016 17:08:36 +0000 (17:08 +0000)]
Auto merge of #32055 - mitaa:rdoc-strip-priv-imports, r=alexcrichton

fixes #27104

r? @alexcrichton

8 years agoSpelling fix for "because"
Craig M. Brandenburg [Sun, 6 Mar 2016 15:37:30 +0000 (08:37 -0700)]
Spelling fix for "because"

8 years agoAuto merge of #32048 - bluss:overloaded-assign-op, r=eddyb
bors [Sun, 6 Mar 2016 15:10:44 +0000 (15:10 +0000)]
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

8 years agorustbuild: fix cross compilation of libstd to i686-unknown-linux-musl
Jorge Aparicio [Sun, 6 Mar 2016 13:19:51 +0000 (08:19 -0500)]
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.

8 years agoAuto merge of #32041 - arielb1:multiply-inexhaustive, r=eddyb
bors [Sun, 6 Mar 2016 13:13:14 +0000 (13:13 +0000)]
Auto merge of #32041 - arielb1:multiply-inexhaustive, r=eddyb

the assert was invalidated by PR #31020

Fixes #31561

r? @eddyb

8 years agoAuto merge of #32020 - alexcrichton:stabilize-into-ascii, r=brson
bors [Sun, 6 Mar 2016 11:16:15 +0000 (11:16 +0000)]
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`

8 years agoAuto merge of #31967 - mitaa:rdoc-refactor, r=alexcrichton
bors [Sun, 6 Mar 2016 09:16:32 +0000 (09:16 +0000)]
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

8 years agoSplit out rustdoc pass to strip private imports
mitaa [Sat, 5 Mar 2016 10:20:34 +0000 (11:20 +0100)]
Split out rustdoc pass to strip private imports

8 years agoAuto merge of #30884 - durka:inclusive-ranges, r=aturon
bors [Sun, 6 Mar 2016 07:16:41 +0000 (07:16 +0000)]
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)

8 years agoAdd regression test
Jeffrey Seyfried [Sat, 5 Mar 2016 22:45:46 +0000 (22:45 +0000)]
Add regression test

8 years agoRefactor away `ExternalExports`
Jeffrey Seyfried [Sun, 6 Mar 2016 05:46:24 +0000 (05:46 +0000)]
Refactor away `ExternalExports`

8 years agoFix #21670
Jeffrey Seyfried [Sun, 6 Mar 2016 05:41:40 +0000 (05:41 +0000)]
Fix #21670

8 years agoAdd method `visibility` to `CrateStore`
Jeffrey Seyfried [Sat, 5 Mar 2016 22:22:44 +0000 (22:22 +0000)]
Add method `visibility` to `CrateStore`

8 years agoAuto merge of #31920 - jseyfried:fix_spurious_privacy_error, r=nikomatsakis
bors [Sun, 6 Mar 2016 02:29:34 +0000 (02:29 +0000)]
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

8 years agoUpdate tests
Jeffrey Seyfried [Thu, 3 Mar 2016 23:31:44 +0000 (23:31 +0000)]
Update tests

8 years agoRefactor away `ParsePub` and make errors for unnecessary visibility qualifiers consistent
Jeffrey Seyfried [Sun, 28 Feb 2016 15:58:47 +0000 (15:58 +0000)]
Refactor away `ParsePub` and make errors for unnecessary visibility qualifiers consistent

8 years agoAuto merge of #31889 - alexcrichton:update-jemalloc-again, r=nikomatsakis
bors [Sat, 5 Mar 2016 23:44:51 +0000 (23:44 +0000)]
Auto merge of #31889 - alexcrichton:update-jemalloc-again, r=nikomatsakis

Now that https://github.com/jemalloc/jemalloc/commit/767d85061a6fb88ec977bbcd9b429a43aff391e6 is upstream, the relevant deadlocking issue which prompted our downgrade has been resolved. As a result, there's no known issue to *not* upgrade! This also re-enables jemalloc for the pc-windows-gnu target as known issues with that have also been fixed.

Closes #31030

8 years agoAuto merge of #31726 - jseyfried:improve_import_resolution, r=nikomatsakis
bors [Sat, 5 Mar 2016 20:11:37 +0000 (20:11 +0000)]
Auto merge of #31726 - jseyfried:improve_import_resolution, r=nikomatsakis

This PR improves the import resolution algorithm.

First, it records that an import succeeded or failed for one namespace (by calling `decrement_outstanding_references_for` and `try_define_child` if successful) even if it is still indeterminate in the other namespace, fixing #31444.

Second, it starts importing bindings from globs as soon as the glob path is determined.
It maintains links from imported modules to their importers so that when a resolution becomes successful in an imported module, a corresponding binding will be added to the importer module.
It also maintains links from importer modules to imported modules so that we can determine if an undefined name is indeterminate or failing by recursively checking this in the imported modules.
This allows, for example:
```rust
mod foo {
    pub mod baz {}
    pub use bar::baz::*;
}

mod bar {
    pub use foo::*;
}
```
It also allows cycles of pub glob imports, although by to the current shadowing rules, the only way for such a cycle to compile is if each participating module defines no names. Incidentally, this PR lays the groundwork for more permissive feature-gated shadowing rules.

Finally, this PR encapsulates almost all implementation details of import resolution in `resolve_imports` (some of which used to be in `lib.rs`) and refactors reexport recording, shadowed trait collecting, some duplicate checking, and the `private_in_public` lint out of the core import resolution algorithm and into a post-processing pass in `resolve_imports`.

r? @nrc

8 years agoFix panic on string slicing error to truncate the string
Ulrik Sverdrup [Sat, 5 Mar 2016 17:09:14 +0000 (18:09 +0100)]
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.

8 years agoAuto merge of #31700 - oli-obk:skip_double_ended, r=alexcrichton
bors [Sat, 5 Mar 2016 16:58:20 +0000 (16:58 +0000)]
Auto merge of #31700 - oli-obk:skip_double_ended, r=alexcrichton

[Playground Example](https://play.rust-lang.org/?gist=66fdb4fe1cf4d8aa2ad4&version=stable)

8 years agoRegenerate x86 platform intrinsics
Ruud van Asseldonk [Sat, 5 Mar 2016 15:25:58 +0000 (16:25 +0100)]
Regenerate x86 platform intrinsics

The exact command used was:

    $ cd src/etc/platform-intrinsics/x86
    $ python2 ../generator.py --format compiler-defs -i info.json   \
      sse.json sse2.json sse3.json ssse3.json sse41.json sse42.json \
      avx.json avx2.json fma.json                                   \
      > ../../../librustc_platform_intrinsics/x86.rs