mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
Add autogenerated tests for the spans of various derived traits.
This commit is contained in:
parent
b079ebeb8d
commit
d9a204bf4c
131
src/etc/generate-deriving-span-tests.py
Executable file
131
src/etc/generate-deriving-span-tests.py
Executable file
@ -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))
|
@ -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() {}
|
26
src/test/compile-fail/deriving-span-Clone-enum.rs
Normal file
26
src/test/compile-fail/deriving-span-Clone-enum.rs
Normal file
@ -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() {}
|
24
src/test/compile-fail/deriving-span-Clone-struct.rs
Normal file
24
src/test/compile-fail/deriving-span-Clone-struct.rs
Normal file
@ -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() {}
|
24
src/test/compile-fail/deriving-span-Clone-tuple-struct.rs
Normal file
24
src/test/compile-fail/deriving-span-Clone-tuple-struct.rs
Normal file
@ -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() {}
|
@ -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() {}
|
26
src/test/compile-fail/deriving-span-DeepClone-enum.rs
Normal file
26
src/test/compile-fail/deriving-span-DeepClone-enum.rs
Normal file
@ -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() {}
|
24
src/test/compile-fail/deriving-span-DeepClone-struct.rs
Normal file
24
src/test/compile-fail/deriving-span-DeepClone-struct.rs
Normal file
@ -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() {}
|
@ -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() {}
|
24
src/test/compile-fail/deriving-span-Default-struct.rs
Normal file
24
src/test/compile-fail/deriving-span-Default-struct.rs
Normal file
@ -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() {}
|
24
src/test/compile-fail/deriving-span-Default-tuple-struct.rs
Normal file
24
src/test/compile-fail/deriving-span-Default-tuple-struct.rs
Normal file
@ -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() {}
|
@ -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.
|
||||
|
||||
#[feature(struct_variant)];
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
|
||||
|
||||
struct NotEq;
|
||||
#[feature(struct_variant)];
|
||||
extern mod extra;
|
||||
|
||||
|
||||
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() {}
|
@ -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.
|
||||
|
||||
#[feature(struct_variant)];
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
|
||||
|
||||
struct NotEq;
|
||||
#[feature(struct_variant)];
|
||||
extern mod extra;
|
||||
|
||||
|
||||
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() {}
|
@ -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() {}
|
@ -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() {}
|
@ -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() {}
|
33
src/test/compile-fail/deriving-span-Ord-enum.rs
Normal file
33
src/test/compile-fail/deriving-span-Ord-enum.rs
Normal file
@ -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() {}
|
31
src/test/compile-fail/deriving-span-Ord-struct.rs
Normal file
31
src/test/compile-fail/deriving-span-Ord-struct.rs
Normal file
@ -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() {}
|
31
src/test/compile-fail/deriving-span-Ord-tuple-struct.rs
Normal file
31
src/test/compile-fail/deriving-span-Ord-tuple-struct.rs
Normal file
@ -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() {}
|
@ -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() {}
|
26
src/test/compile-fail/deriving-span-Rand-enum.rs
Normal file
26
src/test/compile-fail/deriving-span-Rand-enum.rs
Normal file
@ -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() {}
|
24
src/test/compile-fail/deriving-span-Rand-struct.rs
Normal file
24
src/test/compile-fail/deriving-span-Rand-struct.rs
Normal file
@ -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() {}
|
24
src/test/compile-fail/deriving-span-Rand-tuple-struct.rs
Normal file
24
src/test/compile-fail/deriving-span-Rand-tuple-struct.rs
Normal file
@ -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() {}
|
@ -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() {}
|
27
src/test/compile-fail/deriving-span-TotalEq-enum.rs
Normal file
27
src/test/compile-fail/deriving-span-TotalEq-enum.rs
Normal file
@ -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() {}
|
25
src/test/compile-fail/deriving-span-TotalEq-struct.rs
Normal file
25
src/test/compile-fail/deriving-span-TotalEq-struct.rs
Normal file
@ -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() {}
|
25
src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs
Normal file
25
src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs
Normal file
@ -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() {}
|
@ -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() {}
|
27
src/test/compile-fail/deriving-span-TotalOrd-enum.rs
Normal file
27
src/test/compile-fail/deriving-span-TotalOrd-enum.rs
Normal file
@ -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() {}
|
25
src/test/compile-fail/deriving-span-TotalOrd-struct.rs
Normal file
25
src/test/compile-fail/deriving-span-TotalOrd-struct.rs
Normal file
@ -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() {}
|
25
src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs
Normal file
25
src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs
Normal file
@ -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() {}
|
24
src/test/compile-fail/deriving-span-Zero-struct.rs
Normal file
24
src/test/compile-fail/deriving-span-Zero-struct.rs
Normal file
@ -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() {}
|
24
src/test/compile-fail/deriving-span-Zero-tuple-struct.rs
Normal file
24
src/test/compile-fail/deriving-span-Zero-tuple-struct.rs
Normal file
@ -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() {}
|
Loading…
Reference in New Issue
Block a user