Skip to content

Commit 068fa97

Browse files
committed
Rollup merge of rust-lang#31031 - brson:issue-30123, r=nikomatsakis
This was fixed in passing. Adding a regression test.
2 parents 03b4bf2 + 796f158 commit 068fa97

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

src/test/auxiliary/issue_30123_aux.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
}

src/test/compile-fail/issue-30123.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
}

0 commit comments

Comments
 (0)