profile
viewpoint
Jonas Schievink jonas-schievink Chief Curse Officer @ferrous-systems Berlin, Germany compilers; embedded systems; emulators; Linux; please do not send me blockchain recruiting emails

dac-gmbh/serde_postgres 51

Easily Deserialize Postgres rows.

dac-gmbh/golomb-set 28

A Golomb Coded Set implementation in Rust

dac-gmbh/mail 21

mail, facade for a number of mail related crates for creating and sending mails

dac-gmbh/derefable 16

Automatically derive Deref/DerefMut implementations in Rust.

jonas-schievink/aligned_alloc.rs 14

Aligned allocation for Rust

dac-gmbh/new-tokio-smtp 13

extendible SMTP (Simple Mail Transfer Protocol) implementation using tokio

helium/longfi-device 11

C library of device-side LongFi Protocol

dac-gmbh/asn1 10

An implementation of the ITU ASN.1 (X.680–X.699) specifications in Rust.

dac-gmbh/hyperdrive 6

Declarative HTTP request routing, guarding and decoding

dac-gmbh/gbl 5

GBL firmware file manipulation library

PullRequestReviewEvent

pull request commentrust-lang/rust

Unignore test for #36710 on MUSL

@bors r=Mark-Simulacrum

jonas-schievink

comment created time in 32 minutes

push eventjonas-schievink/rust

Jonas Schievink

commit sha 60594b1f0fd0fa69959e4fe56a61c01031916fe2

Ignore on 32-bit targets

view details

push time in 33 minutes

push eventjonas-schievink/rust

Mark Rousskov

commit sha e023158145ece18176a2e93420600ccda0d0bc58

Permit uninhabited enums to cast into ints This essentially reverts part of #6204.

view details

Mark Rousskov

commit sha 990a39596cf3b33e550f2045f78a62970f8d78f8

Prevent ICE on uninhabited MIR interpretation

view details

Mark Rousskov

commit sha 05c9c0ee5dcd935f518db151bee2dc88380fb92f

Modify executable checking to be more universal This uses a dummy file to check if the filesystem being used supports the executable bit in general.

view details

dylni

commit sha 1ff7da6551a7cdf6ace2a9d00e92bbab550334ee

Move `slice::check_range` to `RangeBounds`

view details

dylni

commit sha 1095dcab96d524e700b11edf366d45a0fd173fa0

Fix links

view details

dylni

commit sha eb63168e007058dad4af758faf1dca449c049777

Fix doctests

view details

dylni

commit sha f055b0bb0847ecf08fe452a270faae8324b55b05

Rename method to `assert_len`

view details

Camelid

commit sha 549f861f7d53811521cf929cf58fb6828a2a88d9

Use correct article in help message for conversion or cast Before it always used `an`; now it uses the correct article for the type.

view details

Camelid

commit sha 094f14c554c3a1f103a5d6778d4b4e131c297f11

Add article after "to" Also added missing backtick in "you can cast" message.

view details

Camelid

commit sha 8a6831a7fd3fc624643b50f494212e0ceaad3c28

Say "doesn't" instead of "wouldn't" in convert message

view details

Temirkhan Myrzamadi

commit sha 13dfbb64d313137b7d3c33067910e90f27bc6345

Suggest imports of unresolved macros

view details

Temirkhan Myrzamadi

commit sha 479298e05e8177b171c6d6bcd35fc7553b424bee

Re-run tests with --bless

view details

Temirkhan Myrzamadi

commit sha ea7cf6106864ce7929eb9f3cfe580f05ee418ac8

Don't suggest macros that out of scope

view details

Alexander Mols

commit sha 8fe61546696b626ecf68ef838d5d82e393719e80

Use posix_spawn() on unix if program is a path Previously `Command::spawn` would fall back to the non-posix_spawn based implementation if the `PATH` environment variable was possibly changed. On systems with a modern (g)libc `posix_spawn()` can be significantly faster. If program is a path itself the `PATH` environment variable is not used for the lookup and it should be safe to use the `posix_spawnp()` method. [1] We found this, because we have a cli application that effectively runs a lot of subprocesses. It would sometimes noticeably hang while printing output. Profiling showed that the process was spending the majority of time in the kernel's `copy_page_range` function while spawning subprocesses. During this time the process is completely blocked from running, explaining why users were reporting the cli app hanging. Through this we discovered that `std::process::Command` has a fast and slow path for process execution. The fast path is backed by `posix_spawnp()` and the slow path by fork/exec syscalls being called explicitly. Using fork for process creation is supposed to be fast, but it slows down as your process uses more memory. It's not because the kernel copies the actual memory from the parent, but it does need to copy the references to it (see `copy_page_range` above!). We ended up using the slow path, because the command spawn implementation in falls back to the slow path if it suspects the PATH environment variable was changed. Here is a smallish program demonstrating the slowdown before this code change: ``` use std::process::Command; use std::time::Instant; fn main() { let mut args = std::env::args().skip(1); if let Some(size) = args.next() { // Allocate some memory let _xs: Vec<_> = std::iter::repeat(0) .take(size.parse().expect("valid number")) .collect(); let mut command = Command::new("/bin/sh"); command .arg("-c") .arg("echo hello"); if args.next().is_some() { println!("Overriding PATH"); command.env("PATH", std::env::var("PATH").expect("PATH env var")); } let now = Instant::now(); let child = command .spawn() .expect("failed to execute process"); println!("Spawn took: {:?}", now.elapsed()); let output = child.wait_with_output().expect("failed to wait on process"); println!("Output: {:?}", output); } else { eprintln!("Usage: prog [size]"); std::process::exit(1); } () } ``` Running it and passing different amounts of elements to use to allocate memory shows that the time taken for `spawn()` can differ quite significantly. In latter case the `posix_spawnp()` implementation is 30x faster: ``` $ cargo run --release 10000000 ... Spawn took: 324.275µs hello $ cargo run --release 10000000 changepath ... Overriding PATH Spawn took: 2.346809ms hello $ cargo run --release 100000000 ... Spawn took: 387.842µs hello $ cargo run --release 100000000 changepath ... Overriding PATH Spawn took: 13.434677ms hello ``` [1]: https://github.com/bminor/glibc/blob/5f72f9800b250410cad3abfeeb09469ef12b2438/posix/execvpe.c#L81

view details

Bastian Kauschke

commit sha 9c302f55bd07a04305dfa2bd815d2559deb8468f

normalize in codegen_fulfill_obligations

view details

Bastian Kauschke

commit sha f0487cee7439f3a4b4c7daec0e7f2a0ccc21053c

normalize substs during inlining

view details

Bastian Kauschke

commit sha 32739a2ff1b7b6e5c1b475341b01f4a499830a84

add regression test

view details

Bastian Kauschke

commit sha ac893b8a02788eec6f6fad0cc89de0177b0c0a50

add test for should_inline incorrect param_env

view details

Vojtech Kral

commit sha 36d9b72354560528f07796a8a09b339bdcf37d53

liballoc: VecDeque: Add binary search functions

view details

Joshua Nelson

commit sha 54bf8a681bededa6c7e09f4c1da3cb68efb885a3

Don't link to nightly primitives on stable channel I am not sure how to test this.

view details

push time in 34 minutes

push eventjonas-schievink/rust

EC2 Default User

commit sha e8df870788e6caffe1ef0091b7173db92b26a515

Ignore some 32-bit targets

view details

EC2 Default User

commit sha 2eecd6dbc1035e2197469ef89821901d9818ed33

Ignore test on all 32-bit targets

view details

push time in 43 minutes

PullRequestReviewEvent

Pull request review commentknurling-rs/defmt

check defmt version before demangling symbols

 pub struct Table {     entries: BTreeMap<usize, TableEntry>, } +/// Checks if the version encoded in the symbol table is compatible with this version of the+/// `decoder` crate+pub fn check_version(version: &str) -> Result<(), String> {+    if version != DEFMT_VERSION {+        return Err(format!(+            "defmt version mismatch (firmware is using {}, host is using {}); \+             are you using the same git version of defmt and related tools?+Try `cargo install`-ing the latest git version of `probe-run` AND updating your project's `Cargo.lock` with `cargo update`",+            version, DEFMT_VERSION,+        ));+    }++    Ok(())+}+ impl Table {     pub fn new(entries: BTreeMap<usize, TableEntry>, version: &str) -> Result<Self, String> {-        if version != DEFMT_VERSION {-            return Err(format!(-                "defmt version mismatch (firmware is using {}, host is using {}); \-                 are you using the same git version of defmt and related tools?",-                version, DEFMT_VERSION,-            ));-        }+        check_version(version)?;

Seems like this could be removed now, and we could just always have the caller do it. This would allow skipping the version check too, which I've wanted a couple of times.

japaric

comment created time in an hour

PullRequestReviewEvent

Pull request review commentknurling-rs/defmt

store raw symbols in decoder::Table

 impl Table {         self.entries.is_empty()     } +    /// Iterates over the raw symbols of the table entries     pub fn symbols<'s>(&'s self) -> impl Iterator<Item = &'s str> + 's {

We could rename it to raw_symbols if that doesn't cause too much churn, to make it a bit clearer

japaric

comment created time in 2 hours

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentnrf-rs/nrf-hal

Use embedded-dma trait in PWM module

 pub enum Error {     BufferTooLong, } -pub trait Instance: private::Sealed {}+pub trait Instance: private::Sealed + Deref<Target = crate::pac::pwm0::RegisterBlock> {+    const INTERRUPT: Interrupt; -impl Instance for PWM0 {}+    /// Provides access to the associated internal duty buffer for the instance.+    fn buffer() -> &'static mut Cell<[u16; 4]>;

Using this signature will create aliasing mutable references when called twice, can we return an immutable ref instead? Since it's a Cell you can still use interior mutability.

kalkyl

comment created time in 2 hours

PullRequestReviewEvent
PullRequestReviewEvent
PullRequestReviewEvent

push eventnrf-rs/nrf-hal

Dario Nieuwenhuis

commit sha 451b9ffdb41296cf0bcbad7d73b1245ed6245c36

gpio: add conf() utility function.

view details

Jonas Schievink

commit sha 3bc8f2bf2ca6b33f422101243432b33da7b8d69a

Merge pull request #250 from Dirbaio/pin-conf gpio: add conf() utility function.

view details

push time in 3 hours

PR merged nrf-rs/nrf-hal

gpio: add conf() utility function.

This adds a conf() utility function to get the pin's config register.

Slight code duplication reduction :)

+11 -13

1 comment

2 changed files

Dirbaio

pr closed time in 3 hours

pull request commentnrf-rs/nrf-hal

gpio: add conf() utility function.

Nice, thanks!

Dirbaio

comment created time in 3 hours

pull request commentrust-lang/rust

Add missing punctuation

@bors r+ rollup

pierwill

comment created time in 4 hours

issue closedrust-lang/rust

Always get a same pointer

<!-- Thank you for filing a bug report! 🐛 Please provide a short summary of the bug, along with any information you feel relevant to replicating the bug. -->

I tried this code:

#![feature(min_const_generics)]
#![feature(slice_fill)]
use std::ptr;
use std::sync::Once;

use std::convert::TryInto;

static mut MEMS: [*mut u8; 10] = [std::ptr::null_mut::<u8>(); 10];

static SYNC_INIT_MEMORY: Once = Once::new();

pub fn sync_init() -> &'static [*mut u8; 10] {
    unsafe {
        SYNC_INIT_MEMORY.call_once(|| MEMS = creator());
        &MEMS
    }
}

fn new_array(val: u8) -> [u8; 10] {
    let mut arr: [u8; 10] = [0u8; 10];
    arr.fill(val);
    arr
}

fn creator() -> [*mut u8; 10] {
    let boxed_slice = (0..10)
        .map(|item| -> *mut u8 {
            let mut arr = new_array(item as u8);
            let ptr = arr.as_mut_ptr();
            println!("{:?}, ptr: {:?}", arr, ptr);
            ptr
        })
        .collect::<Vec<*mut u8>>()
        .into_boxed_slice();
    let boxed_array: Box<[*mut u8; 10]> = match boxed_slice.try_into() {
        Ok(ba) => ba,
        Err(o) => panic!("Expected a Vec of length {} but it was {:?}", 10, o.len()),
    };
    *boxed_array
}

fn main() {
    sync_init();
}


I expected to see this happen:

I will get difference pointer.

Instead, this happened:

[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ptr: 0x7ffee119f366
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], ptr: 0x7ffee119f366
[2, 2, 2, 2, 2, 2, 2, 2, 2, 2], ptr: 0x7ffee119f366
[3, 3, 3, 3, 3, 3, 3, 3, 3, 3], ptr: 0x7ffee119f366
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4], ptr: 0x7ffee119f366
[5, 5, 5, 5, 5, 5, 5, 5, 5, 5], ptr: 0x7ffee119f366
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6], ptr: 0x7ffee119f366
[7, 7, 7, 7, 7, 7, 7, 7, 7, 7], ptr: 0x7ffee119f366
[8, 8, 8, 8, 8, 8, 8, 8, 8, 8], ptr: 0x7ffee119f366
[9, 9, 9, 9, 9, 9, 9, 9, 9, 9], ptr: 0x7ffee119f366

Meta

<!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. -->

rustc --version --verbose:

rustc 1.49.0-nightly (b1496c6e6 2020-10-18)
binary: rustc
commit-hash: b1496c6e606dd908dd651ac2cce89815e10d7fc5
commit-date: 2020-10-18
host: x86_64-apple-darwin
release: 1.49.0-nightly
LLVM version: 11.0

closed time in 4 hours

NateLing

issue commentrust-lang/rust

Always get a same pointer

Yes, this seems to work as expected. If you have any questions about how local variables and the stack work, feel free to ask them on https://users.rust-lang.org/.

NateLing

comment created time in 4 hours

issue commentjonas-schievink/smith

Provide the systemd user service file

[Unit]
Description=SSH Agent

[Service]
ExecStart=/path/to/smith -f

[Install]
WantedBy=default.target
jonas-schievink

comment created time in 15 hours

issue commentrust-embedded/cortex-m

Latest release of cortex-m-semihosting seems broken?

yeah that should work

korken89

comment created time in 15 hours

push eventjonas-schievink/smith

Jonas Schievink

commit sha 4be2f561bb230d4fbe9c042cb349f61b71358200

Update dependencies

view details

Jonas Schievink

commit sha 3d891a8b110e0e9672c82b50f685fa5f2331536e

Merge lib into binary

view details

Jonas Schievink

commit sha c44fa6ccccd8d0cc3dd578359a6fb6cead17df51

Update deps

view details

push time in 15 hours

