From: Christoph Heiss <c.heiss@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Noel Ullreich <n.ullreich@proxmox.com>
Subject: Re: [pve-devel] [PATCH pve_installer v2] tui: don't abort install if min ram requirement is not met
Date: Mon, 10 Jul 2023 11:08:45 +0200 [thread overview]
Message-ID: <2n2trh3hymowsnho7b6yqt7qkydyp6kehwikfzdm7aagulgiju@afncz7ynftae> (raw)
In-Reply-To: <4ae70068-d2f9-f094-7475-26848564db69@proxmox.com>
On Mon, Jul 10, 2023 at 11:00:58AM +0200, Noel Ullreich wrote:
>
> On 10-07-2023 09:27, Christoph Heiss wrote:
> > On Fri, Jul 07, 2023 at 01:53:46PM +0200, Noel Ullreich wrote:
> > > [..]
> > > @@ -256,6 +256,7 @@ fn installer_setup(in_test_mode: bool) -> Result<(LocaleInfo, RuntimeInfo), Stri
> > > /// Anything that can be done late in the setup and will not result in fatal errors.
> > > fn installer_setup_late(siv: &mut Cursive) {
> > > let state = siv.user_data::<InstallerState>().unwrap();
> > > + let mem = state.runtime_info.total_memory;
> > Nit: Can be folded into the `if` condition directly. It isn't terribly
> > long nor the condition complicated, and it results in a nice "isolated"
> > block.
>
> This doesn't work:
>
> ```
> error[E0499]: cannot borrow `*siv` as mutable more than once at a time
> --> proxmox-tui-installer/src/main.rs:263:39
> |
> 256 | let state = siv.user_data::<InstallerState>().unwrap();
> | --------------------------------- first mutable borrow
> occurs here
> ...
> 263 | display_setup_warning(siv, &format!("Failed to apply
> keyboard layout: {err}"));
> | ^^^ second mutable borrow occurs
> here
> ...
> 268 | if state.runtime_info.total_memory < 1024 {
> | ------------------------------- first borrow later used here
>
> For more information about this error, try `rustc --explain E0499`.
> error: could not compile `proxmox-tui-installer` due to previous error
> ```
>
> That's why I created this extra variable.
Right, did not think about that, even had the same problem occur to me
last week while working on some other patches.
Then it is fine as-is of course, maybe just rename it to `total_memory`
as `mem` is quite generic (but that is really just bike-shedding it this
point).
prev parent reply other threads:[~2023-07-10 9:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-07 11:53 Noel Ullreich
2023-07-10 7:27 ` Christoph Heiss
2023-07-10 9:00 ` Noel Ullreich
2023-07-10 9:08 ` Christoph Heiss [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2n2trh3hymowsnho7b6yqt7qkydyp6kehwikfzdm7aagulgiju@afncz7ynftae \
--to=c.heiss@proxmox.com \
--cc=n.ullreich@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox