profile
viewpoint

smol-rs/smol 1835

A small and fast async runtime for Rust

taiki-e/auto_enums 171

A library for to allow multiple return types by automatically generated enum.

taiki-e/cargo-hack 60

A tool to work around some limitations on cargo.

taiki-e/const_fn 13

An attribute for easy generation of const functions with conditional compilations.

dignifiedquire/smol 1

A small and fast async runtime for Rust

taiki-e/actix 0

Actor framework for Rust

taiki-e/actix-net 0

framework for composable networking services

taiki-e/actix-web 0

Actix web is a small, pragmatic, and extremely fast rust web framework.

taiki-e/advisory-db 0

Security advisory database for Rust crates published through crates.io

pull request commentcuviper/autocfg

Improve panic message of autocfg::new

Do you have an example of how this looks with a real error, before and after?

Here is the current output and the output after this PR has been applied:

  • ErrorKind::Io:

    Before:
    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: Io(Os { code: 2, kind: NotFound, message: "No such file or directory" }) }', autocfg/src/lib.rs:137:28
    After:
    thread 'main' panicked at 'No such file or directory (os error 2)', autocfg/src/lib.rs:146:47
    
  • ErrorKind::Num:

    Before:
    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: Num(ParseIntError { kind: InvalidDigit }) }', autocfg/src/lib.rs:137:28
    After:
    thread 'main' panicked at 'invalid digit found in string', autocfg/src/lib.rs:146:47
    
  • ErrorKind::Utf8:

    Before:
    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: Utf8(Utf8Error { valid_up_to: 1, error_len: Some(1) }) }', autocfg/src/lib.rs:137:28
    After:
    thread 'main' panicked at 'invalid utf-8 sequence of 1 bytes from index 1', autocfg/src/lib.rs:146:47
    
  • ErrorKind::Other:

    Before:
    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: Other("could not find rustc release") }', autocfg/src/lib.rs:137:28
    After:
    thread 'main' panicked at 'could not find rustc release', autocfg/src/lib.rs:146:47
    

If the problem is just the verbosity of derive(Debug), we could implement that manually to look more like Display.

I think verbosity is the main problem, but I think the output of .unwrap (i.e., "called Result::unwrap() on an Err value:") is also verbose. Here is output if use fmt::Display::fmt in Debug impl:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: No such file or directory (os error 2)', autocfg/src/lib.rs:137:28
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: invalid digit found in string', autocfg/src/lib.rs:137:28
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: invalid utf-8 sequence of 1 bytes from index 1', autocfg/src/lib.rs:137:28
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: could not find rustc release', autocfg/src/lib.rs:137:28
taiki-e

comment created time in 32 minutes

push eventrust-lang/futures-rs

Taiki Endo

commit sha a45db5bb90ef56fe17e7f5701411e168d4f337be

Fix install of Rust toolchain

view details

push time in 2 hours

Pull request review commentrust-lang/futures-rs

Migrate CI to GitHub Actions

+name: CI+on:+  pull_request:+  push:+    branches:+      - master+  schedule:+    - cron: '0 1 * * *'++env:+  RUSTFLAGS: -Dwarnings+  RUST_BACKTRACE: 1++defaults:+  run:+    shell: bash++jobs:+  test:+    name: cargo +${{ matrix.rust }} test (${{ matrix.os }})+    strategy:+      matrix:+        rust:+          - nightly+        os:+         - ubuntu-latest+         - macos-latest+         - windows-latest+    runs-on: ${{ matrix.os }}+    steps:+      - uses: actions/checkout@v2+      - name: Install Rust+        run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}

Oh, no, this means if the default toolchain is stable and that is outdated, then the toolchain does not update. I'll revert...

taiki-e

comment created time in 3 hours

PullRequestReviewEvent

Pull request review commenttokio-rs/tokio

time: use intrusive lists for timer tracking

 pin_project! {     } } -// XXX: are these safe if `T: !Unpin`?-impl<T: Unpin> Throttle<T> {+impl<T> Throttle<T> {+    fn get_sleep_mut(self: Pin<&mut Self>) -> Option<Pin<&mut Sleep>> {+        unsafe {+            // SAFETY: We project here to the inner Sleep object. Because we+            // allow access only via a Pin<&mut Sleep>, our returned reference+            // does not allow the pinning guarantees to be violated.

