diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2014-01-27 15:28:04 +1100 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2014-01-27 15:28:04 +1100 |
| commit | d9a204bf4c32743fad187b5c660279c779643b3f (patch) | |
| tree | 1fc4ddf0161e478ec4b2a6fa5e3d0fdf422316b8 /src | |
| parent | b079ebeb8da4198112831af05c88b48974268337 (diff) | |
| download | rust-d9a204bf4c32743fad187b5c660279c779643b3f.tar.gz rust-d9a204bf4c32743fad187b5c660279c779643b3f.zip | |
Add autogenerated tests for the spans of various derived traits.
Diffstat (limited to 'src')
33 files changed, 912 insertions, 28 deletions
diff --git a/src/etc/generate-deriving-span-tests.py b/src/etc/generate-deriving-span-tests.py new file mode 100755 index 00000000000..e66b7113a45 --- /dev/null +++ b/src/etc/generate-deriving-span-tests.py @@ -0,0 +1,131 @@ +#!/usr/bin/env python +# xfail-license +# Copyright 2013 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. + +""" +This script creates a pile of compile-fail tests check that all the +derivings have spans that point to the fields, rather than the +#[deriving(...)] line. + +sample usage: src/etc/generate-deriving-span-tests.py +""" + +import sys, os, datetime, stat + +TEST_DIR = os.path.abspath( + os.path.join(os.path.dirname(__file__), '../test/compile-fail')) + +YEAR = datetime.datetime.now().year + +TEMPLATE = """// Copyright {year} 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + +{error_deriving} +struct Error; +{code} +fn main() {{}} +""" + +ENUM_STRING = """ +#[deriving({traits})] +enum Enum {{ + A( + Error {errors} + ) +}} +""" +ENUM_STRUCT_VARIANT_STRING = """ +#[deriving({traits})] +enum Enum {{ + A {{ + x: Error {errors} + }} +}} +""" +STRUCT_STRING = """ +#[deriving({traits})] +struct Struct {{ + x: Error {errors} +}} +""" +STRUCT_TUPLE_STRING = """ +#[deriving({traits})] +struct Struct( + Error {errors} +); +""" + +ENUM_TUPLE, ENUM_STRUCT, STRUCT_FIELDS, STRUCT_TUPLE = range(4) + +def create_test_case(type, trait, super_traits, number_of_errors): + string = [ENUM_STRING, ENUM_STRUCT_VARIANT_STRING, STRUCT_STRING, STRUCT_TUPLE_STRING][type] + all_traits = ','.join([trait] + super_traits) + super_traits = ','.join(super_traits) + error_deriving = '#[deriving(%s)]' % super_traits if super_traits else '' + + errors = '\n'.join('//~%s ERROR' % ('^' * n) for n in range(error_count)) + code = string.format(traits = all_traits, errors = errors) + return TEMPLATE.format(year = YEAR, error_deriving=error_deriving, code = code) + +def write_file(name, string): + test_file = os.path.join(TEST_DIR, 'deriving-span-%s.rs' % name) + + # set write permission if file exists, so it can be changed + if os.path.exists(test_file): + os.chmod(test_file, stat.S_IWUSR) + + with open(test_file, 'wt') as f: + f.write(string) + + # mark file read-only + os.chmod(test_file, stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH) + + + +ENUM = 1 +STRUCT = 2 +ALL = STRUCT | ENUM + +traits = { + 'Zero': (STRUCT, [], 1), + 'Default': (STRUCT, [], 1), + 'FromPrimitive': (0, [], 0), # only works for C-like enums + + 'Decodable': (0, [], 0), # FIXME: quoting gives horrible spans + 'Encodable': (0, [], 0), # FIXME: quoting gives horrible spans +} + +for (trait, supers, errs) in [('Rand', [], 1), + ('Clone', [], 1), ('DeepClone', ['Clone'], 1), + ('Eq', [], 2), ('Ord', [], 8), + ('TotalEq', [], 2), ('TotalOrd', ['TotalEq'], 2)]: + traits[trait] = (ALL, supers, errs) + +for (trait, (types, super_traits, error_count)) in traits.items(): + mk = lambda ty: create_test_case(ty, trait, super_traits, error_count) + if types & ENUM: + write_file(trait + '-enum', mk(ENUM_TUPLE)) + write_file(trait + '-enum-struct-variant', mk(ENUM_STRUCT)) + if types & STRUCT: + write_file(trait + '-struct', mk(STRUCT_FIELDS)) + write_file(trait + '-tuple-struct', mk(STRUCT_TUPLE)) diff --git a/src/test/compile-fail/deriving-span-Clone-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-Clone-enum-struct-variant.rs new file mode 100644 index 00000000000..983156f9b4f --- /dev/null +++ b/src/test/compile-fail/deriving-span-Clone-enum-struct-variant.rs @@ -0,0 +1,26 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + + +struct Error; + +#[deriving(Clone)] +enum Enum { + A { + x: Error //~ ERROR + } +} + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-Clone-enum.rs b/src/test/compile-fail/deriving-span-Clone-enum.rs new file mode 100644 index 00000000000..e5ceef886e1 --- /dev/null +++ b/src/test/compile-fail/deriving-span-Clone-enum.rs @@ -0,0 +1,26 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + + +struct Error; + +#[deriving(Clone)] +enum Enum { + A( + Error //~ ERROR + ) +} + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-Clone-struct.rs b/src/test/compile-fail/deriving-span-Clone-struct.rs new file mode 100644 index 00000000000..fd763df311c --- /dev/null +++ b/src/test/compile-fail/deriving-span-Clone-struct.rs @@ -0,0 +1,24 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + + +struct Error; + +#[deriving(Clone)] +struct Struct { + x: Error //~ ERROR +} + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-Clone-tuple-struct.rs b/src/test/compile-fail/deriving-span-Clone-tuple-struct.rs new file mode 100644 index 00000000000..d444c5e3161 --- /dev/null +++ b/src/test/compile-fail/deriving-span-Clone-tuple-struct.rs @@ -0,0 +1,24 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + + +struct Error; + +#[deriving(Clone)] +struct Struct( + Error //~ ERROR +); + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-DeepClone-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-DeepClone-enum-struct-variant.rs new file mode 100644 index 00000000000..0dc6266bec4 --- /dev/null +++ b/src/test/compile-fail/deriving-span-DeepClone-enum-struct-variant.rs @@ -0,0 +1,26 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + +#[deriving(Clone)] +struct Error; + +#[deriving(DeepClone,Clone)] +enum Enum { + A { + x: Error //~ ERROR + } +} + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-DeepClone-enum.rs b/src/test/compile-fail/deriving-span-DeepClone-enum.rs new file mode 100644 index 00000000000..5b210d0ff79 --- /dev/null +++ b/src/test/compile-fail/deriving-span-DeepClone-enum.rs @@ -0,0 +1,26 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + +#[deriving(Clone)] +struct Error; + +#[deriving(DeepClone,Clone)] +enum Enum { + A( + Error //~ ERROR + ) +} + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-DeepClone-struct.rs b/src/test/compile-fail/deriving-span-DeepClone-struct.rs new file mode 100644 index 00000000000..f063ed58dce --- /dev/null +++ b/src/test/compile-fail/deriving-span-DeepClone-struct.rs @@ -0,0 +1,24 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + +#[deriving(Clone)] +struct Error; + +#[deriving(DeepClone,Clone)] +struct Struct { + x: Error //~ ERROR +} + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-DeepClone-tuple-struct.rs b/src/test/compile-fail/deriving-span-DeepClone-tuple-struct.rs new file mode 100644 index 00000000000..1b053897c0e --- /dev/null +++ b/src/test/compile-fail/deriving-span-DeepClone-tuple-struct.rs @@ -0,0 +1,24 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + +#[deriving(Clone)] +struct Error; + +#[deriving(DeepClone,Clone)] +struct Struct( + Error //~ ERROR +); + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-Default-struct.rs b/src/test/compile-fail/deriving-span-Default-struct.rs new file mode 100644 index 00000000000..7c2edd8cb7b --- /dev/null +++ b/src/test/compile-fail/deriving-span-Default-struct.rs @@ -0,0 +1,24 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + + +struct Error; + +#[deriving(Default)] +struct Struct { + x: Error //~ ERROR +} + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-Default-tuple-struct.rs b/src/test/compile-fail/deriving-span-Default-tuple-struct.rs new file mode 100644 index 00000000000..e0269a6aad3 --- /dev/null +++ b/src/test/compile-fail/deriving-span-Default-tuple-struct.rs @@ -0,0 +1,24 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + + +struct Error; + +#[deriving(Default)] +struct Struct( + Error //~ ERROR +); + +fn main() {} diff --git a/src/test/compile-fail/deriving-field-span-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-Eq-enum-struct-variant.rs index 44b56e09840..abedb3e660f 100644 --- a/src/test/compile-fail/deriving-field-span-enum-struct-variant.rs +++ b/src/test/compile-fail/deriving-span-Eq-enum-struct-variant.rs @@ -1,4 +1,4 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -8,16 +8,20 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + #[feature(struct_variant)]; +extern mod extra; + -struct NotEq; +struct Error; #[deriving(Eq)] -enum Foo { - Bar { - x: NotEq //~ ERROR mismatched types - //~^ ERROR failed to find an implementation of trait std::cmp::Eq for NotEq - } +enum Enum { + A { + x: Error //~ ERROR +//~^ ERROR + } } -pub fn main() {} +fn main() {} diff --git a/src/test/compile-fail/deriving-field-span-enum.rs b/src/test/compile-fail/deriving-span-Eq-enum.rs index 8189744de1e..3486d96205b 100644 --- a/src/test/compile-fail/deriving-field-span-enum.rs +++ b/src/test/compile-fail/deriving-span-Eq-enum.rs @@ -1,4 +1,4 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -8,15 +8,20 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + #[feature(struct_variant)]; +extern mod extra; + -struct NotEq; +struct Error; #[deriving(Eq)] -enum Foo { - Bar(NotEq), //~ ERROR mismatched types - //~^ ERROR failed to find an implementation of trait std::cmp::Eq for NotEq - Baz { x: NotEq } +enum Enum { + A( + Error //~ ERROR +//~^ ERROR + ) } -pub fn main() {} +fn main() {} diff --git a/src/test/compile-fail/deriving-field-span-struct.rs b/src/test/compile-fail/deriving-span-Eq-struct.rs index 1add2cd6894..32d2e78eabc 100644 --- a/src/test/compile-fail/deriving-field-span-struct.rs +++ b/src/test/compile-fail/deriving-span-Eq-struct.rs @@ -1,4 +1,4 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -8,12 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct NotEq; +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + + +struct Error; #[deriving(Eq)] -struct Foo { - x: NotEq //~ ERROR mismatched types - //~^ ERROR failed to find an implementation of trait std::cmp::Eq for NotEq +struct Struct { + x: Error //~ ERROR +//~^ ERROR } -pub fn main() {} +fn main() {} diff --git a/src/test/compile-fail/deriving-field-span-tuple-struct.rs b/src/test/compile-fail/deriving-span-Eq-tuple-struct.rs index 1f56e774f62..acc46a1002a 100644 --- a/src/test/compile-fail/deriving-field-span-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-Eq-tuple-struct.rs @@ -1,4 +1,4 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -8,12 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct NotEq; +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + + +struct Error; #[deriving(Eq)] -struct Foo ( - NotEq //~ ERROR mismatched types - //~^ ERROR failed to find an implementation of trait std::cmp::Eq for NotEq - ); +struct Struct( + Error //~ ERROR +//~^ ERROR +); -pub fn main() {} +fn main() {} diff --git a/src/test/compile-fail/deriving-span-Ord-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-Ord-enum-struct-variant.rs new file mode 100644 index 00000000000..933da411db8 --- /dev/null +++ b/src/test/compile-fail/deriving-span-Ord-enum-struct-variant.rs @@ -0,0 +1,33 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + + +struct Error; + +#[deriving(Ord)] +enum Enum { + A { + x: Error //~ ERROR +//~^ ERROR +//~^^ ERROR +//~^^^ ERROR +//~^^^^ ERROR +//~^^^^^ ERROR +//~^^^^^^ ERROR +//~^^^^^^^ ERROR + } +} + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-Ord-enum.rs b/src/test/compile-fail/deriving-span-Ord-enum.rs new file mode 100644 index 00000000000..c310965cfa1 --- /dev/null +++ b/src/test/compile-fail/deriving-span-Ord-enum.rs @@ -0,0 +1,33 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + + +struct Error; + +#[deriving(Ord)] +enum Enum { + A( + Error //~ ERROR +//~^ ERROR +//~^^ ERROR +//~^^^ ERROR +//~^^^^ ERROR +//~^^^^^ ERROR +//~^^^^^^ ERROR +//~^^^^^^^ ERROR + ) +} + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-Ord-struct.rs b/src/test/compile-fail/deriving-span-Ord-struct.rs new file mode 100644 index 00000000000..327ac73ff2d --- /dev/null +++ b/src/test/compile-fail/deriving-span-Ord-struct.rs @@ -0,0 +1,31 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + + +struct Error; + +#[deriving(Ord)] +struct Struct { + x: Error //~ ERROR +//~^ ERROR +//~^^ ERROR +//~^^^ ERROR +//~^^^^ ERROR +//~^^^^^ ERROR +//~^^^^^^ ERROR +//~^^^^^^^ ERROR +} + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-Ord-tuple-struct.rs b/src/test/compile-fail/deriving-span-Ord-tuple-struct.rs new file mode 100644 index 00000000000..2a482f872c5 --- /dev/null +++ b/src/test/compile-fail/deriving-span-Ord-tuple-struct.rs @@ -0,0 +1,31 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + + +struct Error; + +#[deriving(Ord)] +struct Struct( + Error //~ ERROR +//~^ ERROR +//~^^ ERROR +//~^^^ ERROR +//~^^^^ ERROR +//~^^^^^ ERROR +//~^^^^^^ ERROR +//~^^^^^^^ ERROR +); + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-Rand-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-Rand-enum-struct-variant.rs new file mode 100644 index 00000000000..ae0732e4db6 --- /dev/null +++ b/src/test/compile-fail/deriving-span-Rand-enum-struct-variant.rs @@ -0,0 +1,26 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + + +struct Error; + +#[deriving(Rand)] +enum Enum { + A { + x: Error //~ ERROR + } +} + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-Rand-enum.rs b/src/test/compile-fail/deriving-span-Rand-enum.rs new file mode 100644 index 00000000000..ef29ce08292 --- /dev/null +++ b/src/test/compile-fail/deriving-span-Rand-enum.rs @@ -0,0 +1,26 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + + +struct Error; + +#[deriving(Rand)] +enum Enum { + A( + Error //~ ERROR + ) +} + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-Rand-struct.rs b/src/test/compile-fail/deriving-span-Rand-struct.rs new file mode 100644 index 00000000000..2ce4d49e721 --- /dev/null +++ b/src/test/compile-fail/deriving-span-Rand-struct.rs @@ -0,0 +1,24 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + + +struct Error; + +#[deriving(Rand)] +struct Struct { + x: Error //~ ERROR +} + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-Rand-tuple-struct.rs b/src/test/compile-fail/deriving-span-Rand-tuple-struct.rs new file mode 100644 index 00000000000..3f6738fd306 --- /dev/null +++ b/src/test/compile-fail/deriving-span-Rand-tuple-struct.rs @@ -0,0 +1,24 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + + +struct Error; + +#[deriving(Rand)] +struct Struct( + Error //~ ERROR +); + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs new file mode 100644 index 00000000000..22c9351e13a --- /dev/null +++ b/src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs @@ -0,0 +1,27 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + + +struct Error; + +#[deriving(TotalEq)] +enum Enum { + A { + x: Error //~ ERROR +//~^ ERROR + } +} + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-TotalEq-enum.rs b/src/test/compile-fail/deriving-span-TotalEq-enum.rs new file mode 100644 index 00000000000..36028ebb82c --- /dev/null +++ b/src/test/compile-fail/deriving-span-TotalEq-enum.rs @@ -0,0 +1,27 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + + +struct Error; + +#[deriving(TotalEq)] +enum Enum { + A( + Error //~ ERROR +//~^ ERROR + ) +} + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-TotalEq-struct.rs b/src/test/compile-fail/deriving-span-TotalEq-struct.rs new file mode 100644 index 00000000000..f3e38b3df4e --- /dev/null +++ b/src/test/compile-fail/deriving-span-TotalEq-struct.rs @@ -0,0 +1,25 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + + +struct Error; + +#[deriving(TotalEq)] +struct Struct { + x: Error //~ ERROR +//~^ ERROR +} + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs b/src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs new file mode 100644 index 00000000000..7293da91471 --- /dev/null +++ b/src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs @@ -0,0 +1,25 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + + +struct Error; + +#[deriving(TotalEq)] +struct Struct( + Error //~ ERROR +//~^ ERROR +); + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs new file mode 100644 index 00000000000..27a6bea1b04 --- /dev/null +++ b/src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs @@ -0,0 +1,27 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + +#[deriving(TotalEq)] +struct Error; + +#[deriving(TotalOrd,TotalEq)] +enum Enum { + A { + x: Error //~ ERROR +//~^ ERROR + } +} + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-TotalOrd-enum.rs b/src/test/compile-fail/deriving-span-TotalOrd-enum.rs new file mode 100644 index 00000000000..84c691b0fad --- /dev/null +++ b/src/test/compile-fail/deriving-span-TotalOrd-enum.rs @@ -0,0 +1,27 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + +#[deriving(TotalEq)] +struct Error; + +#[deriving(TotalOrd,TotalEq)] +enum Enum { + A( + Error //~ ERROR +//~^ ERROR + ) +} + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-TotalOrd-struct.rs b/src/test/compile-fail/deriving-span-TotalOrd-struct.rs new file mode 100644 index 00000000000..c3a83df67d4 --- /dev/null +++ b/src/test/compile-fail/deriving-span-TotalOrd-struct.rs @@ -0,0 +1,25 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + +#[deriving(TotalEq)] +struct Error; + +#[deriving(TotalOrd,TotalEq)] +struct Struct { + x: Error //~ ERROR +//~^ ERROR +} + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs b/src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs new file mode 100644 index 00000000000..9d913727e6c --- /dev/null +++ b/src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs @@ -0,0 +1,25 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + +#[deriving(TotalEq)] +struct Error; + +#[deriving(TotalOrd,TotalEq)] +struct Struct( + Error //~ ERROR +//~^ ERROR +); + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-Zero-struct.rs b/src/test/compile-fail/deriving-span-Zero-struct.rs new file mode 100644 index 00000000000..2892938926b --- /dev/null +++ b/src/test/compile-fail/deriving-span-Zero-struct.rs @@ -0,0 +1,24 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + + +struct Error; + +#[deriving(Zero)] +struct Struct { + x: Error //~ ERROR +} + +fn main() {} diff --git a/src/test/compile-fail/deriving-span-Zero-tuple-struct.rs b/src/test/compile-fail/deriving-span-Zero-tuple-struct.rs new file mode 100644 index 00000000000..43d84a593ed --- /dev/null +++ b/src/test/compile-fail/deriving-span-Zero-tuple-struct.rs @@ -0,0 +1,24 @@ +// Copyright 2014 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. + +// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' + +#[feature(struct_variant)]; +extern mod extra; + + +struct Error; + +#[deriving(Zero)] +struct Struct( + Error //~ ERROR +); + +fn main() {} |
