Skip to content

Commit 090160f

Browse files
committed
---
yaml --- r: 212247 b: refs/heads/tmp c: 01dee1b h: refs/heads/master i: 212245: 149d405 212243: c4b2f69 212239: 62f71b5 v: v3
1 parent e6d5653 commit 090160f

File tree

12 files changed

+116
-197
lines changed

12 files changed

+116
-197
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3232
refs/heads/beta: 62e70d35be3fe532c26a400b499c58a18f18dd3a
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
35-
refs/heads/tmp: d6b82428b5f7ad3691adaa1c2a1ed10b2c96baa4
35+
refs/heads/tmp: 01dee1b77e3f594256fc380c348f7ba8fcff41db
3636
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3737
refs/tags/homu-tmp: b77d60adb019bb5de05e884a99f3290ec4694137
3838
refs/heads/gate: 97c84447b65164731087ea82685580cc81424412

branches/tmp/src/doc/trpl/hello-cargo.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ $ mv main.rs src/main.rs
3333
```
3434

3535
Note that since we're creating an executable, we used `main.rs`. If we
36-
want to make a library instead, we should use `lib.rs`. This convention is required
37-
for Cargo to successfully compile our projects, but it can be overridden if we wish.
36+
want to make a library instead, we should use `lib.rs`.
3837
Custom file locations for the entry point can be specified
3938
with a [`[[lib]]` or `[[bin]]`][crates-custom] key in the TOML file described below.
4039

@@ -63,17 +62,18 @@ version = "0.0.1"
6362
authors = [ "Your name <[email protected]>" ]
6463
```
6564

66-
This file is in the [TOML][toml] format. TOML is similar to INI, but has some
67-
extra goodies. According to the TOML docs,
65+
This file is in the [TOML][toml] format. Let’s let it explain itself to you:
6866

6967
> TOML aims to be a minimal configuration file format that's easy to read due
7068
> to obvious semantics. TOML is designed to map unambiguously to a hash table.
7169
> TOML should be easy to parse into data structures in a wide variety of
7270
> languages.
7371
72+
TOML is very similar to INI, but with some extra goodies.
73+
7474
[toml]: https://github.com/toml-lang/toml
7575

76-
Once you have this file in place, we should be ready to build! To do so, run:
76+
Once you have this file in place, we should be ready to build! Try this:
7777

7878
```bash
7979
$ cargo build
@@ -82,7 +82,7 @@ $ ./target/debug/hello_world
8282
Hello, world!
8383
```
8484

85-
Bam! We built our project with `cargo build`, and ran it with
85+
Bam! We build our project with `cargo build`, and run it with
8686
`./target/debug/hello_world`. We can do both in one step with `cargo run`:
8787

8888
```bash
@@ -103,9 +103,9 @@ Hello, world!
103103
```
104104

105105
This hasn’t bought us a whole lot over our simple use of `rustc`, but think
106-
about the future: when our project gets more complex, we need to do more
106+
about the future: when our project gets more complex, we would need to do more
107107
things to get all of the parts to properly compile. With Cargo, as our project
108-
grows, we can just run `cargo build`, and it’ll work the right way.
108+
grows, we can just `cargo build`, and it’ll work the right way.
109109

110110
When your project is finally ready for release, you can use
111111
`cargo build --release` to compile your project with optimizations.
@@ -118,7 +118,7 @@ name = "hello_world"
118118
version = "0.0.1"
119119
```
120120

121-
The `Cargo.lock` file is used by Cargo to keep track of dependencies in your application.
121+
This file is used by Cargo to keep track of dependencies in your application.
122122
Right now, we don’t have any, so it’s a bit sparse. You won't ever need
123123
to touch this file yourself, just let Cargo handle it.
124124

branches/tmp/src/libcollections/str.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1466,7 +1466,6 @@ impl str {
14661466
/// assert_eq!("bors".as_bytes(), b"bors");
14671467
/// ```
14681468
#[stable(feature = "rust1", since = "1.0.0")]
1469-
#[inline(always)]
14701469
pub fn as_bytes(&self) -> &[u8] {
14711470
core_str::StrExt::as_bytes(&self[..])
14721471
}

