refinement to technique used to not run regionck
This commit is contained in:
parent
e235f6ca53
commit
2ea52a38e5
12 changed files with 65 additions and 88 deletions
|
|
@ -10,8 +10,12 @@
|
|||
// except according to those terms.
|
||||
|
||||
|
||||
// error-pattern: dead
|
||||
fn f(caller: &str) {
|
||||
debug!(caller);
|
||||
let x: uint = 0u32; // induce type error //~ ERROR mismatched types
|
||||
}
|
||||
|
||||
fn f(caller: str) { debug!(caller); }
|
||||
|
||||
fn main() { return f("main"); debug!("Paul is dead"); }
|
||||
fn main() {
|
||||
return f("main");
|
||||
debug!("Paul is dead"); //~ WARNING unreachable
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,35 +0,0 @@
|
|||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// error-pattern: mismatched types
|
||||
extern mod std;
|
||||
use std::bitv;
|
||||
use core::hashmap::HashMap;
|
||||
|
||||
struct FnInfo {
|
||||
vars: HashMap<uint, VarInfo>
|
||||
}
|
||||
|
||||
struct VarInfo {
|
||||
a: uint,
|
||||
b: uint,
|
||||
}
|
||||
|
||||
fn bitv_to_str(enclosing: FnInfo, v: ~bitv::Bitv) -> str {
|
||||
let s = "";
|
||||
|
||||
// error is that the value type in the hash map is var_info, not a box
|
||||
for enclosing.vars.each_value |val| {
|
||||
if *v.get(val) { s += "foo"; }
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
fn main() { debug!("OK"); }
|
||||
|
|
@ -23,10 +23,8 @@ fn a_fn3<'a,'b>(e: a_class<'a>) -> a_class<'b> {
|
|||
return e; //~ ERROR mismatched types: expected `a_class/&'b ` but found `a_class/&'a `
|
||||
}
|
||||
|
||||
fn a_fn4<'a,'b>(e: int<'a>) -> int<'b> {
|
||||
//~^ ERROR region parameters are not allowed on this type
|
||||
//~^^ ERROR region parameters are not allowed on this type
|
||||
return e;
|
||||
fn a_fn4<'a,'b>() {
|
||||
let _: int<'a> = 1; //~ ERROR region parameters are not allowed on this type
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@ fn with<'a, R>(f: &fn(x: &'a int) -> R) -> R {
|
|||
|
||||
fn return_it<'a>() -> &'a int {
|
||||
with(|o| o) //~ ERROR mismatched types
|
||||
//~^ ERROR reference is not valid outside of its lifetime
|
||||
//~^^ ERROR reference is not valid outside of its lifetime
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@ fn with<R>(f: &fn(x: &int) -> R) -> R {
|
|||
|
||||
fn return_it() -> &int {
|
||||
with(|o| o) //~ ERROR mismatched types
|
||||
//~^ ERROR reference is not valid outside of its lifetime
|
||||
//~^^ ERROR reference is not valid outside of its lifetime
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -9,14 +9,11 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
|
||||
// error-pattern: mismatched types
|
||||
|
||||
fn main() {
|
||||
type X = int;
|
||||
type Y = X;
|
||||
if true {
|
||||
type X = str;
|
||||
let y: Y = "hello";
|
||||
type X = &'static str;
|
||||
let y: Y = "hello"; //~ ERROR mismatched types
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue