@@ -1693,16 +1693,16 @@ fn infer_type_param() {
16931693fn infer_const ( ) {
16941694 check_infer (
16951695 r#"
1696- struct Foo;
1697- impl Foo { const ASSOC_CONST: u32 = 0; }
1698- const GLOBAL_CONST: u32 = 101;
1699- fn test() {
1700- const LOCAL_CONST: u32 = 99;
1701- let x = LOCAL_CONST;
1702- let z = GLOBAL_CONST;
1703- let id = Foo::ASSOC_CONST;
1704- }
1705- "#,
1696+ struct Foo;
1697+ impl Foo { const ASSOC_CONST: u32 = 0; }
1698+ const GLOBAL_CONST: u32 = 101;
1699+ fn test() {
1700+ const LOCAL_CONST: u32 = 99;
1701+ let x = LOCAL_CONST;
1702+ let z = GLOBAL_CONST;
1703+ let id = Foo::ASSOC_CONST;
1704+ }
1705+ "# ,
17061706 expect ! [ [ r#"
17071707 48..49 '0': u32
17081708 79..82 '101': u32
@@ -1722,17 +1722,17 @@ fn infer_const() {
17221722fn infer_static ( ) {
17231723 check_infer (
17241724 r#"
1725- static GLOBAL_STATIC: u32 = 101;
1726- static mut GLOBAL_STATIC_MUT: u32 = 101;
1727- fn test() {
1728- static LOCAL_STATIC: u32 = 99;
1729- static mut LOCAL_STATIC_MUT: u32 = 99;
1730- let x = LOCAL_STATIC;
1731- let y = LOCAL_STATIC_MUT;
1732- let z = GLOBAL_STATIC;
1733- let w = GLOBAL_STATIC_MUT;
1734- }
1735- "#,
1725+ static GLOBAL_STATIC: u32 = 101;
1726+ static mut GLOBAL_STATIC_MUT: u32 = 101;
1727+ fn test() {
1728+ static LOCAL_STATIC: u32 = 99;
1729+ static mut LOCAL_STATIC_MUT: u32 = 99;
1730+ let x = LOCAL_STATIC;
1731+ let y = LOCAL_STATIC_MUT;
1732+ let z = GLOBAL_STATIC;
1733+ let w = GLOBAL_STATIC_MUT;
1734+ }
1735+ "# ,
17361736 expect ! [ [ r#"
17371737 28..31 '101': u32
17381738 69..72 '101': u32
@@ -1751,6 +1751,41 @@ fn infer_static() {
17511751 ) ;
17521752}
17531753
1754+ #[ test]
1755+ fn infer_enum_variant ( ) {
1756+ check_infer (
1757+ r#"
1758+ enum Foo {
1759+ A = 15,
1760+ B = Foo::A as isize + 1
1761+ }
1762+ "# ,
1763+ expect ! [ [ r#"
1764+ 19..21 '15': isize
1765+ 31..37 'Foo::A': Foo
1766+ 31..46 'Foo::A as isize': isize
1767+ 31..50 'Foo::A...ze + 1': isize
1768+ 49..50 '1': isize
1769+ "# ] ] ,
1770+ ) ;
1771+ check_infer (
1772+ r#"
1773+ #[repr(u32)]
1774+ enum Foo {
1775+ A = 15,
1776+ B = Foo::A as u32 + 1
1777+ }
1778+ "# ,
1779+ expect ! [ [ r#"
1780+ 32..34 '15': u32
1781+ 44..50 'Foo::A': Foo
1782+ 44..57 'Foo::A as u32': u32
1783+ 44..61 'Foo::A...32 + 1': u32
1784+ 60..61 '1': u32
1785+ "# ] ] ,
1786+ ) ;
1787+ }
1788+
17541789#[ test]
17551790fn shadowing_primitive ( ) {
17561791 check_types (
0 commit comments