Commit Graph

38035 Commits

Author SHA1 Message Date
Manish Goregaokar efdf16b72f Rollup merge of #21964 - semarie:openbsd-env, r=alexcrichton
- add `_SC_GETPW_R_SIZE_MAX` constant
- declare `struct passwd`
- convert `load_self` to `current_exe`

Note: OpenBSD don't provide system function to return a valuable Path
for `env::current_exe`. The implementation is currently based on the
value of `argv[0]`, which couldn't be used when executable is called via
PATH.
2015-02-06 16:21:05 +05:30
Manish Goregaokar 5c172ad03c Rollup merge of #21976 - mzabaluev:fix-copy-mut-lifetime, r=alexcrichton
Part of #21923
2015-02-06 16:21:04 +05:30
Manish Goregaokar ce3a4afd73 Rollup merge of #21980 - pnkfelix:more-robust-span-to-snippet, r=huonw
This can be considered partial work on #8256.

The main observable change: macro expansion sometimes results in spans where `lo > hi`; so for now, when we have such a span, do not attempt to return a snippet result.

(Longer term, we might think about whether we could still present a snippet for the cases where this arises, e.g. perhaps by showing the whole macro as the snippet, assuming that is the sole cause of such spans; or by somehow looking up the closest AST node that holds both `lo` and `hi`, and showing that.)

As a drive-by, revised the API to return a `Result` rather than an `Option`, with better information-packed error value that should help us (and maybe also our users) identify the causes of such problems in the future.  Ideally the call-sites that really want an actual snippet would be updated to catch the newly added `Err` case and print something meaningful about it, but that is not part of this PR.
2015-02-06 16:21:03 +05:30
Manish Goregaokar 60c9f56070 Rollup merge of #21981 - pnkfelix:improve-compile-test-malformed-option-handling, r=huonw
improve `compiletest` error message when path option missing.

I often run `compiletest` by hand by cut-and-pasting from what `make` runs, (which I observe via `remake --trace`), but then I need to tweak it (cut out options) and its useful to be told when I have removed an option that is actually required, such as `--android-cross-path=path`.)
2015-02-06 16:21:03 +05:30
Manish Goregaokar 05e45d094e Rollup merge of #21983 - pnkfelix:eschew-untyped-arena-in-regions-mock-tcx, r=huonw
Ported regions-mock-tcx to use TypedArena rather than Arena since it holds cyclic structure (which the Arena API updated for the Drop-Check-Rule cannot handle).

Plus, the use of `arena::Arena` here really is not justified; the allocated values are all the same type anyway.
2015-02-06 16:21:03 +05:30
Manish Goregaokar 114324f2ba Rollup merge of #21986 - LeoTestard:identical-statics, r=eddyb
Creating two identical static expressions involving casts of pointers to arrays
caused an assertion failure in librustc_trans.

cc @eddyb
2015-02-06 16:21:02 +05:30
Manish Goregaokar cad96b541c Rollup merge of #21987 - pnkfelix:eschew-arena-in-variance-analysis, r=huonw
Use a TypedArena rather than an Arena for the backing storage of variance analysis.

(The code was not using the main feature of Arena in the first place, since all of the `alloc` calls were on the same type.)
2015-02-06 16:21:02 +05:30
bors f3573aa834 Auto merge of #21609 - GarrettHeel:master, r=steveklabnik
Now that it's no longer feature gated, add docs for wildcard syntax.
2015-02-06 05:52:20 +00:00
bors 715f9a5e8d Auto merge of #21947 - bluss:full-range-syntax, r=brson
Implement step 1 of rust-lang/rfcs#702

Allows the expression `..` (without either endpoint) in general, can be
used in slicing syntax `&expr[..]` where we previously wrote `&expr[]`.

