Skip to content

Type aliases and mods of the same name in the same namespace should be forbidden #6936

Closed
@brendanzab

Description

@brendanzab

The tests for this crate compile ok:

#[link(name = "complex", vers = "test")];
#[crate_type = "lib"];

pub struct ComplexT<T> { x: T, y: T, z: T }

impl<T> ComplexT<T> {
    pub fn new(x: T, y: T, z: T) -> ComplexT<T> {
        ComplexT { x: x, y: y, z: z }
    }
}

pub type Complex32 = ComplexT<f32>;

pub mod Complex32 {
    use super::*;
    pub fn new(x: f32, y: f32, z: f32) -> Complex32 {
        ComplexT::new(x, y, z)
    }
}

#[test]
fn test_Complex() {
    let v = Complex32::new(1.0, 2.0, 3.0);
    println(fmt!("%?", v));
}

This is incompatible with #6894, and should probably be forbidden.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions