mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
add issue link comments and bless
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
//! Regression test for https://github.com/rust-lang/rust/issues/3521
|
||||
//!
|
||||
//@ run-rustfix
|
||||
fn main() {
|
||||
let foo = 100;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//! Regression test for https://github.com/rust-lang/rust/issues/3521
|
||||
//!
|
||||
//@ run-rustfix
|
||||
fn main() {
|
||||
let foo = 100;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
error[E0435]: attempt to use a non-constant value in a constant
|
||||
--> $DIR/issue-3521-2.rs:5:23
|
||||
--> $DIR/static-cannot-use-local-variable.rs:7:23
|
||||
|
|
||||
LL | static y: isize = foo + 1;
|
||||
| ^^^ non-constant value
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
//! Regression test for https://github.com/rust-lang/rust/issues/3668
|
||||
//!
|
||||
//@ run-rustfix
|
||||
#![allow(unused_variables, dead_code)]
|
||||
fn f(x:isize) {
|
||||
fn f(x: isize) {
|
||||
let child: isize = x + 1;
|
||||
//~^ ERROR attempt to use a non-constant value in a constant
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
//! Regression test for https://github.com/rust-lang/rust/issues/3668
|
||||
//!
|
||||
//@ run-rustfix
|
||||
#![allow(unused_variables, dead_code)]
|
||||
fn f(x:isize) {
|
||||
fn f(x: isize) {
|
||||
static child: isize = x + 1;
|
||||
//~^ ERROR attempt to use a non-constant value in a constant
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
error[E0435]: attempt to use a non-constant value in a constant
|
||||
--> $DIR/issue-3668-2.rs:4:27
|
||||
--> $DIR/static-in-fn-cannot-use-param.rs:6:27
|
||||
|
|
||||
LL | static child: isize = x + 1;
|
||||
| ^ non-constant value
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
struct P { child: Option<Box<P>> }
|
||||
//! Regression test for https://github.com/rust-lang/rust/issues/3668
|
||||
//!
|
||||
struct P {
|
||||
child: Option<Box<P>>,
|
||||
}
|
||||
trait PTrait {
|
||||
fn getChildOption(&self) -> Option<Box<P>>;
|
||||
fn getChildOption(&self) -> Option<Box<P>>;
|
||||
}
|
||||
|
||||
impl PTrait for P {
|
||||
fn getChildOption(&self) -> Option<Box<P>> {
|
||||
static childVal: Box<P> = self.child.get();
|
||||
//~^ ERROR attempt to use a non-constant value in a constant
|
||||
panic!();
|
||||
}
|
||||
fn getChildOption(&self) -> Option<Box<P>> {
|
||||
static childVal: Box<P> = self.child.get();
|
||||
//~^ ERROR attempt to use a non-constant value in a constant
|
||||
panic!();
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
error[E0435]: attempt to use a non-constant value in a constant
|
||||
--> $DIR/issue-3668.rs:8:34
|
||||
--> $DIR/static-in-method-cannot-use-self.rs:12:35
|
||||
|
|
||||
LL | static childVal: Box<P> = self.child.get();
|
||||
| ^^^^ non-constant value
|
||||
LL | static childVal: Box<P> = self.child.get();
|
||||
| ^^^^ non-constant value
|
||||
|
|
||||
help: consider using `let` instead of `static`
|
||||
|
|
||||
LL - static childVal: Box<P> = self.child.get();
|
||||
LL + let childVal: Box<P> = self.child.get();
|
||||
LL - static childVal: Box<P> = self.child.get();
|
||||
LL + let childVal: Box<P> = self.child.get();
|
||||
|
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
//! Regression test for https://github.com/rust-lang/rust/issues/39367
|
||||
//!
|
||||
//! Tests that lazy static initialization using `Once` and `transmute`
|
||||
//! works correctly with a struct that has a default type parameter.
|
||||
//@ run-pass
|
||||
|
||||
use std::ops::Deref;
|
||||
|
||||
struct ArenaSet<U: Deref, V=<U as Deref>::Target>(U, &'static V)
|
||||
where V: 'static + ?Sized;
|
||||
struct ArenaSet<U: Deref, V = <U as Deref>::Target>(U, &'static V)
|
||||
where
|
||||
V: 'static + ?Sized;
|
||||
|
||||
static Z: [u8; 4] = [1,2,3,4];
|
||||
static Z: [u8; 4] = [1, 2, 3, 4];
|
||||
|
||||
fn arena() -> &'static ArenaSet<Vec<u8>> {
|
||||
fn __static_ref_initialize() -> ArenaSet<Vec<u8>> {
|
||||
@@ -13,17 +18,17 @@ fn __static_ref_initialize() -> ArenaSet<Vec<u8>> {
|
||||
}
|
||||
unsafe {
|
||||
use std::sync::Once;
|
||||
fn require_sync<T: Sync>(_: &T) { }
|
||||
fn require_sync<T: Sync>(_: &T) {}
|
||||
unsafe fn __stability() -> &'static ArenaSet<Vec<u8>> {
|
||||
use std::mem::transmute;
|
||||
static mut DATA: *const ArenaSet<Vec<u8>> = std::ptr::null_mut();
|
||||
|
||||
static mut ONCE: Once = Once::new();
|
||||
ONCE.call_once(|| {
|
||||
//~^ WARN creating a shared reference to mutable static [static_mut_refs]
|
||||
DATA = transmute
|
||||
::<Box<ArenaSet<Vec<u8>>>, *const ArenaSet<Vec<u8>>>
|
||||
(Box::new(__static_ref_initialize()));
|
||||
//~^ WARN creating a shared reference to mutable static [static_mut_refs]
|
||||
DATA = transmute::<Box<ArenaSet<Vec<u8>>>, *const ArenaSet<Vec<u8>>>(Box::new(
|
||||
__static_ref_initialize(),
|
||||
));
|
||||
});
|
||||
|
||||
&*DATA
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
warning: creating a shared reference to mutable static
|
||||
--> $DIR/issue-39367.rs:22:13
|
||||
--> $DIR/static-lazy-init-with-arena-set.rs:27:13
|
||||
|
|
||||
LL | / ONCE.call_once(|| {
|
||||
LL | |
|
||||
LL | | DATA = transmute
|
||||
LL | | ::<Box<ArenaSet<Vec<u8>>>, *const ArenaSet<Vec<u8>>>
|
||||
LL | | (Box::new(__static_ref_initialize()));
|
||||
LL | | DATA = transmute::<Box<ArenaSet<Vec<u8>>>, *const ArenaSet<Vec<u8>>>(Box::new(
|
||||
LL | | __static_ref_initialize(),
|
||||
LL | | ));
|
||||
LL | | });
|
||||
| |______________^ shared reference to mutable static
|
||||
|
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//! Regression test for https://github.com/rust-lang/rust/issues/46604
|
||||
//!
|
||||
static buf: &mut [u8] = &mut [1u8,2,3,4,5,7]; //~ ERROR mutable borrows of temporaries
|
||||
fn write<T: AsRef<[u8]>>(buffer: T) { }
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
error[E0764]: mutable borrows of temporaries that have their lifetime extended until the end of the program are not allowed
|
||||
--> $DIR/issue-46604.rs:1:25
|
||||
--> $DIR/static-mut-borrow-of-temporary.rs:3:25
|
||||
|
|
||||
LL | static buf: &mut [u8] = &mut [1u8,2,3,4,5,7];
|
||||
| ^^^^^^^^^^^^^^^^^^^^ this mutable borrow refers to such a temporary
|
||||
@@ -9,7 +9,7 @@ LL | static buf: &mut [u8] = &mut [1u8,2,3,4,5,7];
|
||||
= help: if you really want global mutable state, try replacing the temporary by an interior mutable `static` or a `static mut`
|
||||
|
||||
error[E0594]: cannot assign to `buf[_]`, as `buf` is an immutable static item
|
||||
--> $DIR/issue-46604.rs:6:5
|
||||
--> $DIR/static-mut-borrow-of-temporary.rs:8:5
|
||||
|
|
||||
LL | static buf: &mut [u8] = &mut [1u8,2,3,4,5,7];
|
||||
| --------------------- this `static` cannot be written to
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//! Regression test for https://github.com/rust-lang/rust/issues/29821
|
||||
//!
|
||||
//@ build-pass
|
||||
|
||||
pub trait Foo {
|
||||
@@ -5,7 +7,7 @@ pub trait Foo {
|
||||
}
|
||||
|
||||
pub struct Bar<F: Foo> {
|
||||
id: F::FooAssoc
|
||||
id: F::FooAssoc,
|
||||
}
|
||||
|
||||
pub struct Baz;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//! Regression test for https://github.com/rust-lang/rust/issues/25901
|
||||
//!
|
||||
struct A;
|
||||
struct B;
|
||||
|
||||
@@ -8,7 +10,10 @@
|
||||
|
||||
impl Deref for A {
|
||||
type Target = B;
|
||||
fn deref(&self)->&B { static B_: B = B; &B_ }
|
||||
fn deref(&self) -> &B {
|
||||
static B_: B = B;
|
||||
&B_
|
||||
}
|
||||
}
|
||||
|
||||
fn main(){}
|
||||
fn main() {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
error[E0277]: the trait bound `A: const Deref` is not satisfied
|
||||
--> $DIR/issue-25901.rs:4:24
|
||||
--> $DIR/static-ref-deref-non-const-trait.rs:6:24
|
||||
|
|
||||
LL | static S: &'static B = &A;
|
||||
| ^^
|
||||
|
||||
Reference in New Issue
Block a user