From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31BE4C433B4 for ; Fri, 16 Apr 2021 21:39:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E2B9A610E7 for ; Fri, 16 Apr 2021 21:39:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344338AbhDPVji (ORCPT ); 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-Google-Smtp-Source: ABdhPJy6fjJ1LaIk+0NY41aYV58CnFUA6clshxkRCpoJPC9v/sp1QPt2XSbN3aUPzb7vMWH10nJweNMaG5p6cNBhrPI= 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: rust-for-linux@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