Commit Graph

44016 Commits

Author SHA1 Message Date
Guillaume Gomez
67c11b0146 Add E0071 error explanation 2015-06-23 19:34:38 +02:00
Guillaume Gomez
0770f665d9 Add E0044 error code explanation 2015-06-23 19:34:07 +02:00
bors
27ecbba388 Auto merge of #26508 - tshepang:stray-code-block, r=bluss 2015-06-23 17:27:07 +00:00
bors
d54ab412ef Auto merge of #26503 - GuillaumeGomez:patch-4, r=Manishearth
r? @Manishearth
2015-06-23 15:55:19 +00:00
bors
3223c885b9 Auto merge of #26367 - tshepang:patch-1, r=bluss 2015-06-23 14:24:10 +00:00
bors
997bd334fb Auto merge of #26354 - jroesch:remove-param-bounds-take-n, r=nikomatsakis
This pull request removes `ParamBounds` a old holdover in the type checker that we (@nikomatsakis and I) had wanted to remove. I'm not sure if the current form is the best possible refactor but I figured we can use this as a place to discuss it.

r? @nikomatsakis
2015-06-23 12:52:59 +00:00
Makoto Kato
11ec95b949 Support Android/x86 for liblibc
All types are same as Android/arm.  So I add condition for Android/x86
2015-06-23 14:09:01 +02:00
bors
699315e4f5 Auto merge of #26519 - oli-obk:camel_case_const_val, r=eddyb 2015-06-23 11:20:51 +00:00
bors
4ffeb2e32d Auto merge of #26517 - nrc:fix-parallel-codegen, r=arielb1
Closes #26420

r? @nikomatsakis
2015-06-23 09:49:03 +00:00
Josh Triplett
01fa55988a tuple.rs: Document more traits implemented by tuples if their components do
Tuples implement Debug and Hash if their components do.
2015-06-23 11:18:08 +02:00
Oliver Schneider
88b03f349e change const_val enum and its variants to camel-case 2015-06-23 10:31:32 +02:00
bors
17450192d9 Auto merge of #26513 - shunyata:master, r=alexcrichton
I'm currently reading the rust book and this variable name tripped me up.
Because it was called "input", I thought at first it might contain the line
read by read_line(). This new variable name will be more instructive to rust
beginners.
2015-06-23 08:18:14 +00:00
Jared Roesch
81e5c1ff06 Remove the mostly unecessary ParamBounds struct 2015-06-23 00:10:19 -07:00
Guillaume Gomez
3ff12223dc Comment E0222 instead of removing it 2015-06-23 08:14:49 +02:00
Nick Cameron
19645c4e21 Test for a particular parallel codegen corner case 2015-06-22 23:08:44 -07:00
Nick Cameron
ce0c2572ec Fix parallel codegen regression
Regressed by #26326
2015-06-22 22:34:12 -07:00
bors
e749f724b0 Auto merge of #26514 - tshepang:repetition, r=Gankro 2015-06-23 02:32:44 +00:00
bors
cffaf0e7a8 Auto merge of #26435 - gsingh93:master, r=nikomatsakis
When a method exists in an impl but can not be used due to missing trait bounds for the type parameters, we should inform the user which trait bounds are missing.

For example, this code
```
// Note this is missing a Debug impl
struct Foo;

fn main() {
    let a: Result<(), Foo> = Ok(());
    a.unwrap()
}
```
Now gives the following error:
```
/home/gulshan/tmp/tmp.rs:6:7: 6:15 error: no method named `unwrap` found for type `core::result::Result<(), Foo>` in the current scope
/home/gulshan/tmp/tmp.rs:6     a.unwrap()
                                 ^~~~~~~~
/home/gulshan/tmp/tmp.rs:6:7: 6:15 note: The method `unwrap` exists but the following trait bounds were not satisfied: `Foo : core::fmt::Debug`
error: aborting due to previous error
```