pull request commentrust-lang/rust

unix: Extend UnixStream and UnixDatagram to send and receive file descriptors

@bors r=Amanieu

LinkTed

comment created time in 16 hours

issue closedrust-lang/rust

rustdoc: `--document-private-items` does not document non-exported macros

With --document-private-items:

  • private fns are documented
  • public fns are documented
  • #[macro_export] macro_rules! are documented
  • non-exported macro_rules! are not documented

I'm not sure if this is intended behavior, but it's not very intuitive and kind of frustrating.

Code

macro_rules! foo_macro {
    () => { };
}

#[macro_export]
macro_rules! exported_foo_macro {
    () => { };
}

fn foo_fn() {}

pub fn pub_foo_fn() {}

Command

cargo doc --document-private-items

Output

image

Version

$ rustdoc -vV
rustdoc 1.47.0 (18bf6b4f0 2020-10-07)
binary: rustdoc
commit-hash: 18bf6b4f01a6feaf7259ba7cdae58031af1b7b39
commit-date: 2020-10-07
host: x86_64-apple-darwin
release: 1.47.0
LLVM version: 11.0

closed time in 16 hours

camelid

issue commentrust-lang/rust

rustdoc: `--document-private-items` does not document non-exported macros

Duplicate of https://github.com/rust-lang/rust/issues/73754

camelid

comment created time in 16 hours

Pull request review commentjonas-schievink/rubble

Don't give up when missing the initial transmit window

 pub struct Connection<C: Config> {     /// Contains the *instant* at which it should be applied to the Link Layer state.     update_data: Option<LlcpUpdate>, +    /// 'transmitWindowSize' of current connection.
    /// `transmitWindowSize` of current connection.
JOE1994

comment created time in 17 hours

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentrust-lang/rust

Remove redundant 'static

@bors r+

est31

comment created time in a day

Pull request review commentrust-analyzer/rust-analyzer

Generate diagnostics docs

 impl Diagnostic for UnresolvedExternCrate {     } } +// Diagnostic: unresolved-import+//+// This diagnostic is triggered if rust-analyzer is unable to discover imported module.
// This diagnostic is triggered if rust-analyzer is unable to discover an imported item.
popzxc

comment created time in a day

PullRequestReviewEvent

Pull request review commentrust-lang/rust

I can't stop writing copy propagation passes

+//! A simple intra-block copy propagation pass.+//!+//! This pass performs simple forwards-propagation of locals that were assigned within the same MIR+//! block. This is a common pattern introduced by MIR building.+//!+//! The pass is fairly simple: It walks every MIR block from top to bottom and looks for assignments+//! we can track. At the same time, it looks for uses of locals whose value we have previously+//! recorded, and replaces them with their value.+//!+//! "Value" in this case means `LocalValue`, not an actual concrete value (that would be constant+//! propagation). `LocalValue` is either `Unknown`, which means that a local has no value we can+//! substitute it for, or `Place`, which means that the local was previously assigned to a copy of+//! some `Place` and can be replaced by it.+//!+//! Removal of the left-over assignments and locals (if possible) is performed by the+//! `SimplifyLocals` pass that runs later.+//!+//! The pass has one interesting optimization to ensure that it runs in linear time: Recorded values+//! are tagged by a "generation", which indicates in which basic block the value was recorded.+//! `LocalValues` will only return values that were recorded in the current generation (so in the+//! current block). Once we move on to a different block, we bump the generation counter, which will+//! result in all old values becoming inaccessible. This is logically equivalent to simply+//! overwriting all of them with `Unknown`, but is much cheaper: Just an increment instead of an+//! `O(n)` clear (where `n` is the number of locals declared in the body). This `O(n)` runtime would+//! otherwise make the total runtime of this pass `O(n * m)`, where `n` is the number of locals and+//! `m` is the number of basic blocks, which is prohibitively expensive.++use rustc_index::bit_set::BitSet;+use rustc_index::vec::IndexVec;+use rustc_middle::mir::visit::{MutVisitor, PlaceContext, Visitor};+use rustc_middle::mir::{+    Body, Local, Location, Operand, Place, ProjectionElem, Rvalue, Statement, StatementKind,+    Terminator, TerminatorKind,+};+use rustc_middle::ty::TyCtxt;+use smallvec::SmallVec;++use super::MirPass;++pub struct BasicBlockCopyProp;++impl<'tcx> MirPass<'tcx> for BasicBlockCopyProp {+    fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {+        if tcx.sess.opts.debugging_opts.mir_opt_level == 0 {+            return;+        }++        debug!("processing {:?}", body.source.def_id());++        let mut borrows = BorrowCollector { locals: BitSet::new_empty(body.local_decls.len()) };+        borrows.visit_body(body);++        let mut visitor = CopyPropVisitor {+            tcx,+            referenced_locals: borrows.locals,+            local_values: LocalValues::new(body),+        };++        for (bb, data) in body.basic_blocks_mut().iter_enumerated_mut() {+            visitor.visit_basic_block_data(bb, data);+            visitor.local_values.clear();+        }+    }+}++/// Symbolic value of a local variable.+#[derive(Copy, Clone)]+enum LocalValue<'tcx> {+    /// Locals start out with unknown values, and are assigned an unknown value when they are+    /// mutated in an incompatible way.+    Unknown,++    /// The local was last assigned to a copy of `place`.+    ///+    /// If a local is in this state, and we see a use of that local, we can substitute `place`+    /// instead, potentially eliminating the local and its assignment.+    Place { place: Place<'tcx>, generation: u32 },+}++/// Stores the locals that need to be invalidated when this local is modified or deallocated.+#[derive(Default, Clone)]+struct Invalidation {+    locals: SmallVec<[Local; 4]>,+    generation: u32,+}++struct LocalValues<'tcx> {+    /// Tracks the values that were assigned to local variables in the current basic block.+    map: IndexVec<Local, LocalValue<'tcx>>,++    /// Maps source locals to a list of destination locals to invalidate when the source is+    /// deallocated or modified.+    invalidation_map: IndexVec<Local, Invalidation>,++    /// Data generation in this map.+    ///+    /// This is bumped when entering a new block. When looking data up, we ensure it was stored in+    /// the same generation. This allows clearing the map by simply incrementing the generation+    /// instead of having to clear the data (which can perform poorly).+    generation: u32,+}++impl<'tcx> LocalValues<'tcx> {+    fn new(body: &Body<'_>) -> Self {+        Self {+            map: IndexVec::from_elem_n(LocalValue::Unknown, body.local_decls.len()),+            invalidation_map: IndexVec::from_elem_n(+                Invalidation::default(),+                body.local_decls.len(),+            ),+            generation: 0,+        }+    }++    fn get(&self, local: Local) -> Option<Place<'tcx>> {+        match self.map[local] {+            LocalValue::Place { place, generation } if generation == self.generation => Some(place),+            _ => None,+        }+    }++    /// Records an assignment of `place` to `local`.+    fn insert(&mut self, local: Local, place: Place<'tcx>) {+        self.map[local] = LocalValue::Place { place, generation: self.generation };++        let inval = &mut self.invalidation_map[place.local];+        if inval.generation != self.generation {+            inval.locals.clear();+            inval.generation = self.generation;+        }++        inval.locals.push(local);+    }++    /// Resets `local`'s state to `Unknown` and invalidates all locals that have been assigned to+    /// `local` in the past.+    fn invalidate(&mut self, local: Local) {+        self.map[local] = LocalValue::Unknown;++        let inval = &mut self.invalidation_map[local];+        if inval.generation == self.generation {+            for local in &inval.locals {+                self.map[*local] = LocalValue::Unknown;+            }++            inval.locals.clear();+        }+    }++    /// Marks the data in the map as dirty, effectively clearing it.+    fn clear(&mut self) {+        self.generation += 1;+    }+}++struct CopyPropVisitor<'tcx> {+    tcx: TyCtxt<'tcx>,++    /// Locals that have their address taken.+    referenced_locals: BitSet<Local>,++    /// Tracks the (symbolic) values of local variables in the visited block.+    local_values: LocalValues<'tcx>,+}++impl<'tcx> MutVisitor<'tcx> for CopyPropVisitor<'tcx> {+    fn tcx(&self) -> TyCtxt<'tcx> {+        self.tcx+    }++    fn visit_statement(&mut self, statement: &mut Statement<'tcx>, location: Location) {+        // We are only looking for *copies* of a place, not moves, since moving out of the place+        // *again* later on would be a use-after-move. For example:+        //   _1 = ...;+        //   _2 = move _1;+        //   use(move _2);   <- can *not* replace with `use(move _1)` or `use(_1)`+        if let StatementKind::Assign(box (dest, Rvalue::Use(Operand::Copy(place)))) =+            &statement.kind+        {+            if let Some(dest) = dest.as_local() {+                if place_eligible(place)+                    && !self.referenced_locals.contains(dest)+                    && !self.referenced_locals.contains(place.local)+                {+                    debug!("recording value at {:?}: {:?} = {:?}", location, dest, place);+                    self.local_values.insert(dest, *place);+                    return;+                }+            }+        }++        // If this is not an eligible assignment to be recorded, visit it. This will keep track of+        // any mutations of locals via `visit_local` and assign an `Unknown` value to them.+        self.super_statement(statement, location);++        // Now that we've invalidated locals mutated by the statement, replace any known locals that+        // *aren't* mutated with the place they were assigned to.+        ReplaceUseVisitor { tcx: self.tcx, local_values: &self.local_values }+            .visit_statement(statement, location);++        InvalidateMovedLocals { tcx: self.tcx, local_values: &mut self.local_values }+            .visit_statement(statement, location);+    }++    fn visit_terminator(&mut self, terminator: &mut Terminator<'tcx>, location: Location) {+        self.super_terminator(terminator, location);++        // Now that we've invalidated locals mutated by the terminator, replace any known locals+        // that *aren't* mutated with the place they were assigned to.+        ReplaceUseVisitor { tcx: self.tcx, local_values: &mut self.local_values }+            .visit_terminator(terminator, location);++        InvalidateMovedLocals { tcx: self.tcx, local_values: &mut self.local_values }+            .visit_terminator(terminator, location);+    }++    fn visit_local(&mut self, local: &mut Local, context: PlaceContext, location: Location) {+        // We invalidate a local `l`, and any other locals whose assigned values contain `l`, if:+        // - `l` is mutated (via assignment or other stores, by taking a mutable ref/ptr, etc.)+        // - `l` is reallocated by storage statements (which deinitializes its storage)++        if context.is_mutating_use() || context.is_storage_marker() {+            debug!("invalidation of {:?} at {:?}: {:?} -> clearing", local, location, context);+            self.local_values.invalidate(*local);+        }++        // Note that we do not yet do anything when `l` is moved out of. The reason for that is that+        // it is fine to replace that local (see reasoning below). We just have to make sure we+        // invalidate the moved-out-of local *after* we finished processing the statement/terminator+        // performing the move.+    }+}++struct ReplaceUseVisitor<'a, 'tcx> {+    tcx: TyCtxt<'tcx>,+    local_values: &'a LocalValues<'tcx>,+}++impl<'a, 'tcx> MutVisitor<'tcx> for ReplaceUseVisitor<'a, 'tcx> {+    fn tcx(&self) -> TyCtxt<'tcx> {+        self.tcx+    }++    fn visit_operand(&mut self, operand: &mut Operand<'tcx>, location: Location) {+        // NB: All `operand`s are non-mutating uses of the contained place, so we don't have to call+        // `super_operand` here.++        // We *can* replace a `move` by a copy from the recorded place, because we only record+        // places that are *copied* from in the first place (so the place type must be `Copy` by+        // virtue of the input MIR). For example, this is a common pattern:+        //   _1 = ...;+        //   _2 = _1;+        //   use(move _2);   <- can replace with `use(_1)`+        // Or:+        //   use(move _2, move _1); <- can replace with `use(_1, _1)`

Extended the comment

jonas-schievink

comment created time in a day

PullRequestReviewEvent

push eventjonas-schievink/rust

Jonas Schievink

commit sha cf5013849bfb2e07be3f15359c814694f8299f91

Extend comment

view details

push time in a day

Pull request review commentrust-lang/rust

I can't stop writing copy propagation passes

+//! A simple intra-block copy propagation pass.+//!+//! This pass performs simple forwards-propagation of locals that were assigned within the same MIR+//! block. This is a common pattern introduced by MIR building.+//!+//! The pass is fairly simple: It walks every MIR block from top to bottom and looks for assignments+//! we can track. At the same time, it looks for uses of locals whose value we have previously+//! recorded, and replaces them with their value.+//!+//! "Value" in this case means `LocalValue`, not an actual concrete value (that would be constant+//! propagation). `LocalValue` is either `Unknown`, which means that a local has no value we can+//! substitute it for, or `Place`, which means that the local was previously assigned to a copy of+//! some `Place` and can be replaced by it.+//!+//! Removal of the left-over assignments and locals (if possible) is performed by the+//! `SimplifyLocals` pass that runs later.+//!+//! The pass has one interesting optimization to ensure that it runs in linear time: Recorded values+//! are tagged by a "generation", which indicates in which basic block the value was recorded.+//! `LocalValues` will only return values that were recorded in the current generation (so in the+//! current block). Once we move on to a different block, we bump the generation counter, which will+//! result in all old values becoming inaccessible. This is logically equivalent to simply+//! overwriting all of them with `Unknown`, but is much cheaper: Just an increment instead of an+//! `O(n)` clear (where `n` is the number of locals declared in the body). This `O(n)` runtime would+//! otherwise make the total runtime of this pass `O(n * m)`, where `n` is the number of locals and+//! `m` is the number of basic blocks, which is prohibitively expensive.++use rustc_index::bit_set::BitSet;+use rustc_index::vec::IndexVec;+use rustc_middle::mir::visit::{MutVisitor, PlaceContext, Visitor};+use rustc_middle::mir::{+    Body, Local, Location, Operand, Place, ProjectionElem, Rvalue, Statement, StatementKind,+    Terminator, TerminatorKind,+};+use rustc_middle::ty::TyCtxt;+use smallvec::SmallVec;++use super::MirPass;++pub struct BasicBlockCopyProp;++impl<'tcx> MirPass<'tcx> for BasicBlockCopyProp {+    fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {+        if tcx.sess.opts.debugging_opts.mir_opt_level == 0 {+            return;+        }++        debug!("processing {:?}", body.source.def_id());++        let mut borrows = BorrowCollector { locals: BitSet::new_empty(body.local_decls.len()) };+        borrows.visit_body(body);++        let mut visitor = CopyPropVisitor {+            tcx,+            referenced_locals: borrows.locals,+            local_values: LocalValues::new(body),+        };++        for (bb, data) in body.basic_blocks_mut().iter_enumerated_mut() {+            visitor.visit_basic_block_data(bb, data);+            visitor.local_values.clear();+        }+    }+}++/// Symbolic value of a local variable.+#[derive(Copy, Clone)]+enum LocalValue<'tcx> {+    /// Locals start out with unknown values, and are assigned an unknown value when they are+    /// mutated in an incompatible way.+    Unknown,++    /// The local was last assigned to a copy of `place`.+    ///+    /// If a local is in this state, and we see a use of that local, we can substitute `place`+    /// instead, potentially eliminating the local and its assignment.+    Place { place: Place<'tcx>, generation: u32 },+}++/// Stores the locals that need to be invalidated when this local is modified or deallocated.+#[derive(Default, Clone)]+struct Invalidation {+    locals: SmallVec<[Local; 4]>,+    generation: u32,+}++struct LocalValues<'tcx> {+    /// Tracks the values that were assigned to local variables in the current basic block.+    map: IndexVec<Local, LocalValue<'tcx>>,++    /// Maps source locals to a list of destination locals to invalidate when the source is+    /// deallocated or modified.+    invalidation_map: IndexVec<Local, Invalidation>,++    /// Data generation in this map.+    ///+    /// This is bumped when entering a new block. When looking data up, we ensure it was stored in+    /// the same generation. This allows clearing the map by simply incrementing the generation+    /// instead of having to clear the data (which can perform poorly).+    generation: u32,+}++impl<'tcx> LocalValues<'tcx> {+    fn new(body: &Body<'_>) -> Self {+        Self {+            map: IndexVec::from_elem_n(LocalValue::Unknown, body.local_decls.len()),+            invalidation_map: IndexVec::from_elem_n(+                Invalidation::default(),+                body.local_decls.len(),+            ),+            generation: 0,+        }+    }++    fn get(&self, local: Local) -> Option<Place<'tcx>> {+        match self.map[local] {+            LocalValue::Place { place, generation } if generation == self.generation => Some(place),+            _ => None,+        }+    }++    /// Records an assignment of `place` to `local`.+    fn insert(&mut self, local: Local, place: Place<'tcx>) {+        self.map[local] = LocalValue::Place { place, generation: self.generation };++        let inval = &mut self.invalidation_map[place.local];+        if inval.generation != self.generation {+            inval.locals.clear();+            inval.generation = self.generation;+        }++        inval.locals.push(local);+    }++    /// Resets `local`'s state to `Unknown` and invalidates all locals that have been assigned to+    /// `local` in the past.+    fn invalidate(&mut self, local: Local) {+        self.map[local] = LocalValue::Unknown;++        let inval = &mut self.invalidation_map[local];+        if inval.generation == self.generation {+            for local in &inval.locals {+                self.map[*local] = LocalValue::Unknown;+            }++            inval.locals.clear();+        }+    }++    /// Marks the data in the map as dirty, effectively clearing it.+    fn clear(&mut self) {+        self.generation += 1;+    }+}++struct CopyPropVisitor<'tcx> {+    tcx: TyCtxt<'tcx>,++    /// Locals that have their address taken.+    referenced_locals: BitSet<Local>,++    /// Tracks the (symbolic) values of local variables in the visited block.+    local_values: LocalValues<'tcx>,+}++impl<'tcx> MutVisitor<'tcx> for CopyPropVisitor<'tcx> {+    fn tcx(&self) -> TyCtxt<'tcx> {+        self.tcx+    }++    fn visit_statement(&mut self, statement: &mut Statement<'tcx>, location: Location) {+        // We are only looking for *copies* of a place, not moves, since moving out of the place+        // *again* later on would be a use-after-move. For example:+        //   _1 = ...;+        //   _2 = move _1;+        //   use(move _2);   <- can *not* replace with `use(move _1)` or `use(_1)`+        if let StatementKind::Assign(box (dest, Rvalue::Use(Operand::Copy(place)))) =+            &statement.kind+        {+            if let Some(dest) = dest.as_local() {+                if place_eligible(place)+                    && !self.referenced_locals.contains(dest)+                    && !self.referenced_locals.contains(place.local)+                {+                    debug!("recording value at {:?}: {:?} = {:?}", location, dest, place);+                    self.local_values.insert(dest, *place);+                    return;+                }+            }+        }++        // If this is not an eligible assignment to be recorded, visit it. This will keep track of+        // any mutations of locals via `visit_local` and assign an `Unknown` value to them.+        self.super_statement(statement, location);++        // Now that we've invalidated locals mutated by the statement, replace any known locals that+        // *aren't* mutated with the place they were assigned to.+        ReplaceUseVisitor { tcx: self.tcx, local_values: &self.local_values }+            .visit_statement(statement, location);++        InvalidateMovedLocals { tcx: self.tcx, local_values: &mut self.local_values }+            .visit_statement(statement, location);+    }++    fn visit_terminator(&mut self, terminator: &mut Terminator<'tcx>, location: Location) {+        self.super_terminator(terminator, location);++        // Now that we've invalidated locals mutated by the terminator, replace any known locals+        // that *aren't* mutated with the place they were assigned to.+        ReplaceUseVisitor { tcx: self.tcx, local_values: &mut self.local_values }+            .visit_terminator(terminator, location);++        InvalidateMovedLocals { tcx: self.tcx, local_values: &mut self.local_values }+            .visit_terminator(terminator, location);+    }++    fn visit_local(&mut self, local: &mut Local, context: PlaceContext, location: Location) {+        // We invalidate a local `l`, and any other locals whose assigned values contain `l`, if:+        // - `l` is mutated (via assignment or other stores, by taking a mutable ref/ptr, etc.)+        // - `l` is reallocated by storage statements (which deinitializes its storage)++        if context.is_mutating_use() || context.is_storage_marker() {+            debug!("invalidation of {:?} at {:?}: {:?} -> clearing", local, location, context);+            self.local_values.invalidate(*local);+        }++        // Note that we do not yet do anything when `l` is moved out of. The reason for that is that+        // it is fine to replace that local (see reasoning below). We just have to make sure we+        // invalidate the moved-out-of local *after* we finished processing the statement/terminator+        // performing the move.+    }+}++struct ReplaceUseVisitor<'a, 'tcx> {+    tcx: TyCtxt<'tcx>,+    local_values: &'a LocalValues<'tcx>,+}++impl<'a, 'tcx> MutVisitor<'tcx> for ReplaceUseVisitor<'a, 'tcx> {+    fn tcx(&self) -> TyCtxt<'tcx> {+        self.tcx+    }++    fn visit_operand(&mut self, operand: &mut Operand<'tcx>, location: Location) {+        // NB: All `operand`s are non-mutating uses of the contained place, so we don't have to call+        // `super_operand` here.++        // We *can* replace a `move` by a copy from the recorded place, because we only record+        // places that are *copied* from in the first place (so the place type must be `Copy` by+        // virtue of the input MIR). For example, this is a common pattern:+        //   _1 = ...;+        //   _2 = _1;+        //   use(move _2);   <- can replace with `use(_1)`+        // Or:+        //   use(move _2, move _1); <- can replace with `use(_1, _1)`

Yeah, for example call destinations must not alias any call arguments (maybe this only applies to copied arguments, as you mentioned). I ran into this when writing the destination propagation pass.

Unfortunately these invariants haven't really been consciously designed or documented from what I know, but the MIR validator does try to enforce them (or what I think is a reasonably approximation of them).

It seems that this pass is still correct though – aliasing restrictions generally only apply when one of the places is being mutated, and when that happens we invalidate all affected locals.

jonas-schievink

comment created time in a day

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentrust-lang/rust

Don't copy into arena when we had to heap allocate for iter

@rust-timer build c2dea8a743324c28c48d675cb0373cb75d3161f7

bugadani

comment created time in a day

pull request commentrust-lang/rust

Clean up small, surprising bits of code

@bors r+

bugadani

comment created time in a day

Pull request review commentrust-lang/rust

I can't stop writing copy propagation passes

+//! A simple intra-block copy propagation pass.+//!+//! This pass performs simple forwards-propagation of locals that were assigned within the same MIR+//! block. This is a common pattern introduced by MIR building.+//!+//! The pass is fairly simple: It walks every MIR block from top to bottom and looks for assignments+//! we can track. At the same time, it looks for uses of locals whose value we have previously+//! recorded, and replaces them with their value.+//!+//! "Value" in this case means `LocalValue`, not an actual concrete value (that would be constant+//! propagation). `LocalValue` is either `Unknown`, which means that a local has no value we can+//! substitute it for, or `Place`, which means that the local was previously assigned to a copy of+//! some `Place` and can be replaced by it.+//!+//! Removal of the left-over assignments and locals (if possible) is performed by the+//! `SimplifyLocals` pass that runs later.+//!+//! The pass has one interesting optimization to ensure that it runs in linear time: Recorded values+//! are tagged by a "generation", which indicates in which basic block the value was recorded.+//! `LocalValues` will only return values that were recorded in the current generation (so in the+//! current block). Once we move on to a different block, we bump the generation counter, which will+//! result in all old values becoming inaccessible. This is logically equivalent to simply+//! overwriting all of them with `Unknown`, but is much cheaper: Just an increment instead of an+//! `O(n)` clear (where `n` is the number of locals declared in the body). This `O(n)` runtime would+//! otherwise make the total runtime of this pass `O(n * m)`, where `n` is the number of locals and+//! `m` is the number of basic blocks, which is prohibitively expensive.++use rustc_index::bit_set::BitSet;+use rustc_index::vec::IndexVec;+use rustc_middle::mir::visit::{MutVisitor, PlaceContext, Visitor};+use rustc_middle::mir::{+    Body, Local, Location, Operand, Place, ProjectionElem, Rvalue, Statement, StatementKind,+    Terminator, TerminatorKind,+};+use rustc_middle::ty::TyCtxt;+use smallvec::SmallVec;++use super::MirPass;++pub struct BasicBlockCopyProp;++impl<'tcx> MirPass<'tcx> for BasicBlockCopyProp {+    fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {+        if tcx.sess.opts.debugging_opts.mir_opt_level == 0 {+            return;+        }++        debug!("processing {:?}", body.source.def_id());++        let mut borrows = BorrowCollector { locals: BitSet::new_empty(body.local_decls.len()) };+        borrows.visit_body(body);++        let mut visitor = CopyPropVisitor {+            tcx,+            referenced_locals: borrows.locals,+            local_values: LocalValues::new(body),+        };++        for (bb, data) in body.basic_blocks_mut().iter_enumerated_mut() {+            visitor.visit_basic_block_data(bb, data);+            visitor.local_values.clear();+        }+    }+}++/// Symbolic value of a local variable.+#[derive(Copy, Clone)]+enum LocalValue<'tcx> {+    /// Locals start out with unknown values, and are assigned an unknown value when they are+    /// mutated in an incompatible way.+    Unknown,++    /// The local was last assigned to a copy of `place`.+    ///+    /// If a local is in this state, and we see a use of that local, we can substitute `place`+    /// instead, potentially eliminating the local and its assignment.+    Place { place: Place<'tcx>, generation: u32 },+}++/// Stores the locals that need to be invalidated when this local is modified or deallocated.+#[derive(Default, Clone)]+struct Invalidation {+    locals: SmallVec<[Local; 4]>,+    generation: u32,+}++struct LocalValues<'tcx> {+    /// Tracks the values that were assigned to local variables in the current basic block.+    map: IndexVec<Local, LocalValue<'tcx>>,++    /// Maps source locals to a list of destination locals to invalidate when the source is+    /// deallocated or modified.+    invalidation_map: IndexVec<Local, Invalidation>,++    /// Data generation in this map.+    ///+    /// This is bumped when entering a new block. When looking data up, we ensure it was stored in+    /// the same generation. This allows clearing the map by simply incrementing the generation+    /// instead of having to clear the data (which can perform poorly).+    generation: u32,+}++impl<'tcx> LocalValues<'tcx> {+    fn new(body: &Body<'_>) -> Self {+        Self {+            map: IndexVec::from_elem_n(LocalValue::Unknown, body.local_decls.len()),+            invalidation_map: IndexVec::from_elem_n(+                Invalidation::default(),+                body.local_decls.len(),+            ),+            generation: 0,+        }+    }++    fn get(&self, local: Local) -> Option<Place<'tcx>> {+        match self.map[local] {+            LocalValue::Place { place, generation } if generation == self.generation => Some(place),+            _ => None,+        }+    }++    /// Records an assignment of `place` to `local`.+    fn insert(&mut self, local: Local, place: Place<'tcx>) {+        self.map[local] = LocalValue::Place { place, generation: self.generation };++        let inval = &mut self.invalidation_map[place.local];+        if inval.generation != self.generation {+            inval.locals.clear();+            inval.generation = self.generation;+        }++        inval.locals.push(local);+    }++    /// Resets `local`'s state to `Unknown` and invalidates all locals that have been assigned to+    /// `local` in the past.+    fn invalidate(&mut self, local: Local) {+        self.map[local] = LocalValue::Unknown;++        let inval = &mut self.invalidation_map[local];+        if inval.generation == self.generation {+            for local in &inval.locals {+                self.map[*local] = LocalValue::Unknown;+            }++            inval.locals.clear();+        }+    }++    /// Marks the data in the map as dirty, effectively clearing it.+    fn clear(&mut self) {+        self.generation += 1;+    }+}++struct CopyPropVisitor<'tcx> {+    tcx: TyCtxt<'tcx>,++    /// Locals that have their address taken.+    referenced_locals: BitSet<Local>,++    /// Tracks the (symbolic) values of local variables in the visited block.+    local_values: LocalValues<'tcx>,+}++impl<'tcx> MutVisitor<'tcx> for CopyPropVisitor<'tcx> {+    fn tcx(&self) -> TyCtxt<'tcx> {+        self.tcx+    }++    fn visit_statement(&mut self, statement: &mut Statement<'tcx>, location: Location) {+        // We are only looking for *copies* of a place, not moves, since moving out of the place+        // *again* later on would be a use-after-move. For example:+        //   _1 = ...;+        //   _2 = move _1;+        //   use(move _2);   <- can *not* replace with `use(move _1)` or `use(_1)`+        if let StatementKind::Assign(box (dest, Rvalue::Use(Operand::Copy(place)))) =+            &statement.kind+        {+            if let Some(dest) = dest.as_local() {+                if place_eligible(place)+                    && !self.referenced_locals.contains(dest)+                    && !self.referenced_locals.contains(place.local)+                {+                    debug!("recording value at {:?}: {:?} = {:?}", location, dest, place);+                    self.local_values.insert(dest, *place);+                    return;+                }+            }+        }++        // If this is not an eligible assignment to be recorded, visit it. This will keep track of+        // any mutations of locals via `visit_local` and assign an `Unknown` value to them.+        self.super_statement(statement, location);++        // Now that we've invalidated locals mutated by the statement, replace any known locals that+        // *aren't* mutated with the place they were assigned to.+        ReplaceUseVisitor { tcx: self.tcx, local_values: &self.local_values }+            .visit_statement(statement, location);++        InvalidateMovedLocals { tcx: self.tcx, local_values: &mut self.local_values }+            .visit_statement(statement, location);+    }++    fn visit_terminator(&mut self, terminator: &mut Terminator<'tcx>, location: Location) {+        self.super_terminator(terminator, location);++        // Now that we've invalidated locals mutated by the terminator, replace any known locals+        // that *aren't* mutated with the place they were assigned to.+        ReplaceUseVisitor { tcx: self.tcx, local_values: &mut self.local_values }+            .visit_terminator(terminator, location);++        InvalidateMovedLocals { tcx: self.tcx, local_values: &mut self.local_values }+            .visit_terminator(terminator, location);+    }++    fn visit_local(&mut self, local: &mut Local, context: PlaceContext, location: Location) {+        // We invalidate a local `l`, and any other locals whose assigned values contain `l`, if:+        // - `l` is mutated (via assignment or other stores, by taking a mutable ref/ptr, etc.)+        // - `l` is reallocated by storage statements (which deinitializes its storage)++        if context.is_mutating_use() || context.is_storage_marker() {+            debug!("invalidation of {:?} at {:?}: {:?} -> clearing", local, location, context);+            self.local_values.invalidate(*local);+        }++        // Note that we do not yet do anything when `l` is moved out of. The reason for that is that+        // it is fine to replace that local (see reasoning below). We just have to make sure we+        // invalidate the moved-out-of local *after* we finished processing the statement/terminator+        // performing the move.+    }+}++struct ReplaceUseVisitor<'a, 'tcx> {+    tcx: TyCtxt<'tcx>,+    local_values: &'a LocalValues<'tcx>,+}++impl<'a, 'tcx> MutVisitor<'tcx> for ReplaceUseVisitor<'a, 'tcx> {+    fn tcx(&self) -> TyCtxt<'tcx> {+        self.tcx+    }++    fn visit_operand(&mut self, operand: &mut Operand<'tcx>, location: Location) {+        // NB: All `operand`s are non-mutating uses of the contained place, so we don't have to call+        // `super_operand` here.++        // We *can* replace a `move` by a copy from the recorded place, because we only record+        // places that are *copied* from in the first place (so the place type must be `Copy` by+        // virtue of the input MIR). For example, this is a common pattern:+        //   _1 = ...;+        //   _2 = _1;+        //   use(move _2);   <- can replace with `use(_1)`+        // Or:+        //   use(move _2, move _1); <- can replace with `use(_1, _1)`

