summaryrefslogtreecommitdiffstats
path: root/src/test/ui/array-slice-vec/vec-macro-rvalue-scope.rs
blob: bde01037181a963ac84ef5c201f0896d2f5af456 (plain)
1
2
3
4
5
6
7
8
9
10
11
// run-pass


fn one() -> i32 { 1 }

// Make sure the vec![...] macro doesn't introduce hidden rvalue
// scopes (such as blocks) around the element expressions.
pub fn main() {
    assert_eq!(vec![&one(), &one(), &2], vec![&1, &1, &(one()+one())]);
    assert_eq!(vec![&one(); 2], vec![&1, &one()]);
}