profile
viewpoint
David Wood davidtwco Huawei R&D, Edinburgh Programming Languages Group Edinburgh, Scotland https://davidtw.co A software engineer from Scotland, with an interest in systems software and open source software; member of the Rust compiler team.

davidtwco/ansi-c-exercises 14

@davidtwco does exercises from the C Programming Language, Second Edition by Brian Kernighan and Dennis Ritchie.

davidtwco/dotfiles 8

@davidtwco does dotfiles. Configurations for vim, tmux, zsh, bash, git, gpg and more.

autokrator-uog/project-and-dissertation 2

Central hub for project documentation and specifications, including final dissertation produced as coursework.

autokrator-uog/user-interface 1

React-based frontend for the financial platform, works with the BfaF to provide a user-friendly live interface to accounts, balances and transactions.

autokrator-uog/accounts-service 0

DEPRECATED: Java-based microservice for managing financial accounts, balances and acception/rejection of transactions.

autokrator-uog/actix-web 0

Actix web framework - fork with minor changes for use with Autokrator project.

autokrator-uog/backend 0

UI Backend (or BfaF/Backend-for-a-frontend) acts as a gateway between the user interface and the microservices, providing a unified API for interacting with the core services.

autokrator-uog/core 0

Autokrator application for Team Project 3 course at the University of Glasgow.

autokrator-uog/demo 0

Full financial platform orchestration and management for use in presenting demos.

autokrator-uog/jackie 0

Jackie is the reporting service that allows querying of Couchbase to extract information about past events.

Pull request review commentrust-lang/rust

