Commit Graph

58453 Commits

Author SHA1 Message Date
Tamir Duberstein
7367db6fcc
tidy/bins: fix false positive on non checked-in binary
`git ls-files` now exits zero when called with a missing file; check
that the file is included in the output before reporting a checked-in
binary. Observed with git 2.10.1 and tripped by a symlink created by
tests:

src/test/run-make/issue-26006/out/time/deps/liblibc.rlib -> out/libc/liblibc.rlib
2016-10-27 21:35:57 -04:00
Federico Mena Quintero
9f8d4ee74d reference: Mention --crate-type=cdylib in the Linkage section 2016-10-27 20:23:23 -05:00
bors
5530030420 Auto merge of #37035 - petrochenkov:selfstruct, r=eddyb
Support `Self` in struct expressions and patterns

Struct expressions and patterns generally support type aliases `Alias { field: 10 }` i.e. they already have to work with `ty::Ty` to do their job. `Self` is a type alias (when it's not a type parameter) => struct expressions and patterns should support `Self`.

Typical example:
```
impl MyStruct {
    fn new() -> Self {
        Self { a: 10, b: "Hello" }
    }
}
```

The first commit does some preparations and cleanups, see the commit message for  details.
This also fixes couple of bugs related to aliases in struct paths (fixes https://github.com/rust-lang/rust/issues/36286).

EDIT:
Since struct expressions and patterns always work with `ty::Ty` now, associated paths in them are also supported. If associated type `A::B` successfully resolves to a struct (or union) type, then `A::B { /* fields */ }` is a valid expression/pattern. This will become more important when enum variants are treated as [associated items](https://github.com/rust-lang/rust/issues/26264#issuecomment-250603946).

r? @eddyb
2016-10-27 18:18:56 -07:00
Nick Cameron
15821caee9 Split up libproc_macro_plugin
Separate the plugin code from non-plugin code to break a potential cycle in crates.

This will allow us to merge the new libproc_macro_tokens into libproc_macro.
2016-10-28 12:17:17 +13:00
Nick Cameron
16e1d36c08 Give variant spans used in derives the correct expansion id
This fixes a problem in save-analysis where it mistakes a path to a variant as the variant itself.
2016-10-28 10:49:45 +13:00
Marcin Fatyga
4e2822c5c2 Rename ordering chaining functions. 2016-10-27 23:31:10 +02:00
bors
3f4408347d Auto merge of #37350 - srinivasreddy:meta_2, r=nrc
run rustfmt on librustc_metadata folder
2016-10-27 12:51:49 -07:00
Vadim Petrochenkov
8a38928b44 Address comments + Fix rebase 2016-10-27 22:20:25 +03:00
Vadim Petrochenkov
eada951f9c Support Self in struct expressions and patterns 2016-10-27 22:14:42 +03:00
Vadim Petrochenkov
a9f91b1b0e Preparations and cleanup
Diagnostics for struct path resolution errors in resolve and typeck are unified.
Self type is treated as a type alias in few places (not reachable yet).
Unsafe cell is seen in constants even through type aliases.
All checks for struct paths in typeck work on type level.
2016-10-27 22:14:41 +03:00
Alex Crichton
de80670f74 Disable jemalloc on aarch64/powerpc
Sounds like jemalloc is broken on systems which differ in page size than the
host it was compiled on (unless an option was passed). This unfortunately
reduces the portability of binaries created and can often make Rust segfault by
default. For now let's patch over this by disabling jemalloc until we can figure
out a better solution.

Closes #36994
Closes #37320
cc jemalloc/jemalloc#467
2016-10-27 08:08:33 -07:00
bors
07436946b6 Auto merge of #37245 - goffrie:recovery, r=nrc
Recover out of an enum or struct's braced block.

If we encounter a syntax error inside of a braced block, then we should
fail by consuming the rest of the block if possible.
This implements such recovery for enums and structs.

Fixes #37113.
2016-10-27 07:19:16 -07:00
Ulrik Sverdrup
9568f44842 Add documentation for Read, Write impls for slices and Vec
The Write impls for &[u8] and Vec<u8> are quite different, and we need this to
be reflected in the docs.

These documentation comments will be visible on the respective type's
page in the trait impls section.
2016-10-27 15:25:14 +02:00
bors
a0e31a5bfc Auto merge of #36894 - petrochenkov:deny, r=nikomatsakis
Make sufficiently old or low-impact compatibility lints deny-by-default

Tracking issues are updated/created when necessary.
Needs crater run before proceeding.

r? @nikomatsakis
2016-10-27 04:06:31 -07:00
Vadim Petrochenkov
2a85211040 Make sufficiently old or low-impact compatibility lints deny-by-default 2016-10-27 12:06:03 +03:00
bors
46d39f3329 Auto merge of #37128 - nrc:depr-attr, r=@alexcrichton
Deprecate no_debug and custom_derive

r? @nikomatsakis
2016-10-27 00:51:58 -07:00
Zack M. Davis
ef6a07221d deduplicate one-time diagnostics on lint ID as well as span and message
Some lint-level attributes (like `bad-style`, or, more dramatically,
`warnings`) can affect more than one lint; it seems fairer to point out
the attribute once for each distinct lint affected. Also, a UI test is
added. This remains in the matter of #24690.
2016-10-26 23:24:59 -07:00
Zack M. Davis
8d1da8452c one-time diagnostics are only one-time for humans, not JSON-eating tools
Jonathan D. Turner pointed out that we don't want to dedup in JSON
mode. Since the compile-test runner uses JSON output, we regrettably
need to revert the edits to existing tests; one imagines that testing
for one-time diagnosticity for humans will have to be added as a UI
test.

This remains in the matter of #24690.
2016-10-26 22:42:20 -07:00
bors
bc283c9487 Auto merge of #11994 - eddyb:struct-literal-field-shorthand, r=nrc
Implement field shorthands in struct literal expressions.

Implements #37340 in a straight-forward way: `Foo { x, y: f() }` parses as `Foo { x: x, y: f() }`.
Because of the added `is_shorthand` to `ast::Field`, this is `[syntax-breaking]` (cc @Manishearth).

* [x] Mark the fields as being a shorthand (the exact same way we do it in patterns), for pretty-printing.
* [x] Gate the shorthand syntax with `#![feature(field_init_shorthand)]`.
* [x] Don't parse numeric field as identifiers.
* [x] Arbitrary field order tests.
2016-10-26 21:47:25 -07:00
Robin Stocker
de5172ce5f Add semicolon to "Maybe a missing extern crate foo" message
I had it a couple of times that I was missing the "extern crate" line
after I introduced a new dependency. So I copied the text from the
message and inserted it into the beginning of my code, only to find the
compiler complaining that I was missing the semicolon. (I forgot to add
it after the text that I had pasted.)

There's a similar message which does include the semicolon, namely
"help: you can import it into scope: `use foo::Bar;`". I think the two
messages should be consistent, so this change adds it for "extern
crate".
2016-10-27 15:24:08 +11:00
Zack M. Davis
95805ee627 save a borrow by using return value of HashSet::insert
Thanks to Niko Matsakis's review for the suggestion.
2016-10-26 20:52:54 -07:00
Geoffry Song
c9036ccffe Recover out of an enum or struct's braced block.
If we encounter a syntax error inside of a braced block, then we should
fail by consuming the rest of the block if possible.
This implements such recovery for enums and structs.

Fixes #37113.
2016-10-26 22:27:14 -04:00
Nick Cameron
8c4a39cd95 review changes 2016-10-27 14:44:05 +13:00
bors
4a584637b0 Auto merge of #36695 - arielb1:literal-match, r=eddyb
Refactor match checking to use HAIR

Refactor match checking to use HAIR instead of HIR, fixing quite a few bugs in the process.

r? @eddyb
2016-10-26 18:18:57 -07:00
Eduard Burtescu
9908711e5e Implement field shorthands in struct literal expressions. 2016-10-27 03:15:13 +03:00
Ulrik Sverdrup
5dc9db541e vec: Remove the Vec specialization for .extend()
This now produces as good code (with optimizations) using the TrustedLen
codepath.
2016-10-27 01:45:31 +02:00
Nick Cameron
9322332140 deprecation message for custom derive 2016-10-27 11:44:42 +13:00
Nick Cameron
b7675cf04a Deprecate custom_derive
Has a custom deprecation since deprecating features is not supported and is a pain to implement
2016-10-27 11:44:42 +13:00
Nick Cameron
d1b08b136c deprecate no_debug 2016-10-27 11:44:42 +13:00
Nick Cameron
121e903f17 Add possibility of deprecating attributes 2016-10-27 11:44:42 +13:00
Ulrik Sverdrup
2411be5cae impl TrustedLen for vec::IntoIter 2016-10-27 00:18:13 +02:00
Ulrik Sverdrup
8b2108c6cb core::ptr: Add .wrapping_offset() methods
.wrapping_offset() exposes the arith_offset intrinsic in the core
module. This is the first step in making it possible to stabilize the
interface later.

`arith_offset` is a useful tool for developing iterators for two
reasons:

1. `arith_offset` is used by the slice's iterator, the most important
   iterator in libcore, and it is natural that Rust users need the same
   power available to implement similar iterators.
2. It is a good way to implement raw pointer iterations with step
   greater than one.

The name seems to fit the style of methods like "wrapping_add".
2016-10-27 00:07:26 +02:00
bors
c59cb71d97 Auto merge of #37419 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 7 pull requests

- Successful merges: #36206, #37144, #37391, #37394, #37396, #37398, #37414
- Failed merges:
2016-10-26 14:58:16 -07:00
Guillaume Gomez
48b022838b Rollup merge of #37414 - thepowersgang:fix-typo, r=nrc
Fix typo in libsyntax, it was bothering me

May I present - the world's shortest diff.
2016-10-26 23:49:27 +02:00
Guillaume Gomez
dc3b3afda6 Rollup merge of #37398 - zoffixznet:patch-1, r=GuillaumeGomez
Fix typo
2016-10-26 23:49:27 +02:00
Guillaume Gomez
46c5c6ccfd Rollup merge of #37396 - mikhail-m1:e0221, r=jonathandturner
Make error E0221 more helpful

fix #35970 as part of #35233
r? @jonathandturner
2016-10-26 23:49:27 +02:00
Guillaume Gomez
cf6f885e75 Rollup merge of #37394 - cramertj:cramertj/unused-import-with-id, r=GuillaumeGomez
Add identifier to unused import warnings

Fix #37376.

For some reason, though, I'm getting warnings with messages like "76:9: 76:16: unused import: `self::g`" instead of "unused import: `self::g`". @pnkfelix Any ideas what might be causing this?
2016-10-26 23:49:27 +02:00
Guillaume Gomez
12eefac766 Rollup merge of #37391 - vtduncan:vec-docs, r=GuillaumeGomez
Broken links in Vec docs

Fixed some issues with quote/bracket nesting and made quoting more consistent.

r? @steveklabnik
2016-10-26 23:49:27 +02:00
Guillaume Gomez
6a1d4e911a Rollup merge of #37144 - eulerdisk:fix_37126, r=nrc
save_analysis: Dump data only if get_path_data doesn't fail to resolve a path.

Solves #37126

Dump data only if `get_path_data` doesn't fail to resolve a path.
`get_path_data` returns `None` when it have to deals with `Def::Err`, which is used as placeholder for a failed resolution.

Tell me if this is good enough, maybe I have to add some tests ?

r? @nrc
2016-10-26 23:49:26 +02:00
Ariel Ben-Yehuda
3f9ebb48cf add back test for issue #6804 2016-10-27 00:38:18 +03:00
Ariel Ben-Yehuda
41578507a6 flatten nested slice patterns in HAIR construction
nested slice patterns have the same functionality as non-nested
ones, so flatten them in HAIR construction.

Fixes #26158.
2016-10-26 23:52:03 +03:00
Ariel Ben-Yehuda
8d3e89b484 handle mixed byte literal and byte array patterns
Convert byte literal pattern to byte array patterns when they are both
used together. so matching them is properly handled. I could've done the
conversion eagerly, but that could have caused a bad worst-case for
massive byte-array matches.

Fixes #18027.
Fixes #25051.
Fixes #26510.
2016-10-26 23:10:30 +03:00
Ariel Ben-Yehuda
76fb7d90ec remove StaticInliner and NaN checking
NaN checking was a lint for a deprecated feature. It can go away.
2016-10-26 22:41:17 +03:00
Ariel Ben-Yehuda
37418b850f stop using MatchCheckCtxt to hold the param-env for check_match 2016-10-26 22:41:17 +03:00
Ariel Ben-Yehuda
e313d8b290 change match checking to use HAIR
no intended functional changes
2016-10-26 22:41:17 +03:00
Ariel Ben-Yehuda
04a92a1f56 un-break the construct_witness logic
Fixes #35609.
2016-10-26 22:41:17 +03:00
Ariel Ben-Yehuda
abae5e7e25 split the exhaustiveness-checking logic to its own module
`check_match` is now left with its grab bag of random checks.
2016-10-26 22:41:17 +03:00
Ariel Ben-Yehuda
48387c8bd9 refactor the pat_is_catchall logic 2016-10-26 22:41:17 +03:00
Ariel Ben-Yehuda
732f22745d move hair::cx::pattern to const_eval 2016-10-26 22:41:17 +03:00
Ariel Ben-Yehuda
bb5afb4121 use a struct abstraction in check_match 2016-10-26 22:41:16 +03:00