The old syntax &expr[] is not yet removed or warned for.
2015-02-06 03:11:34 +00:00
Leo Testard 47c2091f26 Fix an ICE when translating some static expressions.
Creating two identical static expressions involving casts of pointers to arrays
caused an assertion failure in librustc_trans.
2015-02-06 00:25:32 +01:00
bors 706be5ba1f Auto merge of #21619 - brson:featureck-tidy, r=alexcrichton
Builds on my [feature staging PR](https://github.com/rust-lang/rust/pull/21248) to clean up the tidy scripts a bit, and make them much faster (6s vs ~40s).

Adds make rules 'tidy-basic', 'tidy-binaries', 'tidy-errors' and 'tidy-features'.

This is the output of `make tidy` here:

```
cfg: version 1.0.0-dev (a8c878d41 2015-01-25 01:49:14 -0800)
cfg: build triple x86_64-unknown-linux-gnu
cfg: host triples x86_64-unknown-linux-gnu
cfg: target triples x86_64-unknown-linux-gnu
cfg: host for x86_64-unknown-linux-gnu is x86_64
cfg: os for x86_64-unknown-linux-gnu is unknown-linux-gnu
cfg: good valgrind for x86_64-unknown-linux-gnu is 1
cfg: using CC=gcc (CFG_CC)
cfg: enabling valgrind run-pass tests (CFG_ENABLE_VALGRIND_RPASS)
cfg: valgrind-rpass command set to "/usr/bin/valgrind" --error-exitcode=100 --soname-synonyms=somalloc=NONE --quiet --suppressions=/home/brian/dev/rust3/src/etc/x86.supp  --tool=memcheck --leak-check=full
cfg: no lualatex found, deferring to xelatex
cfg: no xelatex found, deferring to pdflatex
cfg: no pdflatex found, disabling LaTeX docs
cfg: no pandoc found, omitting PDF and EPUB docs
cfg: including test rules
cfg: javac not available, skipping lexer test...
check: formatting

* linted .rs files: 4948
* linted .py files: 27
* linted .js files: 2
* linted .sh files: 5
* linted .pl files: 0
* linted .c files: 28
* linted .h files: 3
* other linted files: 0
* total lines of code: 481217
* total non-blank lines of code: 423682

check: binaries
check: extended errors

* 249 error codes
* highest error code: E0315

check: feature sanity

* advanced_slice_patterns         lang    unstable    None    
* alloc                           lib     unstable    None    
* asm                             lang    unstable    None    
* associated_types                lang    stable      1.0.0   
* box_syntax                      lang    unstable    None    
* collections                     lib     unstable    None    
* concat_idents                   lang    unstable    None    
* core                            lib     unstable    None    
* default_type_params             lang    stable      1.0.0   
* globs                           lang    stable      1.0.0   
* hash                            lib     unstable    None    
* if_let                          lang    stable      1.0.0   
* import_shadowing                lang    unstable    None    
* int_uint                        lang    unstable    None    
* intrinsics                      lang    unstable    None    
* io                              lib     unstable    None    
* issue_5723_bootstrap            lang    stable      1.0.0   
* lang_items                      lang    unstable    None    
* link_args                       lang    unstable    None    
* link_llvm_intrinsics            lang    unstable    None    
* linkage                         lang    unstable    None    
* log_syntax                      lang    unstable    None    
* macro_rules                     lang    stable      1.0.0   
* main                            lang    unstable    None    
* managed_boxes                   lang    unstable    None    
* non_ascii_idents                lang    unstable    None    
* old_impl_check                  lang    unstable    None    
* old_orphan_check                lang    unstable    None    
* on_unimplemented                lang    unstable    None    
* opt_out_copy                    lang    unstable    None    
* optin_builtin_traits            lang    unstable    None    
* os                              lib     unstable    None    
* path                            lib     unstable    None    
* phase                           lang    unstable    None    
* plugin                          lang    unstable    None    
* plugin_registrar                lang    unstable    None    
* quad_precision_float            lang    unstable    None    
* quote                           lang    unstable    None    
* rand                            lib     unstable    None    
* rust1                           lib     stable      1.0.0   
* rustc_diagnostic_macros         lang    unstable    None    
* rustc_private                   lib     unstable    None    
* rustdoc                         lib     unstable    None    
* simd                            lang    unstable    None    
* simd_ffi                        lang    unstable    None    
* slicing_syntax                  lang    unstable    None    
* staged_api                      lang    unstable    None    
* start                           lang    unstable    None    
* std_misc                        lib     unstable    None    
* struct_inherit                  lang    unstable    None    
* struct_variant                  lang    stable      1.0.0   
* test                            lib     unstable    None    
* test_accepted_feature           lang    stable      1.0.0   
* test_removed_feature            lang    unstable    None    
* thread_local                    lang    unstable    None    
* trace_macros                    lang    unstable    None    
* tuple_indexing                  lang    stable      1.0.0   
* unboxed_closures                lang    unstable    None    
* unicode                         lib     unstable    None    
* unsafe_destructor               lang    unstable    None    
* visible_private_types           lang    unstable    None    
* while_let                       lang    stable      1.0.0   
```

There's a lot of informational output now, which comes after things like 'NOTE's.
2015-02-05 23:14:28 +00:00
Felix S. Klock II 50c6742113 Use a TypedArena rather than an Arena for the backing storage of variance analysis.
(The code was not using the main feature of Arena in the first place,
since all of the `alloc` calls were on the same type.
2015-02-06 00:14:17 +01:00
Felix S. Klock II e4a678ddab Ported regions-mock-tcx to use TypedArena rather than Arena since it holds
cyclic structure (which the Arena API updated for dropck cannot handle).
2015-02-06 00:04:32 +01:00
Felix S. Klock II 1e8e7dcdd0 improve `compiletest` error message when path option missing.
(I often run `compiletest` by hand by cut-and-pasting from what `make`
runs, but then I need to tweak it (cut out options) and its useful to
be told when I have removed an option that is actually required, such
as `--android-cross-path=path`.)
2015-02-05 23:58:32 +01:00
Felix S. Klock II fa9d2230a6 make codemap more robust in face of ill-formed spans.
This can be considered partial work on #8256.

The main observable change: macro expansion sometimes results in spans
where `lo > hi`; so for now, when we have such a span, do not attempt
to return a snippet result.

(Longer term, we might think about whether we could still present a
snippet for the cases where this arises, e.g. perhaps by showing the
whole macro as the snippet, assuming that is the sole cause of such
spans; or by somehow looking up the closest AST node that holds both
`lo` and `hi`, and showing that.)

As a drive-by, revised the API to return a `Result` rather than an
`Option`, with better information-packed error value that should help
us (and maybe also our users) identify the causes of such problems in
the future.  Ideally the call-sites that really want an actual snippet
would be updated to catch the newly added `Err` case and print
something meaningful about it, but that is not part of this PR.
2015-02-05 23:47:17 +01:00
Brian Anderson d0e82a68a9 Tidy fixes 2015-02-05 14:38:56 -08:00
Brian Anderson 3454c504cf Address review feedback 2015-02-05 14:37:17 -08:00
Brian Anderson 1364919b6c mk: Print test summary after tidy when running 'make check' 2015-02-05 14:37:17 -08:00
Brian Anderson 68ddd73257 testparser has long lines 2015-02-05 14:37:16 -08:00
Brian Anderson 4368f6161c mk: Add version number to output. Useful for logs 2015-02-05 14:37:16 -08:00
Brian Anderson 62c90fc6be mk: Add tidy commands to 'make tips' 2015-02-05 14:37:16 -08:00
Brian Anderson 29be938136 mk: Remove redundant valgrind notices in build 2015-02-05 14:37:16 -08:00
Brian Anderson 290b79c15d Clean up tidy scripts, coverage, performance
This restructures tidy.py to walk the tree itself,
and improves performance considerably by not loading entire
files into buffers for licenseck.

Splits build rules into 'tidy', 'tidy-basic', 'tidy-binaries',
'tidy-errors', 'tidy-features'.
2015-02-05 14:37:16 -08:00
Brian Anderson 0e16ad8c3f Polish errorck and featureck UI 2015-02-05 14:37:16 -08:00
Brian Anderson 1ce86651c7 mk: Split tidy into multiple tidy rules
* tidy - runs all tidy scripts
* tidy-basic - tidy.rs
* tidy-binaries - check-binaries.py
* tidy-errors - errorck.py
* tidy-features - featureck.py
2015-02-05 14:37:16 -08:00
bors 99f6206c4e Auto merge of #21894 - dotdash:assume_rc, r=alexcrichton
This is half of what @Aatch implemented in #21418. The non-null assumption is later canonicalized to !nonnull metadata and doesn't cause any slowdowns (in fact the build is slightly faster with this change). I left out the other half of #21418 because that still causes a ~16% increase in compile times (30m -> 35m).
2015-02-05 21:08:03 +00:00
Mikhail Zabaluev 023a931309 Make the lifetime anchor immutable on std::mem::copy_mut_lifetime
Only the second reference's mutability is relevant to the mutability
of the returned reference.
2015-02-05 22:19:11 +02:00
bors 189930fcae Auto merge of #21916 - japaric:no-as-slice, r=alexcrichton
r? @alexcrichton 
cc @eddyb
2015-02-05 19:00:13 +00:00
Jorge Aparicio 17bc7d8d5b cleanup: replace `as[_mut]_slice()` calls with deref coercions 2015-02-05 13:45:01 -05:00
Sébastien Marie cb4965ef3a complete openbsd support for `std::env`
- add `std::env:consts`
- deprecating `std::os::consts`
- refactoring errno_location()
2015-02-05 19:04:30 +01:00
Ulrik Sverdrup 7d527fa96b Implement pretty-printing of `..` and update tests.
Update tests to change all `&expr[]` to `&expr[..]` to make sure pretty printing
passes.
2015-02-05 18:09:12 +01:00
Sébastien Marie 5ad3488f29 unbreak tree for openbsd after #21787
- add `_SC_GETPW_R_SIZE_MAX` constant
- declare `struct passwd`
- convert `load_self` to `current_exe`

Note: OpenBSD don't provide system function to return a valuable Path
for `env::current_exe`. The implementation is currently based on the
value of `argv[0]`, which couldn't be used when executable is called via
PATH.
2015-02-05 16:37:39 +01:00
bors 2c05354211 Auto merge of #21843 - japaric:kindless, r=alexcrichton
This needs a snapshot that includes #21805 before it can be merged.

There are some places where type inference regressed after I removed the annotations (see `FIXME`s). cc @nikomatsakis.

r? @eddyb or anyone
(I'll remove the `FIXME`s before merging, as they are only intended to point out regressions)
2015-02-05 15:22:48 +00:00
bors 2bd8ec2d19 Auto merge of #21944 - alexcrichton:lframework, r=eddyb
On OSX the linker has a separate framework lookup path which is specified via
the `-F` flag. This adds a new kind of `-L` path recognized by the compiler for
frameworks to be passed through to the linker.

Closes #20259
2015-02-05 08:47:48 +00:00
bors fa28f023c2 Auto merge of #21152 - steveklabnik:tasks, r=huonw
This moves the "Tasks" chapter to a "Concurrency" one, as it's about threads, but also about how to deal with concurrency issues.

r? @aturon
2015-02-05 03:11:57 +00:00
Steve Klabnik 5401f086f0 A concurrency chapter to replace the tasks chapter.
Fixes #18936
Fixes #18938
Fixes #20038
Fixes #8395
Fixes #2080
Fixes #21194
2015-02-04 21:47:16 -05:00
Jorge Aparicio 92f11e938a register snapshots 2015-02-04 20:06:12 -05:00
Jorge Aparicio 571cc7f8e9 remove all kind annotations from closures 2015-02-04 20:06:08 -05:00
Ulrik Sverdrup 75239142a8 Implement `..` syntax for RangeFull as expression
Allows the expression `..` (without either endpoint) in general, can be
used in slicing syntax `&expr[..]` where we previously wrote `&expr[]`.

The old syntax &expr[] is not yet removed or warned for.
2015-02-04 23:23:12 +01:00
Alex Crichton 6c62839a7f rustc: Recognize `-L framework=foo`
On OSX the linker has a separate framework lookup path which is specified via
the `-F` flag. This adds a new kind of `-L` path recognized by the compiler for
frameworks to be passed through to the linker.

Closes #20259
2015-02-04 13:54:49 -08:00
bors ba2f13ef06 Auto merge of #21885 - dotdash:nonnull_load, r=alexcrichton
These pointers are never null, let's tell LLVM about it.
2015-02-04 20:03:55 +00:00
bors 3ae76d5c1c Auto merge of #21544 - P1start:mangle-unicode, r=alexcrichton
`{` and `}` aren’t valid characters on ARM, so this makes Unicode characters render as, e.g., `$u38d$` instead of `$u{38d}`.

This also fixes a small bug where `)` (**r**ight **p**arenthesis) and `*` (**r**aw **p**ointer) would both mangle to `$RP$`, making `)` show up as `*` in backtraces.
2015-02-04 15:49:43 +00:00
bors ac134f7ca4 Auto merge of #21499 - P1start:issue-8706, r=huonw
Closes #8706.
2015-02-04 12:42:40 +00:00
bors c3e1f77291 Auto merge of #21892 - huonw:deprecate-rand, r=alexcrichton
Use [`rand`](https://crates.io/crates/rand) and [`derive_rand`](https://crates.io/crates/derive_rand) from crates.io.

[breaking-change]
2015-02-04 08:47:27 +00:00
bors d6c15d9b2d Auto merge of #21919 - alexcrichton:rollup, r=alexcrichton 2015-02-04 06:40:12 +00:00
Alex Crichton 70ecd8ed38 Test fixes and rebase conflicts 2015-02-03 21:30:32 -08:00
Alex Crichton d0029a47c2 rollup merge of #21910: Manishearth/missing_stability
Currently, if a `#![staged_api]` crate contains an exported item without a stability marker (or inherited stability),
the item is useless.

This change introduces a check to ensure that all exported items have a defined stability.

it also introduces the `unmarked_api` feature, which lets users import unmarked features. While this PR should in theory forbid these from existing,
in practice we can't be so sure; so this lets users bypass this check instead of having to wait for the library and/or compiler to be fixed (since otherwise this is a hard error).

r? @aturon
2015-02-03 20:11:20 -08:00
Alex Crichton 9db593c90a rollup merge of #21907: alexcrichton/iter-by-ref
This removes the `ByRef` iterator adaptor to stay in line with the changes to
`std::io`. The `by_ref` method instead just returns `&mut Self`.

This also removes the implementation of `Iterator for &mut Iterator` and instead
generalizes it to `Iterator for &mut I` where `I: Iterator + ?Sized`. The
`Box<I>` implementations were also updated.
2015-02-03 20:11:20 -08:00
Alex Crichton 74f7e06939 rollup merge of #21899: nikomatsakis/closure-unify-anyhow
This *almost* completes the job for #16440. The idea is that even if we do not know whether some closure type `C` implements `Fn` or `FnMut` (etc), we still know its argument and return types. So if we see an obligation `C : Fn(_0)`, we can unify `_0` with those argument types while still considering the obligation ambiguous and unsatisfied. This helps to make a lot of progress with type inference even before closure kind inference is done.

As part of this PR, the explicit `:` syntax is removed from the AST and completely ignored. We still infer the closure kind based on the expected type if that is available. There are several reasons for this. First, deciding the closure kind earlier is always better, as it allows us to make more progress. Second, this retains a (admittedly obscure) way for users to manually specify the closure kind, which is useful for writing tests if nothing else. Finally, there are still some cases where inference can fail, so it may be useful to have this manual override. (The expectation is that we will eventually revisit an explicit syntax for specifying the closure kind, but it will not be `:` and may be some sort of generalization of the `||` syntax to handle other traits as well.)

This commit does not *quite* fix #16640 because a snapshot is still needed to enable the obsolete syntax errors for explicit `&mut:` and friends.

r? @eddyb as he reviewed the prior patch in this direction
2015-02-03 20:11:20 -08:00
Alex Crichton 1d921f557d rollup merge of #21897: dotdash/rposition
The extra check caused by the expect() call can, in general, not be
optimized away, because the length of the iterator is unknown at compile
time, causing a noticable slow-down. Since the check only triggers if
the element isn't actually found in the iterator, i.e. it isn't
guaranteed to trigger for ill-behaved ExactSizeIterators, it seems
reasonable to switch to an implementation that doesn't need the check
and just always returns None if the value isn't found.

Benchmark:
````rust
let v: Vec<u8> = (0..1024*65).map(|_| 0).collect();
b.iter(|| {
    v.as_slice().iter().rposition(|&c| c == 1)
});
````

Before:
````
test rposition  ... bench:     49939 ns/iter (+/- 23)
````

After:
````
test rposition  ... bench:     33306 ns/iter (+/- 68)
````
2015-02-03 20:11:20 -08:00