fix(parse): return unpected when current token is EOF

 impl<'a> Parser<'a> {         } else if inedible.contains(&self.token.kind) {             // leave it in the input             Ok(false)+        } else if self.token.kind == token::Eof {+            self.expected_one_of_not_found(edible, inedible)         } else if self.last_unexpected_token_span == Some(self.token.span) {
        } else if self.token.kind != token::Eof && self.last_unexpected_token_span == Some(self.token.span) {

I think this is better, we avoid duplicating the content of the else block, which is the behaviour we want.

bvanjoi

comment created time in 24 days

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentrust-lang/rust

Restrict `From<S>` for `{D,Subd}iagnosticMessage`.

Apologies, didn't get to this quick enough, r=me once you've rebased - most of the changes will be trivial.

nnethercote

comment created time in a month

pull request commentrust-lang/rust

lint/ctypes: ext. abi fn-ptr in internal abi fn

@bors retry

python setuptools issue

davidtwco

comment created time in a month

pull request commentrust-lang/rust

Migrate `rustc_hir_analysis` to session diagnostic [Part 4]

@bors r+

obeis

comment created time in a month

PullRequestReviewEvent

pull request commentrust-lang/rust

lint/ctypes: ext. abi fn-ptr in internal abi fn

@bors r=jackh726

I think that suggestion is best left for a follow-up.

davidtwco

comment created time in a month

push eventdavidtwco/rust

Gary Guo

commit sha c5829c2ee544eb9931ce0d34f46b113b0a1e7f04

Fix new usage of old api

view details

Gary Guo

commit sha 2a9d710d999e629c064908076420635096eb39de

Bless tests

view details

Gary Guo

commit sha e06de16a8242ce55b84ad273de25c8d8696a9e4d

Add miri tests for terminate terminator

view details

Gary Guo

commit sha 04126398c227d3ba9994bbb303e6c2a26d9198b2

Ignore many tests on wasm32

view details

bors

commit sha ce3cb03927f711f653ae2937c10ba40a5ede62c7

Auto merge of #109961 - nikic:llvm-16.0.1, r=cuviper Update to LLVM 16.0.1 Update to current `release/16.x` branch. I've opted for a rebase to get rid of all our custom cherry-picks. Fixes #109775. r? `@cuviper`

view details

Philipp Krones

commit sha 04c387efe7bef9b071596a7a4004297bf9e3c77c

Merge remote-tracking branch 'upstream/master' into rustup

view details

Philipp Krones

commit sha fa425061e641429cc63fcd02b0c42694cd74dfc6

Bump nightly version -> 2023-04-06

view details

bors

commit sha 2b05f794e7d6c2d2edf2df107f94e23bafdeb1e8

Auto merge of #10602 - flip1995:rustup, r=flip1995 Rustup r? `@ghost` changelog: none

view details

Michael Schubart

commit sha b66aa09b951dace249fad3376c2d97c95d11b6a9

Add [`manual_slice_size_calculation`]

view details

SparrowLii

commit sha ded048398f36c6bc15c71b1be270cc91c418935e

add `dont_check_failure_status` option in the compiler test

view details

bors

commit sha 0534655d9b5f61dbd75cf142ec8d2d3f68b550ee

Auto merge of #108504 - cjgillot:thir-pattern, r=compiler-errors,Nilstrieb Check pattern refutability on THIR The current `check_match` query is based on HIR, but partially re-lowers HIR into THIR. This PR proposed to use the results of the `thir_body` query to check matches, instead of re-building THIR. Most of the diagnostic changes are spans getting shorter, or commas/semicolons not getting removed. This PR degrades the diagnostic for confusing constants in patterns (`let A = foo()` where `A` resolves to a `const A` somewhere): it does not point ot the definition of `const A` any more.

view details

Michael Schubart

commit sha b47a322ef11e541231b18c67dfe133dac8764b11

Add tests suggested by @llogiq

view details

bors

commit sha de5c6d6b1ed50246cf3d5c93b8d6e0b467dfbddf

Auto merge of #10594 - J-ZhengLi:issue9824, r=Jarcho fix [`mem_replace_option_with_none`] not considering field variables fixes: #9824 --- changelog: fix [`mem_replace_option_with_none`] not considering field variables

view details

klensy

commit sha 40b6095e88926801e002221d09e53f97cfb732f3

bump few deps

view details

bors

commit sha f5b8f44e5d5dee0f60cec1729b5a107659779d94

Auto merge of #109333 - Zoxc:erase-query-cache-values, r=cjgillot Erase query cache values This replaces most concrete query values `V` with `MaybeUninit<[u8; { size_of::<V>() }]>` without introducing dynamic dispatch like https://github.com/rust-lang/rust/pull/108638 does. This is split out of https://github.com/rust-lang/rust/pull/108638 so the performance impact of only this change can be measured. r? `@cjgillot`

view details

Matthias Krüger

commit sha 3e21d6875f90eb0bc12833f73f56ec30cad6c1bd

Rollup merge of #109395 - chenyukang:yukang/fix-109291, r=cjgillot Fix issue when there are multiple candidates for edit_distance_with_substrings Fixes #109291

view details

Matthias Krüger

commit sha c86c9339e6991dbf9a9a4ae210492e94b142a728

Rollup merge of #109755 - compiler-errors:new-solver-generator-witness-mir, r=cjgillot Implement support for `GeneratorWitnessMIR` in new solver r? ```@cjgillot``` I mostly want this to cut down the number of failing UI tests when running the UI test suite with `--compare-mode=next-solver`, but there doesn't seem like much reason to block implementing this since it adds minimal complexity to the existing structural traits impl in the new solver. If others are against adding this for some reason, then maybe we should just make `GeneratorWitnessMIR` return `NoSolution` for these traits. Anything but an ICE please :smile_cat: :ice_cube:

view details

Matthias Krüger

commit sha b153e2bd122ab5993fa9837a81b7647266ae6178

Rollup merge of #109782 - WaffleLapkin:nocommawhenremovingarguments, r=oli-obk Don't leave a comma at the start of argument list when removing arguments Fixes #109425 Quite a dirty hack, but at least it works ig.

view details

Matthias Krüger

commit sha 08ab38a7036da7a014afc899c5a741e967f45a49

Rollup merge of #109977 - notriddle:notriddle/data-nosnippet, r=jsha,the8472 rustdoc: avoid including line numbers in Google SERP snippets ![image](https://user-images.githubusercontent.com/1593513/230141184-9171c8e0-de92-48e6-85b6-8baee35e6d86.png)

view details

Matthias Krüger

commit sha dbc2941c15db37bc4da07ae1df52045efe0f85c9

Rollup merge of #109980 - xfix:derive-string-partialeq, r=scottmcm Derive String's PartialEq implementation

view details

push time in a month

delete branch davidtwco/thorin

delete branch : release-0.6.0

delete time in a month

pull request commentrust-lang/rust

remove unused ftl messages

does it make sense to check via tidy that there exist no ftl message names which are never mentioned in compiler/**.rs

It does, I've opened #110754 to track that.

lcnr

comment created time in a month

issue openedrust-lang/rust

Unused Fluent messages lint

Inspired by #110597 - we should add a check for unused Fluent messages.

created time in a month

pull request commentrust-lang/rust

Restrict `From<S>` for `{D,Subd}iagnosticMessage`.

idk. Let's wait for @davidtwco to chime in.

Even if that is the goal, we may want to just wait until we got rid of all the manual diagnostics creation sites, so we can just fix it in the derives and not have to touch everything everywhere at once.

Apologies for the delay in getting to this - I like this change. Longer-term, we can get rid of manual diagnostic creation sites and this isn't so necessary, but there's still a lot to do before we get to that and I think this is a worthwhile improvement in the meantime.

nnethercote

comment created time in a month

PR opened rust-lang/thorin

release version 0.6.0

Includes all changes since f5c2c3c:

  • f3a1f5e Reexport object
  • 343aaaa Update object to 0.31.0
+5 -5

0 comment

4 changed files

pr created time in 2 months

push eventdavidtwco/thorin

David Wood

commit sha 534eebe93a977e07093e3bb91cbd4b9810ea1205

release version 0.6.0 Includes all changes since f5c2c3c: - f3a1f5e Reexport `object` - 343aaaa Update object to 0.31.0 Signed-off-by: David Wood <david.wood@huawei.com>

view details

push time in 2 months

create barnchdavidtwco/thorin

branch : release-0.6.0

created branch time in 2 months

pull request commentrust-lang/rfcs

The `#[diagnostic]` attribute namespace

@rfcbot resolved translation

weiznich

comment created time in 2 months

Pull request review commentrust-lang/rust

Uplift `clippy::{drop,forget}_{ref,copy}` lints

+use rustc_hir::{Arm, Expr, ExprKind, Node};+use rustc_span::sym;++use crate::{+    lints::{DropCopyDiag, DropRefDiag, ForgetCopyDiag, ForgetRefDiag},+    LateContext, LateLintPass, LintContext,+};++declare_lint! {+    /// The `drop_ref` lint checks for calls to `std::mem::drop` with a reference+    /// instead of an owned value.+    ///+    /// ### Example+    ///+    /// ```rust+    /// # fn operation_that_requires_mutex_to_be_unlocked() {} // just to make it compile+    /// # let mutex = std::sync::Mutex::new(1); // just to make it compile+    /// let mut lock_guard = mutex.lock();+    /// std::mem::drop(&lock_guard); // Should have been drop(lock_guard), mutex+    /// // still locked+    /// operation_that_requires_mutex_to_be_unlocked();+    /// ```+    ///+    /// {{produces}}+    ///+    /// ### Explanation+    ///+    /// Calling `drop` on a reference will only drop the+    /// reference itself, which is a no-op. It will not call the `drop` method (from+    /// the `Drop` trait implementation) on the underlying referenced value, which+    /// is likely what was intended.+    pub DROP_REF,+    Warn,+    "calls to `std::mem::drop` with a reference instead of an owned value"+}++declare_lint! {+    /// The `forget_ref` lint checks for calls to `std::mem::forget` with a reference+    /// instead of an owned value.+    ///+    /// ### Example+    ///+    /// ```rust+    /// let x = Box::new(1);+    /// std::mem::forget(&x); // Should have been forget(x), x will still be dropped+    /// ```+    ///+    /// {{produces}}+    ///+    /// ### Explanation+    ///+    /// Calling `forget` on a reference will only forget the+    /// reference itself, which is a no-op. It will not forget the underlying+    /// referenced value, which is likely what was intended.+    pub FORGET_REF,+    Warn,+    "calls to `std::mem::forget` with a reference instead of an owned value"+}++declare_lint! {+    /// The `drop_copy` lint checks for calls to `std::mem::drop` with a value+    /// that derives the Copy trait.+    ///+    /// ### Example+    ///+    /// ```rust+    /// let x: i32 = 42; // i32 implements Copy+    /// std::mem::drop(x); // A copy of x is passed to the function, leaving the+    ///                    // original unaffected+    /// ```+    ///+    /// {{produces}}+    ///+    /// ### Explanation+    ///+    /// Calling `std::mem::drop` [does nothing for types that+    /// implement Copy](https://doc.rust-lang.org/std/mem/fn.drop.html), since the+    /// value will be copied and moved into the function on invocation.+    pub DROP_COPY,+    Warn,+    "calls to `std::mem::drop` with a value that implements Copy"+}++declare_lint! {+    /// The `forget_copy` lint checks for calls to `std::mem::forget` with a value+    /// that derives the Copy trait.+    ///+    /// ### Example+    ///+    /// ```rust+    /// let x: i32 = 42; // i32 implements Copy+    /// std::mem::forget(x); // A copy of x is passed to the function, leaving the+    ///                      // original unaffected+    /// ```+    ///+    /// {{produces}}+    ///+    /// ### Explanation+    ///+    /// Calling `std::mem::forget` [does nothing for types that+    /// implement Copy](https://doc.rust-lang.org/std/mem/fn.drop.html) since the+    /// value will be copied and moved into the function on invocation.+    ///+    /// An alternative, but also valid, explanation is that Copy types do not+    /// implement the Drop trait, which means they have no destructors. Without a+    /// destructor, there is nothing for `std::mem::forget` to ignore.+    pub FORGET_COPY,+    Warn,+    "calls to `std::mem::forget` with a value that implements Copy"+}++declare_lint_pass!(DropForgetUseless => [DROP_REF, FORGET_REF, DROP_COPY, FORGET_COPY]);++impl<'tcx> LateLintPass<'tcx> for DropForgetUseless {+    fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) {+        if let ExprKind::Call(path, [arg]) = expr.kind+            && let ExprKind::Path(ref qpath) = path.kind+            && let Some(def_id) = cx.qpath_res(qpath, path.hir_id).opt_def_id()+            && let Some(fn_name) = cx.tcx.get_diagnostic_name(def_id)+        {+            let arg_ty = cx.typeck_results().expr_ty(arg);+            let is_copy = arg_ty.is_copy_modulo_regions(cx.tcx, cx.param_env);+            let drop_is_single_call_in_arm = is_single_call_in_arm(cx, arg, expr);+            match fn_name {+                sym::mem_drop if arg_ty.is_ref() && !drop_is_single_call_in_arm => {+                    cx.emit_spanned_lint(DROP_REF, expr.span, DropRefDiag { arg_ty, label: arg.span });+                },+                sym::mem_forget if arg_ty.is_ref() => {+                    cx.emit_spanned_lint(FORGET_REF, expr.span, ForgetRefDiag { arg_ty, label: arg.span });+                },+                sym::mem_drop if is_copy && !drop_is_single_call_in_arm => {+                    cx.emit_spanned_lint(DROP_COPY, expr.span, DropCopyDiag { arg_ty, label: arg.span });+                }+                sym::mem_forget if is_copy => {+                    cx.emit_spanned_lint(FORGET_COPY, expr.span, ForgetCopyDiag { arg_ty, label: arg.span });+                }+                _ => return,+            };+        }+    }+}++// dropping returned value of a function like in the following snippet is considered idiomatic, see+// clippy#9482 for examples match <var> {+//     <pat> => drop(fn_with_side_effect_and_returning_some_value()),+//     ..+// }
// Dropping returned value of a function, as in the following snippet is considered idiomatic, see
// rust-lang/clippy#9482 for examples.
//
// ```
// match <var> {
//     <pat> => drop(fn_with_side_effect_and_returning_some_value()),
//     ..
// }
// ```
Urgau

comment created time in 2 months

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentrust-lang/rust

Report allocation errors as panics

@bors r+

Amanieu

comment created time in 2 months

pull request commentrust-lang/rust

Add `rustc_fluent_macro` to decouple fluent from `rustc_macros`

r? @davidtwco @bors r+

Nilstrieb

comment created time in 2 months

PullRequestReviewEvent

Pull request review commentrust-lang/rust

Add GNU Property Note

 pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static         _ => elf::ELFOSABI_NONE,     };     let abi_version = 0;+    // check bti protection+    let mut check_cfprotection = false;+    let mut pr_type: u32 = 0;+    if architecture == Architecture::X86_64+        && matches!(+            sess.opts.unstable_opts.cf_protection,+            rustc_session::config::CFProtection::Branch | rustc_session::config::CFProtection::Full+        )+    {+        check_cfprotection = true;+        pr_type = 0xc0000002;+    }+    if architecture == Architecture::Aarch64 && sess.opts.unstable_opts.branch_protection.is_some()+    {+        check_cfprotection = true;+        pr_type = 0xc0000000;+    }+    if check_cfprotection && binary_format == BinaryFormat::Elf {+        let segment: Vec<u8> = file.segment_name(StandardSegment::Data).to_vec();+        let name: Vec<u8> = b".note.gnu.property".to_vec();+        let kind = SectionKind::Note;+        let section = file.add_section(segment, name, kind);+        let mut data: Vec<u8> = Vec::new();+        let n_namsz: u32 = 4; // Size of the n_name field+        let n_descsz: u32 = 16; // Size of the n_desc field+        let n_type: u32 = NT_GNU_PROPERTY_TYPE_0; // Type of note descriptor+        let values = [n_namsz, n_descsz, n_type];+        values.map(|v| data.extend_from_slice(&(v.to_ne_bytes())));+        data.push(b'G'); // Owner of the program property note+        data.push(b'N');+        data.push(b'U');+        data.push(0);+        let pr_datasz: u32 = 4; //size of the pr_data field
        let pr_datasz: u32 = 4; // Size of the pr_data field

nit

cchiw

comment created time in 2 months

Pull request review commentrust-lang/rust

Add GNU Property Note

 pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static         _ => elf::ELFOSABI_NONE,     };     let abi_version = 0;+    // check bti protection+    let mut check_cfprotection = false;+    let mut pr_type: u32 = 0;+    if architecture == Architecture::X86_64+        && matches!(+            sess.opts.unstable_opts.cf_protection,+            rustc_session::config::CFProtection::Branch | rustc_session::config::CFProtection::Full+        )+    {+        check_cfprotection = true;+        pr_type = 0xc0000002;+    }+    if architecture == Architecture::Aarch64 && sess.opts.unstable_opts.branch_protection.is_some()+    {+        check_cfprotection = true;+        pr_type = 0xc0000000;+    }+    if check_cfprotection && binary_format == BinaryFormat::Elf {+        let segment: Vec<u8> = file.segment_name(StandardSegment::Data).to_vec();+        let name: Vec<u8> = b".note.gnu.property".to_vec();+        let kind = SectionKind::Note;+        let section = file.add_section(segment, name, kind);+        let mut data: Vec<u8> = Vec::new();+        let n_namsz: u32 = 4; // Size of the n_name field+        let n_descsz: u32 = 16; // Size of the n_desc field+        let n_type: u32 = NT_GNU_PROPERTY_TYPE_0; // Type of note descriptor+        let values = [n_namsz, n_descsz, n_type];+        values.map(|v| data.extend_from_slice(&(v.to_ne_bytes())));+        data.push(b'G'); // Owner of the program property note+        data.push(b'N');+        data.push(b'U');+        data.push(0);+        let pr_datasz: u32 = 4; //size of the pr_data field+        let pr_data: u32 = 3; //program property descriptor+        let pr_padding: u32 = 3;+        let values = [pr_type, pr_datasz, pr_data, pr_padding];+        values.map(|v| data.extend_from_slice(&(v.to_ne_bytes())));+        let x = data.len();+        assert_eq!(x, 32);+        let align = 4;+        file.append_section_data(section, &data, align);+    }

I think it would be slightly tidier if the logic here was split out into its own function and just invoked here.

cchiw

comment created time in 2 months

PullRequestReviewEvent

Pull request review commentrust-lang/rust

Add GNU Property Note

 pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static         _ => elf::ELFOSABI_NONE,     };     let abi_version = 0;+    // check bti protection+    let mut check_cfprotection = false;+    let mut pr_type: u32 = 0;+    if architecture == Architecture::X86_64+        && matches!(+            sess.opts.unstable_opts.cf_protection,+            rustc_session::config::CFProtection::Branch | rustc_session::config::CFProtection::Full+        )+    {+        check_cfprotection = true;+        pr_type = 0xc0000002;+    }+    if architecture == Architecture::Aarch64 && sess.opts.unstable_opts.branch_protection.is_some()+    {+        check_cfprotection = true;+        pr_type = 0xc0000000;+    }+    if check_cfprotection && binary_format == BinaryFormat::Elf {+        let segment: Vec<u8> = file.segment_name(StandardSegment::Data).to_vec();+        let name: Vec<u8> = b".note.gnu.property".to_vec();+        let kind = SectionKind::Note;+        let section = file.add_section(segment, name, kind);+        let mut data: Vec<u8> = Vec::new();+        let n_namsz: u32 = 4; // Size of the n_name field+        let n_descsz: u32 = 16; // Size of the n_desc field+        let n_type: u32 = NT_GNU_PROPERTY_TYPE_0; // Type of note descriptor+        let values = [n_namsz, n_descsz, n_type];+        values.map(|v| data.extend_from_slice(&(v.to_ne_bytes())));+        data.push(b'G'); // Owner of the program property note+        data.push(b'N');+        data.push(b'U');+        data.push(0);+        let pr_datasz: u32 = 4; //size of the pr_data field+        let pr_data: u32 = 3; //program property descriptor
        let pr_data: u32 = 3; // Program property descriptor

nit

cchiw

comment created time in 2 months

PullRequestReviewEvent

pull request commentrust-lang/rfcs

The `#[diagnostic]` attribute namespace

Since the RFC discusses the details of #[diagnostic::on_umimplemented]..

@rfcbot concern translation

It would be good if we had an approach for translation support (like rust-lang/rust#100717) in mind for diagnostics in this namespace, so that eventually we can support users providing translations of their diagnostics.

weiznich

comment created time in 2 months

pull request commentrust-lang/rust

Migrate diagnostics in `rustc_borrowck`

@bors r+

AndyJado

comment created time in 2 months

more