Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloning empty Vec does not create a new Vec instance #6956

Open
bitzoic opened this issue Feb 24, 2025 · 0 comments
Open

Cloning empty Vec does not create a new Vec instance #6956

bitzoic opened this issue Feb 24, 2025 · 0 comments
Labels
bug Something isn't working lib: std Standard library

Comments

@bitzoic
Copy link
Member

bitzoic commented Feb 24, 2025

When creating a new Vec, no new ptr is created and therefor the following fails:

#[test]
fn test_clone() {
    let vec_1: Vec<u64> = Vec::new();
    let vec_2: Vec<u64> = Vec::new();
    let vec_3: Vec<u64> = vec_1.clone();

    assert(vec_1.ptr() != vec_2.ptr()); // This fails
    assert(vec_1.ptr() != vec_3.ptr()); // This fails
}
@bitzoic bitzoic added bug Something isn't working lib: std Standard library labels Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lib: std Standard library
Projects
None yet
Development

No branches or pull requests

1 participant