Hmm, this doesn't sound right, this is only correct if the places _1 and _1 are used are allowed to overlap

jonas-schievink

comment created time in 2 days

PullRequestReviewEvent

push eventjonas-schievink/rust

Jonas Schievink

commit sha cd01d1696a3a09427429b62cb56701c03baf593b

Bless mir-opt tests

view details

push time in 2 days

push eventjonas-schievink/rust

Mark Rousskov

commit sha e023158145ece18176a2e93420600ccda0d0bc58

Permit uninhabited enums to cast into ints This essentially reverts part of #6204.

view details

Mark Rousskov

commit sha 990a39596cf3b33e550f2045f78a62970f8d78f8

Prevent ICE on uninhabited MIR interpretation

view details

Temirkhan Myrzamadi

commit sha 13dfbb64d313137b7d3c33067910e90f27bc6345

Suggest imports of unresolved macros

view details

Temirkhan Myrzamadi

commit sha 479298e05e8177b171c6d6bcd35fc7553b424bee

Re-run tests with --bless

view details

Temirkhan Myrzamadi

commit sha ea7cf6106864ce7929eb9f3cfe580f05ee418ac8

Don't suggest macros that out of scope

view details

Alexander Mols

commit sha 8fe61546696b626ecf68ef838d5d82e393719e80

Use posix_spawn() on unix if program is a path Previously `Command::spawn` would fall back to the non-posix_spawn based implementation if the `PATH` environment variable was possibly changed. On systems with a modern (g)libc `posix_spawn()` can be significantly faster. If program is a path itself the `PATH` environment variable is not used for the lookup and it should be safe to use the `posix_spawnp()` method. [1] We found this, because we have a cli application that effectively runs a lot of subprocesses. It would sometimes noticeably hang while printing output. Profiling showed that the process was spending the majority of time in the kernel's `copy_page_range` function while spawning subprocesses. During this time the process is completely blocked from running, explaining why users were reporting the cli app hanging. Through this we discovered that `std::process::Command` has a fast and slow path for process execution. The fast path is backed by `posix_spawnp()` and the slow path by fork/exec syscalls being called explicitly. Using fork for process creation is supposed to be fast, but it slows down as your process uses more memory. It's not because the kernel copies the actual memory from the parent, but it does need to copy the references to it (see `copy_page_range` above!). We ended up using the slow path, because the command spawn implementation in falls back to the slow path if it suspects the PATH environment variable was changed. Here is a smallish program demonstrating the slowdown before this code change: ``` use std::process::Command; use std::time::Instant; fn main() { let mut args = std::env::args().skip(1); if let Some(size) = args.next() { // Allocate some memory let _xs: Vec<_> = std::iter::repeat(0) .take(size.parse().expect("valid number")) .collect(); let mut command = Command::new("/bin/sh"); command .arg("-c") .arg("echo hello"); if args.next().is_some() { println!("Overriding PATH"); command.env("PATH", std::env::var("PATH").expect("PATH env var")); } let now = Instant::now(); let child = command .spawn() .expect("failed to execute process"); println!("Spawn took: {:?}", now.elapsed()); let output = child.wait_with_output().expect("failed to wait on process"); println!("Output: {:?}", output); } else { eprintln!("Usage: prog [size]"); std::process::exit(1); } () } ``` Running it and passing different amounts of elements to use to allocate memory shows that the time taken for `spawn()` can differ quite significantly. In latter case the `posix_spawnp()` implementation is 30x faster: ``` $ cargo run --release 10000000 ... Spawn took: 324.275µs hello $ cargo run --release 10000000 changepath ... Overriding PATH Spawn took: 2.346809ms hello $ cargo run --release 100000000 ... Spawn took: 387.842µs hello $ cargo run --release 100000000 changepath ... Overriding PATH Spawn took: 13.434677ms hello ``` [1]: https://github.com/bminor/glibc/blob/5f72f9800b250410cad3abfeeb09469ef12b2438/posix/execvpe.c#L81

view details

Vojtech Kral

commit sha 36d9b72354560528f07796a8a09b339bdcf37d53

liballoc: VecDeque: Add binary search functions

view details

Joshua Nelson

commit sha 54bf8a681bededa6c7e09f4c1da3cb68efb885a3

Don't link to nightly primitives on stable channel I am not sure how to test this.

view details

Guillaume Gomez

commit sha e3c3efe5abb2025fdc8a4937b22e76fbd8093dd5

Filter out imports added by the compiler

view details

Guillaume Gomez

commit sha 0faaa499ccc9fb4835251845cf457bae385f07f5

Add test for compiler reexports removal

view details

Thomas de Zeeuw

commit sha 8c0c7ec4ec6c4f305c229d74f74f08f86a59fc69

Use fdatasync for File::sync_data on more OSes Add support for the following OSes: * Android * FreeBSD: https://www.freebsd.org/cgi/man.cgi?query=fdatasync&sektion=2 * OpenBSD: https://man.openbsd.org/OpenBSD-5.8/fsync.2 * NetBSD: https://man.netbsd.org/fdatasync.2 * illumos: https://illumos.org/man/3c/fdatasync

view details

Stein Somers

commit sha 28af355b9ffa7fdd1761caa4dd323eacd68ee0ed

BTreeMap: improve gdb introspection of BTreeMap with ZST keys or values

view details

Mike Hommey

commit sha 684d142e700cf52ee2fe0405e43568ddd324c57c

Set .llvmbc and .llvmcmd sections as allocatable

view details

David Wood

commit sha adf31e95e44ff0b7fbc798fe2b8cc5a42a3abf4b

resolve: suggest variants with placeholders This commit improves the diagnostic modified in rust-lang/rust#77341 to suggest not only those variants which do not have fields, but those with fields (by suggesting with placeholders). Signed-off-by: David Wood <david@davidtw.co>

view details

David Wood

commit sha f897162f3efc841461adce9510bb627cea9bac45

resolve: improve "try using tuple struct" message This commit improves the tuple struct case added in rust-lang/rust#77341 so that the context is mentioned in more of the message. Signed-off-by: David Wood <david@davidtw.co>

view details

Josh Stone

commit sha 1588e34bccde88aeeb090449691adda1fa34ca4b

llvm: backport SystemZ fix for AGR clobbers

view details

Aaron Hill

commit sha 865c30d52ac19481ad7714979ef49c1bd5b1f663

Bump backtrace-rs This pulls in https://github.com/rust-lang/backtrace-rs/pull/376, which fixes Miri support for `std::backtrace::Backtrace`.

view details

Joshua Nelson

commit sha 65835d1059b91fb6458942ea1dc4273990b035e2

Deny broken intra-doc links in linkchecker Since rustdoc isn't warning about these links, check for them manually.

view details

Joshua Nelson

commit sha b221819ff7b2d53b25714635dc72d68d732c491e