I don't think this is correct, pin-project(-lite) assume non-#[pin] field is not structurally pinned fields (i.e., never pinned) and implement Unpin based on that assumption. https://docs.rs/pin-project/1.0.1/pin_project/attr.pin_project.html#safety

To enforce this, this attribute will automatically generate an Unpin implementation for you, which will require that all structurally pinned fields be Unpin.

In this case, Unpin implementation like the following is generated:

impl<T> Unpin for Throttle<T> where T: Unpin {}

This violates the following safety requirements if Sleep is not Unpin. (delay field is structurally pinned fields.) https://doc.rust-lang.org/nightly/core/pin/index.html#pinning-is-structural-for-field

  1. The struct must only be Unpin if all the structural fields are Unpin.

So I think the correct solution here is to add a #[pin] attribute to delay field and use .as_pin_mut() to convert Pin<&mut Option<Sleep>> to Option<Pin<&mut Sleep>>.

bdonlan

comment created time in 4 hours

Pull request review commenttokio-rs/tokio

time: use intrusive lists for timer tracking

 enum Action { struct Inner {     actions: VecDeque<Action>,     waiting: Option<Instant>,-    sleep: Option<Sleep>,+    sleep: Option<std::pin::Pin<Box<Sleep>>>,
    sleep: Option<Pin<Box<Sleep>>>,
bdonlan

comment created time in 5 hours

PullRequestReviewEvent
PullRequestReviewEvent
PullRequestReviewEvent

push eventrust-lang/futures-rs

Taiki Endo

commit sha 310fd0d608671d47e6117eb154e3cd03cec5a978

impl Clone for stream::{Empty, Pending, Repeat} (#2248)

view details

push time in 5 hours

delete branch taiki-e/futures-rs

delete branch : stream-clone

delete time in 5 hours

PR merged rust-lang/futures-rs

impl Clone for stream::{Empty, Pending, Repeat} C-feature-request futures-util

I'm not clear about if it needs to implement Clone for almost combinator as std iterator does, but I think it makes sense for these streams to implement Clone.

+13 -1

0 comment

3 changed files

taiki-e

pr closed time in 5 hours

Pull request review commenttokio-rs/tokio

doc: add from_std change to CHANGELOG

 Biggest changes are: - fs: `File` operations take `&self` (#2930). - rt: runtime API, and `#[tokio::main]` macro polish (#2876) - rt: `Runtime::enter` uses an RAII guard instead of a closure (#2954).+- net: the `from_std` function on all sockets no longer sets `O_NONBLOCK` (#2893)
- net: the `from_std` function on all sockets no longer sets socket into non-blocking mode (#2893)

"non-blocking mode" is may easier to understand, given that the tokio, mio, and std docs don't mention O_NONBLOCK directly.

Darksonn

comment created time in 5 hours

PullRequestReviewEvent

pull request commenttokio-rs/tokio

tracing: replace future names with spawn locations in task spans

Probably MSRV will be increased in 1.0, so dependency on autocfg should be temporary.

However, futures-core may depend on autocfg in the future. (see https://github.com/rust-lang/futures-rs/issues/2207#issuecomment-689654816 and https://github.com/rust-lang/futures-rs/issues/1875#issuecomment-639895854)

hawkw

comment created time in 6 hours

Pull request review commenttokio-rs/tokio

tracing: replace future names with spawn locations in task spans

+use std::{env, ffi::OsString, process::Command};++fn main() {+    match rustc_minor_version() {+        // If rustc >= 1.47.0, we can enable `track_caller`.+        Ok(minor) if minor >= 47 => println!("cargo:rustc-cfg=tokio_track_caller"),+        Err(e) => println!("cargo:warning=could not parse rustc version: {}", e),+        _ => {}+    }+}++fn rustc_minor_version() -> Result<usize, Box<dyn std::error::Error>> {+    let rustc = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc"));+    let out = Command::new(rustc).arg("-V").output()?;+    let version_str = std::str::from_utf8(&out.stdout)?;+    let mut parts = version_str.split(' ');+    if parts.next() != Some("rustc") {+        Err(format!(+            "weird rustc version: {:?} (missing 'rustc') ",+            version_str+        ))?;+    }+    if let Some(part) = parts.next() {+        let mut parts = part.split('.');+        if parts.next() != Some("1") {+            Err(format!(+                "weird rustc version: {:?} (does not start with 1)",+                version_str+            ))?;+        }+        if let Some(middle) = parts.next() {+            Ok(middle.parse()?)+        } else {+            Err(format!("weird rustc version: {:?} (no minor version)", version_str).into())+        }+    } else {+        Err(format!(+            "weird rustc version: {:?} (missing version entirely?) ",+            version_str,+        )+        .into())+    }+}

AFAICT, it isn't possible to feature flag build deps, so we will always pull autocfg, even when the tracing feature is disabled...i'm not sure if that's a huge issue.

(as you said in another comment, this PR is currently always using track_caller)

hawkw

comment created time in 6 hours

PullRequestReviewEvent

PR opened rust-lang/futures-rs

impl Clone for stream::{empty, pending, repeat} C-feature-request futures-util

I'm not clear about if it needs to implement Clone for almost combinator as std iterator does, but I think it makes sense for these streams to implement Clone.

+13 -1

0 comment

3 changed files

pr created time in 6 hours

push eventtaiki-e/futures-rs

Taiki Endo

commit sha 0623c8dfdc64099454f8de48e837ad7e7483b905

impl Clone for stream::{empty, pending, repeat}

view details

push time in 7 hours

pull request commentrust-lang/futures-rs

Migrate CI to GitHub Actions

It needs to change the "required statuses" of the branch protection settings to merge this (requires admin rights).

@cramertj: Could you change the branch protection settings? (or could you add me on admins of this repo?)

taiki-e

comment created time in 7 hours

push eventrust-lang/futures-rs

Taiki Endo

commit sha c4aa7981c195ea1a39b7623b4bfa89af137a15a5

Remove ci/remove-dev-dependencies

view details

push time in 7 hours

push eventrust-lang/futures-rs

Taiki Endo

commit sha dc271d4ba3380aef20d473d15ce506be4ee39998

Remove ci/remove-dev-dependencies

view details

push time in 7 hours

push eventrust-lang/futures-rs

Taiki Endo

commit sha 83d038da93ada7006d3a5d896aff83867f0cc637

Remove ci/remove-dev-dependencies

view details

push time in 7 hours

push eventrust-lang/futures-rs

Taiki Endo

commit sha cfb827ad3cdefc4d3404793132e13463e7883f94

Fix unsoundness in MappedMutexGuard (#2240) See #2239

view details

Taiki Endo

commit sha c4f734926f40d8c3e4bc50ad81483dc705a3c31c

Release 0.3.7

view details

Kyle Huey

commit sha 8bb7fd9aea23a29764e6c321b8da875f0044200e

Add WeakShared. This makes implementing a cache with futures much easier. With the current architecture a cache that uses Shareds cannot honor the "drop as cancellation" feature of futures. And the cache is forced to either poll futures itself to ensure they're polled to completion or to leave half-polled futures dangling inside it (potentially consuming resources like sockets or database connections). WeakShared is to Shared as Weak is to Arc. If any copy of the underlying Shared exists that has not be dropped or polled to completion the WeakShared can be upgraded to it. This makes it possible to construct a cache that does not entrain futures, thus honoring the "drop as cancellation" feature.

view details

Andronik Ordian

commit sha 4122f3d5af75e3c83a8059c57ba08888ea29adbe

Use only_hack_old_rustc for proc_macro_hack (#2243)

view details

Taiki Endo

commit sha e363f1839f78e7743209c0bc410f9f94fb82519e

Fix clippy::unnecessary_cast warning

view details

Taiki Endo

commit sha e3f5a55b6fddf04c59301ffb72a5c0e921d1f062

Migrate CI to GitHub Actions

view details

push time in 7 hours

Pull request review commentrust-lang/futures-rs

Migrate CI to GitHub Actions

+name: CI+on:+  pull_request:+  push:+    branches:+      - master+  schedule:+    - cron: '0 1 * * *'++env:+  RUSTFLAGS: -Dwarnings+  RUST_BACKTRACE: 1++defaults:+  run:+    shell: bash++jobs:+  test:+    name: cargo +${{ matrix.rust }} test (${{ matrix.os }})+    strategy:+      matrix:+        rust:+          - nightly+        os:+         - ubuntu-latest+         - macos-latest+         - windows-latest+    runs-on: ${{ matrix.os }}+    steps:+      - uses: actions/checkout@v2+      - name: Install Rust+        run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}+      - run: cargo test --workspace --all-features+      - run: cargo test --workspace --all-features --release++  core-msrv:+    name: cargo +${{ matrix.rust }} build (futures-{core, io, sink, task})+    strategy:+      matrix:+        rust:+          # This is the minimum Rust version supported by futures-core, futures-io, futures-sink, futures-task, futures-channel.+          # When updating this, the reminder to update the minimum required version of `async-await` feature in README.md.+          - 1.36.0+    runs-on: ubuntu-latest+    steps:+      - uses: actions/checkout@v2+      - name: Install Rust+        run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}+      # cargo does not support for --features/--no-default-features with workspace, so use cargo-hack instead.+      # Refs: cargo#3620, cargo#4106, cargo#4463, cargo#4753, cargo#5015, cargo#5364, cargo#6195+      - run: cargo install cargo-hack+      # remove dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866+      - run: cargo hack --remove-dev-deps --workspace+      # Check no-default-features+      - run: |+          cargo hack build --workspace --ignore-private --no-default-features \+            --exclude futures --exclude futures-util --exclude futures-macro --exclude futures-executor --exclude futures-test+      # Check alloc feature+      - run: |+          cargo hack build --workspace --ignore-private --no-default-features --features alloc --ignore-unknown-features \+            --exclude futures --exclude futures-util --exclude futures-macro --exclude futures-executor --exclude futures-test+      # Check std feature+      - run: |+          cargo hack build --workspace --ignore-private --no-default-features --features std \+            --exclude futures --exclude futures-util --exclude futures-macro --exclude futures-executor --exclude futures-test++  util-msrv:+    name: cargo +${{ matrix.rust }} build+    strategy:+      matrix:+        rust:+          # This is the minimum Rust version supported by futures, futures-util, futures-macro, futures-executor, futures-test.+          # When updating this, the reminder to update the minimum required version of `async-await` feature in README.md.+          - 1.37.0+    runs-on: ubuntu-latest+    steps:+      - uses: actions/checkout@v2+      - name: Install Rust+        run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}+      - run: cargo install cargo-hack+      # remove dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866+      - run: cargo hack --remove-dev-deps --workspace+      # Check no-default-features+      - run: cargo hack build --workspace --exclude futures-test --ignore-private --no-default-features+      # Check alloc feature+      - run: cargo hack build --workspace --exclude futures-test --ignore-private --no-default-features --features alloc --ignore-unknown-features+      # Check std feature+      - run: cargo hack build --workspace --ignore-private --no-default-features --features std --ignore-unknown-features+      # Check compat feature (futures, futures-util)+      - run: cargo hack build -p futures -p futures-util --no-default-features --features std,io-compat+      # Check thread-pool feature (futures, futures-executor)+      - run: cargo hack build -p futures -p futures-executor --no-default-features --features std,thread-pool++  build:+    name: cargo +${{ matrix.rust }} build+    strategy:+      matrix:+        rust:+          # This is the minimum Rust version supported by `async-await` feature.+          # When updating this, the reminder to update the minimum required version of `async-await` feature in README.md.+          - 1.39.0+          - stable+          - beta+          - nightly+    runs-on: ubuntu-latest+    steps:+      - uses: actions/checkout@v2+      - name: Install Rust+        run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}+      - run: cargo install cargo-hack+      - run: cargo hack build --workspace --no-dev-deps+      - run: cargo build --tests --features default,thread-pool,io-compat --manifest-path futures/Cargo.toml++  minimal-versions:+    name: cargo build -Zminimal-versions+    runs-on: ubuntu-latest+    steps:+      - uses: actions/checkout@v2+      - name: Install Rust+        run: rustup update nightly && rustup default nightly+      - run: cargo run --manifest-path ci/remove-dev-dependencies/Cargo.toml */Cargo.toml+      - run: cargo update -Zminimal-versions+      - run: cargo build --workspace --all-features++  thumbv6m:+    name: cargo build --target thumbv6m-none-eabi+    runs-on: ubuntu-latest+    steps:+      - uses: actions/checkout@v2+      - name: Install Rust+        run: rustup update nightly && rustup default nightly+      - run: rustup target add thumbv6m-none-eabi+      - run: cargo run --manifest-path ci/remove-dev-dependencies/Cargo.toml */Cargo.toml

This is equivalent to cargo hack --remove-dev-deps. It may be okay to remove this script given that this script takes as long to compile as installing cargo-hack.

FYI @Nemo157

taiki-e

comment created time in 7 hours

PullRequestReviewEvent

Pull request review commentrust-lang/futures-rs

Migrate CI to GitHub Actions

+name: CI+on:+  pull_request:+  push:+    branches:+      - master+  schedule:+    - cron: '0 1 * * *'++env:+  RUSTFLAGS: -Dwarnings+  RUST_BACKTRACE: 1++defaults:+  run:+    shell: bash++jobs:+  test:+    name: cargo +${{ matrix.rust }} test (${{ matrix.os }})+    strategy:+      matrix:+        rust:+          - nightly+        os:+         - ubuntu-latest+         - macos-latest+         - windows-latest+    runs-on: ${{ matrix.os }}+    steps:+      - uses: actions/checkout@v2+      - name: Install Rust+        run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}

Seems rustup update .. is does not actually need, as the recent rustup's rustup default automatically installs the toolchain if the toolchain is unavailable.

taiki-e

comment created time in 7 hours

PullRequestReviewEvent

push eventtaiki-e/test

Taiki Endo

commit sha b91d9b7a10d2198c49b3a17e0f335c74f88c9dd3

update ci.yml

view details

push time in 7 hours

push eventtaiki-e/test

Taiki Endo

commit sha bc3ba8d6dc32095625bab44567fe6813c535df9e

update ci.yml

view details

push time in 7 hours

issue commentrust-lang/rustfmt

Support nightly CI

You can use rustup-components-history, like:

toolchain=nightly-$(curl -sSf https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/rustfmt)
rustup set profile minimal
rustup default $toolchain
rustup component add rustfmt
mleonhard

comment created time in 8 hours

push eventtaiki-e/test

Taiki Endo

commit sha cfa41fcd36de1ffe7c61399938f5787977e590e0

ci: update ci scripts

view details

push time in 8 hours

push eventtaiki-e/test

Taiki Endo

commit sha e74a37cd631823d41926f8acd4092541c9e77a85

ci: update ci scripts

view details

push time in 8 hours

issue closedrust-lang/futures-rs

Add normal `read()` / `peek()` async functions to `AsyncBufReadExt`

This would fill the internal buffer until the given amount is reached and then provide access to it. read() could return a value that implements Deref<Target=[u8]> and on Drop consumes the read data, peek() would only provide direct access to an &[u8].

This seems useful to have to allow copy-less operation on AsyncBufRead impls. If they implement AsyncRead in addition, a copy would always be necessary.

Inspired partially by https://boats.gitlab.io/blog/post/io-uring/

closed time in 10 hours

sdroege

issue commentrust-lang/futures-rs

Add normal `read()` / `peek()` async functions to `AsyncBufReadExt`

I think this is addressed by #2225.

sdroege

comment created time in 10 hours

push eventtaiki-e/futures-rs

Taiki Endo

commit sha fed75d5fed6af6a0d24840b6b45ed70889f78b20

impl Clone for stream::{empty, pending, repeat}

view details

push time in 10 hours

push eventtaiki-e/futures-rs

Taiki Endo

commit sha fa268953a8e120c79abe419fad864f077b0de757

impl Clone for stream::{empty, pending, repeat}

view details

push time in 10 hours

create barnchtaiki-e/futures-rs

branch : stream-clone

created branch time in 10 hours

PullRequestReviewEvent

issue closedrust-lang/futures-rs

Clarify that examples are in async context

As pointed out on reddit we don't actually specify anywhere that our examples are in an async context. We could have a comment in the top level docs saying this, but it's likely to be missed. We could have comments in every example, but that's a lot of extra comments. Is there some way we can obviously show this without cluttering the documentation too much? (Also, this was in relation to examples in the blog, those should also be annotated somehow, probably with something louder than the doc examples).

closed time in 11 hours

Nemo157

issue commentrust-lang/futures-rs

Clarify that examples are in async context

Addressed by #1230

Nemo157

comment created time in 11 hours

issue openedrust-lang/futures-rs

Re-add disabled tests

We have some disabled tests:

They should be re-enabled. (or remove if it is really unneeded)

Context: #1785, #1690

created time in 11 hours

PullRequestReviewEvent

push eventkhuey/futures-rs

Taiki Endo

commit sha e363f1839f78e7743209c0bc410f9f94fb82519e

Fix clippy::unnecessary_cast warning

view details

Taiki Endo

commit sha aa1dde3459529613a4e3c5191e1bd410f07e46b4

Merge branch 'master' into try_buffered

view details

push time in 12 hours

push eventrust-lang/futures-rs

Taiki Endo

commit sha e363f1839f78e7743209c0bc410f9f94fb82519e

Fix clippy::unnecessary_cast warning

view details

push time in 12 hours

delete branch taiki-e/futures-rs

delete branch : clippy-unnecessary_cast

delete time in 12 hours

PR merged rust-lang/futures-rs

Fix clippy::unnecessary_cast warning

Fixes CI failure due to new clippy lint. https://travis-ci.com/github/rust-lang/futures-rs/jobs/422936952#L348

+2 -2

0 comment

2 changed files

taiki-e

pr closed time in 12 hours

PR opened rust-lang/futures-rs

Fix clippy::unnecessary_cast warning

Fixes CI failure due to new clippy lint. https://travis-ci.com/github/rust-lang/futures-rs/jobs/422936952#L348

+2 -2

0 comment

2 changed files

pr created time in 12 hours

create barnchtaiki-e/futures-rs

branch : clippy-unnecessary_cast

created branch time in 12 hours

push eventtaiki-e/pin-project

Taiki Endo

commit sha fd1cfc174f68fa476705bacdd9256b927a5455af

Fix outdated message

view details

push time in a day

issue commenttime-rs/time

Error `if` is not allowed in a `const fn` when compiling with nightly

The current usage of cfg flags in build.rs are for runtime features that can't be omitted unless using the rustversion crate, which unfortunately relies on some hefty proc macro crates.

FWIW, rustversion crate recently dropped all dependencies: https://github.com/dtolnay/rustversion/pull/24

dunnock

comment created time in a day

issue commentrust-lang/futures-rs

futures-macro (pulled in by futures-util) appears not to compile on musl

@loewenheim Hmm, it seems all proc-macros failed to compile. Can you show me the version of rustc (rustc --version --verbose)? Also, if you installed rustc using a way other than rustup, that may be the cause. If updating the compiler and using the toolchain installed via rustup doesn't fix the problem, you may be able to fix it by using -C target-feature=-crt-static (https://github.com/rust-lang/rust/issues/59302):

RUSTFLAGS="-C target-feature=-crt-static" cargo build
jbaublitz

comment created time in a day

Pull request review commenttokio-rs/tokio

tracing: replace future names with spawn locations in task spans

+use std::{env, ffi::OsString, process::Command};++fn main() {+    match rustc_minor_version() {+        // If rustc >= 1.47.0, we can enable `track_caller`.

Seems track_caller was stabilized in 1.46: https://blog.rust-lang.org/2020/08/27/Rust-1.46.0.html#track_caller

hawkw

comment created time in a day

PullRequestReviewEvent

Pull request review commenttokio-rs/tokio

tracing: replace future names with spawn locations in task spans

+use std::{env, ffi::OsString, process::Command};++fn main() {+    match rustc_minor_version() {+        // If rustc >= 1.47.0, we can enable `track_caller`.+        Ok(minor) if minor >= 47 => println!("cargo:rustc-cfg=tokio_track_caller"),+        Err(e) => println!("cargo:warning=could not parse rustc version: {}", e),
        Err(e) => println!("cargo:warning=tokio: could not parse rustc version: {}", e),

I would prefer including the crate name in the warning. Otherwise, If you have multiple crates that display similar warnings, you may see warnings like the following (dependencies are compiled in parallel):

   Compiling crate_a...
   Compiling crate_b...
   Compiling crate_c...
warning: could not parse...
warning: could not parse...
hawkw

comment created time in a day

PullRequestReviewEvent

Pull request review commenttokio-rs/tokio

tracing: replace future names with spawn locations in task spans

+use std::{env, ffi::OsString, process::Command};++fn main() {+    match rustc_minor_version() {+        // If rustc >= 1.47.0, we can enable `track_caller`.+        Ok(minor) if minor >= 47 => println!("cargo:rustc-cfg=tokio_track_caller"),+        Err(e) => println!("cargo:warning=could not parse rustc version: {}", e),+        _ => {}+    }+}++fn rustc_minor_version() -> Result<usize, Box<dyn std::error::Error>> {+    let rustc = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc"));+    let out = Command::new(rustc).arg("-V").output()?;+    let version_str = std::str::from_utf8(&out.stdout)?;+    let mut parts = version_str.split(' ');+    if parts.next() != Some("rustc") {+        Err(format!(+            "weird rustc version: {:?} (missing 'rustc') ",+            version_str+        ))?;+    }+    if let Some(part) = parts.next() {+        let mut parts = part.split('.');+        if parts.next() != Some("1") {+            Err(format!(+                "weird rustc version: {:?} (does not start with 1)",+                version_str+            ))?;+        }+        if let Some(middle) = parts.next() {+            Ok(middle.parse()?)+        } else {+            Err(format!("weird rustc version: {:?} (no minor version)", version_str).into())+        }+    } else {+        Err(format!(+            "weird rustc version: {:?} (missing version entirely?) ",+            version_str,+        )+        .into())+    }+}

I would prefer to use autocfg. It's very lightweight. And rust version parsers that parse the output of rustc --version instead of rustc --version --verbose, including this PR's implementation, may not be able to parse the version of rustc installed by any way other than rustup (e.g., rustc_version, version_check, etc.)

FWIW, I've actually received bug reports about this in my project that was using version_check in the past... (I'm using own parser for now because autocfg doesn't provide the ability to detect the nightly compiler, but I think it makes sense to use autocfg if it doesn't need that ability.)

hawkw

comment created time in a day

PullRequestReviewEvent

push eventtaiki-e/const_fn

Taiki Endo

commit sha ddc39258c3b3084c9d4ae721f0b1181824d9c2a2

Update comment in build.rs

view details

push time in a day

push eventtaiki-e/easytime

Taiki Endo

commit sha f6c3b78ce139d96d484c21b3e3508280e8e58bc7

Use autocfg instead of our own version parser

view details

push time in 2 days

push eventtaiki-e/io-enum

Taiki Endo

commit sha 11baba0563f295d39bcc55a203f938fd6dc35f94

Use autocfg instead of our own version parser

view details

push time in 2 days

pull request commenttaiki-e/auto_enums

Use autocfg instead of our own version parser

bors r+

taiki-e

comment created time in 2 days

PR opened taiki-e/auto_enums

Use autocfg instead of our own version parser A-derive
+13 -36

0 comment

2 changed files

pr created time in 2 days

create barnchtaiki-e/auto_enums

branch : autocfg

created branch time in 2 days

PR opened cuviper/autocfg

Improve panic message of autocfg::new
+1 -1

0 comment

1 changed file

pr created time in 2 days

create barnchtaiki-e/autocfg

branch : panic-msg

created branch time in 2 days

delete branch taiki-e/autocfg

delete branch : staging

delete time in 2 days

delete branch taiki-e/autocfg

delete branch : set_no_std

delete time in 2 days

delete branch taiki-e/autocfg

delete branch : actions

delete time in 2 days

delete branch taiki-e/autocfg

delete branch : release-1.0.0

delete time in 2 days

delete branch taiki-e/autocfg

delete branch : expressions

delete time in 2 days

delete branch taiki-e/autocfg

delete branch : travis-os

delete time in 2 days

fork taiki-e/autocfg

Automatic cfg for Rust compiler features

fork in 2 days

push eventtaiki-e/auto_enums

Taiki Endo

commit sha 41c12d086469b5876c845c06f13e6ad6e328f2c4

Remove debug print

view details

push time in 2 days

push eventtaiki-e/io-enum

Taiki Endo

commit sha d1d0393e9c1025d221e94199d734082125cda509

Display warning if unable to determine rustc version

view details

push time in 2 days

push eventtaiki-e/futures-compat-experiment

Taiki Endo

commit sha 36a51d442d1773e4f89cbda0771f20da63026ebb

Display warning if unable to determine rustc version

view details

push time in 2 days

push eventtaiki-e/easytime

Taiki Endo

commit sha ce0ea97af0bed106b240be6d017738449d0247f9

Display warning if unable to determine rustc version

view details

push time in 2 days

push eventtaiki-e/auto_enums

Taiki Endo

commit sha 7f44c02251928b3da5931c991844b724f452435e

Display warning if unable to determine rustc version

view details

push time in 2 days

push eventtaiki-e/test

Taiki Endo

commit sha f81122b56bcdf2e1719dcf789b1cfa5bbd04bab9

Fix gitattributes

view details

push time in 2 days

push eventtaiki-e/syn-serde

Taiki Endo

commit sha 3e80cfeb020382af334e1b8b5a953326e1fc0c17

Fix gitattributes

view details

push time in 2 days

push eventtaiki-e/syn-mid

Taiki Endo

commit sha 861b36d2ba8c8a0d42e574167a4f9edd8609fb84

Fix gitattributes

view details

push time in 2 days

push eventtaiki-e/iter-enum

Taiki Endo

commit sha 7658b8cc3c076cff05d3edb3483555ba487f6eab

Fix gitattributes

view details

push time in 2 days

push eventtaiki-e/io-enum

Taiki Endo

commit sha 067f5b41d8417fff56dbf0dcea9c5689c757c3f9

Fix gitattributes

view details

push time in 2 days

push eventtaiki-e/futures-enum

Taiki Endo

commit sha 6b0344cdd69aa8b0563115f762ad410fd9548737

Fix gitattributes

view details

push time in 2 days

push eventtaiki-e/futures-compat-experiment

Taiki Endo

commit sha 8fea979111e87adb09e5e65a38fc558d975a941e

Fix gitattributes

view details

push time in 2 days

push eventtaiki-e/futures-async-stream

Taiki Endo

commit sha 2009ac747f0c17c4f2a3a0b4192f6a04a4e0b976

Do not require developers to manually set TRYBUILD

view details

push time in 2 days

push eventtaiki-e/find-crate

Taiki Endo

commit sha 9ea57e8cbfcbdc8703aea0d54b627fff94d67369

Fix gitattributes

view details

push time in 2 days

push eventtaiki-e/easytime

Taiki Endo

commit sha 8e733e330d290419c45b67f87d053b3a28dc92e0

Fix gitattributes

view details

push time in 2 days

push eventtaiki-e/easy-ext

Taiki Endo

commit sha b41b095bcd3d6ef4207d3171f1ca5e230ff51ee5

Tweak cargo manifests

view details

Taiki Endo

commit sha 30f2af7b6d39321c615d3f12b2b5bbfc41e778e8

Fix gitattributes

view details

Taiki Endo

commit sha 3e484317372f5662b542d697ad1b74f3ecfd5d5e

Do not require developers to manually set TRYBUILD

view details

push time in 2 days

push eventtaiki-e/derive_utils

Taiki Endo

commit sha 4a0235972843dd4baefc92b2e94c8eff9ee69928

Fix gitattributes

view details

push time in 2 days

push eventtaiki-e/const_fn

Taiki Endo

commit sha 88cdd28fb06df2d9ac4a00c04a3f7694f4d320e2

Fix gitattributes

view details

push time in 2 days

push eventtaiki-e/cargo-hack

Taiki Endo

commit sha 2566e1fc33e8618b43c87d3cbb401024116ab957

Improve output of help message test when failed

view details

Taiki Endo

commit sha 79f72148e682be4afe1d7fd5cca1c2db0f3e5bd8

Fix gitattributes

view details

push time in 2 days

push eventtaiki-e/auto_enums

Taiki Endo

commit sha 052da2b06b42c93cdb5f8dd0ec0c10800da1e33d

Fix gitattributes

view details

Taiki Endo

commit sha 9d771c9082a1bc0c9b6dffdc74cd159df23818b4

Do not require developers to manually set TRYBUILD

view details

push time in 2 days

push eventtaiki-e/pin-project-lite

Taiki Endo

commit sha 2d2210744c521b233aad46e920b58bf4c6483a06

Update macrotest and remove scripts/expandtest.sh

view details

push time in 2 days

pull request commenttaiki-e/pin-project

Update macrotest and remove scripts/expandtest.sh

bors r+

taiki-e

comment created time in 2 days

push eventtaiki-e/pin-project

Taiki Endo

commit sha 74291b49c4d8f18a198fdf961b29371d0721e3b6

Use macrotest from crates.io

view details

push time in 2 days

pull request commenteupn/macrotest

Bump version 1.0.5 -> 1.0.6

@eupn Thanks!

eupn

comment created time in 2 days

delete branch taiki-e/macrotest

delete branch : readme

delete time in 2 days

delete branch taiki-e/macrotest

delete branch : overwrite

delete time in 2 days

pull request commenteupn/macrotest

Provide a way to control updates of expanded.rs files via environment variable

macrotest

Branch protection requires Travis CI -- Branch, but this check probably only done on branches of this repository, so it seems never passes.

taiki-e

comment created time in 2 days

more