Skip to content

Commit dac57a3

Browse files
committed
---
yaml --- r: 228145 b: refs/heads/try c: 8d94bbf h: refs/heads/master i: 228143: 1e15a8f v: v3
1 parent 985ae56 commit dac57a3

File tree

33 files changed

+1261
-440
lines changed

33 files changed

+1261
-440
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: aca2057ed5fb7af3f8905b2bc01f72fa001c35c8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: 720da310a92242290df5623bf3d5e2ea5f83e7f8
4+
refs/heads/try: 8d94bbf106dfee6e722ac3896b7329bce1fd7120
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ will run all the tests on every platform we support. If it all works out,
123123

124124
[merge-queue]: http://buildbot.rust-lang.org/homu/queue/rust
125125

126+
Speaking of tests, Rust has a comprehensive test suite. More information about
127+
it can be found
128+
[here](https://github.com/rust-lang/rust-wiki-backup/blob/master/Note-testsuite.md).
129+
126130
## Writing Documentation
127131

128132
Documentation improvements are very welcome. The source of `doc.rust-lang.org`

branches/try/mk/main.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@ LLVM_BINDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --bindir)
295295
LLVM_INCDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --includedir)
296296
LLVM_LIBDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libdir)
297297
LLVM_LIBDIR_RUSTFLAGS_$(1)=-L "$$(LLVM_LIBDIR_$(1))"
298-
LLVM_LIBS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libs $$(LLVM_COMPONENTS))
299298
LLVM_LDFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --ldflags)
300299
ifeq ($$(findstring freebsd,$(1)),freebsd)
301300
# On FreeBSD, it may search wrong headers (that are for pre-installed LLVM),

branches/try/mk/target.mk

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,9 @@ endef
249249

250250
$(foreach host,$(CFG_HOST), \
251251
$(foreach target,$(CFG_TARGET), \
252-
$(foreach stage,$(STAGES), \
253-
$(foreach crate,$(CRATES), \
254-
$(eval $(call SETUP_LIB_MSVC_ENV_VARS,$(stage),$(target),$(host),$(crate)))))))
252+
$(foreach crate,$(CRATES), \
253+
$(eval $(call SETUP_LIB_MSVC_ENV_VARS,0,$(target),$(host),$(crate))))))
255254
$(foreach host,$(CFG_HOST), \
256255
$(foreach target,$(CFG_TARGET), \
257-
$(foreach stage,$(STAGES), \
258-
$(foreach tool,$(TOOLS), \
259-
$(eval $(call SETUP_TOOL_MSVC_ENV_VARS,$(stage),$(target),$(host),$(tool)))))))
256+
$(foreach tool,$(TOOLS), \
257+
$(eval $(call SETUP_TOOL_MSVC_ENV_VARS,0,$(target),$(host),$(tool))))))

branches/try/src/doc/trpl/ffi.md

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -533,19 +533,10 @@ attribute turns off Rust's name mangling, so that it is easier to link to.
533533

534534
# FFI and panics
535535

536-
It’s important to be mindful of `panic!`s when working with FFI. This code,
537-
when called from C, will `abort`:
538-
539-
```rust
540-
#[no_mangle]
541-
pub extern fn oh_no() -> ! {
542-
panic!("Oops!");
543-
}
544-
# fn main() {}
545-
```
546-
547-
If you’re writing code that may panic, you should run it in another thread,
548-
so that the panic doesn’t bubble up to C:
536+
It’s important to be mindful of `panic!`s when working with FFI. A `panic!`
537+
across an FFI boundary is undefined behavior. If you’re writing code that may
538+
panic, you should run it in another thread, so that the panic doesn’t bubble up
539+
to C:
549540

550541
```rust
551542
use std::thread;

branches/try/src/doc/trpl/patterns.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,38 @@ This ‘destructuring’ behavior works on any compound data type, like
282282
[tuples]: primitive-types.html#tuples
283283
[enums]: enums.html
284284

285+
# Ignoring bindings
286+
287+
You can use `_` in a pattern to disregard the value. For example, here’s a
288+
`match` against a `Result<T, E>`:
289+
290+
```rust
291+
# let some_value: Result<i32, &'static str> = Err("There was an error");
292+
match some_value {
293+
Ok(value) => println!("got a value: {}", value),
294+
Err(_) => println!("an error occurred"),
295+
}
296+
```
297+
298+
In the first arm, we bind the value inside the `Ok` variant to `value`. But
299+
in the `Err` arm, we use `_` to disregard the specific error, and just print
300+
a general error message.
301+
302+
`_` is valid in any pattern that creates a binding. This can be useful to
303+
ignore parts of a larger structure:
304+
305+
```rust
306+
fn coordinate() -> (i32, i32, i32) {
307+
// generate and return some sort of triple tuple
308+
# (1, 2, 3)
309+
}
310+
311+
let (x, _, z) = coordinate();
312+
```
313+
314+
Here, we bind the first and last element of the tuple to `x` and `z`, but
315+
ignore the middle element.
316+
285317
# Mix and Match
286318

287319
Whew! That’s a lot of different ways to match things, and they can all be

branches/try/src/etc/mklldeps.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414

1515
f = open(sys.argv[1], 'wb')
1616

17-
components = sys.argv[2].split(' ')
18-
components = [i for i in components if i] # ignore extra whitespaces
17+
components = sys.argv[2].split() # splits on whitespace
1918
enable_static = sys.argv[3]
20-
llconfig = sys.argv[4]
19+
llvm_config = sys.argv[4]
2120

2221
f.write("""// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2322
// file at the top-level directory of this distribution and at
@@ -39,15 +38,15 @@ def run(args):
3938
out, err = proc.communicate()
4039

4140
if err:
42-
print("failed to run llconfig: args = `{}`".format(args))
41+
print("failed to run llvm_config: args = `{}`".format(args))
4342
print(err)
4443
sys.exit(1)
4544
return out
4645

4746
f.write("\n")
4847

4948
# LLVM libs
50-
args = [llconfig, '--libs', '--system-libs']
49+
args = [llvm_config, '--libs', '--system-libs']
5150

5251
args.extend(components)
5352
out = run(args)
@@ -69,13 +68,13 @@ def run(args):
6968
f.write(")]\n")
7069

7170
# LLVM ldflags
72-
out = run([llconfig, '--ldflags'])
71+
out = run([llvm_config, '--ldflags'])
7372
for lib in out.strip().split(' '):
7473
if lib[:2] == "-l":
7574
f.write("#[link(name = \"" + lib[2:] + "\")]\n")
7675

7776
# C++ runtime library
78-
out = run([llconfig, '--cxxflags'])
77+
out = run([llvm_config, '--cxxflags'])
7978
if enable_static == '1':
8079
assert('stdlib=libc++' not in out)
8180
f.write("#[link(name = \"stdc++\", kind = \"static\")]\n")

0 commit comments

Comments
 (0)