branches/tmp/src/librustc/middle/check_rvalues.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for RvalueContextDelegate<'a, 'tcx> {
6060
cmt: mc::cmt<'tcx>,
6161
_: euv::ConsumeMode) {
6262
debug!("consume; cmt: {:?}; type: {}", *cmt, ty_to_string(self.tcx, cmt.ty));
63-
if !ty::type_is_sized(Some(self.param_env), self.tcx, span, cmt.ty) {
63+
if !ty::type_is_sized(self.param_env, span, cmt.ty) {
6464
span_err!(self.tcx.sess, span, E0161,
6565
"cannot move a value of type {0}: the size of {0} cannot be statically determined",
6666
ty_to_string(self.tcx, cmt.ty));

branches/tmp/src/librustc/middle/intrinsicck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ impl<'a, 'tcx> IntrinsicCheckingVisitor<'a, 'tcx> {
212212
debug!("with_each_combination: space={:?}, index={}, param_ty={}",
213213
space, index, param_ty.repr(self.tcx));
214214

215-
if !ty::type_is_sized(Some(param_env), self.tcx, span, param_ty) {
215+
if !ty::type_is_sized(param_env, span, param_ty) {
216216
debug!("with_each_combination: param_ty is not known to be sized");
217217

218218
substs.types.get_mut_slice(space)[index] = self.dummy_unsized_ty;

branches/tmp/src/librustc/middle/traits/select.rs

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2523,41 +2523,57 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
25232523
ty::lookup_field_type_unsubstituted(tcx, def_id, f.id)
25242524
}).collect::<Vec<_>>();
25252525

2526-
// FIXME(#25351) The last field of the structure has to exist and be a
2527-
// type parameter (for now, to avoid tracking edge cases).
2528-
let i = if let Some(&ty::ty_param(p)) = fields.last().map(|ty| &ty.sty) {
2529-
assert!(p.space == TypeSpace);
2530-
p.idx as usize
2526+
// The last field of the structure has to exist and contain type parameters.
2527+
let field = if let Some(&field) = fields.last() {
2528+
field
25312529
} else {
25322530
return Err(Unimplemented);
25332531
};
2532+
let mut ty_params = vec![];
2533+
ty::walk_ty(field, |ty| {
2534+
if let ty::ty_param(p) = ty.sty {
2535+
assert!(p.space == TypeSpace);
2536+
let idx = p.idx as usize;
2537+
if !ty_params.contains(&idx) {
2538+
ty_params.push(idx);
2539+
}
2540+
}
2541+
});
2542+
if ty_params.is_empty() {
2543+
return Err(Unimplemented);
2544+
}
25342545

2535-
// Replace the type parameter chosen for unsizing with
2536-
// ty_err and ensure it does not affect any other fields.
2546+
// Replace type parameters used in unsizing with
2547+
// ty_err and ensure they do not affect any other fields.
25372548
// This could be checked after type collection for any struct
25382549
// with a potentially unsized trailing field.
25392550
let mut new_substs = substs_a.clone();
2540-
new_substs.types.get_mut_slice(TypeSpace)[i] = tcx.types.err;
2551+
for &i in &ty_params {
2552+
new_substs.types.get_mut_slice(TypeSpace)[i] = tcx.types.err;
2553+
}
25412554
for &ty in fields.init() {
25422555
if ty::type_is_error(ty.subst(tcx, &new_substs)) {
25432556
return Err(Unimplemented);
25442557
}
25452558
}
25462559

2547-
// Extract T and U from Struct<T> and Struct<U>.
2548-
let inner_source = *substs_a.types.get(TypeSpace, i);
2549-
let inner_target = *substs_b.types.get(TypeSpace, i);
2560+
// Extract Field<T> and Field<U> from Struct<T> and Struct<U>.
2561+
let inner_source = field.subst(tcx, substs_a);
2562+
let inner_target = field.subst(tcx, substs_b);
25502563

2551-
// Check that all the source structure with the unsized
2552-
// type parameter is a subtype of the target.
2553-
new_substs.types.get_mut_slice(TypeSpace)[i] = inner_target;
2564+
// Check that the source structure with the target's
2565+
// type parameters is a subtype of the target.
2566+
for &i in &ty_params {
2567+
let param_b = *substs_b.types.get(TypeSpace, i);
2568+
new_substs.types.get_mut_slice(TypeSpace)[i] = param_b;
2569+
}
25542570
let new_struct = ty::mk_struct(tcx, def_id, tcx.mk_substs(new_substs));
25552571
let origin = infer::Misc(obligation.cause.span);
25562572
if self.infcx.sub_types(false, origin, new_struct, target).is_err() {
25572573
return Err(Unimplemented);
25582574
}
25592575

2560-
// Construct the nested T: Unsize<U> predicate.
2576+
// Construct the nested Field<T>: Unsize<Field<U>> predicate.
25612577
nested.push(util::predicate_for_trait_def(tcx,
25622578
obligation.cause.clone(),
25632579
obligation.predicate.def_id(),

0 commit comments

Comments
 (0)