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

Backport of PRs to Beta #25004

Merged
merged 8 commits into from
Apr 30, 2015
Merged

Backport of PRs to Beta #25004

merged 8 commits into from
Apr 30, 2015

Conversation

bombless and others added 8 commits April 30, 2015 15:11
Conflicts:
	src/libsyntax/parse/parser.rs
Currently if a standard I/O handle is set to inherited on Windows, no action is
taken and the slot in the process information description is set to
`INVALID_HANDLE_VALUE`. Due to our passing of `STARTF_USESTDHANDLES`, however,
this means that the handle is actually set to nothing and if a child tries to
print it will generate an error.

This commit fixes this behavior by explicitly creating stdio handles to be
placed in these slots by duplicating the current process's I/O handles. This is
presumably what previously happened silently by using a file-descriptor-based
implementation instead of a `HANDLE`-centric implementation.

Along the way this cleans up a lot of code in `Process::spawn` for Windows by
ensuring destructors are always run, using more RAII, and limiting the scope of
`unsafe` wherever possible.
[breaking-change]

What does this break?  Basically, code that implements `Drop` and is
using `T:Copy` for one of its type parameters and is relying on the
Drop Check rule not applying to it.

Here is an example:

```rust
#![allow(dead_code,unused_variables,unused_assignments)]
struct D<T:Copy>(T);
impl<T:Copy> Drop for D<T> { fn drop(&mut self) { } }

trait UserT { fn c(&self) { } }
impl<T:Copy> UserT for T { }
struct E<T:UserT>(T);
impl<T:UserT> Drop for E<T> { fn drop(&mut self) { } }

// This one will start breaking.
fn foo() { let (d2, d1); d1 = D(34); d2 = D(&d1); }

#[cfg(this_one_does_and_should_always_break)]
fn bar() { let (e2, e1); e1 = E(34); e2 = E(&e1); }

fn main() {
    foo();
}
```
use visible characters for the multibyte character filler.
THis includes tests for struct and enum. (I suspect the closure case
is actually unreachable, but i see no harm in including it.)
@rust-highfive
Copy link
Collaborator

r? @pcwalton

(rust_highfive has picked a reviewer for you, use r? to override)

brson added a commit that referenced this pull request Apr 30, 2015
@brson brson merged commit 09e8ad5 into rust-lang:beta Apr 30, 2015
@alexcrichton alexcrichton deleted the beta-backport branch April 30, 2015 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants