Auto merge of #129759 - dingxiangfei2009:stabilize-const-refs-to-stat… · rust-lang/rust@4428a05 (original) (raw)

1

``

`-

error[E0658]: referencing statics in constants is unstable

`

2

``

`-

--> $DIR/type-check-4.rs:24:25

`

``

1

`+

error[E0080]: evaluation of constant value failed

`

``

2

`+

--> $DIR/type-check-4.rs:17:34

`

3

3

` |

`

4

``

`-

LL | global_asm!("{}", const S);

`

5

``

`-

| ^

`

6

``

`-

|

`

7

``

`-

= note: see issue #119618 https://github.com/rust-lang/rust/issues/119618 for more information

`

8

``

`` -

= help: add #![feature(const_refs_to_static)] to the crate attributes to enable

``

9

``

`-

= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

`

10

``

`` -

= note: static and const variables can refer to other const variables. A const variable, however, cannot refer to a static variable.

``

11

``

`` -

= help: to fix this, the value can be extracted to a const and then used.

``

``

4

`+

LL | global_asm!("{}", const unsafe { S });

`

``

5

`+

| ^ constant accesses mutable global memory

`

12

6

``

13

``

`-

error[E0658]: referencing statics in constants is unstable

`

14

``

`-

--> $DIR/type-check-4.rs:27:35

`

15

``

`-

|

`

16

``

`-

LL | global_asm!("{}", const const_foo(S));

`

17

``

`-

| ^

`

``

7

`+

error[E0080]: evaluation of constant value failed

`

``

8

`+

--> $DIR/type-check-4.rs:21:44

`

18

9

` |

`

19

``

`-

= note: see issue #119618 https://github.com/rust-lang/rust/issues/119618 for more information

`

20

``

`` -

= help: add #![feature(const_refs_to_static)] to the crate attributes to enable

``

21

``

`-

= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

`

22

``

`` -

= note: static and const variables can refer to other const variables. A const variable, however, cannot refer to a static variable.

``

23

``

`` -

= help: to fix this, the value can be extracted to a const and then used.

``

``

10

`+

LL | global_asm!("{}", const const_foo(unsafe { S }));

`

``

11

`+

| ^ constant accesses mutable global memory

`

24

12

``

25

``

`-

error[E0658]: referencing statics in constants is unstable

`

26

``

`-

--> $DIR/type-check-4.rs:30:35

`

27

``

`-

|

`

28

``

`-

LL | global_asm!("{}", const const_bar(S));

`

29

``

`-

| ^

`

``

13

`+

error[E0080]: evaluation of constant value failed

`

``

14

`+

--> $DIR/type-check-4.rs:25:44

`

30

15

` |

`

31

``

`-

= note: see issue #119618 https://github.com/rust-lang/rust/issues/119618 for more information

`

32

``

`` -

= help: add #![feature(const_refs_to_static)] to the crate attributes to enable

``

33

``

`-

= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

`

34

``

`` -

= note: static and const variables can refer to other const variables. A const variable, however, cannot refer to a static variable.

``

35

``

`` -

= help: to fix this, the value can be extracted to a const and then used.

``

``

16

`+

LL | global_asm!("{}", const const_bar(unsafe { S }));

`

``

17

`+

| ^ constant accesses mutable global memory

`

36

18

``

37

19

`error: aborting due to 3 previous errors

`

38

20

``

39

``

`` -

For more information about this error, try rustc --explain E0658.

``

``

21

`` +

For more information about this error, try rustc --explain E0080.

``