profile
viewpoint
Léo Lanteri Thauvin LeSeulArtichaut France Full-time Rust enthusiast. A beautiful artichoke the rest of the time.

LeSeulArtichaut/alloc-cortex-m 0

A heap allocator for Cortex-M processors

LeSeulArtichaut/arm-dcc 0

Debug Communication Channel (DCC) API

LeSeulArtichaut/awesome-embedded-rust 0

Curated list of resources for Embedded and Low-level development in the Rust programming language

LeSeulArtichaut/bare-metal 0

Abstractions common to microcontrollers

LeSeulArtichaut/blog 0

The Rust Embedded WG Blog

LeSeulArtichaut/book 0

The Rust Programming Language

LeSeulArtichaut/book-1 0

Documentation on how to use the Rust Programming Language to develop firmware for bare metal (microcontroller) devices

LeSeulArtichaut/cargo 0

The Rust package manager

LeSeulArtichaut/cargo-binutils 0

Cargo subcommands to invoke the LLVM tools shipped with the Rust toolchain

Pull request review commentrust-lang/rustc-dev-guide

Implement date-checker

+use std::{+    collections::BTreeMap,+    convert::TryInto as _,+    env, fmt, fs,+    path::{Path, PathBuf},+};++use chrono::{Datelike as _, TimeZone as _, Utc};+use glob::glob;+use regex::Regex;++#[derive(Debug, Copy, Clone, PartialEq, Eq)]+struct Date {+    year: u32,+    month: u32,+}++impl Date {+    fn months_since(self, other: Date) -> Option<u32> {+        let self_chrono = Utc.ymd(self.year.try_into().unwrap(), self.month, 1);+        let other_chrono = Utc.ymd(other.year.try_into().unwrap(), other.month, 1);+        let duration_since = self_chrono.signed_duration_since(other_chrono);+        let days_since = duration_since.num_days();

It's the number of days in the duration.

camelid

comment created time in 8 hours

Pull request review commentrust-lang/rustc-dev-guide

Implement date-checker

+use std::{+    collections::BTreeMap,+    convert::TryInto as _,+    env, fmt, fs,+    path::{Path, PathBuf},+};++use chrono::{Datelike as _, TimeZone as _, Utc};+use glob::glob;+use regex::Regex;++#[derive(Debug, Copy, Clone, PartialEq, Eq)]+struct Date {+    year: u32,+    month: u32,

I think we should limit this to u8

I tried that at first but it requires using TryInto because chrono uses u32.

if not a custom enum for the specific twelve months

That seems like unnecessary complexity to me. At some point it might be good to have a --validate mode that makes sure all the dates are valid (e.g. not in the future) and put that in CI, but I don't think we should do that here.

camelid

comment created time in 8 hours

pull request commentrust-lang/rustc-dev-guide

Implement date-checker

Can we run this manually to confirm it works?

I tested this on a private repo and it seems to work. I had to manually trigger it because it's not the first of the month so I wasn't able to test the cronjob. However, it seems like it should work.

camelid

comment created time in 9 hours

startedJguer/yay

started time in 14 hours

startedgvinciguerra/PGM-index

started time in 17 hours

startedrxi/lite

started time in a day

Pull request review commentrust-lang/rustc-dev-guide

Implement date-checker

+use std::{+    collections::BTreeMap,+    convert::TryInto as _,+    env, fmt, fs,+    path::{Path, PathBuf},+};++use chrono::{Datelike as _, TimeZone as _, Utc};+use glob::glob;+use regex::Regex;++#[derive(Debug, Copy, Clone, PartialEq, Eq)]+struct Date {+    year: u32,+    month: u32,+}++impl Date {+    fn months_since(self, other: Date) -> Option<u32> {+        let self_chrono = Utc.ymd(self.year.try_into().unwrap(), self.month, 1);+        let other_chrono = Utc.ymd(other.year.try_into().unwrap(), other.month, 1);+        let duration_since = self_chrono.signed_duration_since(other_chrono);+        let days_since = duration_since.num_days();+        if days_since < 0 {+            None+        } else {+            Some(days_since.try_into().unwrap())+        }+    }+}++impl fmt::Display for Date {+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {+        write!(f, "{:04}-{:02}", self.year, self.month)+    }+}++fn make_date_regex() -> Regex {+    Regex::new(

I'd prefer to use once_cell, since it will soon be upstreamed into the standard library: https://github.com/rust-lang/rfcs/pull/2788

camelid

comment created time in 2 days

Pull request review commentrust-lang/rustc-dev-guide

Implement date-checker

