-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.relnotesMarks issues that should be documented in the release notes of the next release.Marks issues that should be documented in the release notes of the next release.
Description
This regression is only visible in cross-crate code; NOTE it's very likely it's due to an actual rustc bug fix.
Here is some playpen code for illustration anyway.
Given a struct with default parameters and two constructor functions:
pub struct Graph<N, E, Ty = Directed, Ix: IndexType = DefIndex> {
nodes: Vec<Node<N, Ix>>,
edges: Vec<Edge<E, Ix>>,
ty: PhantomData<Ty>,
}
impl<N, E> Graph<N, E, Directed> {
pub fn new() -> Self {
Graph{nodes: Vec::new(), edges: Vec::new(), ty: PhantomData}
}
}
impl<N, E> Graph<N, E, Undirected> {
pub fn new_undirected() -> Self {
Graph{nodes: Vec::new(), edges: Vec::new(), ty: PhantomData}
}
}
In Rust 1.4 or later (current stable and current nightly), both must be called like this to compile:
let g = Graph::<i32, i32>::new();
let ug = Graph::<i32, i32, _>::new_undirected();
In current stable Rust 1.4, the following compiles if you import Graph
across crates!
let ug = Graph::<i32, i32>::new_undirected();
This is invalid in current nightly Rust ~1.6, see travis build example; the testcases are in their own crates.
tests/ograph.rs:1018:18: 1018:48 error: no associated item named `new_undirected` found for type `petgraph::graph::Graph<_, ()>` in the current scope
tests/ograph.rs:1018 let mut gr = Graph::<_, ()>::new_undirected();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Metadata
Metadata
Assignees
Labels
P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.relnotesMarks issues that should be documented in the release notes of the next release.Marks issues that should be documented in the release notes of the next release.