about summary refs log tree commit diff
path: root/src/test/run-pass
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2017-03-19 10:18:12 -0400
committerGitHub <noreply@github.com>2017-03-19 10:18:12 -0400
commit7b686ce4caa65efb96a9a00062d7d408f6d475cd (patch)
tree5e842607f7390870fd7ce62c5e10aab8170b70d9 /src/test/run-pass
parent9c15de4fd59bee290848b5443c7e194fd5afb02c (diff)
parentf06b04949f7944bfe31405d3735240bb02ee9bd1 (diff)
downloadrust-7b686ce4caa65efb96a9a00062d7d408f6d475cd.tar.gz
rust-7b686ce4caa65efb96a9a00062d7d408f6d475cd.zip
Rollup merge of #40441 - tschottdorf:promotable-rfc, r=eddyb
Add feature gate for rvalue-static-promotion

Probably needs more tests (which ones?) and there may be other things that need to be done. Also not sure whether the version that introduces the flag is really `1.15.1`.

See https://github.com/rust-lang/rfcs/pull/1414.

Updates #38865.
Diffstat (limited to 'src/test/run-pass')
-rw-r--r--src/test/run-pass/rvalue-static-promotion.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/run-pass/rvalue-static-promotion.rs b/src/test/run-pass/rvalue-static-promotion.rs
new file mode 100644
index 00000000000..30643cfc3eb
--- /dev/null
+++ b/src/test/run-pass/rvalue-static-promotion.rs
@@ -0,0 +1,17 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(rvalue_static_promotion)]
+
+#[allow(unused_variables)]
+fn main() {
+    let x: &'static u32 = &42;
+    let y: &'static Option<u32> = &None;
+}