+use std::{+    collections::BTreeMap,+    convert::TryInto as _,+    env, fmt, fs,+    path::{Path, PathBuf},+};++use chrono::{Datelike as _, TimeZone as _, Utc};+use glob::glob;+use regex::Regex;++#[derive(Debug, Copy, Clone, PartialEq, Eq)]+struct Date {+    year: u32,+    month: u32,+}++impl Date {+    fn months_since(self, other: Date) -> Option<u32> {+        let self_chrono = Utc.ymd(self.year.try_into().unwrap(), self.month, 1);+        let other_chrono = Utc.ymd(other.year.try_into().unwrap(), other.month, 1);+        let duration_since = self_chrono.signed_duration_since(other_chrono);+        let days_since = duration_since.num_days();+        if days_since < 0 {+            None+        } else {+            Some(days_since.try_into().unwrap())+        }+    }+}++impl fmt::Display for Date {+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {+        write!(f, "{:04}-{:02}", self.year, self.month)+    }+}++fn make_date_regex() -> Regex {+    Regex::new(

Not sure if lazy_static would be one too many dependencies but it might make sense here.

camelid

comment created time in 2 days

Pull request review commentrust-lang/rustc-dev-guide

Implement date-checker

+use std::{+    collections::BTreeMap,+    convert::TryInto as _,+    env, fmt, fs,+    path::{Path, PathBuf},+};++use chrono::{Datelike as _, TimeZone as _, Utc};+use glob::glob;+use regex::Regex;++#[derive(Debug, Copy, Clone, PartialEq, Eq)]+struct Date {+    year: u32,+    month: u32,+}++impl Date {+    fn months_since(self, other: Date) -> Option<u32> {+        let self_chrono = Utc.ymd(self.year.try_into().unwrap(), self.month, 1);+        let other_chrono = Utc.ymd(other.year.try_into().unwrap(), other.month, 1);+        let duration_since = self_chrono.signed_duration_since(other_chrono);+        let days_since = duration_since.num_days();+        if days_since < 0 {+            None+        } else {+            Some(days_since.try_into().unwrap())+        }+    }+}++impl fmt::Display for Date {+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {+        write!(f, "{:04}-{:02}", self.year, self.month)+    }+}++fn make_date_regex() -> Regex {+    Regex::new(+        r"(?x) # insignificant whitespace mode+        <!--\s*+        date:\s*+        (?P<y>\d{4}) # year+        -+        (?P<m>\d{2}) # month+        \s*-->",+    )+    .unwrap()+}++fn collect_dates_from_file(date_regex: &Regex, text: &str) -> Vec<(usize, Date)> {+    let mut dates = vec![];+    let mut line = 1;+    let mut end_of_last_cap = 0;+    for (byte_range, date) in date_regex.captures_iter(&text).map(|cap| {+        (+            cap.get(0).unwrap().range(),+            Date {+                year: cap["y"].parse().unwrap(),+                month: cap["m"].parse().unwrap(),+            },+        )+    }) {+        for chr in text[end_of_last_cap..byte_range.end].chars() {
line += text[end_of_last_cap..byte_range.end].chars().filter(|c| c == '\n').count()
camelid

comment created time in 2 days

Pull request review commentrust-lang/rustc-dev-guide

Implement date-checker

+use std::{+    collections::BTreeMap,+    convert::TryInto as _,+    env, fmt, fs,+    path::{Path, PathBuf},+};++use chrono::{Datelike as _, TimeZone as _, Utc};+use glob::glob;+use regex::Regex;++#[derive(Debug, Copy, Clone, PartialEq, Eq)]+struct Date {+    year: u32,+    month: u32,

I think we should limit this to u8 if not a custom enum for the specific twelve months. Incorrectly formatted dates will likely propagate pretty far into this and could be somewhat hard to debug. Might be best to try to catch them as early as possible.

camelid

comment created time in 2 days

Pull request review commentrust-lang/rustc-dev-guide

Implement date-checker

+use std::{+    collections::BTreeMap,+    convert::TryInto as _,+    env, fmt, fs,+    path::{Path, PathBuf},+};++use chrono::{Datelike as _, TimeZone as _, Utc};+use glob::glob;+use regex::Regex;++#[derive(Debug, Copy, Clone, PartialEq, Eq)]+struct Date {+    year: u32,+    month: u32,+}++impl Date {+    fn months_since(self, other: Date) -> Option<u32> {+        let self_chrono = Utc.ymd(self.year.try_into().unwrap(), self.month, 1);+        let other_chrono = Utc.ymd(other.year.try_into().unwrap(), other.month, 1);+        let duration_since = self_chrono.signed_duration_since(other_chrono);+        let days_since = duration_since.num_days();

