Skip to content

Commit d36c4db

Browse files
committed
Add the tests for duplicate symbol errors
1 parent baa52ca commit d36c4db

File tree

8 files changed

+172
-0
lines changed

8 files changed

+172
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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_type="rlib"]
12+
#![allow(warnings)]
13+
14+
#[export_name="fail"]
15+
pub fn a() {
16+
}
17+
18+
#[export_name="fail"]
19+
pub fn b() {
20+
//~^ symbol `fail` already exists
21+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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_type="rlib"]
12+
#![allow(warnings)]
13+
14+
mod a {
15+
#[no_mangle]
16+
pub extern fn fail() {
17+
}
18+
}
19+
20+
mod b {
21+
#[no_mangle]
22+
pub extern fn fail() {
23+
//~^ symbol `fail` already exists
24+
}
25+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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_type="rlib"]
12+
#![allow(warnings)]
13+
14+
#[export_name="fail"]
15+
pub fn a() {
16+
}
17+
18+
#[no_mangle]
19+
pub fn fail() {
20+
//~^ symbol `fail` already exists
21+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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_type="rlib"]
12+
#![allow(warnings)]
13+
14+
15+
pub trait A {
16+
fn fail(self);
17+
}
18+
19+
struct B;
20+
struct C;
21+
22+
impl A for B {
23+
#[no_mangle]
24+
fn fail(self) {}
25+
}
26+
27+
impl A for C {
28+
#[no_mangle]
29+
fn fail(self) {}
30+
//~^ symbol `fail` already exists
31+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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_type="rlib"]
12+
#![allow(warnings)]
13+
14+
#[export_name="fail"]
15+
static HELLO: u8 = 0;
16+
17+
#[export_name="fail"]
18+
pub fn b() {
19+
//~^ symbol `fail` already exists
20+
}
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+
#![crate_type="rlib"]
11+
#![allow(warnings)]
12+
13+
#[export_name="fail"]
14+
static HELLO: u8 = 0;
15+
16+
#[export_name="fail"]
17+
static HELLO_TWICE: u16 = 0;
18+
//~^ symbol `fail` already exists
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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_type="rlib"]
12+
#![allow(warnings)]
13+
14+
extern {
15+
fn fail();
16+
}
17+
18+
#[export_name="fail"]
19+
pub fn a() {
20+
//~^ symbol `fail` already exists
21+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
// error-pattern: entry symbol `main` defined multiple times
12+
#![allow(warnings)]
13+
14+
#[no_mangle]
15+
fn main(){}

0 commit comments

Comments
 (0)