From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by sourceware.org (Postfix) with ESMTPS id 9EFE23983829 for ; Wed, 23 Jun 2021 09:55:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9EFE23983829 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-wr1-x433.google.com with SMTP id l12so1198382wrt.3 for ; Wed, 23 Jun 2021 02:55:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:references:subject:message-id:date:user-agent:mime-version :in-reply-to; bh=/c1wwaQ+KPo5hBICFRd1H7Rj1HRwDNyMRdQMPegm9ko=; b=AkeT1xxizg2ClN9wO0LSKN4DtqWoAXErjLPq5r4gKeRcP/CFBKTCi0W7lIMGjGxiN5 xvWh0XDP9jRCEco7xuMML7dkDt2uym8207dFL1b6kfjMY8rL+KOSZYRXoJvCqO1KOmdw JzRbdpbH0Hkh+TCyqCz91RJh0a9+znXHe4mhKzXF7hYUe3IxaDu466ZnylG85+oJnJ2u 27HeFFPkcOZp6evCI2bLN3QNg7e8CuSMun6VqBswjLMhj/EwgvvdfXoUYerb8Kjgeimu BdHqN/NRCnII291xrlNZdVmaY349f/zMqShrAN6TN+mpOgZ7JqMDHDtf9ilO0bjT//B5 vabQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:references:subject:message-id:date :user-agent:mime-version:in-reply-to; bh=/c1wwaQ+KPo5hBICFRd1H7Rj1HRwDNyMRdQMPegm9ko=; b=r6j/JjZt8sitmYySqvwbCGH8sPSN7Vo81ZZfOB3cXJMuVFXrDxQDZK+Yfmabwxb3PX mLE+hAPphMktwrSxJLK7S7i38c3QUhdpe/fQPxRSmPkvJ8szmLSY9S71w1QnZ6XItXJE 0txL8gaAFcNaHkw7BhGuOMEoI669GkrbSeeM9CMQ4QnBRf8gBcQ0/v53HPWZObNlrmj6 Lh7V+/kQJDF7javdP+2UP28KhYOeY1aDJ/F35dQm2GGIGu6sPYvdH0zsMp40ZjYFlzKE 6U18kVksw9+CulBxm5z/mfDNhhaJYXtXy+YCB1UikliB3aE2srOz9m80pxZI5We+uOKl PrxA== X-Gm-Message-State: AOAM531ARgIaPWrOEJ7K7MnMDtpqF++G8IIsVq5eHleTHU2ba/U4Lq8h rFVTqOu5vMa2Cd7pBX4w2of02g9FEO4GHg== X-Google-Smtp-Source: ABdhPJyc4FwdUKvGHE3H/7euAx1/ft8Z4ZGSqRzqkKa9HSdJB3X/m8RJBcTGZHq7PHGtHy+0NTCHpA== X-Received: by 2002:a5d:504e:: with SMTP id h14mr5830322wrt.273.1624442135567; Wed, 23 Jun 2021 02:55:35 -0700 (PDT) Received: from [192.168.0.40] ([86.14.124.218]) by smtp.gmail.com with ESMTPSA id y189sm5270774wmg.6.2021.06.23.02.55.34 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Jun 2021 02:55:35 -0700 (PDT) From: Philip Herron To: gcc-rust@gcc.gnu.org References: <2f353271-7ee6-ab21-e862-69582a503627@embecosm.com> Subject: Re: tuple indexes Message-ID: <8e2ce8ca-ff1d-4b25-d3bf-f4f523edef03@embecosm.com> Date: Wed, 23 Jun 2021 10:55:34 +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: <2f353271-7ee6-ab21-e862-69582a503627@embecosm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="AwHZEVCeBNVRfzjXueBimvAF8oWzpsU0y" X-Spam-Status: No, score=-4.5 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:55:38 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --AwHZEVCeBNVRfzjXueBimvAF8oWzpsU0y Content-Type: multipart/mixed; boundary="n6GUisIqmU6l0Qf47q09ZmDR3mwVYNFUL"; protected-headers="v1" From: Philip Herron To: gcc-rust@gcc.gnu.org Message-ID: <8e2ce8ca-ff1d-4b25-d3bf-f4f523edef03@embecosm.com> Subject: Re: tuple indexes References: <2f353271-7ee6-ab21-e862-69582a503627@embecosm.com> In-Reply-To: <2f353271-7ee6-ab21-e862-69582a503627@embecosm.com> --n6GUisIqmU6l0Qf47q09ZmDR3mwVYNFUL Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Content-Language: en-US On 23/06/2021 10:47, Philip Herron wrote: > 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 fiel= d >> >> 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. > From 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= =2E > If i make any progress I will update the ticket and let you know here. > > Thanks, > > --Phil > Small update, I think part of this issue is that the support for unit-structs is not there yet in the compiler, so if you remove the unit tuple struct and move the other struct definitions outside of the block the test case works: https://godbolt.org/z/nb84sEaE4 It might be enough to help with testing your tuple index fixes. Thanks --Phil --n6GUisIqmU6l0Qf47q09ZmDR3mwVYNFUL-- --AwHZEVCeBNVRfzjXueBimvAF8oWzpsU0y Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsD5BAABCAAjFiEET83ATZOayqRjyL0Cr7gxHEFOdpkFAmDTBRYFAwAAAAAACgkQr7gxHEFOdpkS swv/S1ACBZld+bI0E0TG6CcmJjy+XImwxT5mbDlxSKKObNvBbfZHqW+hlUlxWu8qPJA21oMFtqcV yR2GQKRPo4jxWQf4W471M5qpTaBwsmtLvliJS/kFT98ag/Wss36dgedmrg2MI6rorrENgmYx2oEJ napbyoK7FC4+0LaaffuPalrhgvT8nGEMzaXy0JKJhKxB4ekde5gJ8Cog+uGjrivdn5A9mGEmJHI3 T2rQgoORSJVRgwmt134o8H7FwnSVM9BHN33EsPITTCmLsFND5AflHZaIJiwHmsD6OB6YmCTHcYD+ cwf27qdd03E7UmqWm5HUDkHO3Fp/VzYekUOLxsON3KNf1ulH/OnaoO/bk7D9g9oFuSuSrmHYcbl2 +0rEoqru9rI/H6fcrZLATMBziV/oYgv5xUVIFJs+Xh6HMDDh91cGdynCNt8wFsXIqLNOueeMoBEL 7ST3j9aMnKcZgoipmc6QMvdHatPRJNyggsi+LpE26iP1xqv8POT0mV7CSRuu =kt3h -----END PGP SIGNATURE----- --AwHZEVCeBNVRfzjXueBimvAF8oWzpsU0y--