Commit Graph

50103 Commits

Author SHA1 Message Date
Simonas Kazlauskas
65921ca13c Do not .UR in man
seems to not work on OS X (or requires label, which would make link repeat twice on non-OS X)
2016-02-05 20:51:36 +02:00
bors
98422e8c15 Auto merge of #31400 - durka:civilized-deriving, r=alexcrichton
You can `#[derive(FromPrimitive)]`, but it [fails later in the compile](https://play.rust-lang.org/?gist=82cb8ad2fac49e3fe472&version=stable) due to hardcoding `std::num::FromPrimitive` which [was removed](eeb94886ad) (for some reason Github doesn't show `FromPrimitive` in the diff, but `git show` does).

Anyway, this PR removes the code. I didn't mark it as a breaking change, even though [this extremely contrived code using highly unstable features](https://play.rust-lang.org/?gist=1e1b1bbff962837b228a&version=nightly) is broken by it -- should I?
2016-02-05 15:11:45 +00:00
bors
38dfb96b46 Auto merge of #31390 - dotdash:fix_quadratic_drop, r=nagisa
If a new cleanup is added to a cleanup scope, the cached exits for that
scope are cleared, so all previous cleanups have to be translated
again. In the worst case this means that we get N distinct landing pads
where the last one has N cleanups, then N-1 and so on.

As new cleanups are to be executed before older ones, we can instead
cache the number of already translated cleanups in addition to the
block that contains them, and then only translate new ones, if any and
then jump to the cached ones, getting away with linear growth instead.

For the crate in #31381 this reduces the compile time for an optimized
build from >20 minutes (I cancelled the build at that point) to about 11
seconds. Testing a few crates that come with rustc show compile time
improvements somewhere between 1 and 8%. The "big" winner being
rustc_platform_intrinsics which features code similar to that in #31381.

Fixes #31381
2016-02-05 13:02:26 +00:00
bors
f12d32d307 Auto merge of #31389 - mitaa:schars, r=nrc
A span spanning only a single character would render like `^~`
instead of just `^`.

r? @nrc
2016-02-05 10:58:52 +00:00
bors
06fac8298f Auto merge of #31388 - gmbonnet:compiler-rt-werror, r=alexcrichton
Without this patch, `compiler-rt` fails to build when the `CFLAGS` environment variable contains a `-Werror=*` flag (for example `-Werror=format-security`).

The build system was removing only the `-Werror` part from the flag, thus passing an unrecognized `=*` (for example `=format-security`) argument to gcc.
2016-02-05 08:54:46 +00:00
bors
2ad6dc2556 Auto merge of #31386 - tbu-:pr_cow_from_vec, r=alexcrichton
Fixes #31354.
2016-02-05 06:51:05 +00:00
bors
dcf8ef2723 Auto merge of #31321 - jseyfried:cleanup, r=nrc
The first commit improves detection of unused imports -- it should have been part of #30325. Right now, the unused import in the changed test would not be reported.

The rest of the commits are miscellaneous, independent clean-ups in resolve that I didn't think warranted individual PRs.

r? @nrc
2016-02-05 03:03:45 +00:00
bors
7bcced73b7 Auto merge of #30865 - alexcrichton:mtime-system-time, r=aturon
These accessors are used to get at the last modification, last access, and
creation time of the underlying file. Currently not all platforms provide the
creation time, so that currently returns `Option`.
2016-02-05 01:00:31 +00:00
bors
9d8e3a024a Auto merge of #31416 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #31007, #31396, #31401, #31411, #31412, #31413, #31415
- Failed merges:
2016-02-04 22:55:47 +00:00
Steve Klabnik
96d866a19d Rollup merge of #31415 - tshepang:2-space-indent, r=steveklabnik 2016-02-04 16:39:06 -05:00
Steve Klabnik
09e62bac0f Rollup merge of #31413 - tshepang:improve, r=steveklabnik 2016-02-04 16:39:06 -05:00
Steve Klabnik
fc6e7698c1 Rollup merge of #31412 - tshepang:add-trailing-commas, r=steveklabnik 2016-02-04 16:39:05 -05:00
Steve Klabnik
cd418ba09b Rollup merge of #31411 - tshepang:idiom, r=steveklabnik 2016-02-04 16:39:05 -05:00
Steve Klabnik
73db842617 Rollup merge of #31401 - frewsxcv:clarify-ascii, r=steveklabnik
Fixes https://github.com/rust-lang/rust/issues/31203
2016-02-04 16:39:05 -05:00
Steve Klabnik
3cccf261fc Rollup merge of #31396 - mbrubeck:grammar-stmts, r=alexcrichton
"stmt" already includes the terminating semicolon.
2016-02-04 16:39:05 -05:00
Steve Klabnik
c98833d41e Rollup merge of #31007 - pra85:license, r=aturon
According to http://www.copyright.gov/circs/circ01.pdf (See screenshot of relevant section below) , listing the first year of publication in the copyright is enough

![selection_008](https://cloud.githubusercontent.com/assets/829526/12409934/7021c3a6-be95-11e5-8d1a-18f6948571e0.png)

The commits d5c8f626a8 and f979f91ae2 have changed the copyright years

This commit reverts back those changes, so that license year is again 2014 (As it was, when this license was first introduced in commit 90ba013bde  )

--------------------------------------
Edit 1: Added screenshot
2016-02-04 16:39:05 -05:00
Tshepang Lekhonkhobe
9721752d35 doc: Rust indents are 4-space wide by convention 2016-02-04 23:31:22 +02:00
Alex Crichton
d1681bbde5 std: Expose SystemTime accessors on fs::Metadata
These accessors are used to get at the last modification, last access, and
creation time of the underlying file. Currently not all platforms provide the
creation time, so that currently returns `Option`.
2016-02-04 13:15:28 -08:00
bors
c007e4a010 Auto merge of #30759 - Manishearth:attr-tls, r=alexcrichton
fixes #30756

r? @Gankro
2016-02-04 20:52:22 +00:00
Tshepang Lekhonkhobe
a2f22a00ec reference: add trailing commas 2016-02-04 22:44:32 +02:00
Tshepang Lekhonkhobe
69b1d75b76 reference: make the line a little more readable 2016-02-04 22:39:15 +02:00
Tshepang Lekhonkhobe
85b19d8aa3 reference: explicit return at function end is not idiomatic 2016-02-04 22:32:53 +02:00
bors
d0ef740266 Auto merge of #31360 - pitdicker:fs_tests_cleanup, r=alexcrichton
- use `symlink_file` and `symlink_dir` instead of the old `soft_link`
- create a junction instead of a directory symlink for testing recursive_rmdir (as it causes the
  same troubles, but can be created by users without `SeCreateSymbolicLinkPrivilege`)
- `remove_dir_all` was unable to remove directory symlinks and junctions
- only run tests that create symlinks if we have the right permissions.
- rename `Path2` to `Path`
- remove the global `#[allow(deprecated)]` and outdated comments
- After factoring out `create_junction()` from the test `directory_junctions_are_directories` and
  removing needlessly complex code, what I was left with was:
  ```
  #[test]
  #[cfg(windows)]
  fn directory_junctions_are_directories() {
      use sys::fs::create_junction;

      let tmpdir = tmpdir();

      let foo = tmpdir.join("foo");
      let bar = tmpdir.join("bar");

      fs::create_dir(&foo).unwrap();
      check!(create_junction(&foo, &bar));
      assert!(bar.metadata().unwrap().is_dir());
  }
  ```
  It test whether a junction is a directory instead of a reparse point. But it actually test the
  target of the junction (which is a directory if it exists) instead of the junction itself, which
  should always be a symlink. So this test is invalid, and I expect it only exists because the
  author was suprised by it. So I removed it.

Some things that do not yet work right:
- relative symlinks do not accept forward slashes
- the conversion of paths for `create_junction` is hacky
- `remove_dir_all` now messes with the internal data of `FileAttr` to be able to remove symlinks.
  We should add some method like `is_symlink_dir()` to it, so code outside the standard library
  can see the difference between file and directory symlinks too.
2016-02-04 18:48:41 +00:00
Manish Goregaokar
4b68c293fd Test for unsafe code in TLS macro 2016-02-04 22:23:23 +05:30
Manish Goregaokar
6c4f0bf79b Stop using unsafe code in TLS macro expansion (fixes #30756) 2016-02-04 22:23:20 +05:30
Corey Farwell
93d6425b43 Clarify scenario where AsciiExt appears to operate on non-ASCII
Fixes https://github.com/rust-lang/rust/issues/31203
2016-02-04 11:34:11 -05:00
bors
f01b85b103 Auto merge of #31382 - DanielJCampbell:SaveSpans, r=nrc
r? @nrc
2016-02-04 15:44:35 +00:00
Paul Dicker
fb172b676e Allow dead code for symlink_junction() 2016-02-04 16:29:55 +01:00
bors
e64ca8cd59 Auto merge of #31161 - sfackler:slice-to-socket-addrs, r=alexcrichton
This is useful when you have an API that takes a `T: ToSocketAddrs` and needs to turn that into an owned value which will be passed to another API taking `T: ToSocketAddrs` at a later time, for example: https://github.com/sfackler/rust-hyper-socks/blob/master/src/lib.rs#L15
2016-02-04 13:41:42 +00:00
bors
7b9d6d3bc8 Auto merge of #31069 - sfackler:file-try-clone, r=alexcrichton
I have it set as stable right now under the rationale that it's extending an existing, stable API to another type in the "obvious" way.

r? @alexcrichton

cc @reem
2016-02-04 11:39:27 +00:00
Steven Fackler
7ea0abfb35 Implement ToSocketAddrs for &[SocketAddr] 2016-02-04 09:44:30 +00:00
Steven Fackler
a414b61f92 Add File::try_clone 2016-02-04 09:43:21 +00:00
bors
9c30f12790 Auto merge of #31378 - nagisa:target-man, r=alexcrichton 2016-02-04 09:38:15 +00:00
bors
f511b21dba Auto merge of #31326 - sdleffler:master, r=nikomatsakis
After the truly incredible and embarrassing mess I managed to make in my last pull request, this should be a bit less messy.

Fixes #31267 - with this change, the code mentioned in the issue compiles.

Found and fixed another issue as well - constants of zero-size types, when used in ExprRepeats inside associated constants, were causing the compiler to crash at the same place as #31267. An example of this:
```

struct Bar;

const BAZ: Bar = Bar;

struct Foo([Bar; 1]);

struct Biz;

impl Biz {
    const BAZ: Foo = Foo([BAZ; 1]);
}

fn main() {
    let foo = Biz::BAZ;
    println!("{:?}", foo);
}
```
However, I'm fairly certain that my fix for this is not as elegant as it could be. The problem seems to occur only with an associated constant of a tuple struct containing a fixed size array which is initialized using a repeat expression, and when the element to be repeated provided to the repeat expression is another constant which is of a zero-sized type. The fix works by looking for constants and associated constants which are zero-width and consequently contain no data, but for which rustc is still attempting to emit an LLVM value; it simply stops rustc from attempting to emit anything. By my logic, this should work fine since the only values that are emitted in this case (according to the comments) are for closures with side effects, and constants will never have side effects, so it's fine to simply get rid of them. It fixes the error and things compile fine with it, but I have a sneaking suspicion that it could be done in a far better manner.

r? @nikomatsakis
2016-02-04 06:07:26 +00:00
Alex Burka
45e716e51c test #[derive(FromPrimitive)] triggers custom-derive error 2016-02-04 01:03:08 -05:00
bors
1096e7ab7a Auto merge of #30962 - Amanieu:non_volatile_atomic, r=alexcrichton
Rust currently emits atomic loads and stores with the LLVM `volatile` qualifier. This is unnecessary and prevents LLVM from performing optimization on these atomic operations.
2016-02-04 02:46:44 +00:00
Alex Burka
f6e22e53f3 remove dead #[derive(FromPrimitive)] code 2016-02-03 21:26:02 -05:00
bors
3c9442fc50 Auto merge of #30796 - GuillaumeGomez:impl_box_error, r=alexcrichton
Fixes #30349
2016-02-04 00:39:55 +00:00
Jeffrey Seyfried
9c166cb671 Remove unneeded borrows and slices 2016-02-03 23:40:46 +00:00
Jeffrey Seyfried
9fc71b4506 Remove unneeded use of Cell 2016-02-03 23:40:44 +00:00
Jeffrey Seyfried
79a3f22246 Refactor away resolve_item_by_name_in_lexical_scope 2016-02-03 23:40:38 +00:00
Jeffrey Seyfried
964b72b3e0 Refactor resolve_import_for_module 2016-02-03 23:39:16 +00:00
Jeffrey Seyfried
0c40621759 Refactor away resolve_module_in_lexical_scope 2016-02-03 23:39:14 +00:00
Jeffrey Seyfried
23bdbb13f4 Refactor block_needs_anonymous_module 2016-02-03 23:39:13 +00:00
Jeffrey Seyfried
2ed210d5fe Refactor more functionality into record_import_use 2016-02-03 23:39:12 +00:00
Jeffrey Seyfried
8e61ca4acc Refactor resolve_item_in_lexical_scope 2016-02-03 23:39:10 +00:00
Jeffrey Seyfried
298346dd5b Improve detection of unused imports 2016-02-03 23:39:08 +00:00
Björn Steinbrink
8c0f4f5d3a Avoid quadratic growth of functions due to cleanups
If a new cleanup is added to a cleanup scope, the cached exits for that
scope are cleared, so all previous cleanups have to be translated
again. In the worst case this means that we get N distinct landing pads
where the last one has N cleanups, then N-1 and so on.

As new cleanups are to be executed before older ones, we can instead
cache the number of already translated cleanups in addition to the
block that contains them, and then only translate new ones, if any and
then jump to the cached ones, getting away with linear growth instead.

For the crate in #31381 this reduces the compile time for an optimized
build from >20 minutes (I cancelled the build at that point) to about 11
seconds. Testing a few crates that come with rustc show compile time
improvements somewhere between 1 and 8%. The "big" winner being
rustc_platform_intrinsics which features code similar to that in #31381.

Fixes #31381
2016-02-04 00:34:53 +01:00
bors
e3bcddb44b Auto merge of #31078 - nbaksalyar:illumos, r=alexcrichton
This pull request adds support for [Illumos](http://illumos.org/)-based operating systems: SmartOS, OpenIndiana, and others. For now it's x86-64 only, as I'm not sure if 32-bit installations are widespread. This PR is based on #28589 by @potatosalad, and also closes #21000, #25845, and #25846.

Required changes in libc are already merged: https://github.com/rust-lang-nursery/libc/pull/138

Here's a snapshot required to build a stage0 compiler:
https://s3-eu-west-1.amazonaws.com/nbaksalyar/rustc-sunos-snapshot.tar.gz
It passes all checks from `make check`.

There are some changes I'm not quite sure about, e.g. macro usage in `src/libstd/num/f64.rs` and `DirEntry` structure in `src/libstd/sys/unix/fs.rs`, so any comments on how to rewrite it better would be greatly appreciated.

Also, LLVM configure script might need to be patched to build it successfully, or a pre-built libLLVM should be used. Some details can be found here: https://llvm.org/bugs/show_bug.cgi?id=25409

Thanks!

r? @brson
2016-02-03 22:40:32 +00:00
Matt Brubeck
7b3ea40500 Remove redundant semicolon from "block_expr" in grammar reference
"stmt" already includes the terminating semicolon.
2016-02-03 13:43:52 -08:00