blob: aabcca514d317f08eb3c9d8d266c0f036621e5f9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
//! Originally, inner statics in generic functions were generated only once, causing the same
//! static to be shared across all generic instantiations. This created a soundness hole where
//! different types could be coerced through thread-local storage in safe code.
//!
//! This test checks that generic parameters from outer scopes cannot be used in inner statics,
//! preventing this soundness issue.
//!
//! See https://github.com/rust-lang/rust/issues/9186
enum Bar<T> {
//~^ ERROR parameter `T` is never used
What,
}
fn foo<T>() {
static a: Bar<T> = Bar::What;
//~^ ERROR can't use generic parameters from outer item
}
fn main() {}
|