Skip to content

Any plans to support "compile-fail" tests? #521

Closed
@japaric

Description

@japaric

Like the ones in the rust repository

These kind of tests are useful if you are creating data structures from scratch (with raw pointers in it) and you want to make sure you added the proper markers (ContravariantLifetime!) to them. For example:

let outlive = {
    let v = vec![0i, 1, 2, 3, 4];
    v.step_slice(0, 3, 2)  //~ ERROR: `v` does not live long enough
};

Could be a compile-fail test that checks that a view doesn't outlives its "parent".

Also, this feature would help to build rust with cargo.

So, is anything like this in scope for cargo?

(Slighty on topic: Anyone knows if the rust test suite checks that the //~ ERROR: patterns match the compiler output on each test, or simply checks that the compilation failed?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions