Commit Graph

51078 Commits

Author SHA1 Message Date
Eduard Burtescu
3855fa99ca trans: Keep transmutes from fn item types working, but lint them. 2016-03-09 18:35:27 +02:00
Eduard Burtescu
eb926dd4b7 typeck: Unify if-else blocks, match arms and array elements by coercing where possible. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
d2c6bef493 typeck: Remove the redundant "unifier" from check_expr_with_unifier. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
ad91f19957 typeck: Support multiple expressions getting coerced at the same type. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
3ff4c347c7 typeck: don't wastefully clone expressions for cast checks. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
dbab236a9e typeck: Remove Coerce::unpack_actual_value. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
dc37664c94 infer: Take the origin in report_mismatched_types. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
871a1e1cf8 typeck: rename mk_assignty to coercion::try. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
2b1bd80f34 infer: Remove redundant commit_if_ok calls. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
1b7fb17745 Test that function types are actually zero-sized. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
61a77b38e2 tests: Avoid transmuting from fn item types. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
644d6390be typeck: Use TyFnDef for methods. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
847f00738b typeck: Introduce reification for fn ptr casts. 2016-03-09 16:45:29 +02:00
Eduard Burtescu
8f07f8a4fa trans: Reify functions & methods to fn ptrs only where necessary. 2016-03-09 16:45:28 +02:00
Eduard Burtescu
c284099f56 trans: Remove unused ref_id from monomorphic_fn. 2016-03-09 16:45:28 +02:00
Eduard Burtescu
0c01f6e149 trans: Move type_of_fn_from_ty callers to type_of. 2016-03-09 16:45:28 +02:00
Eduard Burtescu
e4e1242769 Print fn type parameters for TyFnDef. 2016-03-09 16:45:28 +02:00
Eduard Burtescu
ffa0860467 Track fn type and lifetime parameters in TyFnDef. 2016-03-09 16:45:28 +02:00
Eli Friedman
b423a0f9ef 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.
2016-03-09 16:45:28 +02:00
bors
4b868411af Auto merge of #30804 - shssoichiro:deny-warnings-msg, r=nrc
Show clearer error message when #![deny(warnings)] escalates a warning

Addresses #30730
2016-03-09 03:34:55 -08:00
bors
bb868f17fa 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
2016-03-09 01:45:33 -08:00
bors
e1704f76ef 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 ;)
2016-03-08 23:34:34 -08:00
bors
d289e1a145 Auto merge of #31981 - achanda:unspecified-ip, r=alexcrichton
Exclude 0.0.0.0 from the list of globally routable addresses
2016-03-08 21:13:29 -08:00
bors
567937d626 Auto merge of #32126 - steveklabnik:rollup, r=steveklabnik
Rollup of 7 pull requests

- Successful merges: #31772, #32083, #32084, #32092, #32099, #32103, #32115
- Failed merges:
2016-03-08 16:13:19 -08:00
Steve Klabnik
33fe4d10fc Rollup merge of #32115 - tclfs:patch-1, r=apasel422
Update a spelling inconsistency

L26: "zero cost" -> "zero-cost"
2016-03-08 21:44:12 +03:00
Steve Klabnik
bf9610ddbb Rollup merge of #32103 - timmontague:patch-1, r=alexcrichton
Fixed link in ownership documentation

Changed "[vector]" to a link to the vector documentation.
2016-03-08 21:44:11 +03:00
Steve Klabnik
13ba07b854 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
2016-03-08 21:44:11 +03:00
Steve Klabnik
e35e5c434b 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.
2016-03-08 21:44:11 +03:00
Steve Klabnik
477c4c37f0 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
2016-03-08 21:44:11 +03:00
Steve Klabnik
86fb351059 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
2016-03-08 21:44:11 +03:00
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
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
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