Why are we using num_days here? I thought this was supposed to return the months since the other date.

camelid

comment created time in 2 days

startedjammus/lastfm-node

started time in 3 days

Pull request review commentrust-lang/rustc-dev-guide

Document how to stabilize a library feature

 if [ "$MAX_LINE_LENGTH" == "" ]; then fi  if [ "$1" == "" ]; then-  files=( src/**/*.md )+  files=( src/**.md )

err actually I think this change is wrong:

> ls src/**.md | grep building | wc -l
0

ls src/**/*.md | grep building | wc -l 8

The actual issue is that the script is being run with `sh`, not `bash`, which doesn't support double asterisks in globs. I'll fix it.
jyn514

comment created time in 3 days

pull request commentrust-lang/rustc-dev-guide

Implement date-checker

@rylev do you have time to review this?

camelid

comment created time in 3 days

push eventrust-lang/rustc-dev-guide

Deployment Bot (from Travis CI)

commit sha 93cd6b8a99a48aa34fedcef68bf4af287a9a4e8e

Deploy rustc-dev-guide.rust-lang.org to github.com/rust-lang/rustc-dev-guide.git:gh-pages

view details

push time in 3 days

push eventrust-lang/rustc-dev-guide

LeSeulArtichaut

commit sha 93a25a9fb783e7cfe89c18ba41981dd406fa3a75

Update links to `librustc_llvm` and `rustllvm`

view details

push time in 3 days

PR merged rust-lang/rustc-dev-guide

Update links to `librustc_llvm` and `rustllvm` waiting-on-review

Closes #1038. cc rust-lang/rust#74787 rust-lang/rust#74862

+12 -11

0 comment

2 changed files

LeSeulArtichaut

pr closed time in 3 days

issue closedrust-lang/rustc-dev-guide

No src/librustc_llvm as sais in dev guide

On here https://rustc-dev-guide.rust-lang.org/compiler-src.html it says

One final thing: src/llvm-project is a submodule for our fork of LLVM. During bootstrapping, LLVM is built and the src/librustc_llvm and src/rustllvm crates contain rust wrappers around LLVM (which is written in C++), so that the compiler can interface with it.

but there is no src/librustc_llvm

closed time in 3 days

lucaszanella

startedmathiasvr/audio-oscilloscope

started time in 3 days

startedjarcode-foss/glava

started time in 3 days

issue openedrust-lang/rustc-dev-guide

No src/librustc_llvm as sais in dev guide

On here https://rustc-dev-guide.rust-lang.org/compiler-src.html it says

One final thing: src/llvm-project is a submodule for our fork of LLVM. During bootstrapping, LLVM is built and the src/librustc_llvm and src/rustllvm crates contain rust wrappers around LLVM (which is written in C++), so that the compiler can interface with it.

but there is no src/librustc_llvm

created time in 3 days

Pull request review commentrust-lang/rustc-dev-guide

Document how to stabilize a library feature

 # Request for stabilization +**NOTE**: this page is about stabilizing language features.+For stabilizing library features, see [Stabilizing a library feature].

Maybe add italics since language and library look somewhat similar?

For stabilizing *library* features, see [Stabilizing a library feature].
jyn514

comment created time in 3 days

Pull request review commentrust-lang/rustc-dev-guide

Document how to stabilize a library feature

 even on an `unstable` function, if that function is called from another Furthermore this attribute is needed to mark an intrinsic as callable from `rustc_const_stable` functions. +## Stabilizing a library feature++To stabilize a feature, follow these steps:++0. Ask a **@T-libs** member to start an FCP on the tracking issue and wait for+   the FCP to complete (with `disposition-merge`).+1. Change `#[unstable]` to `#[stable(since = "version")]`.+   `version` should be the *current nightly*, i.e. stable+2. You can see which version is+   currently nightly [on Forge](https://forge.rust-lang.org/#current-release-versions).+2. Remove `#![feature]` from any test or doc-test for this API. If the feature is used in the+   compiler or tools, remove it from there as well.+3. If applicable, change `#[rustc_const_unstable]` to `#[rustc_const_stable(since = "version")]`.
3. If applicable, change `#[rustc_const_unstable(...)]` to `#[rustc_const_stable(since = "version")]`.
jyn514

comment created time in 3 days

Pull request review commentrust-lang/rustc-dev-guide

Document how to stabilize a library feature

 even on an `unstable` function, if that function is called from another Furthermore this attribute is needed to mark an intrinsic as callable from `rustc_const_stable` functions. +## Stabilizing a library feature++To stabilize a feature, follow these steps:++0. Ask a **@T-libs** member to start an FCP on the tracking issue and wait for+   the FCP to complete (with `disposition-merge`).+1. Change `#[unstable]` to `#[stable(since = "version")]`.+   `version` should be the *current nightly*, i.e. stable+2. You can see which version is+   currently nightly [on Forge](https://forge.rust-lang.org/#current-release-versions).+2. Remove `#![feature]` from any test or doc-test for this API. If the feature is used in the+   compiler or tools, remove it from there as well.+3. If applicable, change `#[rustc_const_unstable]` to `#[rustc_const_stable(since = "version")]`.+4. Open a PR against `rust-lang/rust`
4. Open a PR against `rust-lang/rust`.
jyn514

comment created time in 3 days

Pull request review commentrust-lang/rustc-dev-guide

Document how to stabilize a library feature

 even on an `unstable` function, if that function is called from another Furthermore this attribute is needed to mark an intrinsic as callable from `rustc_const_stable` functions. +## Stabilizing a library feature++To stabilize a feature, follow these steps:++0. Ask a **@T-libs** member to start an FCP on the tracking issue and wait for+   the FCP to complete (with `disposition-merge`).+1. Change `#[unstable]` to `#[stable(since = "version")]`.+   `version` should be the *current nightly*, i.e. stable+2. You can see which version is+   currently nightly [on Forge](https://forge.rust-lang.org/#current-release-versions).+2. Remove `#![feature]` from any test or doc-test for this API. If the feature is used in the
2. Remove `#![feature(...)]` from any test or doc-test for this API. If the feature is used in the
jyn514

comment created time in 3 days

Pull request review commentrust-lang/rustc-dev-guide

Document how to stabilize a library feature

 even on an `unstable` function, if that function is called from another Furthermore this attribute is needed to mark an intrinsic as callable from `rustc_const_stable` functions. +## Stabilizing a library feature++To stabilize a feature, follow these steps:++0. Ask a **@T-libs** member to start an FCP on the tracking issue and wait for+   the FCP to complete (with `disposition-merge`).+1. Change `#[unstable]` to `#[stable(since = "version")]`.+   `version` should be the *current nightly*, i.e. stable+2. You can see which version is+   currently nightly [on Forge](https://forge.rust-lang.org/#current-release-versions).

I feel like #[unstable] might confuse people who haven't seen the unstable attribute before since it makes it look like it doesn't take arguments.

1. Change `#[unstable(...)]` to `#[stable(since = "version")]`.
   `version` should be the *current nightly*, i.e. stable+2. You can see which version is
   the current nightly [on Forge](https://forge.rust-lang.org/#current-release-versions).
jyn514

comment created time in 3 days

Pull request review commentrust-lang/rustc-dev-guide

Document how to stabilize a library feature

 if [ "$MAX_LINE_LENGTH" == "" ]; then fi  if [ "$1" == "" ]; then-  files=( src/**/*.md )+  files=( src/**.md )

Wow, I didn't realize src/**.md worked! Learned a new thing about globs :)

jyn514

comment created time in 3 days

Pull request review commentrust-lang/rustc-dev-guide

Document how to stabilize a library feature

 even on an `unstable` function, if that function is called from another Furthermore this attribute is needed to mark an intrinsic as callable from `rustc_const_stable` functions. +## Stabilizing a library feature++To stabilize a feature, follow these steps:++0. Ask a **@T-libs** to start an FCP on the tracking issue and wait for the FCP to complete (with `disposition-merge`).

Also lol can we please make "a T-libs" a noun :joy:

jyn514

comment created time in 3 days

Pull request review commentrust-lang/rustc-dev-guide

Document how to stabilize a library feature

 even on an `unstable` function, if that function is called from another Furthermore this attribute is needed to mark an intrinsic as callable from `rustc_const_stable` functions. +## Stabilizing a library feature++To stabilize a feature, follow these steps:++0. Ask a **@T-libs** to start an FCP on the tracking issue and wait for the FCP to complete (with `disposition-merge`).

Or it can be seen as a step before the actual stabilization process, which also makes sense

Yes, that's what I intended.

jyn514

comment created time in 3 days

pull request commentrust-lang/rustc-dev-guide

Document how to stabilize a library feature

Even though we have an empty std dev guide where we should put this, I'd still be inclined to merge this here and we can look at migrating content around once the std dev guide actually has a home for it.

jyn514

comment created time in 3 days

more