about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2016-02-05std: Atomically set CLOEXEC for sockets if possibleAlex Crichton-0/+23
This commit adds support for creating sockets with the `SOCK_CLOEXEC` flag. Support for this flag was added in Linux 2.6.27, however, and support does not exist on platforms other than Linux. For this reason we still have the same fallback as before but just special case Linux if we can.
2016-02-05std: When duplicating fds, skip extra set_cloexecAlex Crichton-6/+15
Similar to the previous commit, if `F_DUPFD_CLOEXEC` succeeds then there's no need for us to then call `set_cloexec` on platforms other than Linux. The bug mentioned of kernels not actually setting the `CLOEXEC` flag has only been repored on Linux, not elsewhere.
2016-02-05std: Only have extra set_cloexec for files on LinuxAlex Crichton-4/+12
On Linux we have to do this for binary compatibility with 2.6.18, but for other OSes (e.g. OSX/BSDs/etc) they all support this flag so we don't need to pass it.
2016-02-05Auto merge of #31304 - nikomatsakis:incr-comp-read-from-hir-map, ↵bors-69/+289
r=michaelwoerister This change also modifies the dep graph infrastructure to keep track of the number of active tasks, so that even if we are not building the full dep-graph, we still get assertions when there is no active task and one does something that would add a read/write edge. This is particularly helpful since, if the assertions are *not* active, you wind up with the error happening in the message processing thread, which is too late to know the correct backtrace. ~~Before landing, I need to do some performance measurements. Those are underway.~~ See measurements below. No real effect on time. r? @michaelwoerister
2016-02-05Address nits.Niko Matsakis-5/+5
2016-02-05Update collect to use the standard visit routine, rather than rollingNiko Matsakis-5/+1
its own.
2016-02-05Instrument a bunch of tasks that employ the HIR map in one way orNiko Matsakis-42/+123
another and were not previously instrumented.
2016-02-05Instrument the AST map so that it registers reads when data isNiko Matsakis-18/+118
acccessed.
2016-02-05Add a local counter that tracks how many tasks are pushed or not pushed,Niko Matsakis-4/+47
so that we can still get assertion failures even when dep-graph construction is disabled.
2016-02-05Auto merge of #31349 - nikomatsakis:issue-31157-obligation-forest-cache, ↵bors-152/+314
r=aturon Have the `ObligationForest` keep some per-tree state (or type `T`) and have it give a mutable reference for use when processing obligations. In this case, it will be a hashmap. This obviously affects the work that @soltanmm has been doing on snapshotting. I partly want to toss this out there for discussion. Fixes #31157. (The test in question goes to approx. 30s instead of 5 minutes for me.) cc #30977. cc @aturon @arielb1 @soltanmm r? @aturon who reviewed original `ObligationForest`
2016-02-05Auto merge of #31400 - durka:civilized-deriving, r=alexcrichtonbors-168/+4
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](https://github.com/rust-lang/rust/commit/eeb94886adccb3f13003f92f117115d17846ce1f) (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-05Auto merge of #31390 - dotdash:fix_quadratic_drop, r=nagisabors-13/+71
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-05Auto merge of #31389 - mitaa:schars, r=nrcbors-10/+10
A span spanning only a single character would render like `^~` instead of just `^`. r? @nrc
2016-02-05Auto merge of #31386 - tbu-:pr_cow_from_vec, r=alexcrichtonbors-0/+36
Fixes #31354.
2016-02-05Auto merge of #31321 - jseyfried:cleanup, r=nrcbors-290/+128
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-05Auto merge of #30865 - alexcrichton:mtime-system-time, r=aturonbors-8/+183
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-04Auto merge of #31416 - steveklabnik:rollup, r=steveklabnikbors-12/+33
- Successful merges: #31007, #31396, #31401, #31411, #31412, #31413, #31415 - Failed merges:
2016-02-04Rollup merge of #31415 - tshepang:2-space-indent, r=steveklabnikSteve Klabnik-3/+3
2016-02-04Rollup merge of #31413 - tshepang:improve, r=steveklabnikSteve Klabnik-2/+2
2016-02-04Rollup merge of #31412 - tshepang:add-trailing-commas, r=steveklabnikSteve Klabnik-5/+5
2016-02-04Rollup merge of #31411 - tshepang:idiom, r=steveklabnikSteve Klabnik-1/+1
2016-02-04Rollup merge of #31401 - frewsxcv:clarify-ascii, r=steveklabnikSteve Klabnik-0/+21
Fixes https://github.com/rust-lang/rust/issues/31203
2016-02-04Rollup merge of #31396 - mbrubeck:grammar-stmts, r=alexcrichtonSteve Klabnik-1/+1
"stmt" already includes the terminating semicolon.
2016-02-04doc: Rust indents are 4-space wide by conventionTshepang Lekhonkhobe-3/+3
2016-02-04std: Expose SystemTime accessors on fs::MetadataAlex Crichton-8/+183
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-04Auto merge of #30759 - Manishearth:attr-tls, r=alexcrichtonbors-23/+43
fixes #30756 r? @Gankro
2016-02-04reference: add trailing commasTshepang Lekhonkhobe-5/+5
2016-02-04reference: make the line a little more readableTshepang Lekhonkhobe-2/+2
2016-02-04reference: explicit return at function end is not idiomaticTshepang Lekhonkhobe-1/+1
2016-02-04Auto merge of #31360 - pitdicker:fs_tests_cleanup, r=alexcrichtonbors-183/+192
- 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-04Test for unsafe code in TLS macroManish Goregaokar-0/+16
2016-02-04Stop using unsafe code in TLS macro expansion (fixes #30756)Manish Goregaokar-23/+27
2016-02-04Clarify scenario where AsciiExt appears to operate on non-ASCIICorey Farwell-0/+21
Fixes https://github.com/rust-lang/rust/issues/31203
2016-02-04Auto merge of #31382 - DanielJCampbell:SaveSpans, r=nrcbors-8/+51
r? @nrc
2016-02-04Allow dead code for `symlink_junction()`Paul Dicker-0/+2
2016-02-04Auto merge of #31161 - sfackler:slice-to-socket-addrs, r=alexcrichtonbors-0/+11
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-04Auto merge of #31069 - sfackler:file-try-clone, r=alexcrichtonbors-39/+87
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-04Implement ToSocketAddrs for &[SocketAddr]Steven Fackler-0/+11
2016-02-04Add File::try_cloneSteven Fackler-39/+87
2016-02-04Auto merge of #31378 - nagisa:target-man, r=alexcrichtonbors-5/+1
2016-02-04Auto merge of #31326 - sdleffler:master, r=nikomatsakisbors-2/+71
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-04test #[derive(FromPrimitive)] triggers custom-derive errorAlex Burka-23/+4
2016-02-04Auto merge of #30962 - Amanieu:non_volatile_atomic, r=alexcrichtonbors-2/+0
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-03remove dead #[derive(FromPrimitive)] codeAlex Burka-145/+0
2016-02-04Auto merge of #30796 - GuillaumeGomez:impl_box_error, r=alexcrichtonbors-0/+11
Fixes #30349
2016-02-03Remove unneeded borrows and slicesJeffrey Seyfried-15/+15
2016-02-03Remove unneeded use of CellJeffrey Seyfried-6/+6
2016-02-03Refactor away resolve_item_by_name_in_lexical_scopeJeffrey Seyfried-45/+10
2016-02-03Refactor resolve_import_for_moduleJeffrey Seyfried-77/+32
2016-02-03Refactor away resolve_module_in_lexical_scopeJeffrey Seyfried-34/+11