File tree 2 files changed +52
-0
lines changed
2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change
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
+ use std:: marker:: PhantomData ;
12
+
13
+ pub struct Directed ;
14
+ pub struct Undirected ;
15
+
16
+ pub struct Graph < N , E , Ty = Directed > {
17
+ nodes : Vec < PhantomData < N > > ,
18
+ edges : Vec < PhantomData < E > > ,
19
+ ty : PhantomData < Ty > ,
20
+ }
21
+
22
+
23
+ impl < N , E > Graph < N , E , Directed > {
24
+ pub fn new ( ) -> Self {
25
+ Graph { nodes : Vec :: new ( ) , edges : Vec :: new ( ) , ty : PhantomData }
26
+ }
27
+ }
28
+
29
+ impl < N , E > Graph < N , E , Undirected > {
30
+ pub fn new_undirected ( ) -> Self {
31
+ Graph { nodes : Vec :: new ( ) , edges : Vec :: new ( ) , ty : PhantomData }
32
+ }
33
+ }
Original file line number Diff line number Diff line change
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
+ // aux-build:issue_30123_aux.rs
12
+
13
+ extern crate issue_30123_aux;
14
+ use issue_30123_aux:: * ;
15
+
16
+ fn main ( ) {
17
+ let ug = Graph :: < i32 , i32 > :: new_undirected ( ) ;
18
+ //~^ ERR no associated item named `new_undirected` found for type
19
+ }
You can’t perform that action at this time.
0 commit comments