Fixes https://github.com/rust-lang/rust/issues/20941.
2015-06-23 01:00:48 +00:00
Tshepang Lekhonkhobe
4ce7901a5a doc: remove repeated word 2015-06-23 02:48:37 +02:00
Gulshan Singh
a006a82724 Suggest missing trait bounds when a method exists but the bounds aren't satisfied 2015-06-22 20:28:46 -04:00
Jake Hickey
deee268015 Use a more descriptive variable name.
I'm currently reading the rust book and this variable name tripped me up.
Because it was called "input", I thought at first it might contain the line
read by read_line(). This new variable name will be more instructive to rust
beginners.
2015-06-22 18:48:50 -04:00
bors
a8dbd71fc8 Auto merge of #26512 - yongqli:master, r=sfackler 2015-06-22 22:33:51 +00:00
Yongqian Li
f21682ba2d fix minor indentation issues 2015-06-22 15:30:56 -07:00
Guillaume Gomez
ccb459e49a Change description of error (thanks @Manisheart) 2015-06-22 21:53:30 +02:00
Guillaume Gomez
11f0f47220 Remove E0222 from errors list 2015-06-22 21:53:19 +02:00
bors
5c5753e876 Auto merge of #26500 - sanxiyn:dead-field, r=alexcrichton
Fix #26353.
2015-06-22 18:42:31 +00:00
Tshepang Lekhonkhobe
f8158122c5 book: there are 4 special sections 2015-06-22 20:32:56 +02:00
Tshepang Lekhonkhobe
7a0a69f801 book: remove a stray code block 2015-06-22 20:14:27 +02:00
Tshepang Lekhonkhobe
e13077f7f0 book: whitespace 2015-06-22 19:29:34 +02:00
Tshepang Lekhonkhobe
0adda45c04 book: fix sentence 2015-06-22 19:29:29 +02:00
Guillaume Gomez
97e1615735 Add E0045 error explanation 2015-06-22 18:39:25 +02:00
Guillaume Gomez
3f9fc39ab9 Unify variadic errors 2015-06-22 18:34:52 +02:00
bors
4e2a898afc Auto merge of #25784 - geofft:subprocess-signal-masks, r=alexcrichton
UNIX specifies that signal dispositions and masks get inherited to child processes, but in general, programs are not very robust to being started with non-default signal dispositions or to signals being blocked. For example, libstd sets `SIGPIPE` to be ignored, on the grounds that Rust code using libstd will get the `EPIPE` errno and handle it correctly. But shell pipelines are built around the assumption that `SIGPIPE` will have its default behavior of killing the process, so that things like `head` work:

```
geofft@titan:/tmp$ for i in `seq 1 20`; do echo "$i"; done | head -1
1
geofft@titan:/tmp$ cat bash.rs
fn main() {
        std::process::Command::new("bash").status();
}
geofft@titan:/tmp$ ./bash
geofft@titan:/tmp$ for i in `seq 1 20`; do echo "$i"; done | head -1
1
bash: echo: write error: Broken pipe
bash: echo: write error: Broken pipe
bash: echo: write error: Broken pipe
bash: echo: write error: Broken pipe
bash: echo: write error: Broken pipe
[...]
```

Here, `head` is supposed to terminate the input process quietly, but the bash subshell has inherited the ignored disposition of `SIGPIPE` from its Rust grandparent process. So it gets a bunch of `EPIPE`s that it doesn't know what to do with, and treats it as a generic, transient error. You can see similar behavior with `find / | head`, `yes | head`, etc.

This PR resets Rust's `SIGPIPE` handler, as well as any signal mask that may have been set, before spawning a child. Setting a signal mask, and then using a dedicated thread or something like `signalfd` to dequeue signals, is one of two reasonable ways for a library to process signals. See carllerche/mio#16 for more discussion about this approach to signal handling and why it needs a change to `std::process`. The other approach is for the library to set a signal-handling function (`signal()` / `sigaction()`): in that case, dispositions are reset to the default behavior on exec (since the function pointer isn't valid across exec), so we don't have to care about that here.

As part of this PR, I noticed that we had two somewhat-overlapping sets of bindings to signal functionality in `libstd`. One dated to old-IO and probably the old runtime, and was mostly unused. The other is currently used by `stack_overflow.rs`. I consolidated the two bindings into one set, and double-checked them by hand against all supported platforms' headers. This probably means it's safe to enable `stack_overflow.rs` on more targets, but I'm not including such a change in this PR.

r? @alexcrichton
cc @Zoxc for changes to `stack_overflow.rs`
2015-06-22 16:11:38 +00:00
Seo Sanghyeon
6f7b4ce65a Do not consider fields matched by wildcard patterns to be used 2015-06-22 21:36:14 +09:00
bors
2287b4b628 Auto merge of #26037 - nhowell:plain_js_playpen, r=steveklabnik
Since the "Book" already avoids jQuery in its inline script tags and playpen.js is tiny, I figured I would convert it to plain old JS as well.

Side note: This is a separate issue, but another thing I noticed in my testing is that the "⇱" character doesn't display correctly in Chrome on Windows 7. (Firefox and IE work fine; other browsers not tested)

r? @steveklabnik

