From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id 3D059385DC3B for ; Wed, 23 Jun 2021 09:47:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3D059385DC3B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wm1-x336.google.com with SMTP id j11-20020a05600c1c0bb02901e23d4c0977so2943811wms.0 for ; Wed, 23 Jun 2021 02:47:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=to:references:from:subject:message-id:date:user-agent:mime-version :in-reply-to; bh=7Su4IKEMLUbLxdelo6tX4kpXs8GzHISFBnQhC7Cb7Kg=; b=RVsM/NxK66tgcjDbJz2zldvRYEUr+qK/szFMPoiUJlClUfm1Y8IjgEOUhp0FjnonvN fYSpYG8fl2emgdk2FjAQZ5SMHuNz0jBC2BRr4fxsZxzZXClGnaAF5qfrvh+7EhRcDFg6 etrQ8tw1A1hmLu9oQ7MX/gLQgyOOqA3k3V17dvc4g+OdTFI0ICIPthACKhObfM0c93hM rNzxRlGOUdXXCC0Rz0FbGzdSjlxz1dvkNMUfKorh8LRHobZYULGseUZR/CPt1Qo9h6Bz BNF9v11zFC7oMxKF3G+fpGoFtA8F6qoS1IE//xCdUR00KBGxuKcheSXEaGcbeMUa662/ Nugg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to; bh=7Su4IKEMLUbLxdelo6tX4kpXs8GzHISFBnQhC7Cb7Kg=; b=Mic2i0u1IKGKLYhCqjnhwbfuSPvqcFzdQ2H8PpsPWfmhVcqw/XaQRcbWw/rRv9F2GG tjR42fNbA0Did4mT5wW5vv5uH4ve02dVfTWiFxbB8j7kbFTJUVcu4wJllaLugCp7PvB4 Q6lXbvpF1WE0d0ta71qoK37hyEp8pd5Xvhm9gxLxC/06vfllePpckOPI3mvDlYNiA32P s7GFA+Pn9rbRFQ9UG6qLOonzKXb/WLEoRW+3XTJJtMjSJpM2TkarA8MWowjIqZdW0UQ9 Iw+Cqlgr7PphhrsHBjUrWJku8LaGHz6SzpTQ4ji3JmimVfzzy1CpdWOVXBpxQMFsNYhx thOQ== X-Gm-Message-State: AOAM533XIMk9xYxkfEj5FV9f8jNMHeGc9eP694XV4D49HND4QRc0IaWf PcBs+kbNDwm4JqlZvfauhjTyBvAhibSJxw== X-Google-Smtp-Source: ABdhPJzG/Kg3bXNPHUj7AaTeVmYCvWCSCVc6la/+AKkXhGy7Lv3nA4J+wRJtl4o9134gl2bdbuJpow== X-Received: by 2002:a05:600c:1552:: with SMTP id f18mr9752523wmg.184.1624441628932; Wed, 23 Jun 2021 02:47:08 -0700 (PDT) Received: from [192.168.0.40] ([86.14.124.218]) by smtp.gmail.com with ESMTPSA id z5sm2192907wrp.92.2021.06.23.02.47.08 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Jun 2021 02:47:08 -0700 (PDT) To: gcc-rust@gcc.gnu.org References: From: Philip Herron Subject: Re: tuple indexes Message-ID: <2f353271-7ee6-ab21-e862-69582a503627@embecosm.com> Date: Wed, 23 Jun 2021 10:47:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="BVF9XuXcUTl084TzirvUL0GdAF2Y0FSmo" X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-rust@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: gcc-rust mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jun 2021 09:47:11 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --BVF9XuXcUTl084TzirvUL0GdAF2Y0FSmo Content-Type: multipart/mixed; boundary="1ApIB2WsYwtfW8MXDAWWGcIQqncSbHqgT"; protected-headers="v1" From: Philip Herron To: gcc-rust@gcc.gnu.org Message-ID: <2f353271-7ee6-ab21-e862-69582a503627@embecosm.com> Subject: Re: tuple indexes References: In-Reply-To: --1ApIB2WsYwtfW8MXDAWWGcIQqncSbHqgT Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Content-Language: en-US On 22/06/2021 23:51, Mark Wielaard wrote: > Hi, > > I was looking into https://github.com/Rust-GCC/gccrs/issues/511 "rust > has two kinds of integer literal" Which explains that integer literals > used for a tuple index are not general integer literals. > > First I wanted to write some tests, and started with some constructs > that should pass. But some don't. In particular the empty tuple struct > isn't recognized, and the struct name path lookup doesn't work when > initializing the tuple struct. > > tuple_index.rs:16:12: error: unrecognised token =91)=92 in type > 16 | struct E(); > | ^ > tuple_index.rs:16:12: error: could not parse type in tuple struct field= > > tuple_index.rs:20:12: error: unknown root segment in path O lookup O > 20 | let so =3D O(0); > | ^ > tuple_index.rs:24:12: error: unknown root segment in path T lookup T > 24 | let st =3D T(0,1); > | ^ > tuple_index.rs:28:12: error: unknown root segment in path M lookup M > 28 | let sm =3D M(0,1,2,3,4,5,6,7,8,9,10); > | ^ > > I haven't had time to try to resolve these issues, but wanted to > report them. > > Finally, the The Rust Reference says "A tuple index is used to refer > to the fields of tuples, tuple structs, and tuple variants." I don't > understand how this would work for tuple variants. Does anybody have > an example of how to refer to a tuple variant so a tuple index can be > used on it? > > Cheers, > > Mark > Hi Mark, Good find, I have raised https://github.com/Rust-GCC/gccrs/issues/519. =46rom the top of my head I think there are a few issues going on. 1. The parser is not able to parse the structure definitions within a block properly. 2. The knock on is that the name resolution and type resolution will need updated to handle this. I think I might take a quick look into this one today I want to double check a few things as it may have a knock on as to what I am working on. If i make any progress I will update the ticket and let you know here. Thanks, --Phil --1ApIB2WsYwtfW8MXDAWWGcIQqncSbHqgT-- --BVF9XuXcUTl084TzirvUL0GdAF2Y0FSmo Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsD5BAABCAAjFiEET83ATZOayqRjyL0Cr7gxHEFOdpkFAmDTAxsFAwAAAAAACgkQr7gxHEFOdpkr vwv+Lzjxa0p4qmpO68SPnTUBRjvaXNecRyHSkUvqA1rHmwK4SqHOvYPzKfCM8WtQ3YtaB//f+6Fk doNNcvRk/BIBQRj5HC2VU7Syev2AjsQ7yG4Sk6dlmTOtWVHtCdrEpOLCjP3dM7v4h/alJ2GnESXn 2SGiHVG2e1EDuXgn46rV+NTW0jdliSYRc5AlnLG476I/h8YB05FGiIUxas426UWfL6712r4/VSLI pfn4rNq0oQ7lF0eMmjpw5mBwzgBbYQi90umogeXohbhw/KSNjUUGhdEv3iBl1D50jDD2BHOIBLii 1y7wDbtP63QMrf/hMzhOFrIZv9iO4qO8rQsQNzxGrU4iGqFuG0z5A+q+is3rituhjtLSC1OxVgRF FS5IU56eYlEEhCv7aP3+IMbEi1TqjpY9auLaQAUHYmERGZrAeZP+M2fGbxaojMmO9b0e71TpMSjp 7ciQ+dYx5jVI7qQA/U3Qv/GeCgBzWI3cXS1oJxGqi1IC6lM6pT/BD18FPdlz =m020 -----END PGP SIGNATURE----- --BVF9XuXcUTl084TzirvUL0GdAF2Y0FSmo--