Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp663303pxb; Fri, 16 Apr 2021 15:12:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwj8KvnZo1agipaXtZnoTlmSia0nF1+BJF2FXuzr2QRc7j2UVEZY7S1uPSj9thVH5nJnh+z X-Received: by 2002:a05:6402:ca6:: with SMTP id cn6mr12356096edb.169.1618611154134; Fri, 16 Apr 2021 15:12:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618611154; cv=none; d=google.com; s=arc-20160816; b=E6omFTAAHYkNaRTaNU3blA9hBQdrDuOPj8HcmTSB/yegHQMitC2eqFR3EVY9XBz+6z nDkLjcQZzPW4EiK2LrLwOhsISV0wdI/mBGGwXVr6u1psH97N73gXWGeyjfrV4eiaYStz 8uKC6ENnPNBl6CqiUjdva06X8CR1QS7wFf20e/f03EYxFcVTBhkgxYN56rFAuP+F6yDY Mmlt2/WxHyEWsWhfJJRwUOQEY0Ev7R5qBHXRtC5Vov39qNP03wJDhd2hKY5pQeR1seLh 7jdxEmIKT9FP4UEPvUkZaMe+HGwwE6XAgDINmBnK44aPEDvzD3sfp5JpP4SLbXOxRTDy 7xRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=FhRl8wyt4kyWOXB4hj/P/sBHkU0fAxeEEfW1FWg8FGY=; b=qAyuvqEXi2QxaC7ynNI/zzjbdajmrub79yKDnh7jmsq6RbM0MIGF58t2VWzG44JH6Z 2pE+rwRE0gCc0ZmfG1/SKcarLqJhWIQifFX6dTRFbrVykSDpkbMLz7C0+oY5P4HJkqE4 yMU64VzvS6smMXIIrvS5lcsuBXzMq9QtMeMt13gkoAZVn5O7+t3jFo0gXLoMqQFqXNDb NBjy9L6MNzFXh8MPpU+A+5dGjJBbsnNZRYw01DTW5Jp4/nNyT88wIF3ZPM3tvFYSgPta rJyj62Zs2HIYM/qQrb8MKYFIfKhwWeklVzMPAJ7H6uVabWf/ZNazovV/C918TnBZpiI2 EtBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XUGR4Fum; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ky21si5518040ejc.641.2021.04.16.15.12.11; Fri, 16 Apr 2021 15:12:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XUGR4Fum; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344495AbhDPVji (ORCPT + 99 others); Fri, 16 Apr 2021 17:39:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235540AbhDPVjh (ORCPT ); Fri, 16 Apr 2021 17:39:37 -0400 Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [IPv6:2607:f8b0:4864:20::b2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34A51C061574; Fri, 16 Apr 2021 14:39:12 -0700 (PDT) Received: by mail-yb1-xb2d.google.com with SMTP id y2so29590937ybq.13; Fri, 16 Apr 2021 14:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FhRl8wyt4kyWOXB4hj/P/sBHkU0fAxeEEfW1FWg8FGY=; b=XUGR4FumO2z4d0PIcvh90tV8PwYc+5gWKgmSCmH3w1L7wBW7hlSBrBhtWIegDIdFi+ tYyIcTf4dOiNcHnz8/O3l3/r1VcosYhR9v74MM11yCYBg66MjAcX2suBNjvS8LNFe2jh vvwY0I623sJv0wFH71vOF7qFnp5Z5DUKuh4hBULkM5sqAc87aYjDoLh2+E3OljTUcW61 wuxXmf3rVGfEpJhxnWcTDvj0Y1EZUyDiJrK2FmMNjsbufrCfeqeS4F0EwtNZljFSMP68 m1OIu+L6I6f7BeHfWENgUkMIcUFezR6bkG7n2ByWKCekEaWqD/u7BK+OaVYISkTez5Rb K84g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FhRl8wyt4kyWOXB4hj/P/sBHkU0fAxeEEfW1FWg8FGY=; b=aaHSRCsBV0A99BYkmKwWfSlA6hZISHwMN6xRHCnyw5O62RgOHKk448Xytpo0WpAYkF f41bSJqLjZmwZgkSewIZIABLeJyBgn8TIhyNfSsfEJLsF21aQo81qZbiBleCmnDfybwK sTBSNzfTyHuKV9qS9PPtW1PBjWsugf1Qu5mmeuhnyVOTllZrWDhLB8nrozw3WLOMCGRO 3rysMzxZV5DXdw1ClE7e0F5vHlNldKYV5r8Lgjd2FGhlM7vO3KRRh92P3W2Pqbx9K2tw FgMSptXkb1Ln1GHj5FPQNGJI6NPW2O8+qR7GRvvdCjeTnrprufkVnGRWIxAR7psLB18U 4Vag== X-Gm-Message-State: AOAM532BozrXS+rJeYlfxWe4nHp01YbkLhCDMdupc/Tn/quUBfZoJc8r wRztkQ2S/5QbF32p0hXL13XvhGH188vf5UqJKdM= X-Received: by 2002:a25:7909:: with SMTP id u9mr1622529ybc.22.1618609151601; Fri, 16 Apr 2021 14:39:11 -0700 (PDT) MIME-Version: 1.0 References: <20210414184604.23473-1-ojeda@kernel.org> <20210414184604.23473-5-ojeda@kernel.org> <20210416202215.GA11236@1wt.eu> <20210416205812.GA11655@1wt.eu> In-Reply-To: <20210416205812.GA11655@1wt.eu> From: Miguel Ojeda Date: Fri, 16 Apr 2021 23:39:00 +0200 Message-ID: Subject: Re: [PATCH 04/13] Kbuild: Rust support To: Willy Tarreau Cc: Connor Kuehl , Al Viro , Linus Torvalds , Peter Zijlstra , Miguel Ojeda , Greg Kroah-Hartman , rust-for-linux@vger.kernel.org, Linux Kbuild mailing list , "open list:DOCUMENTATION" , Linux Kernel Mailing List , Alex Gaynor , Geoffrey Thomas , Finn Behrens , Adam Bratschi-Kaye , Wedson Almeida Filho , Michael Ellerman Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 16, 2021 at 10:58 PM Willy Tarreau wrote: > > No, two: > - ok in %rax (seems like it's "!ok" technically speaking since it > returns 1 on !ok and 0 on ok) > - foo_or_err in %rdx Yes, but that is the implementation -- conceptually you only have one or the other, and Rust won't allow you to use the wrong one. > However then I'm bothered because Miguel's example showed that regardless > of OK, EINVAL was always returned in foo_or_err, so maybe it's just > because his example was not well chosen but it wasn't very visible from > the source: That is the optimizer being fancy since the error can be put unconditionally in `rdx`. If you compile: pub fn it_is_ok() -> KernelResult { Ok(Bar) } you will see it just clears `rax`. Cheers, Miguel