Edit: Github didn't like the "script" tag above
Edit 2: Actually, now IE seems to render "⇱" fine for me. Odd.
2015-06-22 05:23:50 +00:00
Geoffrey Thomas
a8dbb92b47 Fix build on Android API levels below 21
signal(), sigemptyset(), and sigaddset() are only available as inline
functions until Android API 21. liblibc already handles signal()
appropriately, so drop it from c.rs; translate sigemptyset() and
sigaddset() (which is only used in a test) by hand from the C inlines.

We probably want to revert this commit when we bump Android API level.
2015-06-22 00:55:42 -04:00
Geoffrey Thomas
cae005162d sys/unix/process: Reset signal behavior before exec
Make sure that child processes don't get affected by libstd's desire to
ignore SIGPIPE, nor a third-party library's signal mask (which is needed
to use either a signal-handling thread correctly or to use signalfd /
kqueue correctly).
2015-06-22 00:55:42 -04:00
Geoffrey Thomas
56d904c4bb sys/unix: Consolidate signal-handling FFI bindings
Both c.rs and stack_overflow.rs had bindings of libc's signal-handling
routines. It looks like the split dated from #16388, when (what is now)
c.rs was in libnative but not libgreen. Nobody is currently using the
c.rs bindings, but they're a bit more accurate in some places.

Move everything to c.rs (since I'll need signal handling in process.rs,
and we should avoid duplication), clean up the bindings, and manually
double-check everything against the relevant system headers (fixing a
few things in the process).
2015-06-22 00:55:42 -04:00
Geoffrey Thomas
e13642163a sys/unix/c.rs: Remove unused code
It looks like a lot of this dated to previous incarnations of the io
module, etc., and went unused in the reworking leading up to 1.0. Remove
everything we're not actively using (except for signal handling, which
will be reworked in the next commit).
2015-06-22 00:55:42 -04:00
Geoffrey Thomas
feba393b8e std::process: Remove helper function pwd_cmd from test module
The test that used it was removed in 700e627cf7.
2015-06-22 00:55:42 -04:00
OGINO Masanori
59399088ca Put CFG_BUILD triples into CFG_HOST triples.
I've configured with the parameters suggested by @brson in #18670 and
confirmed that it works on Gentoo Linux amd64.

Fixes #18670.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2015-06-22 12:53:34 +09:00
Alex Crichton
db5b463705 rustc_trans: Use custom PATH for archive commands
This commit ensures that the modifications made in #26382 also apply to the
archive commands run in addition to the linker commands.
2015-06-21 20:47:20 -07:00
bors
ba7f79e9f8 Auto merge of #26481 - nham:test-18655, r=arielb1
These issues are fixed but still open.

Closes #18655.
Closes #18988.
2015-06-22 01:43:02 +00:00
bors
31d9aee684 Auto merge of #26394 - arielb1:implement-rfc401-part2, r=nrc
This makes them compliant with the new version of RFC 401 (i.e.
    RFC 1052).

Fixes #26391. I *hope* the tests I have are enough.

This is a [breaking-change]

r? @nrc
2015-06-22 00:11:00 +00:00
bors
4a788a2003 Auto merge of #26479 - arielb1:expr-kind, r=eddyb
Previously it also tried to find out the best way to translate the
expression, which could ICE during type-checking.

Fixes #23173
Fixes #24322
Fixes #25757

r? @eddyb
2015-06-21 22:41:00 +00:00
bors
fd874cd02e Auto merge of #26463 - sfackler:stdout-panic-fix, r=alexcrichton
If a local stderr is present but the normal stderr is missing, we still
want to print.

r? @alexcrichton
2015-06-21 20:14:45 +00:00
Nick Hamann
57a66f8ef3 Add regression tests for issues #18655 and #18988.
Closes #18655.
Closes #18988.
2015-06-21 15:09:05 -05:00
Ariel Ben-Yehuda
59be753544 Make expr_is_lval more robust
Previously it also tried to find out the best way to translate the
expression, which could ICE during type-checking.

Fixes #23173
Fixes #24322
Fixes #25757
2015-06-21 22:31:57 +03:00
Ulrik Sverdrup
71006bd654 StrSearcher: Use trait to specialize two way algorithm by case
Use a trait to be able to implement both the fast search that skips to
each match, and the slower search that emits `Reject` intervals
regularly. The latter is important for uses of `next_reject`.
2015-06-21 19:58:56 +02:00
Ulrik Sverdrup
a6dd2031a3 StrSearcher: Specialize is_prefix_of/is_suffix_of for &str 2015-06-21 19:58:56 +02:00