Stream: t-compiler/wg-prioritization/alerts

Topic: I-prioritize #77628 Compilation uses 16GB of memory on loca…


triagebot (Oct 07 2020 at 01:04, on Zulip):

@WG-prioritization/alerts issue #77628 has been requested for prioritization.

Procedure

Camelid (Oct 07 2020 at 01:05, on Zulip):

Waiting on an MCVE, so not sure how to prioritize yet

Camelid (Oct 07 2020 at 03:06, on Zulip):

The issue author posted this code that repros for them:

use bson::{doc};
use bson::oid::ObjectId;
use mongodb::{error::Error, Collection, options::FindOneOptions};

#[derive(Clone)]
pub struct UserService {
    collection: Collection,
}

impl UserService {
    pub async fn get_all(&self) -> Result<Vec<UserSchema>, Error> {
        let mut cursor = self.collection.find(None, None).await?; // That's the bad line
        let mut vec: Vec<UserSchema> = Vec::new();
        while let Some(result) = cursor.next().await {
            match result {
                Ok(document) => {
                    let user: UserSchema = bson::from_bson(bson::Bson::Document(document)).unwrap();
                    vec.push(user);
                }
                Err(e) => return Err(e.into()),
            }
        };
        Ok(vec)
    }
}
apiraino (Oct 07 2020 at 22:03, on Zulip):

ok, closed as dupe of https://github.com/rust-lang/rust/issues/75992

Last update: Apr 10 2021 at 21:15UTC