Skip to content

Commit 088371a

Browse files
committed
---
yaml --- r: 208543 b: refs/heads/snap-stage3 c: 952614b h: refs/heads/master i: 208541: 32bc619 208539: b626107 208535: 9514b4c 208527: 7eabaf3 208511: 175eda3 v: v3
1 parent 9fd636e commit 088371a

File tree

4 files changed

+85
-44
lines changed

4 files changed

+85
-44
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: 38a97becdf3e6a6157f6f7ec2d98ade8d8edc193
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 83c6a12a54f6f9690cb4e1776483d108f653d24a
4+
refs/heads/snap-stage3: 952614bc8b5e198ffa82dd0ecffc96b141a3cc91
55
refs/heads/try: 7b4ef47b7805a402d756fb8157101f64880a522f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
-include ../tools.mk
2-
all:
2+
all: code
3+
krate2: krate2.rs
4+
$(RUSTC) $<
5+
code: foo.rs krate2
36
$(RUSTC) foo.rs -Zsave-analysis

branches/snap-stage3/src/test/run-make/save-analysis/foo.rs

Lines changed: 62 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,43 +9,52 @@
99
// except according to those terms.
1010

1111
#![ crate_name = "test" ]
12-
#![allow(unstable)]
13-
#![feature(box_syntax, rustc_private, core, zero_one)]
12+
#![feature(box_syntax)]
13+
#![feature(rustc_private)]
14+
1415

1516
extern crate graphviz;
1617
// A simple rust project
1718

19+
extern crate krate2;
20+
extern crate krate2 as krate3;
1821
extern crate flate as myflate;
1922

23+
use graphviz::RenderOption;
2024
use std::collections::{HashMap,HashSet};
2125
use std::cell::RefCell;
26+
use std::io::Write;
2227

2328

2429
use sub::sub2 as msalias;
2530
use sub::sub2;
2631
use sub::sub2::nested_struct as sub_struct;
27-
use std::num::One;
2832

2933
use std::mem::size_of;
3034

35+
use std::char::from_u32;
36+
3137
static uni: &'static str = "Les Miséééééééérables";
3238
static yy: usize = 25;
3339

34-
static bob: Option<&'static [isize]> = None;
40+
static bob: Option<graphviz::RenderOption> = None;
3541

3642
// buglink test - see issue #1337.
3743

3844
fn test_alias<I: Iterator>(i: Option<<I as Iterator>::Item>) {
39-
let s = sub_struct{ field2: 45, };
45+
let s = sub_struct{ field2: 45u32, };
4046

4147
// import tests
42-
fn foo(x: &One) {}
48+
fn foo(x: &Write) {}
49+
let _: Option<_> = from_u32(45);
4350

44-
let x = 42;
51+
let x = 42usize;
4552

53+
krate2::hello();
54+
krate3::hello();
4655
myflate::deflate_bytes(&[]);
4756

48-
let x = (3, 4);
57+
let x = (3isize, 4usize);
4958
let y = x.1;
5059
}
5160

@@ -55,15 +64,21 @@ fn test_tup_struct(x: TupStruct) -> isize {
5564
x.1
5665
}
5766

