From 29ec2506abb1d382e432cae2519aa7b7695c276a Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 4 Jul 2014 00:56:57 -0700 Subject: librustc: Remove the `&LIFETIME EXPR` production from the language. This was parsed by the parser but completely ignored; not even stored in the AST! This breaks code that looks like: static X: &'static [u8] = &'static [1, 2, 3]; Change this code to the shorter: static X: &'static [u8] = &[1, 2, 3]; Closes #15312. [breaking-change] --- src/test/compile-fail/borrowck-forbid-static-unsafe-interior.rs | 2 +- src/test/compile-fail/check-static-values-constraints.rs | 4 ++-- src/test/run-pass/issue-5917.rs | 2 +- src/test/run-pass/issue-8578.rs | 2 +- src/test/run-pass/trans-tag-static-padding.rs | 4 ++-- src/test/run-pass/typeck_type_placeholder_1.rs | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/test') diff --git a/src/test/compile-fail/borrowck-forbid-static-unsafe-interior.rs b/src/test/compile-fail/borrowck-forbid-static-unsafe-interior.rs index 9939fc79190..1c7516ef7e2 100644 --- a/src/test/compile-fail/borrowck-forbid-static-unsafe-interior.rs +++ b/src/test/compile-fail/borrowck-forbid-static-unsafe-interior.rs @@ -32,7 +32,7 @@ static STATIC1: UnsafeEnum = VariantSafe; static STATIC2: Unsafe = Unsafe{value: 1, marker1: marker::InvariantType}; static STATIC3: MyUnsafe = MyUnsafe{value: STATIC2}; -static STATIC4: &'static Unsafe = &'static STATIC2; +static STATIC4: &'static Unsafe = &STATIC2; //~^ ERROR borrow of immutable static items with unsafe interior is not allowed struct Wrap { diff --git a/src/test/compile-fail/check-static-values-constraints.rs b/src/test/compile-fail/check-static-values-constraints.rs index da5f7680d8c..b7344d72a46 100644 --- a/src/test/compile-fail/check-static-values-constraints.rs +++ b/src/test/compile-fail/check-static-values-constraints.rs @@ -113,12 +113,12 @@ static mut STATIC14: SafeStruct = SafeStruct { field2: Variant4("str".to_string()) }; -static STATIC15: &'static [Box] = &'static [box MyOwned, box MyOwned]; +static STATIC15: &'static [Box] = &[box MyOwned, box MyOwned]; //~^ ERROR static items are not allowed to have custom pointers //~^^ ERROR static items are not allowed to have custom pointers static STATIC16: (&'static Box, &'static Box) = - (&'static box MyOwned, &'static box MyOwned); + (&box MyOwned, &box MyOwned); //~^ ERROR static items are not allowed to have custom pointers //~^^ ERROR static items are not allowed to have custom pointers diff --git a/src/test/run-pass/issue-5917.rs b/src/test/run-pass/issue-5917.rs index 543f4bf027b..5b601267356 100644 --- a/src/test/run-pass/issue-5917.rs +++ b/src/test/run-pass/issue-5917.rs @@ -9,7 +9,7 @@ // except according to those terms. struct T (&'static [int]); -static t : T = T (&'static [5, 4, 3]); +static t : T = T (&[5, 4, 3]); pub fn main () { let T(ref v) = t; assert_eq!(v[0], 5); diff --git a/src/test/run-pass/issue-8578.rs b/src/test/run-pass/issue-8578.rs index 6ceb2cf87b9..275fe740db1 100644 --- a/src/test/run-pass/issue-8578.rs +++ b/src/test/run-pass/issue-8578.rs @@ -17,7 +17,7 @@ impl<'a> UninterpretedOption_NamePart { static instance: UninterpretedOption_NamePart = UninterpretedOption_NamePart { name_part: None, }; - &'static instance + &instance } } diff --git a/src/test/run-pass/trans-tag-static-padding.rs b/src/test/run-pass/trans-tag-static-padding.rs index c6a3a0b0409..ed4712ff3be 100644 --- a/src/test/run-pass/trans-tag-static-padding.rs +++ b/src/test/run-pass/trans-tag-static-padding.rs @@ -43,7 +43,7 @@ fn default_instance() -> &'static Request { // size of struct may be not equal to size of struct, and // compiler crashes in internal assertion check. }; - &'static instance + &instance } fn non_default_instance() -> &'static Request { @@ -51,7 +51,7 @@ fn non_default_instance() -> &'static Request { foo: TestSome(0x1020304050607080), bar: 19, }; - &'static instance + &instance } pub fn main() { diff --git a/src/test/run-pass/typeck_type_placeholder_1.rs b/src/test/run-pass/typeck_type_placeholder_1.rs index 1a79edb30c9..f95e9ad7d83 100644 --- a/src/test/run-pass/typeck_type_placeholder_1.rs +++ b/src/test/run-pass/typeck_type_placeholder_1.rs @@ -11,7 +11,7 @@ // This test checks that the `_` type placeholder works // correctly for enabling type inference. -static CONSTEXPR: *const int = &'static 413 as *const _; +static CONSTEXPR: *const int = &413 as *const _; pub fn main() { let x: Vec<_> = range(0u, 5).collect(); -- cgit 1.4.1-3-g733a5