Update submodules for link fixes - [rust-embedded](https://github.com/rust-embedded/book/compare/79ab7776929c66db83203397958fa7037d5d9a30...ca8169e69b479f615855d0eece7e318138fcfc00) - [cargo](https://github.com/rust-lang/cargo/compare/12db56cdedbc2c26a9aa18f994c0188cdcc67df5...79b397d72c557eb6444a2ba0dc00a211a226a35a)

view details

Mara Bos

commit sha 0b062887db9be8fe05791411dd08ca35683cedc8

Remove shrink_to_fit from default ToString::to_string implementation. Co-authored-by: scottmcm <scottmcm@users.noreply.github.com>

view details

push time in 2 days

push eventjonas-schievink/rubble

JOE1994

commit sha 68633de10d736a2875c7b0e16c985a76bd527356

reply to LL_VERSION_IND once per connection

view details

JOE1994

commit sha 07a549eef547e6a855e0ec64c60b576b35df854b

log error upon receiving LL_VERSION_IND repeatedly

view details

Jonas Schievink

commit sha 29bafe3da1b96691a4d88bec49dc38f3f59d70ab

Merge pull request #154 from JOE1994/LL_VERSION_IND_once reply to LL_VERSION_IND once per connection

view details

push time in 2 days

PR merged jonas-schievink/rubble

reply to LL_VERSION_IND once per connection

Hello ! :crab:

This PR is for issue #49 . (relevant to Version Exchange procedure section of bluetooth 5.2 core specs)

I added a bool member to Connection that keeps track of whether we had previously sent a Control PDU LL_VERSION_IND for the connection. I also added a new variant VersionIndSent to enum LlcpError.

It is also mentioned in #49 that eventually we want to collapse all bool state variables to a single byte as bitflags, but I didn't make that change in this PR. So I guess the issue should be kept open?

Thank you for reviewing this PR ! :+1:

+17 -0

0 comment

1 changed file

JOE1994

pr closed time in 2 days

issue closedrust-lang/rust

Trait are not implemented for Trait object with marker trait

<!-- Thank you for filing a bug report! 🐛 Please provide a short summary of the bug, along with any information you feel relevant to replicating the bug. -->

I tried this code:

trait Foo {}
trait Bar {
    fn bar(&self) {}
}

struct A {}

impl Foo for A {}
impl Bar for &dyn Foo {}

fn func<T>(bar: T) where T: Bar {}

fn main() {
    let a = A {};
    // let a_as_foo = &a as &dyn Foo;
    let a_as_foo = &a as &(dyn Foo + Send);
    a_as_foo.bar(); // E0599
    func(a_as_foo); // E0277
}

I expected to see this happen: Bar is implemented for a_as_foo by impl Bar for &dyn Foo {} and code compiles.

Instead, this happened: It doesn't. Are &dyn Foo and &dyn Foo + Send considered as completely different type?

closed time in 2 days

Piroro-hs

issue commentrust-lang/rust

Trait are not implemented for Trait object with marker trait

Are &dyn Foo and &dyn Foo + Send considered as completely different type?

Yes. This is working as intended.

Piroro-hs

comment created time in 2 days

push eventjonas-schievink/rust

Jonas Schievink

commit sha 19ad18964590ba7febefac3635e20205862fc1e8

Update compiler/rustc_middle/src/mir/visit.rs Co-authored-by: LingMan <LingMan@users.noreply.github.com>

view details

push time in 2 days

Pull request review commentjonas-schievink/rubble

reply to LL_VERSION_IND once per connection

 enum LlcpError {      /// Consider the connection lost due to a critical error or timeout.     ConnectionLost,++    /// Shouldn't send Control PDU *LL_VERSION_IND* more than once.
    /// Already sent Control PDU *LL_VERSION_IND* (indicates invalid behavior by the other device).
JOE1994

comment created time in 2 days

Pull request review commentjonas-schievink/rubble

reply to LL_VERSION_IND once per connection

 impl<C: Config> Connection<C> {                         Err(LlcpError::ConnectionLost) => {                             return Err(());                         }-                        Err(LlcpError::NoSpace) => {+                        Err(LlcpError::NoSpace) | Err(LlcpError::VersionIndSent) => {

We should probably log this case, since it is invalid behavior

JOE1994

comment created time in 2 days

PullRequestReviewEvent
PullRequestReviewEvent

issue closedrust-lang/rust

Strange stack overflow

<!-- Thank you for filing a bug report! 🐛 Please provide a short summary of the bug, along with any information you feel relevant to replicating the bug. -->

I tried this code:

use std::io::{Read,BufRead,BufReader};
pub trait StreamDigest
{
    fn update_data(&mut self, data: &[u8]);
    fn finish(self) -> Vec<u8>;
}
pub trait StreamHash: StreamDigest + Sized
{
    fn hash_stream<R: Read>(mut self, stream: R) -> Result<String, String>
    {
        println!("IN HASH STREAM !");
        let mut stream = BufReader::new(stream);
        let mut buffer = [0u8;4*1024*1024];// Buffer of 4Mio
        loop
        {
            println!("LOOP !");
            let count = match stream.read(&mut buffer)
            {
                Ok(n) => n,
                Err(e) =>
                {
                    return Err(e.to_string());
                }
            };
            if count == 0
            {
                println!("BREAK !");
                break;
            }
            println!("UPDATE !");
            self.update_data(&buffer[..count]);
        }
        println!("FINISH !");
        let v = self.finish();
        let mut s = String::new();
        for i in v
        {
            s.push_str(&format!("{:x}", i));
        }
        Ok(s)
    }
}

impl<T: digest::Digest> StreamDigest for T
{
    fn update_data(&mut self, data: &[u8])
    {
        println!("StreamDigest update !");
        digest::Digest::update(self, data);
    }
    fn finish(self) -> Vec<u8>
    {
        println!("StreamDigest finish !");
        digest::Digest::finalize(self).to_vec()
    }
}


impl<T: StreamDigest + Sized> StreamHash for T {}


#[test]
fn test_sha3()
{
    println!("TEST SHA3 !");
    let sha3 = sha3::Sha3_224::default();
    println!("CALL HASH STREAM");
    let hash = sha3.hash_stream(std::fs::File::open("reference_file.txt").unwrap()).unwrap();
    println!("{}", hash);
    assert_eq!("affa21aa40652080b2b8d2deb293fc4086a15d94f04df93df76bbf43", &hash);
}

I expected to see this happen: Computing a sha3, display it, and assert_eq! the expected result.

Instead, this happened: Stack overflow on the first line of stream_hash, unable get any line of this method to be run.

Meta

<!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. -->

rustc --version --verbose:

rustc 1.49.0-nightly (e3051d8c2 2020-10-16)
binary: rustc
commit-hash: e3051d8c24467b54c81da9d9ad70a3e82e106ec1
commit-date: 2020-10-16
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly
LLVM version: 11.0

(Same problem on 1.47 nightly)

<!-- Include a backtrace in the code block by setting RUST_BACKTRACE=1 in your environment. E.g. RUST_BACKTRACE=1 cargo build. --> <details><summary>Backtrace</summary> <p>

running 1 test
TEST SHA3 !
CALL HASH STREAM

thread 'streamhash::test_sha3' has overflowed its stack
fatal runtime error: stack overflow
error: test failed, to rerun pass '--bin arrs'

Caused by:
  process didn't exit successfully: `/home/valentin/git/arrs/target/debug/deps/arrs-dd66f5583bcd18f8 test_sha3 --nocapture` (signal: 6, SIGABRT: process abort signal)

With gdb:

Thread 8 "streamhash::tes" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff7bfc700 (LWP 227448)]
0x000055555561d291 in __rust_probestack ()
(gdb) bt
#0  0x000055555561d291 in __rust_probestack ()
#1  0x000055555556a1da in arrs::streamhash::StreamHash::hash_stream (self=..., stream=...) at src/streamhash/mod.rs:9
#2  0x0000555555583f47 in arrs::streamhash::test_sha3 () at src/streamhash/mod.rs:72
#3  0x000055555556e2fa in arrs::streamhash::test_sha3::{{closure}} () at src/streamhash/mod.rs:67
#4  0x0000555555571bae in core::ops::function::FnOnce::call_once ()
    at /home/valentin/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227
#5  0x00005555555c6db3 in core::ops::function::FnOnce::call_once () at /rustc/e3051d8c24467b54c81da9d9ad70a3e82e106ec1/library/core/src/ops/function.rs:227
#6  test::__rust_begin_short_backtrace () at library/test/src/lib.rs:516
#7  0x00005555555c52aa in <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once ()
    at /rustc/e3051d8c24467b54c81da9d9ad70a3e82e106ec1/library/alloc/src/boxed.rs:1042
#8  <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once () at /rustc/e3051d8c24467b54c81da9d9ad70a3e82e106ec1/library/std/src/panic.rs:308
#9  std::panicking::try::do_call () at /rustc/e3051d8c24467b54c81da9d9ad70a3e82e106ec1/library/std/src/panicking.rs:381
#10 std::panicking::try () at /rustc/e3051d8c24467b54c81da9d9ad70a3e82e106ec1/library/std/src/panicking.rs:345
#11 std::panic::catch_unwind () at /rustc/e3051d8c24467b54c81da9d9ad70a3e82e106ec1/library/std/src/panic.rs:382
#12 test::run_test_in_process () at library/test/src/lib.rs:543
#13 test::run_test::run_test_inner::{{closure}} () at library/test/src/lib.rs:449
#14 0x000055555559f096 in std::sys_common::backtrace::__rust_begin_short_backtrace ()
    at /rustc/e3051d8c24467b54c81da9d9ad70a3e82e106ec1/library/std/src/sys_common/backtrace.rs:125
#15 0x00005555555a4155 in std::thread::Builder::spawn_unchecked::{{closure}}::{{closure}} () at /rustc/e3051d8c24467b54c81da9d9ad70a3e82e106ec1/library/std/src/thread/mod.rs:464
#16 <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once () at /rustc/e3051d8c24467b54c81da9d9ad70a3e82e106ec1/library/std/src/panic.rs:308
#17 std::panicking::try::do_call () at /rustc/e3051d8c24467b54c81da9d9ad70a3e82e106ec1/library/std/src/panicking.rs:381
#18 std::panicking::try () at /rustc/e3051d8c24467b54c81da9d9ad70a3e82e106ec1/library/std/src/panicking.rs:345
#19 std::panic::catch_unwind () at /rustc/e3051d8c24467b54c81da9d9ad70a3e82e106ec1/library/std/src/panic.rs:382
#20 std::thread::Builder::spawn_unchecked::{{closure}} () at /rustc/e3051d8c24467b54c81da9d9ad70a3e82e106ec1/library/std/src/thread/mod.rs:463
#21 core::ops::function::FnOnce::call_once{{vtable-shim}} () at /rustc/e3051d8c24467b54c81da9d9ad70a3e82e106ec1/library/core/src/ops/function.rs:227
#22 0x00005555555fe6ea in <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once ()
    at /rustc/e3051d8c24467b54c81da9d9ad70a3e82e106ec1/library/alloc/src/boxed.rs:1042
#23 <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once () at /rustc/e3051d8c24467b54c81da9d9ad70a3e82e106ec1/library/alloc/src/boxed.rs:1042
#24 std::sys::unix::thread::Thread::new::thread_start () at library/std/src/sys/unix/thread.rs:89
#25 0x00007ffff7f4f609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#26 0x00007ffff7d21293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb) 

</p> </details>

I was unable to create a minimal code that reproduce this issue, but I didn't see why this happen. I tried to implement a trait that automatically add a way to hash Read (for large files).

Any idea? Thank you :)

closed time in 2 days

crone123

issue commentrust-lang/rust

Strange stack overflow

let mut buffer = [0u8;4*1024*1024];// Buffer of 4Mio

This uses up half the default stack on Linux. You're just running out of stack space here.

crone123

comment created time in 2 days

issue commentrust-lang/rust

Document the "as _" (as-underscore) syntax for value coercion / type casting

as is documented here: https://doc.rust-lang.org/std/keyword.as.html

It could explicitly mention that the destination type can be an _ placeholder.

cher-nov

comment created time in 2 days

Pull request review commentrust-lang/rust

Remove the old copy propagation pass

 fn run_optimization_passes<'tcx>(         &simplify_try::SimplifyArmIdentity,         &simplify_try::SimplifyBranchSame,         &dest_prop::DestinationPropagation,-        &copy_prop::CopyPropagation,         &simplify_branches::SimplifyBranches::new("after-copy-prop"),

Renamed to "final"

jonas-schievink

comment created time in 3 days

PullRequestReviewEvent

Pull request review commentrust-lang/rust

Remove the old copy propagation pass

-// Check that CopyPropagation does not propagate an assignment to a function argument

I ported this test over, the results look correct

jonas-schievink

comment created time in 3 days

PullRequestReviewEvent

push eventjonas-schievink/rust

Dylan MacKenzie

commit sha bed7b295106c88a2a6cf922ace1483a48183675d

Update `compile-fail` test

view details

Dylan MacKenzie

commit sha 1513904c1c64954e38af8f98549fc56530c48b83

Remove default `build_error` impl Now all structured errors must have their own error code

view details

Dylan MacKenzie

commit sha 7c6d685551604dcb86f8239d09b21eeca5988f67

Rewrite E0019 example Inline assembly is now the only user of E0019. What is it doing that E0015 is not?

view details

Lzu Tao

commit sha 446f86e370884df01cbbacc584d67859c6c2a10b

Remove useless stringify

view details

Jethro Beekman

commit sha 0690f9c5d526baa593cc62b175ef5e7f2c8f4f9c

Add lint for inline assembly syntax style preference

view details

Tyson Nottingham

commit sha d061fee177c70ae146db2b9720c85dc1f38215af

Stable hashing: add comments and tests concerning platform-independence SipHasher128 implements short_write in an endian-independent way, yet its write_xxx Hasher trait methods undo this endian-independence by byte swapping the integer inputs on big-endian hardware. StableHasher then adds endian-independence back by also byte-swapping on big-endian hardware prior to invoking SipHasher128. This double swap may have the appearance of being a no-op, but is in fact by design. In particular, we really do want SipHasher128 to be platform-dependent, in order to be consistent with the libstd SipHasher. Try to clarify this intent. Also, add and update a couple of unit tests.

view details

Oliver Scherer

commit sha ce6c25da5887dcdb446b56892ace1d2463a743f3

References to ZSTs may be at arbitrary aligned addresses

view details

varkor

commit sha 609786dbd8b07599a2bc6618c777f859d7a01451

Validate `rustc_args_required_const`

view details

Pietro Albini

commit sha e05e2f9a94f4fa43f9a77bb59184eeb46fd49577

bootstrap: add ./x.py run src/tools/build-manifest

view details

Ingvar Stepanyan

commit sha 494d6e514bb29341270720067d9842e8862704f8

Fix is_absolute on WASI WASI does not match `cfg(unix)`, but its paths are Unix-like (`/some/path`) and don't have Windows-like prefixes. Without this change, `is_absolute` for paths like `/some/path` was returning `false`on a WASI target, which is obviously not true and undesirable.

view details

Pietro Albini

commit sha d4928ad7fd6636f1a1f8d51209a70f0ee7a5f43e

build-manifest: keep legacy behavior when invoking through ./x.py dist

view details

Pietro Albini

commit sha 6e15975540e46582fbc01110d8d4411c5490dc4b

build-manifest: split the manifest struct definition in a separate file

view details

Hugues de Valon

commit sha d255d70e7a6a84c82cc74f968f529f42dd40b8ce

Update LLVM and add Unsupported diagnostic Secure entry functions do not support if arguments are passed on the stack. An "unsupported" diagnostic will be emitted by LLVM if that is the case. This commits adds support in Rust for that diagnostic so that an error will be output if that is the case! Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>

view details

Hugues de Valon

commit sha 1aaafac6ffec2556a27a3c34365c685c124ee029

Add support for cmse_nonsecure_entry attribute This patch adds support for the LLVM cmse_nonsecure_entry attribute. This is a target-dependent attribute that only has sense for the thumbv8m Rust targets. You can find more information about this attribute here: https://developer.arm.com/documentation/ecm0359818/latest/ Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>

view details

est31

commit sha 7f5008c8293a4d1eb3e4557a36a6bfdef34de284

Backport LLVM apfloat commit to rustc_apfloat Backports LLVM commit: https://github.com/llvm/llvm-project/commit/e34bd1e0b03d20a506ada156d87e1b3a96d82fa2 Fixes #69532

view details

Jake Vossen

commit sha 916d23614b462dbaa60cdb5540a139f5db1fe950

updated p! macro to accept literals

view details

Jake Vossen

commit sha d103fe15d16dddd3300799375e9e6516e1d072e5

Fixed more write literals after master merge

view details

Jake Vossen

commit sha f69a88b7d345e09e076ae65e4c8538c6f034b47c

updated p! macro to accept literals

view details

Jake Vossen

commit sha 50326740651c182e430c8a075e07ae39d3eb180e

fixed merge conflicts

view details

Jake Vossen

commit sha dffb9d6a26a29ea4cbad7df2371e004e7ae20269

cargo fmt

view details

push time in 3 days

issue closedrust-lang/rust

ICE: from_const: invalid ScalarPair layout: TyAndLayout

I'm doing really, really cursed things, so I'm not sure if this is a bug.

Code

#![allow(dead_code, unused_attributes)]
#![feature(no_core)]
#![feature(optin_builtin_traits)]
#![feature(lang_items)]
#![feature(rustc_attrs)]
#![no_core]

#[rustc_builtin_macro]
macro_rules! concat {
    ($($e:expr),*) => {{ /* compiler built-in */ }};
    ($($e:expr,)*) => {{ /* compiler built-in */ }};
}

#[lang = "sized"]
auto trait Sized { }

#[lang = "copy"]
trait Copy { }

fn f(_: &'static str) { }

#[lang = "start"]
fn start(main: fn(), _argc: isize, _argv: *const *const u8) -> isize {
    main();
    0    
}

fn main() {
    f(concat!("Hello, world! %d", "\0"));
}

Meta

rustc --version --verbose:

rustc 1.48.0-nightly (7f7a1cbfd 2020-09-27)
binary: rustc
commit-hash: 7f7a1cbfd3b55daee191247770627afab09eece2
commit-date: 2020-09-27
host: x86_64-unknown-linux-gnu
release: 1.48.0-nightly
LLVM version: 11.0

Error output

error: internal compiler error: /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/compiler/rustc_codegen_ssa/src/mir/operand.rs:92:26: from_const: invalid ScalarPair layout: TyAndLayout {
    ty: &str,
    layout: Layout {
        fields: Primitive,
        variants: Single {
            index: 0,
        },
        abi: Scalar(
            Scalar {
                value: Pointer,
                valid_range: 1..=18446744073709551615,
            },
        ),
        largest_niche: Some(
            Niche {
                offset: Size {
                    raw: 0,
                },
                scalar: Scalar {
                    value: Pointer,
                    valid_range: 1..=18446744073709551615,
                },
            },
        ),
        align: AbiAndPrefAlign {
            abi: Align {
                pow2: 3,
            },
            pref: Align {
                pow2: 3,
            },
        },
        size: Size {
            raw: 8,
        },
    },
}

<!-- Include a backtrace in the code block by setting RUST_BACKTRACE=1 in your environment. E.g. RUST_BACKTRACE=1 cargo build. --> <details><summary><strong>Backtrace</strong></summary> <p>

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945:9
stack backtrace:
   0:     0x7f698a617680 - std::backtrace_rs::backtrace::libunwind::trace::he85dfb3ae4206056
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/../../backtrace/src/backtrace/libunwind.rs:96
   1:     0x7f698a617680 - std::backtrace_rs::backtrace::trace_unsynchronized::h1ad28094d7b00c21
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/../../backtrace/src/backtrace/mod.rs:66
   2:     0x7f698a617680 - std::sys_common::backtrace::_print_fmt::h901b54610713cd21
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/sys_common/backtrace.rs:79
   3:     0x7f698a617680 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb0ad78ee1571f7e0
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/sys_common/backtrace.rs:58
   4:     0x7f698a6855ac - core::fmt::write::h1857a60b204f1b6a
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/fmt/mod.rs:1080
   5:     0x7f698a6099a2 - std::io::Write::write_fmt::hf7b7d7b243f84a36
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/io/mod.rs:1516
   6:     0x7f698a61c1ed - std::sys_common::backtrace::_print::hd093978a5287b8ff
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/sys_common/backtrace.rs:61
   7:     0x7f698a61c1ed - std::sys_common::backtrace::print::h20f46787581d56d7
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/sys_common/backtrace.rs:48
   8:     0x7f698a61c1ed - std::panicking::default_hook::{{closure}}::h486cbb4b82ffc357
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/panicking.rs:208
   9:     0x7f698a61be98 - std::panicking::default_hook::h4190c9e3edd4d591
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/panicking.rs:227
  10:     0x7f698aea3e44 - rustc_driver::report_ice::h33b98c6312de22d9
  11:     0x7f698a61ca36 - std::panicking::rust_panic_with_hook::h72e78719cdda225c
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/panicking.rs:581
  12:     0x7f698de8809d - std::panicking::begin_panic::{{closure}}::h07c37e0eb1cdd0bd
  13:     0x7f698de87fc6 - std::sys_common::backtrace::__rust_end_short_backtrace::h0e913c6e63ac7532
  14:     0x7f698de824ff - std::panicking::begin_panic::hb4984aaf49f869f2
  15:     0x7f698debdf40 - rustc_errors::HandlerInner::bug::hba4e38a3874f5dd8
  16:     0x7f698debcaf0 - rustc_errors::Handler::bug::h9b8941b572d00bc2
  17:     0x7f698d7ffea4 - rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}::ha7dea7ab2c365914
  18:     0x7f698d7f96cb - rustc_middle::ty::context::tls::with_opt::{{closure}}::hd5a48179cc9a1134
  19:     0x7f698d7f9042 - rustc_middle::ty::context::tls::with_opt::h4e42d527c5b50313
  20:     0x7f698d7ffdc9 - rustc_middle::util::bug::opt_span_bug_fmt::h41e68724f24e37b9
  21:     0x7f698d7ffd3e - rustc_middle::util::bug::bug_fmt::h38fd16a2440e0445
  22:     0x7f698b1e6975 - rustc_codegen_ssa::mir::operand::OperandRef<V>::from_const::hbc52e52c77522977
  23:     0x7f698b25b8ba - rustc_codegen_ssa::mir::operand::<impl rustc_codegen_ssa::mir::FunctionCx<Bx>>::codegen_operand::h46775bcf8465fe4f
  24:     0x7f698b254f1d - rustc_codegen_ssa::mir::block::<impl rustc_codegen_ssa::mir::FunctionCx<Bx>>::codegen_call_terminator::h6f3acf2ae2b46a89
  25:     0x7f698b24f4c6 - rustc_codegen_ssa::mir::block::<impl rustc_codegen_ssa::mir::FunctionCx<Bx>>::codegen_block::h2f244e07e56ea3d8
  26:     0x7f698b24cf9e - rustc_codegen_ssa::mir::codegen_mir::h8d642bcb147d41c1
  27:     0x7f698b35ec68 - rustc_codegen_ssa::base::codegen_instance::h894322accffbeb70
  28:     0x7f698b1bc604 - <rustc_middle::mir::mono::MonoItem as rustc_codegen_ssa::mono_item::MonoItemExt>::define::h39a2dd069eed710b
  29:     0x7f698b1ffceb - rustc_codegen_llvm::base::compile_codegen_unit::module_codegen::hb573a456da1f50eb
  30:     0x7f698b2a8e8a - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task::h9e34e57f77fd95f5
  31:     0x7f698b1ff80a - rustc_codegen_llvm::base::compile_codegen_unit::h6bde4cdd8ac24228
  32:     0x7f698b35cc60 - rustc_codegen_ssa::base::codegen_crate::h1469a17db97addb4
  33:     0x7f698b355a85 - <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::h213008e5539f00d1
  34:     0x7f698b0f7bb1 - rustc_interface::passes::QueryContext::enter::h696fdc98b1a21464
  35:     0x7f698b13af83 - rustc_interface::queries::Queries::ongoing_codegen::h14106579db5182fd
  36:     0x7f698aeef454 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::he4e35b4eaa2694c6
  37:     0x7f698ae83527 - rustc_span::with_source_map::hb500901462ee52b5
  38:     0x7f698aef1488 - rustc_interface::interface::create_compiler_and_run::heaaaf154744ddc30
  39:     0x7f698aed692a - scoped_tls::ScopedKey<T>::set::h3b254e0349c75e04
  40:     0x7f698aef3673 - std::sys_common::backtrace::__rust_begin_short_backtrace::h1aa7101e3f5fb15d
  41:     0x7f698ae6f4de - core::ops::function::FnOnce::call_once{{vtable.shim}}::h31069caa752da237
  42:     0x7f698a62b70a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h1080dfe0ef616bdf
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/alloc/src/boxed.rs:1042
  43:     0x7f698a62b70a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::hd2747e1f2d5cec32
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/alloc/src/boxed.rs:1042
  44:     0x7f698a62b70a - std::sys::unix::thread::Thread::new::thread_start::hd0f336b4ef6808a7
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/sys/unix/thread.rs:87
  45:     0x7f698a5313e9 - start_thread
  46:     0x7f698a459293 - __GI___clone
  47:                0x0 - <unknown>

</p> </details>

closed time in 3 days

GoldsteinE

issue commentrust-lang/rust

ICE: from_const: invalid ScalarPair layout: TyAndLayout

Caused by making Sized an auto-trait, so this is a duplicate of https://github.com/rust-lang/rust/issues/9307

GoldsteinE

comment created time in 3 days

issue closedrust-lang/rust

ICE: index out of bounds when using #[lang = "panic_location"]

Code

#![feature(no_core)]
#![feature(lang_items)]
#![feature(optin_builtin_traits)]
#![feature(associated_type_defaults)]
#![no_core]
#![no_main]

#[lang = "panic_location"]
struct P;

#[lang = "sized"]
auto trait Sized { }

#[lang = "copy"]
auto trait Copy { }

#[lang = "add"]
trait Add<Rhs = Self>: Sized {
    type Output = Self;

    fn add(self, other: Rhs) -> Self::Output;
}

impl Add for i32 {
    fn add(self, other: i32) -> i32 {
        self + other
    }
}

pub fn f() -> i32 {
    2.add(2)
}

Meta

rustc --version --verbose:

rustc 1.48.0-nightly (7f7a1cbfd 2020-09-27)
binary: rustc
commit-hash: 7f7a1cbfd3b55daee191247770627afab09eece2
commit-date: 2020-09-27
host: x86_64-unknown-linux-gnu
release: 1.48.0-nightly
LLVM version: 11.0

Error output

error: internal compiler error: unexpected panic

<!-- Include a backtrace in the code block by setting RUST_BACKTRACE=1 in your environment. E.g. RUST_BACKTRACE=1 cargo build. --> <details><summary><strong>Backtrace</strong></summary> <p>

thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', compiler/rustc_target/src/abi/mod.rs:695:59
stack backtrace:
   0:     0x7fdc1b6d8680 - std::backtrace_rs::backtrace::libunwind::trace::he85dfb3ae4206056
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/../../backtrace/src/backtrace/libunwind.rs:96
   1:     0x7fdc1b6d8680 - std::backtrace_rs::backtrace::trace_unsynchronized::h1ad28094d7b00c21
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/../../backtrace/src/backtrace/mod.rs:66
   2:     0x7fdc1b6d8680 - std::sys_common::backtrace::_print_fmt::h901b54610713cd21
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/sys_common/backtrace.rs:79
   3:     0x7fdc1b6d8680 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb0ad78ee1571f7e0
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/sys_common/backtrace.rs:58
   4:     0x7fdc1b7465ac - core::fmt::write::h1857a60b204f1b6a
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/fmt/mod.rs:1080
   5:     0x7fdc1b6ca9a2 - std::io::Write::write_fmt::hf7b7d7b243f84a36
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/io/mod.rs:1516
   6:     0x7fdc1b6dd1ed - std::sys_common::backtrace::_print::hd093978a5287b8ff
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/sys_common/backtrace.rs:61
   7:     0x7fdc1b6dd1ed - std::sys_common::backtrace::print::h20f46787581d56d7
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/sys_common/backtrace.rs:48
   8:     0x7fdc1b6dd1ed - std::panicking::default_hook::{{closure}}::h486cbb4b82ffc357
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/panicking.rs:208
   9:     0x7fdc1b6dce98 - std::panicking::default_hook::h4190c9e3edd4d591
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/panicking.rs:227
  10:     0x7fdc1bf64e44 - rustc_driver::report_ice::h33b98c6312de22d9
  11:     0x7fdc1b6dda36 - std::panicking::rust_panic_with_hook::h72e78719cdda225c
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/panicking.rs:581
  12:     0x7fdc1b6dd5b9 - std::panicking::begin_panic_handler::{{closure}}::h8bd07dbd34150a96
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/panicking.rs:484
  13:     0x7fdc1b6d8b0c - std::sys_common::backtrace::__rust_end_short_backtrace::hdb6b3066ad29028a
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/sys_common/backtrace.rs:153
  14:     0x7fdc1b6dd579 - rust_begin_unwind
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/panicking.rs:483
  15:     0x7fdc1b7430c1 - core::panicking::panic_fmt::hb15d6f55e8472f62
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/panicking.rs:85
  16:     0x7fdc1b743082 - core::panicking::panic_bounds_check::hec58b3e6eeb445f1
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/panicking.rs:62
  17:     0x7fdc1f0088f4 - rustc_target::abi::FieldsShape::offset::h1cbd516eb57ef038
  18:     0x7fdc1d64aaf5 - rustc_mir::interpret::intrinsics::caller_location::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::alloc_caller_location::h446f1ef12298dda2
  19:     0x7fdc1d2b115d - rustc_mir::const_eval::const_caller_location::h293704febfdb50de
  20:     0x7fdc1c30c799 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::const_caller_location>::compute::h1d224cb05ab5cab6
  21:     0x7fdc1c35df0d - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h224107c598c6a1ec
  22:     0x7fdc1c3e01af - rustc_data_structures::stack::ensure_sufficient_stack::h96b8ac0f1c461eee
  23:     0x7fdc1c2daa1c - rustc_query_system::query::plumbing::get_query_impl::h622ead14a2bdd11e
  24:     0x7fdc1c313ca4 - rustc_codegen_ssa::mir::block::<impl rustc_codegen_ssa::mir::FunctionCx<Bx>>::get_caller_location::habf054de751cf5d3
  25:     0x7fdc1c3116fe - rustc_codegen_ssa::mir::block::<impl rustc_codegen_ssa::mir::FunctionCx<Bx>>::codegen_block::h2f244e07e56ea3d8
  26:     0x7fdc1c30df9e - rustc_codegen_ssa::mir::codegen_mir::h8d642bcb147d41c1
  27:     0x7fdc1c41fc68 - rustc_codegen_ssa::base::codegen_instance::h894322accffbeb70
  28:     0x7fdc1c27d604 - <rustc_middle::mir::mono::MonoItem as rustc_codegen_ssa::mono_item::MonoItemExt>::define::h39a2dd069eed710b
  29:     0x7fdc1c2c0ceb - rustc_codegen_llvm::base::compile_codegen_unit::module_codegen::hb573a456da1f50eb
  30:     0x7fdc1c369e8a - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task::h9e34e57f77fd95f5
  31:     0x7fdc1c2c080a - rustc_codegen_llvm::base::compile_codegen_unit::h6bde4cdd8ac24228
  32:     0x7fdc1c41dc60 - rustc_codegen_ssa::base::codegen_crate::h1469a17db97addb4
  33:     0x7fdc1c416a85 - <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::h213008e5539f00d1
  34:     0x7fdc1c1b8bb1 - rustc_interface::passes::QueryContext::enter::h696fdc98b1a21464
  35:     0x7fdc1c1fbf83 - rustc_interface::queries::Queries::ongoing_codegen::h14106579db5182fd
  36:     0x7fdc1bfb0454 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::he4e35b4eaa2694c6
  37:     0x7fdc1bf44527 - rustc_span::with_source_map::hb500901462ee52b5
  38:     0x7fdc1bfb2488 - rustc_interface::interface::create_compiler_and_run::heaaaf154744ddc30
  39:     0x7fdc1bf9792a - scoped_tls::ScopedKey<T>::set::h3b254e0349c75e04
  40:     0x7fdc1bfb4673 - std::sys_common::backtrace::__rust_begin_short_backtrace::h1aa7101e3f5fb15d
  41:     0x7fdc1bf304de - core::ops::function::FnOnce::call_once{{vtable.shim}}::h31069caa752da237
  42:     0x7fdc1b6ec70a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h1080dfe0ef616bdf
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/alloc/src/boxed.rs:1042
  43:     0x7fdc1b6ec70a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::hd2747e1f2d5cec32
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/alloc/src/boxed.rs:1042
  44:     0x7fdc1b6ec70a - std::sys::unix::thread::Thread::new::thread_start::hd0f336b4ef6808a7
                               at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/sys/unix/thread.rs:87
  45:     0x7fdc1b5f23e9 - start_thread
  46:     0x7fdc1b51a293 - __GI___clone
  47:                0x0 - <unknown>

</p> </details>

closed time in 3 days

GoldsteinE

issue commentrust-lang/rust

ICE: index out of bounds when using #[lang = "panic_location"]

Duplicate of https://github.com/rust-lang/rust/issues/9307

GoldsteinE

comment created time in 3 days

push eventjonas-schievink/rust

Ingvar Stepanyan

commit sha 494d6e514bb29341270720067d9842e8862704f8

Fix is_absolute on WASI WASI does not match `cfg(unix)`, but its paths are Unix-like (`/some/path`) and don't have Windows-like prefixes. Without this change, `is_absolute` for paths like `/some/path` was returning `false`on a WASI target, which is obviously not true and undesirable.

view details

Pietro Albini

commit sha d4928ad7fd6636f1a1f8d51209a70f0ee7a5f43e

build-manifest: keep legacy behavior when invoking through ./x.py dist

view details

Pietro Albini

commit sha 6e15975540e46582fbc01110d8d4411c5490dc4b

build-manifest: split the manifest struct definition in a separate file

view details

bors

commit sha 939cc3e445db1eaf8b3834984e274f8c2267d9c5

Auto merge of #77281 - tmiasko:liveness-everybody, r=oli-obk Liveness analysis for everybody Perform liveness analysis for every body instead of limiting it to fns. Fixes #77169.

view details

Hugues de Valon

commit sha d255d70e7a6a84c82cc74f968f529f42dd40b8ce

Update LLVM and add Unsupported diagnostic Secure entry functions do not support if arguments are passed on the stack. An "unsupported" diagnostic will be emitted by LLVM if that is the case. This commits adds support in Rust for that diagnostic so that an error will be output if that is the case! Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>

view details

Hugues de Valon

commit sha 1aaafac6ffec2556a27a3c34365c685c124ee029

Add support for cmse_nonsecure_entry attribute This patch adds support for the LLVM cmse_nonsecure_entry attribute. This is a target-dependent attribute that only has sense for the thumbv8m Rust targets. You can find more information about this attribute here: https://developer.arm.com/documentation/ecm0359818/latest/ Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>

view details

bors

commit sha d92d28e523bf056ab4eb752510ec52fe4f1c6311

Auto merge of #77298 - jyn514:bootstrap-config, r=Mark-Simulacrum Don't warn if the config file is somewhere other than `config.toml` Previously, `config.config` was always hardcoded as `"config.toml"`. I thought that it was being overridden with the actual value later, but it turns out `flags.config` was being completely discarded. This keeps `config.config` in sync with `flags.config`. Fixes https://github.com/rust-lang/rust/issues/77293 r? `@Mark-Simulacrum` cc `@davidtwco`

view details

est31

commit sha 7f5008c8293a4d1eb3e4557a36a6bfdef34de284

Backport LLVM apfloat commit to rustc_apfloat Backports LLVM commit: https://github.com/llvm/llvm-project/commit/e34bd1e0b03d20a506ada156d87e1b3a96d82fa2 Fixes #69532

view details

Jake Vossen

commit sha 916d23614b462dbaa60cdb5540a139f5db1fe950

updated p! macro to accept literals

view details

Jake Vossen

commit sha d103fe15d16dddd3300799375e9e6516e1d072e5

Fixed more write literals after master merge

view details

Jake Vossen

commit sha f69a88b7d345e09e076ae65e4c8538c6f034b47c

updated p! macro to accept literals

view details

Jake Vossen

commit sha 50326740651c182e430c8a075e07ae39d3eb180e

fixed merge conflicts

view details

Jake Vossen

commit sha dffb9d6a26a29ea4cbad7df2371e004e7ae20269

cargo fmt

view details

Hugues de Valon

commit sha 2588287deffd92c4ca0b5b39f92b9cca894a3983

Add more tests and check for ABI Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>

view details

Camelid

commit sha 05d0b969d9e1c3da6a2651a2ded45f662842a3f9

Add test for error message

view details

Dylan MacKenzie

commit sha 0c26144b1ac75267c679bad6a4e2c4e7bc7957d3

Better span for attribute suggestions `def_span` has the same issues as `body.span`, so do it this way instead.

view details

Dylan MacKenzie

commit sha 1301f43119f8ae564a01abd3fa306e87d635e862

Remove E0019, use E0015 for inline assembly in a const

view details

bors

commit sha 867bd42c38bac3870388765f65386b18cf1d9c5f

Auto merge of #75810 - hug-dev:cmse-nonsecure-entry, r=jonas-schievink Add support for cmse_nonsecure_entry attribute This pull request adds the `cmse_nonsecure_entry` attribute under an unstable feature. I was not sure if it was fine for me to send directly the pull-request or if I should submit a RFC first. I was told on Zulip that it was fine to do so but please close it if I need first submit a RFC or follow another process instead. The `cmse_nonsecure_entry` attribute is a LLVM attribute that will be available in LLVM 11. I plan to rebase on the [upgrade PR](https://github.com/rust-lang/rust/pull/73526) once merged to make this one compile. This attribute modifies code generation of the function as explained [here](https://developer.arm.com/documentation/ecm0359818/latest/) to make it work with the TrustZone-M hardware feature. This feature is only available on `thumbv8m` targets so I created an error for that if one tries to use this attribute for another target. I added this attribute in Rust as any other LLVM attribute are added but since this one is target-dependent I am not sure if it was the best thing to do. Please indicate me if you think of other ways, like isolating target-dependent attributes together. ---------------- Tracking issue: https://github.com/rust-lang/rust/issues/75835

view details

Camelid

commit sha b2ce3e53446173b56607b5a8ad8d9c4b3565d5da

Remove trailing space in error message

view details

Jonas Schievink

commit sha 248d6bf1e2103aaac8642aecdfcffd4259927fea

Rollup merge of #77037 - matthiaskrgr:cl42ppy, r=Dylan-DPC more tiny clippy cleanups commits stand alone and can be reviewed one by one

view details

push time in 3 days

pull request commentrust-lang/rust

Unignore test for #36710 on MUSL

@bors r=Mark-Simulacrum

jonas-schievink

comment created time in 3 days

push eventjonas-schievink/rust

Mateusz Mikuła

commit sha 0ad3da06843089c0bf10d6caa3fbbc72fa67787a

Enable ASLR for windows-gnu

view details

Nathan West

commit sha a02014280586b53997622c501db00398376967a8

Refactor io/buffered.rs into submodules

view details

Nathan West

commit sha 96229f02402e82914ec6100b28ad2cbdd273a0d4

move buffered.rs to mod.rs

view details

Nathan West

commit sha 6d75cdfc9ed9e6987bd23add6cf3954d2499dce2

Added updated compiler diagnostic

view details

Amjad Alsharafi

commit sha da700cba08a2b194d19e63d3c51ebadce96fe46b

Stabilize move_ref_pattern

view details

Amjad Alsharafi

commit sha afb9eeb1b9ea16ca65e38673a0ef3e7be81d7252

Disabled error `E0007` from rustc_error_codes

view details

Nathan West

commit sha c4280af8285c61b367a87c8f6eef9876011a8150

Retry fix error reporting suggestions

view details

Waffle

commit sha 0b923d3ca0b7f5a1a611564ee48c1e92f896d79e

add `str::{Split,RSplit}::as_str` methods This commit introduses 2 methods under "str_split_as_str" gate with common signature of `&Split<'a, _> -> &'a str'`. Both of them work like `Chars::as_str` - return unyield part of the inner string.

view details

Waffle

commit sha 4747215d778abd9f280202d07f279fdeaea519f8

add `str::{SplitN, RSplitN, SplitTerminator, RSplitTerminator}::as_str` methods This commit entroduce 4 methods smililar to `Split::as_str` all under the same gate "str_split_as_str".

view details

Waffle

commit sha 076514c8a82591547116a7a2212c4de4bdc56f76

add `str::SplitInclusive::as_str` method This commit entroduces `core::str::SplitInclusive::as_str` method similar to `core::str::Split::as_str`, but under different gate - "str_split_inclusive_as_str" (this is done so because `SplitInclusive` is itself unstable).

view details

Stein Somers

commit sha 97beb074aff40cb1b6444e9eff734a1a5c17dfc7

BTreeMap: derive type-specific variants of node_as_mut and cast_unchecked

view details

Guillaume Gomez

commit sha a215151cd357945acdb2675010708cb2d10bb4c0

Allow ascii whitespace char for doc aliases

view details

Guillaume Gomez

commit sha accc26abc0e53067d7a97d0fb19800c37a24f844

Add test for whitespace in doc alias

view details

Guillaume Gomez

commit sha 11f3476c59ee013c017e669676cfaca00a67b3f1

Enforce whitespace ascii character check for doc alias

view details

Mara Bos

commit sha f84f01c0148cfb2451775fcbf299a2e7b10b1e81

Use futex-based thread-parker for Wasm32.

view details

Mara Bos

commit sha 54a71e89546886951e32035960aa82a15a343668

For backtrace, use StaticMutex instead of a raw sys Mutex.

view details

Mara Bos

commit sha e6d61ade9c1523dc2dd7cbd97206d6ebc5b5d481

Use slice_as_mut_ptr instead of first_ptr_mut. This function was renamed.

view details

Mara Bos

commit sha 0f26578f2e2e41c51279f3b2bd967785241d316d

Get rid of UnsafeCell<MaybeUninit>s in cloudabi mutex.

view details

Mara Bos

commit sha 41066beb4dd3a7618e1f7617d60704f5c4425bf7

Get rid of UnsafeCell in cloudabi rwlock.

view details

Mara Bos

commit sha 060e8cbaf1e3a57b97f96b13f702e04de4a5f1d3

Get rid of raw pointers and UnsafeCell in cloudabi condvar.

view details

push time in 3 days

Pull request review commentnrf-rs/nrf-hal

Add readme documentation for demos

 at your option. Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.++## Running the Demos++All the demos can be found in the examples folder and are completely independent cargo projects. Run them from within the respective project directories. E.g. to run `ccm-demo`, you must be in the `nrf-hal/examples/ccm-demo/` directory and run `cargo run`.++There are many ways to setup programming and debugging with a device. Here we will describe how to do this on the nRF52840-DK using [probe-rs](https://github.com/probe-rs/probe-rs). ++### Once off system setup++Install the cross compilation toolchain to target the device.+```+rustup target add thumbv7em-none-eabihf+```+Install the tools to program and run on the device. See [probe-rs](https://github.com/probe-rs/probe-rs) for more details on other required dependencies.+```+cargo install probe-run+```++### For every project++Setup your `.cargo/config` file (create one in the project root if it does not exist. E.g., `nrf-hal/examples/ccm-demo/.cargo/config`). This example will call the prope-run executable configured for the nrf52840 chip when you call `cargo run`:+```+[target.thumbv7em-none-eabihf]+runner = "probe-run --chip nRF52840_xxAA"++[build]+target = "thumbv7em-none-eabihf"+```+Setup the `Cargo.toml` file to use the correct features. Features allow for conditional compilation which is essential for a library like this that supports multiple different devices. Under the `[features]` section add the following line `default = ["52840"]` for the nRF52840-DK device. This is optional but it will allow you to simply call `cargo run` and `cargo build` instead of `cargo run --features 52840` and `cargo build --features 52840` respectively. Note that some demo projects do not have features so this step may not be necessary. If you get a whole bunch of compilation errors then check that you have set the default features correctly.++### To run++Plug in your device (on the nRF52840-DK it is the J2 usb port)+`cargo run`+This will flash the device, reset it and send `rprintln!` debug messages from the device to the terminal automatically.++## Summary of the Demos++Here follows a brief description of each demo for quick reference. For a more in-depth explanation on how the peripherals work please refer to the device reference manuals above and the comments in the demo code itself.++### blinky-button-demo (Hello World)++The blinky button demo. This demonstrates a simple hello world blinky application targeted at the ***nrf52832 chip*** which has different pinouts to the nRD52840-DK board. It is a useful exercise to experiment with what you need to change to get the same functionality working on the nrf52840 chip as this project does not use features to support multiple chips. This demo also introduces the cargo-embed tool which is an alternative to probe-run but part of the same family.++### ccm-demo (Encryption)++The cipher block chaining - message authentication code (CCM) mode demo. This demo initialises a text message of the maximum size of 251 bytes and encrypts and decrypts it, measuring the time it takes. It then repeats the process with smaller and smaller chunks of data to demonstrate how long smaller packets take to process.++### comp-demo (Analog Pins)++The comparator peripheral demo. This demo uses the comp peripheral to compare the differential voltages between two pins. If the voltage on Pin 30 is higher than Pin 31 (reference voltage) the built in LED will switch off otherwise it will switch on.++### ecb-demo (Encryption)++The AES electronic codebook mode encryption demo. Blocking 128-bit AES encryption of 16 bytes of data using a 16 byte key. Encryption only, no decryption.++### gpiote-demo (Digital Pins)++The General-Purpose Input Output Tasks and Events module demo. This demo targets the nRF52840-DK in particular because of the 4 available hardware buttons on the board itself. The demo shows how you can use the `cortex-m-rtic` crate to easily debounce some buttons without blocking the CPU. GPIO pin state changes fire events which can be used to carry out tasks. This showcases the PPI (programmable peripheral interconnect) system for which there is also a dedicated demo.++### i2s-controller-demo (Audio)++The Inter-IC Sound interface 'controller mode (aka master mode)' demo. This demo generates Morse code audio signals from text received over UART and plays them back over I2S. Tested with nRF52840-DK and a UDA1334a DAC. ++### i2s-peripheral-demo (Audio)++The Inter-IC Sound interface 'peripheral mode (aka slave mode)' demo. This demonstrates full duplex communication between a controller and peripheral mode I2S peripheral using the EasyDMA capabilities of the chip. ++### lpcomp-demo (Analog Pins)++The low power comparator demo. This demo shows how you would keep the device in low power mode and power it up when an analog voltage on a pin changes with respect to a voltage on a reference pin.++### ppi-demo (Channels)++The programmable peripheral interconnect (PPI) demo. The PPI allows peripherals to interact with each other without having to go through the CPU. Note that you need to choose a default feature in order for this demo to build. See above. This demo uses the Bluetooth RADIO peripheral as an example but does nothing special with Bluetooth itself so this is not the demo to learn about that capability.++### pwm-demo (Digital Pins)++The pulse width modulation demo. This demonstrates various PWM use cases by allowing the user to press buttons to change demo modes. This outputs PWM signals to the built in LEDs on the nRF52840-DK.++### qdec-demo (Sensor Decoding)++The quadrature decoder (QDEC) demo. This peripheral supports buffered decoding of quadrature-encoded sensor signals (typically used for mechanical and optical sensors). The demo shows how to use a rotary encoder to trigger an interrupt and update a variable by the amount of rotation. (nRF52840 + Bourns PEC11R rotary encoder)++### rtic-demo (Concurrency Framework)++The Real-Time Interrupt-driven Concurrency framework demo. Many of the demos in this project use RTIC and demonstrate its capabilities in more detail but this is a bare-bones default template for you to build off. RTIC is not unique to the nRF series but very useful for a program that requires concurrency. Unfortunately, this demo does not appear to use rtt for logging so it crashes when used with probe-run. However, it will work with other debuggers. See other demos for rtt logging setup.++### spi-demo (Digital Pins)++The serial peripheral interface master (SPIM) with EasyDMA demo. Sends some text out on the SPI peripheral and loops it back on itself to demonstrate full duplex direct-memory-access based SPI data transfer. You'll need a resistor to connect the output to the input. ++### twi-ssd1306 (Digital Pins)++I2C compatible Two-Wire Interface with the SSD1306 OLED Display demo. This demo uses the TWIM (Two-Wire Interface Master) peripheral along with the embedded_graphics library to draw "Hello Rust!" to an OLED screen. Note that you need to set a default feature to get this to compile (see "Running the demos" section).++### twim-demo (Digital Pins)++I2C compatible Two-Wire Interface Master mode demo. This demo uses the TWIM peripheral to read and write 8 bytes of data to arbitrary addresses on a device that is connected to the I2C pins p0_30 and p0_31. It demonstrates error handling if the device does not respond properly (or it is not connected).++### twis-demo (Digital Pins)++I2C compatible Two-Wire Interface Slave mode demo. This demo uses the twis peripheral with rtic to listen for I2C signals which are exposed as events. The event handler reads data from the peripheral at the address specified.++### wdt-demo (Timer)++Watchdog timer demo. This demonstrates the how the entire device can be set to automatically reset if certain conditions are not met within a certain period of time. In this case you have to press all 4 buttons at least once within a 5 second period to prevent a reset. If you mash the buttons for a while you will encounter an 'attempt to subtract with overflow' panic at `main.rs:205` which is ultimately cleared by the watchdog timer. This is intended demo behaviour ;)

I think the individual demo descriptions should go into the demo's directory. That keeps all information related to a demo in a single directory and makes it easier to update.

ninjasource

comment created time in 3 days

PullRequestReviewEvent

push eventnrf-rs/nrf-hal

Henrik Alsér

commit sha dbc28d058f4c77ccf650b8f3b06035b8bec1d256

Add port for gpiote task ouput pins on 52833 and 52840

view details

Jonas Schievink

commit sha 10367f195d7b1a021910b5b1b61db39a62fad4a4

Merge pull request #248 from kalkyl/gpiote-port Add port for gpiote task output pins (52833/52840)

view details

push time in 3 days

PR merged nrf-rs/nrf-hal

Add port for gpiote task output pins (52833/52840)

Resolves issue #238

+16 -0

0 comment

1 changed file

kalkyl

pr closed time in 3 days

Pull request review commentknurling-rs/defmt

remove common crate

 pub fn parse<'f>(format_string: &'f str) -> Result<Vec<Fragment<'f>>, Cow<'stati     Ok(fragments) } +impl Level {+    pub fn as_str(self) -> &'static str {+        match self {+            Level::Trace => "trace",+            Level::Debug => "debug",+            Level::Info => "info",+            Level::Warn => "warn",+            Level::Error => "error",+        }+    }++    // returns a list of features of which one has to be enabled for this Level to be active+    pub fn necessary_features(self, debug_assertions: bool) -> &'static [&'static str] {

This should maybe go into the macro crate, since it's only needed there

Lotterleben

comment created time in 3 days

PullRequestReviewEvent
PullRequestReviewEvent

startedunicode-org/icu4x

started time in 3 days

issue closedrust-lang/rust

path.ends_with can't work exactly. rust version 1.47 in windows

I tried following code, it can't work, returns false :

let path = Path::new("/etc/resolv.conf");
println!("path:{:?}", &path);
if path.ends_with(".conf") {
    println!("aa ok");
} else {
    println!("aa nok");
}
let s = path.to_str().unwrap();
if s.ends_with(".conf") {
    println!("ok");
} else {
    println!("nok");
}

print following contents: path:"/etc/resolv.conf" aa nok ok

Thanks!

closed time in 3 days

flyinmind

issue commentrust-lang/rust

path.ends_with can't work exactly. rust version 1.47 in windows

Path::ends_with checks path components, not substrings, so it will only return true if the argument is the last segment in the path. In your example, the last component is resolv.conf, not .conf.

Therefore, closing as expected behavior.

flyinmind

comment created time in 3 days

push eventknurling-rs/app-template

Jorge Aparicio

commit sha b1217af50926fa5258743571c710ec8f64f905bd

recommend installing flip-link from crates.io

view details

Jonas Schievink

commit sha 13cc13704ec13a8aa857d798371a4f91c9f0abe0

Merge pull request #15 from knurling-rs/flip-link-up recommend installing flip-link from crates.io

view details

push time in 3 days

PullRequestReviewEvent

issue closedrust-lang/rust

ICE: thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', compiler/rustc_middle/src/ty/mod.rs:893:14

<!-- Thank you for finding an Internal Compiler Error! 🧊 If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples.

http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/

-->

Code

fn sof<T>() -> T {}
fn test<T>() {
    let _: [u8; sof::<T>()];
}

Meta

<!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. -->

rustc --version --verbose:

rustc 1.49.0-nightly (adef9da30 2020-10-13)

binary: rustc

commit-hash: adef9da30f1ecbfeb81312d01ed94ac53f7161ba

commit-date: 2020-10-13

host: x86_64-unknown-linux-gnu

release: 1.49.0-nightly

LLVM version: 11.0

Error output

error[E0601]: `main` function not found in crate `reduced_mutant`
 --> reduced_mutant.rs:1:1
  |
1 | / fn sof<T>() -> T {}
2 | | fn test<T>() {
3 | |     let _: [u8; sof::<T>()];
4 | | }
  | |_^ consider adding a `main` function to `reduced_mutant.rs`

error[E0308]: mismatched types
 --> reduced_mutant.rs:1:16
  |
1 | fn sof<T>() -> T {}
  |    --- -       ^ expected type parameter `T`, found `()`
  |    |   |
  |    |   this type parameter
  |    implicitly returns `()` as its body has no tail or `return` expression
  |
  = note: expected type parameter `T`
                  found unit type `()`

error[E0277]: the size for values of type `T` cannot be known at compilation time
 --> reduced_mutant.rs:3:23
  |
1 | fn sof<T>() -> T {}
  |        - required by this bound in `sof`
2 | fn test<T>() {
  |         - this type parameter needs to be `Sized`
3 |     let _: [u8; sof::<T>()];
  |                       ^ doesn't have a size known at compile-time
  |
help: consider relaxing the implicit `Sized` restriction
  |
1 | fn sof<T: ?Sized>() -> T {}
  |         ^^^^^^^^

thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', compiler/rustc_middle/src/ty/mod.rs:893:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.49.0-nightly (dd7fc54eb 2020-10-15) running on x86_64-unknown-linux-gnu

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0277, E0308, E0601.
For more information about an error, try `rustc --explain E0277`.

<!-- Include a backtrace in the code block by setting RUST_BACKTRACE=1 in your environment. E.g. RUST_BACKTRACE=1 cargo build. --> <details><summary><strong>Backtrace</strong></summary> <p>

thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', compiler/rustc_middle/src/ty/mod.rs:893:14
stack backtrace:
   0: rust_begin_unwind
             at /rustc/dd7fc54ebdca419ad9d3ab1e9f5ed14e770768ea/library/std/src/panicking.rs:483:5
   1: core::panicking::panic_fmt
             at /rustc/dd7fc54ebdca419ad9d3ab1e9f5ed14e770768ea/library/core/src/panicking.rs:85:14
   2: core::panicking::panic_bounds_check
             at /rustc/dd7fc54ebdca419ad9d3ab1e9f5ed14e770768ea/library/core/src/panicking.rs:62:5
   3: rustc_middle::ty::Generics::param_at
   4: rustc_middle::ty::error::<impl rustc_middle::ty::context::TyCtxt>::note_and_explain_type_err
   5: rustc_infer::infer::error_reporting::<impl rustc_infer::infer::InferCtxt>::note_type_err
   6: rustc_infer::infer::error_reporting::<impl rustc_infer::infer::InferCtxt>::report_and_explain_type_error
   7: rustc_infer::infer::InferCtxt::report_mismatched_types
   8: rustc_typeck::check::demand::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::demand_coerce_diag
   9: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_coercable_to_type
  10: rustc_infer::infer::InferCtxtBuilder::enter
  11: rustc_typeck::check::typeck
  12: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  13: rustc_data_structures::stack::ensure_sufficient_stack
  14: rustc_query_system::query::plumbing::get_query_impl
  15: rustc_middle::ty::context::TyCtxt::typeck_opt_const_arg
  16: rustc_mir::const_eval::eval_queries::eval_to_allocation_raw_provider
  17: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::eval_to_allocation_raw>::compute
  18: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  19: rustc_data_structures::stack::ensure_sufficient_stack
  20: rustc_query_system::query::plumbing::get_query_impl
  21: rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider
  22: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::eval_to_const_value_raw>::compute
  23: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  24: rustc_data_structures::stack::ensure_sufficient_stack
  25: rustc_query_system::query::plumbing::get_query_impl
  26: rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider
  27: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::eval_to_const_value_raw>::compute
  28: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  29: rustc_data_structures::stack::ensure_sufficient_stack
  30: rustc_query_system::query::plumbing::get_query_impl
  31: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_global_id
  32: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_resolve
  33: <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_const
  34: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
  35: <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_ty
  36: rustc_data_structures::stack::ensure_sufficient_stack
  37: rustc_trait_selection::traits::project::normalize
  38: <rustc_infer::infer::InferCtxt as rustc_trait_selection::infer::InferCtxtExt>::partially_normalize_associated_types_in
  39: rustc_typeck::check::inherited::Inherited::normalize_associated_types_in
  40: <rustc_typeck::check::fn_ctxt::FnCtxt as rustc_typeck::astconv::AstConv>::normalize_ty
  41: <dyn rustc_typeck::astconv::AstConv>::ast_ty_to_ty_inner
  42: <rustc_typeck::check::gather_locals::GatherLocalsVisitor as rustc_hir::intravisit::Visitor>::visit_local
  43: rustc_hir::intravisit::walk_expr
  44: rustc_typeck::check::check::check_fn
  45: rustc_infer::infer::InferCtxtBuilder::enter
  46: rustc_typeck::check::typeck
  47: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck>::compute
  48: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  49: rustc_data_structures::stack::ensure_sufficient_stack
  50: rustc_query_system::query::plumbing::get_query_impl
  51: rustc_query_system::query::plumbing::ensure_query_impl
  52: rustc_typeck::check::typeck_item_bodies
  53: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck_item_bodies>::compute
  54: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  55: rustc_data_structures::stack::ensure_sufficient_stack
  56: rustc_query_system::query::plumbing::get_query_impl
  57: rustc_typeck::check_crate
  58: rustc_interface::passes::analysis
  59: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
  60: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  61: rustc_data_structures::stack::ensure_sufficient_stack
  62: rustc_query_system::query::plumbing::get_query_impl
  63: rustc_interface::passes::QueryContext::enter
  64: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  65: rustc_span::with_source_map
  66: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

</p> </details>

closed time in 3 days

chengniansun

issue commentrust-lang/rust

ICE: thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', compiler/rustc_middle/src/ty/mod.rs:893:14

Duplicate of https://github.com/rust-lang/rust/issues/43408

chengniansun

comment created time in 3 days

pull request commentrust-lang/rust

Reuse `item_children` query for `associated_item_def_ids`

@bors try @rust-timer queue

bugadani

comment created time in 3 days

issue commentrust-lang/rust

Incorrect "private type in public interface" diagnostic

This is currently working as expected. There were several RFCs related to privacy that have been proposed and/or accepted, but only partially implemented.

ayazhafiz

comment created time in 3 days

pull request commentrust-lang/rust

Create a single source scope for promoteds

@bors retry

tmiasko

comment created time in 4 days

pull request commentrust-lang/rust

Doc change: Change mention of `fnv` in HashMap as an alternative hasher to `aHash`

I'd rather not use libstd to promote hash functions that haven't seen much review, especially since aHash makes claims about DOS-resistance.

tkaitchuck

comment created time in 4 days

issue commentrust-lang/rust

Type mismatch when using constant with type_alias_impl_trait

cc https://github.com/rust-lang/rust/issues/77898, a similar issue

joshlf

comment created time in 4 days

issue commentrust-lang/rust

Type inference results in accessing a private type, causing a compilation error

The actual error happens on the definition of foo::bar:

warning: private type `foo::Private` in public interface (error E0446)
  --> src/lib.rs:12:5
   |
12 |     pub fn bar() -> impl AsRef<Private> {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(private_in_public)]` on by default
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
joshlf

comment created time in 4 days

issue commentrust-lang/rust

link: failed to static link to c++ library when global variable is used

For now, yes, that still won't work.

BusyJay

comment created time in 4 days

pull request commentrust-lang/rust

Fix typo in documentation

Thanks! @bors r+ rollup

strct

comment created time in 4 days

issue commentrust-lang/rust

link: failed to static link to c++ library when global variable is used

This seems to work fine now, as long as -C link-self-contained=no is used (or autodetected), so I've opened https://github.com/rust-lang/rust/pull/77901 to reenable the test.

BusyJay

comment created time in 4 days

pull request commentrust-lang/rust

Revert "Allow dynamic linking for iOS/tvOS targets."

If we don't find a workaround for those Cargo bugs that you can use, I think we should go ahead with the revert, since this is a stable regression affecting production users.

francesca64

comment created time in 4 days

issue commentrust-lang/rust

proc-macro receives warnings only when used within `macro_rules!` macros

The intended behavior of these lints is that they don't show up when the item was generated by a proc. macro, so the second example where it goes through a macro_rules! macro should also not display the lint.

taiki-e

comment created time in 4 days

issue commentrust-lang/rust

Error messages suggest lifetime annotations for stack references in some cases (E 106 instead of E 515)

The error is correct in that lifetime elision doesn't work with that function signature (the body of the function doesn't matter here, you always get that error)

skade

comment created time in 4 days

issue commentrust-embedded/cortex-m

Latest release of cortex-m-semihosting seems broken?

Yanked 0.4.0

korken89

comment created time in 4 days

issue commentrust-embedded/cortex-m

Latest release of cortex-m-semihosting seems broken?

Seems like cargo package doesn't include the right files here? We do have tests for cortex-m-semihosting and those worked fine prior to publishing.

What if we symlink cortex-m-semihosting/bin to ../bin? Will cargo package include the files?

korken89

comment created time in 4 days

issue commentrust-lang/cargo

Ability to set crate-type depending on target

People have also run into this issue when targeting iOS and Android: https://github.com/rust-lang/rust/pull/77716

fschutt

comment created time in 4 days

pull request commentrust-lang/rust

Fix link to foreign calling conventions

@bors r+ rollup

kraai

comment created time in 4 days

more