67+
fn println(s: &str) {
68+
std::io::stdout().write_all(s.as_bytes());
69+
}
70+
5871
mod sub {
5972
pub mod sub2 {
73+
use std::io::Write;
6074
pub mod sub3 {
75+
use std::io::Write;
6176
pub fn hello() {
62-
println!("hello from module 3");
77+
::println("hello from module 3");
6378
}
6479
}
6580
pub fn hello() {
66-
println!("hello from a module");
81+
::println("hello from a module");
6782
}
6883

6984
pub struct nested_struct {
@@ -93,14 +108,14 @@ struct some_fields {
93108
type SF = some_fields;
94109

95110
trait SuperTrait {
96-
fn dummy(&self) { }
111+
fn qux(&self) { panic!(); }
97112
}
98113

99114
trait SomeTrait: SuperTrait {
100115
fn Method(&self, x: u32) -> u32;
101116

102117
fn prov(&self, x: u32) -> u32 {
103-
println!("{}", &x.to_string());
118+
println(&x.to_string());
104119
42
105120
}
106121
fn provided_method(&self) -> u32 {
@@ -116,7 +131,7 @@ trait SubTrait: SomeTrait {
116131

117132
impl SomeTrait for some_fields {
118133
fn Method(&self, x: u32) -> u32 {
119-
println!("{}", &x.to_string());
134+
println(&x.to_string());
120135
self.field1
121136
}
122137
}
@@ -128,14 +143,15 @@ impl SubTrait for some_fields {}
128143

129144
impl some_fields {
130145
fn stat(x: u32) -> u32 {
131-
println!("{}", &x.to_string());
146+
println(&x.to_string());
132147
42
133148
}
134149
fn stat2(x: &some_fields) -> u32 {
135150
42
136151
}
137152

138153
fn align_to<T>(&mut self) {
154+
139155
}
140156

141157
fn test(&mut self) {
@@ -188,61 +204,58 @@ enum SomeStructEnum {
188204

189205
fn matchSomeEnum(val: SomeEnum) {
190206
match val {
191-
SomeEnum::Ints(int1, int2) => { println!("{}", &(int1+int2).to_string()); }
192-
SomeEnum::Floats(float1, float2) => { println!("{}", &(float2*float1).to_string()); }
193-
SomeEnum::Strings(_, _, s3) => { println!("{}", s3); }
194-
SomeEnum::MyTypes(mt1, mt2) => {
195-
println!("{}", &(mt1.field1 - mt2.field1).to_string());
196-
}
207+
SomeEnum::Ints(int1, int2) => { println(&(int1+int2).to_string()); }
208+
SomeEnum::Floats(float1, float2) => { println(&(float2*float1).to_string()); }
209+
SomeEnum::Strings(_, _, s3) => { println(s3); }
210+
SomeEnum::MyTypes(mt1, mt2) => { println(&(mt1.field1 - mt2.field1).to_string()); }
197211
}
198212
}
199213

200214
fn matchSomeStructEnum(se: SomeStructEnum) {
201215
match se {
202-
SomeStructEnum::EnumStruct{a:a, ..} => println!("{}", &a.to_string()),
203-
SomeStructEnum::EnumStruct2{f1:f1, f2:f_2} => println!("{}", &f_2.field1.to_string()),
204-
SomeStructEnum::EnumStruct3{f1, ..} => println!("{}", &f1.field1.to_string()),
216+
SomeStructEnum::EnumStruct{a:a, ..} => println(&a.to_string()),
217+
SomeStructEnum::EnumStruct2{f1:f1, f2:f_2} => println(&f_2.field1.to_string()),
218+
SomeStructEnum::EnumStruct3{f1, ..} => println(&f1.field1.to_string()),
205219
}
206220
}
207221

208222

209223
fn matchSomeStructEnum2(se: SomeStructEnum) {
210224
use SomeStructEnum::*;
211225
match se {
212-
EnumStruct{a: ref aaa, ..} => println!("{}", &aaa.to_string()),
213-
EnumStruct2{f1, f2: f2} => println!("{}", &f1.field1.to_string()),
214-
EnumStruct3{f1, f3: SomeEnum::Ints(_, _), f2} => println!("{}", &f1.field1.to_string()),
226+
EnumStruct{a: ref aaa, ..} => println(&aaa.to_string()),
227+
EnumStruct2{f1, f2: f2} => println(&f1.field1.to_string()),
228+
EnumStruct3{f1, f3: SomeEnum::Ints(_, _), f2} => println(&f1.field1.to_string()),
215229
_ => {},
216230
}
217231
}
218232

219233
fn matchSomeOtherEnum(val: SomeOtherEnum) {
220234
use SomeOtherEnum::{SomeConst2, SomeConst3};
221235
match val {
222-
SomeOtherEnum::SomeConst1 => { println!("I'm const1."); }
223-
SomeConst2 | SomeConst3 => { println!("I'm const2 or const3."); }
236+
SomeOtherEnum::SomeConst1 => { println("I'm const1."); }
237+
SomeConst2 | SomeConst3 => { println("I'm const2 or const3."); }
224238
}
225239
}
226240

227241
fn hello<X: SomeTrait>((z, a) : (u32, String), ex: X) {
228242
SameDir2::hello(43);
229243

230-
println!("{}", &yy.to_string());
244+
println(&yy.to_string());
231245
let (x, y): (u32, u32) = (5, 3);
232-
println!("{}", &x.to_string());
233-
println!("{}", &z.to_string());
246+
println(&x.to_string());
247+
println(&z.to_string());
234248
let x: u32 = x;
235-
println!("{}", &x.to_string());
249+
println(&x.to_string());
236250
let x = "hello";
237-
println!("{}", x);
251+
println(x);
238252

239253
let x = 32.0f32;
240254
let _ = (x + ((x * x) + 1.0).sqrt()).ln();
241255

242-
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
243-
let s: Box<SomeTrait> = Box::new(some_fields {field1: 43});
256+
let s: Box<SomeTrait> = box some_fields {field1: 43};
244257
let s2: Box<some_fields> = box some_fields {field1: 43};
245-
let s3: Box<_> = box nofields;
258+
let s3 = box nofields;
246259

247260
s.Method(43);
248261
s3.Method(43);
@@ -253,8 +266,6 @@ fn hello<X: SomeTrait>((z, a) : (u32, String), ex: X) {
253266
let y: u32 = 56;
254267
// static method on struct
255268
let r = some_fields::stat(y);
256-
// trait static method, calls override
257-
let r = SubTrait::stat2(&*s2);
258269
// trait static method, calls default
259270
let r = SubTrait::stat2(&*s3);
260271

@@ -277,7 +288,7 @@ pub struct blah {
277288
}
278289

279290
fn main() { // foo
280-
let s: Box<_> = box some_fields {field1: 43};
291+
let s = box some_fields {field1: 43};
281292
hello((43, "a".to_string()), *s);
282293
sub::sub2::hello();
283294
sub2::sub3::hello();
@@ -306,7 +317,7 @@ fn main() { // foo
306317
let s3: some_fields = some_fields{ field1: 55};
307318
let s4: msalias::nested_struct = sub::sub2::nested_struct{ field2: 55};
308319
let s4: msalias::nested_struct = sub2::nested_struct{ field2: 55};
309-
println!("{}", &s2.field1.to_string());
320+
println(&s2.field1.to_string());
310321
let s5: MyType = box some_fields{ field1: 55};
311322
let s = SameDir::SameStruct{name: "Bob".to_string()};
312323
let s = SubDir::SubStruct{name:"Bob".to_string()};
@@ -316,9 +327,18 @@ fn main() { // foo
316327
matchSomeEnum(s7);
317328
let s8: SomeOtherEnum = SomeOtherEnum::SomeConst2;
318329
matchSomeOtherEnum(s8);
319-
let s9: SomeStructEnum =
320-
SomeStructEnum::EnumStruct2{f1: box some_fields{field1:10}, f2: box s2};
330+
let s9: SomeStructEnum = SomeStructEnum::EnumStruct2{ f1: box some_fields{ field1:10 },
331+
f2: box s2 };
321332
matchSomeStructEnum(s9);
333+
334+
for x in &vec![1, 2, 3] {
335+
let _y = x;
336+
}
337+
338+
let s7: SomeEnum = SomeEnum::Strings("one", "two", "three");
339+
if let SomeEnum::Strings(..) = s7 {
340+
println!("hello!");
341+
}
322342
}
323343

324344
impl Iterator for nofields {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![ crate_name = "krate2" ]
12+
#![ crate_type = "lib" ]
13+
14+
use std::io::Write;
15+
16+
pub fn hello() {
17+
std::io::stdout().write_all(b"hello world!\n");
18+
}

0 commit comments

Comments
 (0)