Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 5 pull requests #41102

Merged
merged 22 commits into from
Apr 6, 2017
Merged

Rollup of 5 pull requests #41102

merged 22 commits into from
Apr 6, 2017

Conversation

dotdash and others added 22 commits March 29, 2017 20:43
We currently only emit a single call to the lifetime start intrinsic
for the personality slot alloca. This happens because we create that
call at the time that we create the alloca, instead of creating it each
time we start using it. Because LLVM usually removes the alloca before
the lifetime intrinsics are even considered, this didn't cause any
problems yet, but we should fix this anyway.
For some reason 'command' and 'subcommand' were intermixed to mean the same thing.  Lets just call it the one thing that it is.
…m in the same order to ease comparing the sections of code in order. I chose the order that appears in the help text, because that is most likely to have been ordered with specific reasoning.
Exception handling on MSVC targets doesn't use personality slots.
- Don't print 'unknown subcommand' at the top of the help message.  The help message now clearly instructs the user to provide a subcommand.
- Clarify the usage line.  Subcommand is required.  Don't echo invalid input back out in the usage line (what the...???).  args renamed to paths, because that's what all the args are referred to elsewhere.
- List the available subcommands immediately following the usage line.  It's the one required argument, after all.
- Slightly improve the extra documentation for the build, test, and doc commands.
- Don't print 'Available invocations:' at all.  It occurred immediately before 'Available paths:'.
- Clearly state that running with '-h -v' will produce a list of available paths.
…ction and then not using it until over 100 lines later is just mean.
- No more manual args manipulation -- getopts used for everything.
  As a result, options can be in any position, now, even before the
  subcommand.
- The additional options for test, bench, and dist now appear in the
  help output.
- No more single-letter variable bindings used internally for large
  scopes.
- Don't output the time measurement when just invoking 'x.py'
- Logic is now much more linear.  We build strings up, and then print
  them.
…y bit of manual arg-parsing. Fixed tidy stuff too.
…variable with the same value in two contexts where it was used differently. That's why you don't use "m" as a variable for hundreds of lines in an outer function, and re-use it in closures several times in the same function. Sheesh.
…ang#40860.

The broken condition can be replicated with:

``shell
export MYARCH=x86_64-apple-darwin && mkdir -p build/$MYARCH/subdir &&
touch build/$MYARCH/subdir/file && ln -s build/$MYARCH/subdir/file
build/$MYARCH/subdir/symlink
``

`src/bootstrap/clean.rs` has a custom implementation of removing a tree
`fn rm_rf` that used `std::path::Path::{is_file, is_dir, exists}` while
recursively deleting directories and files.  Unfortunately, `Path`'s
implementation of `is_file()` and `is_dir()` and `exists()` always
unconditionally follow symlinks, which is the exact opposite of standard
implementations of deleting file trees.

It appears that this custom implementation is being used to workaround a
behavior in Windows where the files often get marked as read-only, which
prevents us from simply using something nice and simple like
`std::fs::remove_dir_all`, which properly deletes links instead of
following them.

So it looks like the fix is to use `.symlink_metadata()` to figure out
whether tree items are files/symlinks/directories.  The one corner case
this won't cover is if there is a broken symlink in the "root"
`build/$MYARCH` directory, because those initial entries are run through
`Path::canonicalize()`, which panics with broken symlinks.  So lets just
never use symlinks in that one directory. :-)
This change moves:

1. `libcoretest` into `libcore/tests`
2. `libcollectionstest` into `libcollections/tests`

This is a follow-up to rust-lang#39561.
…0 build' and detect pathological cases like './x.py --option-that-takes-argument clean build'
Emit proper lifetime start intrinsics for personality slots

We currently only emit a single call to the lifetime start intrinsic
for the personality slot alloca. This happens because we create that
call at the time that we create the alloca, instead of creating it each
time we start using it. Because LLVM usually removes the alloca before
the lifetime intrinsics are even considered, this didn't cause any
problems yet, but we should fix this anyway.
…hton

Overhaul Bootstrap (x.py) Command-Line-Parsing & Help Output

While working on rust-lang#40417, I got frustrated with the behavior of x.py and the bootstrap binary it wraps, so I decided to do something about it.  This PR should improve documentation, make the command-line-parsing more flexible, and clean up some of the internals.  No command that worked before should stop working.  At least that's the theory. :-)

This should resolve at least rust-lang#40920 and rust-lang#38373.

Changes:

- No more manual args manipulation -- getopts used everywhere except the one place it's not possible.  As a result, options can be in any position, now, even before the subcommand.
- The additional options for test, bench, and dist now appear in the help output.
- No more single-letter variable bindings used internally for large scopes.
- Don't output the time measurement when just invoking `x.py` or explicitly passing `-h` or `--help`
- Logic is now much more linear.  We build strings up, and then print them.
- Refer to subcommands as subcommands everywhere (some places we were saying "command")
- Other minor stuff.

@alexcrichton This is my first PR. Do I need to do something specific to request reviewers or anything?
Handle symlinks in src/bootstrap/clean.rs (mostly) -- resolves rust-lang#40860.

In response to rust-lang#40860

The broken condition can be replicated with:

```shell
export MYARCH=x86_64-apple-darwin && mkdir -p build/$MYARCH/subdir &&
touch build/$MYARCH/subdir/file && ln -s build/$MYARCH/subdir/file
build/$MYARCH/subdir/symlink
```

`src/bootstrap/clean.rs` has a custom implementation of removing a tree
`fn rm_rf` that used `std::path::Path::{is_file, is_dir, exists}` while
recursively deleting directories and files.  Unfortunately, `Path`'s
implementation of `is_file()` and `is_dir()` and `exists()` always
unconditionally follow symlinks, which is the exact opposite of standard
implementations of deleting file trees.

It appears that this custom implementation is being used to workaround a
behavior in Windows where the files often get marked as read-only, which
prevents us from simply using something nice and simple like
`std::fs::remove_dir_all`, which properly deletes links instead of
following them.

So it looks like the fix is to use `.symlink_metadata()` to figure out
whether tree items are files/symlinks/directories.  The one corner case
this won't cover is if there is a broken symlink in the "root"
`build/$MYARCH` directory, because those initial entries are run through
`Path::canonicalize()`, which panics with broken symlinks.  So lets just
never use symlinks in that one directory. :-)
Move libXtest into libX/tests

This change moves:

1. `libcoretest` into `libcore/tests`
2. `libcollectionstest` into `libcollections/tests`

This is a follow-up to rust-lang#39561.

r? @alexcrichton
…rochenkov

macros: fix bug parsing `#[derive]` invocations

Fixes rust-lang#40962 (introduced in rust-lang#40346).
r? @nrc
@frewsxcv
Copy link
Member Author

frewsxcv commented Apr 6, 2017

@bors r+ p=10

@bors
Copy link
Contributor

bors commented Apr 6, 2017

📌 Commit 89b364d has been approved by frewsxcv

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@bors
Copy link
Contributor

bors commented Apr 6, 2017

⌛ Testing commit 89b364d with merge e5e9275...

bors added a commit that referenced this pull request Apr 6, 2017
Rollup of 5 pull requests

- Successful merges: #40908, #41011, #41026, #41037, #41050
- Failed merges:
@bors
Copy link
Contributor

bors commented Apr 6, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: frewsxcv
Pushing e5e9275 to master...

@bors bors merged commit 89b364d into rust-lang:master Apr 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants