Skip to content

Commit 8a65dfd

Browse files
committed
---
yaml --- r: 275867 b: refs/heads/auto c: a4e0e6b h: refs/heads/master i: 275865: 3bb5d6d 275863: 0c5b2b5
1 parent 0916c69 commit 8a65dfd

File tree

3 files changed

+73
-4
lines changed

3 files changed

+73
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: ccaa2f855e34028ff9be745ecc9803e720d34b5e
11+
refs/heads/auto: a4e0e6bbf5835afc69ab5df383097a1d7b8293c5
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/src/librustc_typeck/check/mod.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4800,9 +4800,11 @@ fn structurally_resolve_type_or_else<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
48004800

48014801
// If not, error.
48024802
if alternative.is_ty_var() || alternative.references_error() {
4803-
fcx.type_error_message(sp, |_actual| {
4804-
"the type of this value must be known in this context".to_string()
4805-
}, ty, None);
4803+
if !fcx.infcx().is_tainted_by_errors() {
4804+
fcx.type_error_message(sp, |_actual| {
4805+
"the type of this value must be known in this context".to_string()
4806+
}, ty, None);
4807+
}
48064808
demand::suptype(fcx, sp, fcx.tcx().types.err, ty);
48074809
ty = fcx.tcx().types.err;
48084810
} else {
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Copyright 2012 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+
// Regression test for this example from #31997 -- main goal is to
12+
// emit as minimal and precise an error set as possible. Ideally, we'd
13+
// only emit the E0433 error below, but right now we emit two.
14+
15+
use std::io::prelude::*;
16+
// use std::collections::HashMap;
17+
use std::io;
18+
19+
#[derive(Debug)]
20+
struct Instance {
21+
name: String,
22+
start: Option<String>,
23+
end: Option<String>,
24+
}
25+
26+
fn main() {
27+
let input = io::stdin();
28+
let mut input = input.lock();
29+
30+
let mut map = HashMap::new();
31+
//~^ ERROR E0433
32+
//~| ERROR E0425
33+
34+
for line in input.lines() {
35+
let line = line.unwrap();
36+
println!("process: {}", line);
37+
let mut parts = line.splitn(2, ":");
38+
let _logfile = parts.next().unwrap();
39+
let rest = parts.next().unwrap();
40+
let mut parts = line.split(" [-] ");
41+
42+
let stamp = parts.next().unwrap();
43+
44+
let rest = parts.next().unwrap();
45+
let words = rest.split_whitespace().collect::<Vec<_>>();
46+
47+
let instance = words.iter().find(|a| a.starts_with("i-")).unwrap();
48+
let name = words[1].to_owned();
49+
let mut entry = map.entry(instance.to_owned()).or_insert(Instance {
50+
name: name,
51+
start: None,
52+
end: None,
53+
});
54+
55+
if rest.contains("terminating") {
56+
assert!(entry.end.is_none());
57+
entry.end = Some(stamp.to_string());
58+
}
59+
if rest.contains("waiting for") {
60+
assert!(entry.start.is_none());
61+
entry.start = Some(stamp.to_string());
62+
}
63+
64+
}
65+
66+
println!("{:?}", map);
67+
}

0 commit comments

Comments
 (0)