profile
viewpoint

sinkuu/atom-susave 3

Atom package to save a file as super user

sinkuu/api-guidelines 2

Rust API guidelines

sinkuu/atom-language-rust 0

Rust language support in Atom

sinkuu/cargo 0

The Rust package manager

sinkuu/cargo-edit 0

A utility for managing cargo dependencies from the command line.

sinkuu/cargo-fuzz 0

Command line helpers for fuzzing

sinkuu/cargo-outdated 0

A cargo subcommand for displaying when Rust dependencies are out of date

sinkuu/cargo-update 0

A cargo subcommand for checking and applying updates to installed executables

sinkuu/cccd 0

tool for calculating cyclomatic complexity of D sources

create barnchsinkuu/yourbin

branch : master

created branch time in 10 hours

created repositorysinkuu/yourbin

created time in 10 hours

Pull request review commentrust-lang/cargo

Clean up code mostly based on clippy suggestions

 impl Platform {                             )),                         _ => (),                     },-                    Cfg::KeyPair(name, _) => match name.as_str() {-                        "feature" =>-                            warnings.push(String::from(-                                "Found `feature = ...` in `target.'cfg(...)'.dependencies`. \-                                 This key is not supported for selecting dependencies \-                                 and will not work as expected. \-                                 Use the [features] section instead: \-                                 https://doc.rust-lang.org/cargo/reference/features.html"-                            )),-                        _ => (),+                    Cfg::KeyPair(name, _) => if name.as_str() == "feature"{
                    Cfg::KeyPair(name, _) => if name.as_str() == "feature" {
aleksator

comment created time in a day

PR opened rust-lang/rust-clippy

redundant_clone: Migrate to new dataflow framework

Migration to the new dataflow framework is ongoing in rustc. This PR updates the dataflow impl in redundant_clone lint.


changelog: none

+40 -49

0 comment

1 changed file

pr created time in 3 days

push eventsinkuu/rust-clippy

Ian Kronquist

commit sha 5c31efd429e361947b7c54252145261a141c284e

Typo in literal_representation.rs Octal numbers can't have 8 in them ;)

view details

Ian Kronquist

commit sha b13f4e4fafa59402be86f377e360cba215818f8a

Update literal_representation.rs

view details

Ian Kronquist

commit sha aef266289680ba39b41fd1e3333b572c84bc67aa

Update literal_representation.rs

view details

flip1995

commit sha 5e03d5bb067db8ea03e0bb75471fe40daf64f55b

Sort versions in json output

view details

flip1995

commit sha 2044931cbe2ad7229eebd6cc044a73ad3dd244af

Better version ordering of documentation

view details

flip1995

commit sha 0533cff125d89e15bfda0a265ef01b1b33d8cd95

Use python3 instead of python This changes the formatting a bit of json.dump(..)

view details

flip1995

commit sha 0f7918266fa4f4a50237c8bdac79cb1e3001d86c

Rename current -> stable

view details

bors

commit sha bdd4046f01ead4a1581f5cb1c3c634db6567772d

Auto merge of #5171 - flip1995:deploy, r=Manishearth Improve deployment and documentation **This should be merged shortly after** #5172 This extracts the python code that generated the `versions.json` file and now sorts the versions. in addition to that it improves the order on the website, respecting the new `rust-*` directories. The new appearance of the documentation site can be previewed here: https://flip1995.github.io/rust-clippy/ changelog: Add documentation for Clippy stable releases at https://rust-lang.github.io/rust-clippy/

view details

flip1995

commit sha 560559bafe1d61bca3d815ce80c53ae2d48e1829

Make Lint::by_lint_group take impl Iterator as argument

view details

flip1995

commit sha 3da2c9183a19c6f11e8bd61f16d03b6830eb3eec

Save Lint::module as full path of module

view details

flip1995

commit sha 4a9bfe41841ad7299174832cbad450625ef5fc58

Let update_lints also generate the internal lints

view details

flip1995

commit sha 2635a602bc62928fc44b3c7d7c439eb4c788f552

Update some documentation

view details

flip1995

commit sha 07026983f5e46ac5c5caf2dc86014a83297a0c4f

Rename lint_count -> usable_lint_count

view details

flip1995

commit sha 50a2f971fcfb1156dd6bad37f88ba7e651390714

Adapt gen_lint_group_list test to also generate internal lints

view details

bors

commit sha 933a0a9ad59125a35c49c2da910cf2a55f88dc2c

Auto merge of #5156 - flip1995:dev_add_internal, r=phansch Let update_lints also generate the internal lints r? @phansch changelog: none

view details

bors

commit sha 779b6aeaa62d7d832bb791c7d92ed11d43f4873a

Auto merge of #4809 - iankronquist:patch-1, r=flip1995 Typo in literal_representation.rs Octal numbers can't have 8 in them ;) changelog: none

view details

Matthew Jasper

commit sha 787398aa53ef633d67433e6e89c14590b54fa4af

Avoid using regions from `TypeckTables` These regions will all be `ReErased` soon.

view details

bors

commit sha 578960d61dbc01ff2db05ea818e41414a7acc12e

Auto merge of #5177 - matthewjasper:own-infer, r=flip1995 Avoid using regions from `TypeckTables` These regions will all be `ReErased` soon. (rust-lang/rust#69189) changelog: none

view details

Yuki Okushi

commit sha 4480ec5b71c4fb1c58cf5235217cf61df88bd73d

Rustup to rust-lang/rust#67953

view details

Yuki Okushi

commit sha 09165ff5761bb1f397e37ee2d32d96adf7afdd86

Don't lint `single_component_path_imports` in macros

view details

push time in 3 days

delete branch sinkuu/rust-analyzer

delete branch : fix_non_ascii

delete time in 3 days

push eventsinkuu/rust-analyzer

Shotaro Yamada

commit sha d06733efebc5d8b378398f1cbb4bbd9f3deb8270

Cleanup

view details

push time in 3 days

push eventsinkuu/rust-analyzer

Shotaro Yamada

commit sha 01344d9db3dec2ab6fdc11003109d8ed848d8cb7

Cleanup

view details

push time in 3 days

PR opened rust-analyzer/rust-analyzer

Fix a crash with non-ascii whitespace in doc-comments

2nd commit is a random drive-by cleanup.

+22 -9

0 comment

5 changed files

pr created time in 3 days

push eventsinkuu/rust-analyzer

Shotaro Yamada

commit sha d06733efebc5d8b378398f1cbb4bbd9f3deb8270

Cleanup

view details

push time in 3 days

create barnchsinkuu/rust-analyzer

branch : fix_non_ascii

created branch time in 3 days

startedjgthms/bulma

started time in 4 days

startedFortAwesome/react-fontawesome

started time in 7 days

startedrust-lang/futures-rs

started time in 8 days

delete branch sinkuu/rust-clippy

delete branch : redundant_clone_maintainance

delete time in 8 days

create barnchsinkuu/rust-clippy

branch : redundant_clone_maintainance

created branch time in 8 days

create barnchsinkuu/rust-clippy

branch : redundant_clone_df

created branch time in 8 days

startedkoute/stdweb

started time in 11 days

startedipld/specs

started time in 13 days

Pull request review commentrust-lang/rust-clippy

Minor edit to text region replacement

 lazy_static! {     )     .unwrap();     static ref NL_ESCAPE_RE: Regex = Regex::new(r#"\\\n\s*"#).unwrap();-    pub static ref DOCS_LINK: String = "https://rust-lang.github.io/rust-clippy/master/index.html".to_string(); } +pub static DOCS_LINK: &str = "https://rust-lang.github.io/rust-clippy/master/index.html";

Why not const?

lzutao

comment created time in 15 days

delete branch sinkuu/rust-libp2p

delete branch : doc

delete time in 16 days

pull request commentrust-lang/rust

Remove `RefCell` usage from `ObligationForest`.

Is there even the need for mem::take? compress is the only method that uses self.node_rewrites, and the method does not recurse. Unless I'm missing something, I think you can just use self.node_rewrites instead of moving it to a local and back.

nnethercote

comment created time in 16 days

Pull request review commentrust-lang/rust-clippy

[WIP] - new lint: using `let mut a = a` at start of function

+use rustc_lint::{EarlyLintPass, EarlyContext};+use rustc_session::{declare_lint_pass, declare_tool_lint};+use syntax::ast::*;+use syntax::visit::FnKind;+use rustc_span::Span;+use rustc_errors::DiagnosticBuilder;+use crate::utils::{span_lint_and_then, multispan_sugg};+use if_chain::if_chain;++declare_clippy_lint! {+    /// **What it does:** checks if any fn parameters have been assigned to a local mutable+    /// variable.+    ///+    /// **Why is this bad?** reduces the complexity of the code by removing a redundant local+    /// mutable variable.+    ///+    /// **Known problems:** None.+    ///+    /// **Example:**+    ///+    /// ```rust+    /// fn f(a: Vec<bool>) {+    ///     let mut a = a;+    ///     // rest of code+    /// }+    /// ```+    /// +    /// could be defined as +    ///+    /// ```rust+    /// fn f(mut a: Vec<bool>) {+    ///     // rest of code+    /// }+    /// ```+    pub FN_PARAM_REDEF_AS_MUTABLE,

bikeshedding: I think we usually call them variable "bindings" rather than "definitions". So, this can be named FN_PARAM_REBIND_AS_MUT.

sonng

comment created time in 16 days

delete branch sinkuu/rust-libp2p

delete branch : undeps

delete time in 17 days

push eventsinkuu/rust-libp2p

Shotaro Yamada

commit sha 0d93a4eae4f36b97734549efa5cdb2f22dc3a310

Remove unused dependencies

view details

push time in 17 days

PR opened libp2p/rust-libp2p

Remove unused dependencies
+0 -9

0 comment

6 changed files

pr created time in 17 days

create barnchsinkuu/rust-libp2p

branch : undeps

created branch time in 17 days

PR opened libp2p/rust-libp2p

Fix copy-paste error in doc string

It seems they were copied from Identify and left unchanged.

+2 -4

0 comment

2 changed files

pr created time in 17 days

create barnchsinkuu/rust-libp2p

branch : doc

created branch time in 17 days

pull request commentrust-lang/rust

Use BufWriter for emitting MIR

Squashed.

sinkuu

comment created time in 21 days

push eventsinkuu/rust

Charles Gleason

commit sha 293cdf7ac5d14811debdec3408afde104935caef

Make RangeMut::next_unchecked() output a mutable key reference

view details

Charles Gleason

commit sha f547978392872684085c96a3d5c1d00bad24b724

Implement clone_from for BTree collections

view details

Charles Gleason

commit sha 8651aa066fdbbcfaa082531969469c3fa289de9e

Add test for BTreeMap::clone_from

view details

Markus Westerlind

commit sha a5657dbc43d84133bd95e5de178d68634973b1b3

perf: Avoid creating a SmallVec if nothing changes during a fold Not sure if this helps but in theory it should be less work than what the current micro optimization does for `ty::Predicate` lists. (It would explain the overhead I am seeing from `perf`.)

view details

Markus Westerlind

commit sha 898ed636a3f44e3aa0156c1bb5ebc86b08aef5fa

Fix copy_from_slice which should be extend_from_slice

view details

Thom Chiovoloni

commit sha 6a7a69bde9813ac2868f36a01567c633ed6cd023

Add {leading,trailing}_ones to primitive int types

view details

Thom Chiovoloni

commit sha 2330e325ccee2e91d7aec6c0d4068748619bf588

Tests for leading_trailing_ones

view details

Markus Westerlind

commit sha a1586f1d2b17d687444d3b94aedd7ce24ae074ed

Explain fold_list

view details

CAD97

commit sha f76177ce4376ea15b1b303da347e8f653679cf88

Stabilize ptr::slice_from_raw_parts[_mut]

view details

Thom Chiovoloni

commit sha 783a7dc8ed03a38910b9ea5ded11139616dfa67b

Mark leading_trailing_ones with tracking issue 57969

view details

Jorge Aparicio

commit sha 470cdf54ac9acee20ab8da46ef7899bae9f58f29

add bare metal ARM Cortex-A targets to rustc -> `rustc --target armv7-none-eabi` will work also build rust-std (rustup) components for them -> `rustup target add armv7-none-eabi` will work

view details

CAD97

commit sha 1c0d4851a6a686d09b03fab575fb0847d1e9f665

Fix incorrect slice->ptr conversion in slice_from_raw_parts docs

view details

csmoe

commit sha 42b6ed13be779499d118af721913a66bd3d946ea

account temporary borrow by raw-ptr

view details

csmoe

commit sha cd7b5edc2cac3fa0db6b464a6e94edd8f334274d

update test ui for raw-ptr borrow inside generator

view details

Tobias Kortkamp

commit sha de388032555b697d1b0ef197241886ab90ac39b2

Add -Wl,-znotext to default linker flags to link with lld 9 on FreeBSD 13.0-CURRENT i386 rust-nightly has been failing to link since 2019-12-10 with variations of ``` = note: ld: error: relocation R_386_PC32 cannot be used against symbol __rust_probestack; recompile with -fPIC >>> defined in /wrkdirs/usr/ports/lang/rust-nightly/work/rustc-nightly-src/build/i686-unknown-freebsd/stage1/lib/rustlib/i686-unknown-freebsd/lib/libcompiler_builtins-6570a75fe85f0e1a.rlib(compiler_builtins-6570a75fe85f0e1a.compiler_builtins.2i519eqi-cgu.15.rcgu.o) >>> referenced by std.4xivr03c-cgu.14 >>> std-9bd70afd58e204b7.std.4xivr03c-cgu.14.rcgu.o:(_$LT$alloc..boxed..Box$LT$F$GT$$u20$as$u20$core..ops..function..FnOnce$LT$A$GT$$GT$::call_once::h1c78ed6e734a2bfc (.llvm.10122419023709863394)) in archive /wrkdirs/usr/ports/lang/rust-nightly/work/rustc-nightly-src/build/i686-unknown-freebsd/stage1/lib/rustlib/i686-unknown-freebsd/lib/libstd-9bd70afd58e204b7.rlib ld: error: relocation R_386_PC32 cannot be used against symbol __rust_probestack; recompile with -fPIC >>> defined in /wrkdirs/usr/ports/lang/rust-nightly/work/rustc-nightly-src/build/i686-unknown-freebsd/stage1/lib/rustlib/i686-unknown-freebsd/lib/libcompiler_builtins-6570a75fe85f0e1a.rlib(compiler_builtins-6570a75fe85f0e1a.compiler_builtins.2i519eqi-cgu.15.rcgu.o) >>> referenced by std.4xivr03c-cgu.14 >>> std-9bd70afd58e204b7.std.4xivr03c-cgu.14.rcgu.o:(std::io::util::copy::h9115f048f2203467) in archive /wrkdirs/usr/ports/lang/rust-nightly/work/rustc-nightly-src/build/i686-unknown-freebsd/stage1/lib/rustlib/i686-unknown-freebsd/lib/libstd-9bd70afd58e204b7.rlib clang-cpp: error: linker command failed with exit code 1 (use -v to see invocation) error: aborting due to previous error error: could not compile `rustc_macros`. ``` Full log: http://beefy17.nyi.freebsd.org/data/head-i386-default/p523508_s356869/logs/rust-nightly-1.42.0.20200118.log AFAICT it stopped building after bumping compiler_builtins to 0.1.22 in https://github.com/rust-lang/rust/pull/67110.

view details

Tianjiao Huang

commit sha d336e593cc07139468c8f6f12b929e80ae365159

Fix invalid link to C++ Exception Handling ABI documentation

view details

Yuki Okushi

commit sha 2ecc48ffa17d55ec02f3beb5bb17c718cb439202

Fix ICE #68025

view details

Yuki Okushi

commit sha 0017f495783324b036ffcaafedf7881725ba1e02

Replace `walk_callee` with `consume_expr`

view details

Jorge Aparicio

commit sha a3a077610028c773bffc7a74e6a15faa10d2360d

Merge branch 'master' into bare-metal-cortex-a

view details

Mazdak Farrokhzad

commit sha 93efe41b4ef9e0cccedbf962381002d48b3f780c

stabilize transparent_enums

view details

push time in 21 days

push eventsinkuu/edif-rs

Shotaro Yamada

commit sha d307d7621f6df24f33872bfeb7d002f3a8f29082

Add test

view details

push time in 23 days

push eventsinkuu/edif-rs

Shotaro Yamada

commit sha 58500b8771d54aa1c60c80daf57e32e0aa39d9fe

Fix flattening and verify_references

view details

Shotaro Yamada

commit sha 5a873f1940f3d19b2cfc426f15d7a6bc055e3b30

Fix example

view details

push time in 24 days

push eventsinkuu/edif-rs

Shotaro Yamada

commit sha 405fc19ba3b83435c2735760accdbcdc374e5adb

Simplify parser

view details

push time in 25 days

push eventsinkuu/edif-rs

Shotaro Yamada

commit sha d5b61335419a23888add83acbe9d64786f1fe55a

Add properties

view details

Shotaro Yamada

commit sha c88160bf36f76545d0a381b7b7d97f0b15309faf

Box Instance

view details

Shotaro Yamada

commit sha 2535a0c9dc3779a1f2c1c97e7ae6414ca7fb8b48

Use full-paths for nets

view details

push time in 25 days

push eventsinkuu/edif-rs

Shotaro Yamada

commit sha 799152ccc1081257956ca02093bb62c31247b2f5

Fix path flatten Flattened path should be "top" / "all/intermediate/hierarchy/and_original_inst_name".

view details

Shotaro Yamada

commit sha f112ec0ced514607e3db5f9fc3779c0f0f749a88

Add `Path::len` method

view details

push time in 25 days

push eventsinkuu/edif-rs

Shotaro Yamada

commit sha 577a8f87da506d76452257ecec5ea84241f13a3d

Add example

view details

push time in 25 days

push eventsinkuu/edif-rs

Shotaro Yamada

commit sha f0fd58e2c9f667c4706c3d307b553991d15f8604

Create README.md

view details

push time in 25 days

push eventsinkuu/edif-rs

Shotaro Yamada

commit sha 248489ed87d7053cf1d495e106058821997f15e3

Create README.md

view details

push time in 25 days

PR closed rust-lang/rust

Improve nop-match simplification S-waiting-on-review
  • The first commit fixes SimplifyArmIdentity not working in presence of temporaries and storage markes, which are not eliminated in mir-opt-level=1. This does not fix the issue of ? not being eliminated in mir-opt-level < 2.
  • The third commit adds SinkCommonCodeFromPredecessors pass. This allows optimizing identical matches on types that have destructors.

<details>

This code ...

// `String` has destructor
pub fn foo(x: Result<String, u32>) -> Result<String, u32> {
    match x {
        Ok(x) => Ok(x),
        Err(x) => Err(x),
    }
}

... gives you MIR with drop flag manipulation:

    bb2: {
        StorageLive(_3);
        _7 = const false;             // <--- This is drop flag for `String`
        _3 = move ((_1 as Ok).0: std::string::String);
        StorageLive(_4);
        _4 = move _3;
        ((_0 as Ok).0: std::string::String) = move _4;
        discriminant(_0) = 0;
        StorageDead(_4);
        StorageDead(_3);
        goto -> bb8;
    }
    bb3: {
        StorageLive(_5);
        _5 = ((_1 as Err).0: u32);
        StorageLive(_6);
        _6 = _5;
        ((_0 as Err).0: u32) = move _6;
        discriminant(_0) = 1;
        StorageDead(_6);
        StorageDead(_5);
        goto -> bb8;
    }

In this case SimplifyBranchSame does not work because bb2 and bb3 is still unequal after SimplifyArmIdentity pass. It seems that LLVM is able to optimize the match into memcpy from this state, though.

    bb2: {
        _7 = const false;             // <---
        _0 = move _1;
        goto -> bb8;
    }
    bb3: {
        _0 = move _1;
        goto -> bb8;
    }

SinkCommonCodeFromPredecessors is able to sink the common statement, _0 = move _1, to bb8.

I stole the idea from LLVM, but this PR implements only (1) in the comment there. </details>

#66234

+614 -39

3 comments

4 changed files

sinkuu

pr closed time in 25 days

Pull request review commentrust-lang/rust

Improve nop-match simplification

 use rustc_target::abi::VariantIdx; /// discriminant(_LOCAL_0) = VAR_IDX; /// ``` ///+/// or+///+/// ```rust+/// StorageLive(_LOCAL_TMP);

we're slowly adding more optimizations to debug mode, which by it's very definition should be easy to debug with a debugger. Such optimizations can easily end up messing up the source.

I realized this PR is already debuginfo-breaking. If the debugger was stepping on match, it would point to whichever arm the optimizer reduced all other arms into.

Instead of implementing this optimization twice, how about moving the ICEing optimizations to mir-opt-level 3 and making mir-opt-level 2 the standard for --release?

Your plan sounds right. Efforts should be concentrated on fixing/improving advanced MIR optimizations rather than adding ad-hoc optimization passes.

I'll close this PR. Thank you for your time, @oli-obk!

sinkuu

comment created time in 25 days

push eventsinkuu/edif-rs

Shotaro Yamada

commit sha 9b56cdb58a3a900a72936c0a8dc15f382c927bd6

Use vector instead of stringified representation

view details

Shotaro Yamada

commit sha a64745789f44e87106d26947151e2ad434770cc0

clippy

view details

Shotaro Yamada

commit sha 95c8c4511eb3f8078454e40472d5eacfc9b0aca8

Add verify_references method

view details

Shotaro Yamada

commit sha f7ce5c1c72f7e06029c7c917a79e0e09ca9361c6

Update dependencies

view details

push time in a month

Pull request review commentrust-lang/rust-clippy

Add new lint: match with a single binding statement

 declare_clippy_lint! {     "a wildcard pattern used with others patterns in same match arm" } -declare_lint_pass!(Matches => [+declare_clippy_lint! {+    /// **What it does:** Checks for matches being used to destructure a single-variant enum+    /// or tuple struct where a `let` will suffice.+    ///+    /// **Why is this bad?** Just readability – `let` doesn't nest, whereas a `match` does.+    ///+    /// **Known problems:** None.+    ///+    /// **Example:**+    /// ```rust+    /// enum Wrapper {+    ///     Data(i32),+    /// }+    ///+    /// let wrapper = Wrapper::Data(42);+    ///+    /// let data = match wrapper {+    ///     Wrapper::Data(i) => i,+    /// };+    /// ```+    ///+    /// The correct use would be:+    /// ```rust+    /// enum Wrapper {+    ///     Data(i32),+    /// }+    ///+    /// let wrapper = Wrapper::Data(42);+    /// let Wrapper::Data(data) = wrapper;+    /// ```+    pub INFALLIBLE_DESTRUCTURING_MATCH,+    style,+    "a `match` statement with a single infallible arm instead of a `let`"+}++declare_clippy_lint! {+    /// **What it does:** Checks for useless match that binds to only one value.+    ///+    /// **Why is this bad?** Readability and needless complexity.+    ///+    /// **Known problems:** None.

Will there be false-positives related to temporary values?

// I couldn't come up with a realistic example...

match io::stdout().lock() {
    mut stdout => writeln!(stdout, "hi").unwrap(), // ok
}

let mut stdout = io::stdout().lock(); // error[E0716]: temporary value dropped while borrowed
writeln!(stdout, "hi").unwrap();
ThibsG

comment created time in a month

Pull request review commentrust-lang/rust

Improve nop-match simplification

 use rustc_target::abi::VariantIdx; /// discriminant(_LOCAL_0) = VAR_IDX; /// ``` ///+/// or+///+/// ```rust+/// StorageLive(_LOCAL_TMP);

Regarding the compiler performance: I locally run rustc-perf, and it looks perf-neutral. The 2nd point in https://github.com/rust-lang/rust/issues/66234#issuecomment-562663544 is still required for these optimizations to be useful in real cases.

<details> <summary>Improved SimplifyArmIdentity</summary>

new1

</details>

<details> <summary>Improved SimplifyArmIdentity + SinkCommonCodeFromPredecessors</summary>

new2

</details>

sinkuu

comment created time in a month

Pull request review commentrust-lang/rust

Improve nop-match simplification

 fn match_arm<'tcx>(         return;     } -    if drop_flag == Some(local_0)-        || drop_flag == Some(local_tmp)+    if drop_flag == Some(local_tmp)         || drop_flag == Some(local_tmp_2)+        || local_decls[local_tmp_2].is_user_variable()

== Some(local_0) surely didn't make sense as you pointed out. Regarding other checks... I'm not sure. I added checks to make sure the code being matched is exactly what I intended, but probably they can all be removed.

sinkuu

comment created time in a month

push eventsinkuu/rust

Shotaro Yamada

commit sha 99a5c541011849e1376b94169a93f72c4f1d9fb3

Fix comment

view details

push time in a month

Pull request review commentrust-lang/rust

Improve nop-match simplification

 impl<'tcx> MirPass<'tcx> for SimplifyBranchSame {         }     } }++pub struct SinkCommonCodeFromPredecessors;++impl<'tcx> MirPass<'tcx> for SinkCommonCodeFromPredecessors {+    fn run_pass(&self, _tcx: TyCtxt<'tcx>, _src: MirSource<'tcx>, body: &mut BodyAndCache<'tcx>) {+        for (bb, preds) in body.predecessors().clone().iter_enumerated() {+            if preds.len() < 2+                || preds+                    .iter()+                    .any(|p| body.basic_blocks()[*p].terminator().successors().count() != 1)+            {+                continue;+            }++            let mut matched_stmts = 0;+            let basic_blocks = body.basic_blocks_mut();++            loop {

Yes.

sinkuu

comment created time in a month

push eventsinkuu/rust

Shotaro Yamada

commit sha f7640ff856727b29a4eb583f11a440ace227e819

Add/fix comment

view details

push time in a month

Pull request review commentrust-lang/rust

Improve nop-match simplification

 fn match_arm(stmts: &mut [Statement<'_>], local_decls: &mut IndexVec<Local, Loca         return;     } -    if vf_1 != vf_0 // The field-and-variant information match up.+    if drop_flag == Some(local_0)

Yes, this one is definitely unnecessary.

sinkuu

comment created time in a month

Pull request review commentrust-lang/rust

Improve nop-match simplification

 use rustc_target::abi::VariantIdx; /// discriminant(_LOCAL_0) = VAR_IDX; /// ``` ///+/// or+///+/// ```rust+/// StorageLive(_LOCAL_TMP);

Sorry for the late reply!

AFAIK mir-opt-level is always 1 unless explicitly specified, regardless of release or debug build. mir-opt-level is independent from optimization level, and cargo does not set it. (-Zmir-optlevel is an unstable flag and setting it to 2 or larger is prone to ICE/miscompile anyway.) You can confirm this by building MIR of this playground in release / debug build. Temporaries are not eliminated even in release build, and SimplifyArmIdentity is not working.

That said, the purpose of this PR is to improve the codegen of identical match in relase build.

<details>

<summary><code>diff</code> of <code>cargo rustc --release -- --emit=llvm-ir</code>, using the same code as the playground above, before/after this PR

</summary>

--- old.ll	2020-01-27 07:04:08.034979599 +0900
+++ new.ll	2020-01-27 07:04:21.682132255 +0900
@@ -1,5 +1,5 @@
-; ModuleID = 'foo.1lzogcxs-cgu.0'
-source_filename = "foo.1lzogcxs-cgu.0"
+; ModuleID = 'foo.2my2volq-cgu.0'
+source_filename = "foo.2my2volq-cgu.0"
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
@@ -9,80 +9,35 @@
 %"unwind::libunwind::_Unwind_Context" = type { [0 x i8] }
 
 ; foo::try_identity
-; Function Attrs: nofree norecurse nounwind nonlazybind uwtable
-define void @_ZN3foo12try_identity17hf7a3f301f9e3a548E(%"core::result::Result<u64, i32>"* noalias nocapture sret dereferenceable(16), %"core::result::Result<u64, i32>"* noalias nocapture readonly dereferenceable(16) %x) unnamed_addr #0 {
+; Function Attrs: nounwind nonlazybind uwtable
+define void @_ZN3foo12try_identity17h273ad7d1ef012f0eE(%"core::result::Result<u64, i32>"* noalias nocapture sret dereferenceable(16), %"core::result::Result<u64, i32>"* noalias nocapture readonly dereferenceable(16) %x) unnamed_addr #0 {
 start:
-  %1 = getelementptr inbounds %"core::result::Result<u64, i32>", %"core::result::Result<u64, i32>"* %x, i64 0, i32 0, i64 0
-  %2 = load i32, i32* %1, align 8, !range !2
-  %switch = icmp eq i32 %2, 1
-  br i1 %switch, label %bb3, label %bb2
-
-bb2:                                              ; preds = %start
-  %3 = getelementptr inbounds %"core::result::Result<u64, i32>", %"core::result::Result<u64, i32>"* %x, i64 0, i32 2, i64 1
-  %4 = bitcast i32* %3 to i64*
-  %x2 = load i64, i64* %4, align 8
-  %5 = getelementptr inbounds %"core::result::Result<u64, i32>", %"core::result::Result<u64, i32>"* %0, i64 0, i32 2, i64 1
-  %6 = bitcast i32* %5 to i64*
-  store i64 %x2, i64* %6, align 8
-  br label %bb4
-
-bb3:                                              ; preds = %start
-  %7 = getelementptr inbounds %"core::result::Result<u64, i32>", %"core::result::Result<u64, i32>"* %x, i64 0, i32 2, i64 0
-  %x1 = load i32, i32* %7, align 4
-  %8 = getelementptr inbounds %"core::result::Result<u64, i32>", %"core::result::Result<u64, i32>"* %0, i64 0, i32 2, i64 0
-  store i32 %x1, i32* %8, align 4
-  br label %bb4
-
-bb4:                                              ; preds = %bb2, %bb3
-  %.sink = phi i32 [ 0, %bb2 ], [ 1, %bb3 ]
-  %9 = getelementptr inbounds %"core::result::Result<u64, i32>", %"core::result::Result<u64, i32>"* %0, i64 0, i32 0, i64 0
-  store i32 %.sink, i32* %9, align 8
+  %1 = bitcast %"core::result::Result<u64, i32>"* %0 to i8*
+  %2 = bitcast %"core::result::Result<u64, i32>"* %x to i8*
+  tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 8 %1, i8* nonnull align 8 %2, i64 16, i1 false)
   ret void
 }
 
 ; foo::try_identity_drop
 ; Function Attrs: nounwind nonlazybind uwtable
-define void @_ZN3foo17try_identity_drop17h5d9ea5a8e7421c58E(%"core::result::Result<alloc::string::String, i32>"* noalias nocapture sret dereferenceable(32), %"core::result::Result<alloc::string::String, i32>"* noalias nocapture readonly dereferenceable(32) %x) unnamed_addr #1 personality i32 (i32, i32, i64, %"unwind::libunwind::_Unwind_Exception"*, %"unwind::libunwind::_Unwind_Context"*)* @rust_eh_personality {
+define void @_ZN3foo17try_identity_drop17h7d0574702d5fadd5E(%"core::result::Result<alloc::string::String, i32>"* noalias nocapture sret dereferenceable(32), %"core::result::Result<alloc::string::String, i32>"* noalias nocapture readonly dereferenceable(32) %x) unnamed_addr #0 personality i32 (i32, i32, i64, %"unwind::libunwind::_Unwind_Exception"*, %"unwind::libunwind::_Unwind_Context"*)* @rust_eh_personality {
 start:
-  %1 = getelementptr inbounds %"core::result::Result<alloc::string::String, i32>", %"core::result::Result<alloc::string::String, i32>"* %x, i64 0, i32 0, i64 0
-  %2 = load i32, i32* %1, align 8, !range !2
-  %switch = icmp eq i32 %2, 1
-  br i1 %switch, label %bb8, label %bb5
-
-bb4:                                              ; preds = %bb5, %bb8
-  %.sink = phi i32 [ 0, %bb5 ], [ 1, %bb8 ]
-  %3 = getelementptr inbounds %"core::result::Result<alloc::string::String, i32>", %"core::result::Result<alloc::string::String, i32>"* %0, i64 0, i32 0, i64 0
-  store i32 %.sink, i32* %3, align 8
+  %1 = bitcast %"core::result::Result<alloc::string::String, i32>"* %0 to i8*
+  %2 = bitcast %"core::result::Result<alloc::string::String, i32>"* %x to i8*
+  tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 8 %1, i8* nonnull align 8 %2, i64 32, i1 false)
   ret void
-
-bb5:                                              ; preds = %start
-  %x1.sroa.0.0..sroa_idx3 = getelementptr inbounds %"core::result::Result<alloc::string::String, i32>", %"core::result::Result<alloc::string::String, i32>"* %x, i64 0, i32 2, i64 1
-  %x1.sroa.0.0..sroa_cast = bitcast i32* %x1.sroa.0.0..sroa_idx3 to i8*
-  %_4.sroa.0.0..sroa_idx10 = getelementptr inbounds %"core::result::Result<alloc::string::String, i32>", %"core::result::Result<alloc::string::String, i32>"* %0, i64 0, i32 2, i64 1
-  %_4.sroa.0.0..sroa_cast = bitcast i32* %_4.sroa.0.0..sroa_idx10 to i8*
-  call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 8 %_4.sroa.0.0..sroa_cast, i8* nonnull align 8 %x1.sroa.0.0..sroa_cast, i64 24, i1 false)
-  br label %bb4
-
-bb8:                                              ; preds = %start
-  %4 = getelementptr inbounds %"core::result::Result<alloc::string::String, i32>", %"core::result::Result<alloc::string::String, i32>"* %x, i64 0, i32 2, i64 0
-  %x2 = load i32, i32* %4, align 4
-  %5 = getelementptr inbounds %"core::result::Result<alloc::string::String, i32>", %"core::result::Result<alloc::string::String, i32>"* %0, i64 0, i32 2, i64 0
-  store i32 %x2, i32* %5, align 4
-  br label %bb4
 }
 
 ; Function Attrs: nounwind nonlazybind uwtable
-declare i32 @rust_eh_personality(i32, i32, i64, %"unwind::libunwind::_Unwind_Exception"*, %"unwind::libunwind::_Unwind_Context"*) unnamed_addr #1
+declare i32 @rust_eh_personality(i32, i32, i64, %"unwind::libunwind::_Unwind_Exception"*, %"unwind::libunwind::_Unwind_Context"*) unnamed_addr #0
 
 ; Function Attrs: argmemonly nounwind
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1 immarg) #2
+declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1 immarg) #1
 
-attributes #0 = { nofree norecurse nounwind nonlazybind uwtable "probe-stack"="__rust_probestack" "target-cpu"="x86-64" }
-attributes #1 = { nounwind nonlazybind uwtable "probe-stack"="__rust_probestack" "target-cpu"="x86-64" }
-attributes #2 = { argmemonly nounwind }
+attributes #0 = { nounwind nonlazybind uwtable "probe-stack"="__rust_probestack" "target-cpu"="x86-64" }
+attributes #1 = { argmemonly nounwind }
 
 !llvm.module.flags = !{!0, !1}
 
 !0 = !{i32 7, !"PIC Level", i32 2}
 !1 = !{i32 2, !"RtLibUseGOT", i32 1}
-!2 = !{i32 0, i32 2}

</details>

sinkuu

comment created time in a month

issue openedrust-lang/rust

Confusing "type annotations needed" for errorneous struct field type

struct Foo {
    x: Option<NotInScope>,
}

fn main() {
    let f = Foo {
        x: None,
    };
}
error[E0412]: cannot find type `NotInScope` in this scope
 --> src/main.rs:2:15
  |
2 |     x: Option<NotInScope>,
  |               ^^^^^^^^^^ not found in this scope

error[E0282]: type annotations needed
 --> src/main.rs:7:12
  |
7 |         x: None,
  |            ^^^^ cannot infer type for `T`

error: aborting due to 2 previous errors

This "type annotations needed" error is confusing, especially if the two error messages are apart.

created time in a month

pull request commentrust-lang/rust

Improve nop-match simplification

Ready for review.

sinkuu

comment created time in a month

issue commentrust-analyzer/rust-analyzer

Can't Activate Features in Cargo Check

IIUC you have to run RUST_LOG=info code . (or export RUST_LOG=info and then code .).

sanboxrunner

comment created time in a month

push eventsinkuu/rust

Shotaro Yamada

commit sha 4183719084043d0f70fdaed69cb6c1485787d877

Dedup predecessors and filter out non-goto blocks

view details

Shotaro Yamada

commit sha 4ff009bf29b3741946b17bfbd7866a01e8b70552

Don't run on types with destructors

view details

Shotaro Yamada

commit sha b2a9b6b90ae2760175d96d087a24902f663634b5

Check statements length

view details

push time in a month

PullRequestEvent

issue commenttokio-rs/tokio

Why example can not be compiled as standalone project?

I think examples are using this Cargo.toml.

https://github.com/tokio-rs/tokio/blob/a70f7203a46d471345128832987017612d8e4585/examples/Cargo.toml#L8

kingluo

comment created time in a month

issue commenttokio-rs/tokio

Why example can not be compiled as standalone project?

Almost all feature of tokio is disabled by default to reduce compilation time and dependency bloat. You have to enable features flags. https://docs.rs/tokio/0.2.10/tokio/#feature-flags

kingluo

comment created time in a month

PR closed rust-lang/rust

Improve nop-match simplification S-waiting-on-review
  • The first commit fixes SimplifyArmIdentity not working in presence of temporaries and storage markes, which are not eliminated in mir-opt-level=1. This does not fix the issue of ? not being eliminated in mir-opt-level < 2.
  • The third commit adds SinkCommonCodeFromPredecessors pass. This allows optimizing identical matches on types that have destructors.

<details>

This code ...

// `String` has destructor
pub fn foo(x: Result<String, u32>) -> Result<String, u32> {
    match x {
        Ok(x) => Ok(x),
        Err(x) => Err(x),
    }
}

... gives you MIR with drop flag manipulation:

    bb2: {
        StorageLive(_3);
        _7 = const false;             // <--- This is drop flag for `String`
        _3 = move ((_1 as Ok).0: std::string::String);
        StorageLive(_4);
        _4 = move _3;
        ((_0 as Ok).0: std::string::String) = move _4;
        discriminant(_0) = 0;
        StorageDead(_4);
        StorageDead(_3);
        goto -> bb8;
    }
    bb3: {
        StorageLive(_5);
        _5 = ((_1 as Err).0: u32);
        StorageLive(_6);
        _6 = _5;
        ((_0 as Err).0: u32) = move _6;
        discriminant(_0) = 1;
        StorageDead(_6);
        StorageDead(_5);
        goto -> bb8;
    }

In this case SimplifyBranchSame does not work because bb2 and bb3 is still unequal after SimplifyArmIdentity pass. It seems that LLVM is able to optimize the match into memcpy from this state, though.

    bb2: {
        _7 = const false;             // <---
        _0 = move _1;
        goto -> bb8;
    }
    bb3: {
        _0 = move _1;
        goto -> bb8;
    }

SinkCommonCodeFromPredecessors is able to sink the common statement, _0 = move _1, to bb8.

I stole the idea from LLVM, but this PR implements only (1) in the comment there. </details>

#66234

+515 -39

2 comments

4 changed files

sinkuu

pr closed time in a month

PR opened rust-lang/rust

Improve nop-match simplification
  • The first commit fixes SimplifyArmIdentity not working in presence of temporaries and storage markes, which are not eliminated in mir-opt-level=1. This does not fix the issue of ? not being eliminated in mir-opt-level < 2.
  • The third commit adds SinkCommonCodeFromPredecessors pass. This allows optimizing identical matches on types that have destructors.

<details>

This code ...

// `String` has destructor
pub fn foo(x: Result<String, u32>) -> Result<String, u32> {
    match x {
        Ok(x) => Ok(x),
        Err(x) => Err(x),
    }
}

... gives you MIR with drop flag manipulation:

    bb2: {
        StorageLive(_3);
        _7 = const false;             // <--- This is drop flag for `String`
        _3 = move ((_1 as Ok).0: std::string::String);
        StorageLive(_4);
        _4 = move _3;
        ((_0 as Ok).0: std::string::String) = move _4;
        discriminant(_0) = 0;
        StorageDead(_4);
        StorageDead(_3);
        goto -> bb8;
    }
    bb3: {
        StorageLive(_5);
        _5 = ((_1 as Err).0: u32);
        StorageLive(_6);
        _6 = _5;
        ((_0 as Err).0: u32) = move _6;
        discriminant(_0) = 1;
        StorageDead(_6);
        StorageDead(_5);
        goto -> bb8;
    }

In this case SimplifyBranchSame does not work because bb2 and bb3 is still unequal after SimplifyArmIdentity pass. It seems that LLVM is able to optimize the match into memcpy from this state, though.

    bb2: {
        _7 = const false;             // <---
        _0 = move _1;
        goto -> bb8;
    }
    bb3: {
        _0 = move _1;
        goto -> bb8;
    }

SinkCommonCodeFromPredecessors is able to sink the common statement, _0 = move _1, to bb8.

I stole the idea from LLVM, but this PR implements only (1) in the comment there. </details>

+515 -39

0 comment

4 changed files

pr created time in a month

push eventsinkuu/rust

Shotaro Yamada

commit sha d0a9500b7d1f7e292481097dd40dfca69b2fb9dc

Add test

view details

Shotaro Yamada

commit sha bde6308e32f2571b7098ab3b08485dcc42bb2c5d

Add SinkCommonCodeFromPredecessors pass

view details

push time in a month

push eventsinkuu/rust

Jorge Aparicio

commit sha 470cdf54ac9acee20ab8da46ef7899bae9f58f29

add bare metal ARM Cortex-A targets to rustc -> `rustc --target armv7-none-eabi` will work also build rust-std (rustup) components for them -> `rustup target add armv7-none-eabi` will work

view details

Tobias Kortkamp

commit sha de388032555b697d1b0ef197241886ab90ac39b2

Add -Wl,-znotext to default linker flags to link with lld 9 on FreeBSD 13.0-CURRENT i386 rust-nightly has been failing to link since 2019-12-10 with variations of ``` = note: ld: error: relocation R_386_PC32 cannot be used against symbol __rust_probestack; recompile with -fPIC >>> defined in /wrkdirs/usr/ports/lang/rust-nightly/work/rustc-nightly-src/build/i686-unknown-freebsd/stage1/lib/rustlib/i686-unknown-freebsd/lib/libcompiler_builtins-6570a75fe85f0e1a.rlib(compiler_builtins-6570a75fe85f0e1a.compiler_builtins.2i519eqi-cgu.15.rcgu.o) >>> referenced by std.4xivr03c-cgu.14 >>> std-9bd70afd58e204b7.std.4xivr03c-cgu.14.rcgu.o:(_$LT$alloc..boxed..Box$LT$F$GT$$u20$as$u20$core..ops..function..FnOnce$LT$A$GT$$GT$::call_once::h1c78ed6e734a2bfc (.llvm.10122419023709863394)) in archive /wrkdirs/usr/ports/lang/rust-nightly/work/rustc-nightly-src/build/i686-unknown-freebsd/stage1/lib/rustlib/i686-unknown-freebsd/lib/libstd-9bd70afd58e204b7.rlib ld: error: relocation R_386_PC32 cannot be used against symbol __rust_probestack; recompile with -fPIC >>> defined in /wrkdirs/usr/ports/lang/rust-nightly/work/rustc-nightly-src/build/i686-unknown-freebsd/stage1/lib/rustlib/i686-unknown-freebsd/lib/libcompiler_builtins-6570a75fe85f0e1a.rlib(compiler_builtins-6570a75fe85f0e1a.compiler_builtins.2i519eqi-cgu.15.rcgu.o) >>> referenced by std.4xivr03c-cgu.14 >>> std-9bd70afd58e204b7.std.4xivr03c-cgu.14.rcgu.o:(std::io::util::copy::h9115f048f2203467) in archive /wrkdirs/usr/ports/lang/rust-nightly/work/rustc-nightly-src/build/i686-unknown-freebsd/stage1/lib/rustlib/i686-unknown-freebsd/lib/libstd-9bd70afd58e204b7.rlib clang-cpp: error: linker command failed with exit code 1 (use -v to see invocation) error: aborting due to previous error error: could not compile `rustc_macros`. ``` Full log: http://beefy17.nyi.freebsd.org/data/head-i386-default/p523508_s356869/logs/rust-nightly-1.42.0.20200118.log AFAICT it stopped building after bumping compiler_builtins to 0.1.22 in https://github.com/rust-lang/rust/pull/67110.

view details

Jorge Aparicio

commit sha a3a077610028c773bffc7a74e6a15faa10d2360d

Merge branch 'master' into bare-metal-cortex-a

view details

Nikita Popov

commit sha 2c0845c6ccfdee7fb255756918a22101376efa7e

Mark __msan_track_origins as an exported symbol for LTO

view details

Tomasz Miąsko

commit sha d8c661a88644ad710e309d3a8f0f27c5f74d705f

Mark __msan_keep_going as an exported symbol for LTO

view details

varkor

commit sha dd0507c054ea27ae836025761908d339a478e0ab

Make `TooGeneric` error in WF checking a proper error `TooGeneric` is encountered during WF checking when we cannot determine that a constant involving a generic parameter will always be evaluated successfully (rather than resulting in an error). In these cases, the burden of proof should be with the caller, so that we can avoid post-monomorphisation tim errors (which was the previous previous behaviour). This commit ensures that this situation produces a proper compiler error, rather than silently ignoring it or ICEing.

view details

Jorge Aparicio

commit sha 8abbd0beae79de5186158a759b08cb73d175b5ad

for now, do not build rust-std for the armv7a-none-eabihf target it needs some upstream changes in the build script of the compiler-builtins crate

view details

Philipp Gesang

commit sha 5dee7dddf24a022184a743b714b5062e83516a87

Handle methods in try diagnostic The diagnostic for diagnostic for methods and trait provided methods would only show the empty string: error[E0277]: the `?` operator can only be used in that returns `Result` or `Option` (or another type that implements `std::ops::Try`) Handle the missing cases so it reads ``a method'' / ``an async method'' / ``a trait method'' respectively. Signed-off-by: Philipp Gesang <phg@phi-gamma.net>

view details

Philipp Gesang

commit sha 02e66baac6882ef30e607d2bca98929f01758957

Test try diagnostics for impl and trait methods Signed-off-by: Philipp Gesang <phg@phi-gamma.net>

view details

Philipp Gesang

commit sha db3b40c2a1fe6129a7bbc12df6260b7197731153

Cleanup: rewrite conditional as match As suggested by @Centril. Signed-off-by: Philipp Gesang <phg@phi-gamma.net>

view details

Mark Rousskov

commit sha d1bb7e16e0d0ad4e568df14eceedc5b0dd484214

Privatize private fields of OutputFilenames

view details

Mark Rousskov

commit sha 8c6067c24e181aa388619ca0f39100e5c9a1f509

Store filestem in a pre-formatted form

view details

Mark Rousskov

commit sha dc97181a0966cd1686a70ce06849a19c196f72eb

Do not base path to append extension We already have ownership of the base path, so no need to clone it (within Path::with_extension).

view details

Matthias Krüger

commit sha eb2da27af27c010bf5501bbe85341ccd457dc3d7

bootstrap: update clippy subcmd decription Clarify where the clippy used in `./x.py clippy` is coming from. It uses whatever clippy binary was installed via rustup, cargo-install or otherwise and does NOT use the binary generated by `./x.py build src/tools/clippy`.

view details

Mazdak Farrokhzad

commit sha 7962ccb216e993b52f67986f7944fba5fc38482c

pprust: use as_deref

view details

Matthias Krüger

commit sha 71370c87f74fa38a6976bec27ebe4f449058872c

librustc_mir: don't allocate vectors where slices will do.

view details

Victor Ding

commit sha 6a6ebb4403683e1e12d3916cabc1a4898ce798cf

Add `-Z no-link` flag Adds a compiler option to allow rustc compile a crate without linking. With this flag, rustc serializes codegen_results into a .rlink file.

view details

Tyler Mandry

commit sha 0c3827bfa764340298a224bc68d422c52519e0bb

Rollup merge of #67195 - 0dvictor:nolink, r=tmandry [experiment] Add `-Z no-link` flag Adds a compiler option to allow rustc compile a crate without linking. With this flag, `rustc` serializes codegen_results into a `.rlink` file. Part of Issue #64191

view details

Tyler Mandry

commit sha 9246b3056c1e669d8afc497cd7a98719ec53965b

Rollup merge of #68253 - japaric:bare-metal-cortex-a, r=alexcrichton add bare metal ARM Cortex-A targets to rustc -> `rustc --target armv7a-none-eabi` will work also build rust-std (rustup) components for them -> `rustup target add armv7a-none-eabi` will work this completes our bare-metal support of ARMv7 cores on stable Rust (by 1.42 or 1.43) (these target specifications have been tested on a real (no emulation / QEMU) [Cortex-A7 core](https://github.com/iqlusioninc/usbarmory.rs/))

view details

Tyler Mandry

commit sha 51e4424ea4e8ffe1145eec2acc4cec55a7a0ffed

Rollup merge of #68361 - t6:patch-freebsd-lld-i386, r=alexcrichton Unbreak linking with lld 9 on FreeBSD 13.0-CURRENT i386 Add -Wl,-znotext to default linker flags to link with lld 9 on FreeBSD 13.0-CURRENT i386 where rust-nightly has been failing to link since 2019-12-10 with variations of ``` = note: ld: error: relocation R_386_PC32 cannot be used against symbol __rust_probestack; recompile with -fPIC >>> defined in /wrkdirs/usr/ports/lang/rust-nightly/work/rustc-nightly-src/build/i686-unknown-freebsd/stage1/lib/rustlib/i686-unknown-freebsd/lib/libcompiler_builtins-6570a75fe85f0e1a.rlib(compiler_builtins-6570a75fe85f0e1a.compiler_builtins.2i519eqi-cgu.15.rcgu.o) >>> referenced by std.4xivr03c-cgu.14 >>> std-9bd70afd58e204b7.std.4xivr03c-cgu.14.rcgu.o:(_$LT$alloc..boxed..Box$LT$F$GT$$u20$as$u20$core..ops..function..FnOnce$LT$A$GT$$GT$::call_once::h1c78ed6e734a2bfc (.llvm.10122419023709863394)) in archive /wrkdirs/usr/ports/lang/rust-nightly/work/rustc-nightly-src/build/i686-unknown-freebsd/stage1/lib/rustlib/i686-unknown-freebsd/lib/libstd-9bd70afd58e204b7.rlib ld: error: relocation R_386_PC32 cannot be used against symbol __rust_probestack; recompile with -fPIC >>> defined in /wrkdirs/usr/ports/lang/rust-nightly/work/rustc-nightly-src/build/i686-unknown-freebsd/stage1/lib/rustlib/i686-unknown-freebsd/lib/libcompiler_builtins-6570a75fe85f0e1a.rlib(compiler_builtins-6570a75fe85f0e1a.compiler_builtins.2i519eqi-cgu.15.rcgu.o) >>> referenced by std.4xivr03c-cgu.14 >>> std-9bd70afd58e204b7.std.4xivr03c-cgu.14.rcgu.o:(std::io::util::copy::h9115f048f2203467) in archive /wrkdirs/usr/ports/lang/rust-nightly/work/rustc-nightly-src/build/i686-unknown-freebsd/stage1/lib/rustlib/i686-unknown-freebsd/lib/libstd-9bd70afd58e204b7.rlib clang-cpp: error: linker command failed with exit code 1 (use -v to see invocation) error: aborting due to previous error error: could not compile `rustc_macros`. ``` Full log: http://beefy17.nyi.freebsd.org/data/head-i386-default/p523508_s356869/logs/rust-nightly-1.42.0.20200118.log AFAICT it stopped building after bumping compiler_builtins to 0.1.22 in https://github.com/rust-lang/rust/pull/67110.

view details

push time in a month

push eventsinkuu/rust

Shotaro Yamada

commit sha d413363dacd32c9d0da9aaed68c8eae2bff21ed4

fix

view details

push time in a month

push eventsinkuu/rust

Shotaro Yamada

commit sha 5456d4738090a1edb40fbee43c60940ead40f475

wip

view details

push time in a month

starteddtolnay/anyhow

started time in a month

push eventsinkuu/rust

Shotaro Yamada

commit sha 77b07bc9fd408506c9e37bbd2fbecc6d211a1b4e

wip

view details

push time in a month

delete branch sinkuu/rust

delete branch : temp_path

delete time in a month

push eventsinkuu/rust

Shotaro Yamada

commit sha 0cb06389883b174c5af8721ed2974e2ecff76501

Add test

view details

push time in a month

push eventsinkuu/rust

Shotaro Yamada

commit sha 0df11f290831793017c4c703849333fda8c1b463

Add test

view details

push time in a month

create barnchsinkuu/rust

branch : simplify_try

created branch time in a month

push eventsinkuu/rust

Shotaro Yamada

commit sha 05746e0d6142427c3e8dd5a98490557e38d1ffb2

Use BufWriter

view details

push time in a month

PR opened rust-lang/rust

Use BufWriter for emitting MIR

I noticed that --emit=mir takes long time on a large crate. https://github.com/rust-lang/rust/pull/64344 seem to have fixed -Zdump-mir, but not --emit=mir.

+1 -1

0 comment

1 changed file

pr created time in a month

create barnchsinkuu/rust

branch : emit_mir_buffered

created branch time in a month

startedflamegraph-rs/flamegraph

started time in a month

create barnchsinkuu/flamegraph

branch : delay

created branch time in a month

fork sinkuu/flamegraph

Easy flamegraphs for Rust projects and everything else, without Perl or pipes <3

fork in a month

Pull request review commentrust-lang/rust

Micro-optimize OutputFilenames

 impl OutputFilenames {             extension.push_str(ext);         } -        let path = base.with_extension(&extension[..]);+        path.set_extension(extension);         path     }      pub fn with_extension(&self, extension: &str) -> PathBuf {-        self.out_directory.join(&self.filestem()).with_extension(extension)+        let mut path = self.out_directory.join(&self.filestem());+        path.set_extension(extension);+        path     }      pub fn filestem(&self) -> String {-        format!("{}{}", self.out_filestem, self.extra)+        let mut s = String::with_capacity(self.out_filestem.len() + self.extra.len());+        s.push_str(&self.out_filestem);+        s.push_str(&self.extra);+        s

Thanks! I've added your commits to this PR.

sinkuu

comment created time in a month

push eventsinkuu/rust

Mark Rousskov

commit sha d1bb7e16e0d0ad4e568df14eceedc5b0dd484214

Privatize private fields of OutputFilenames

view details

Mark Rousskov

commit sha 8c6067c24e181aa388619ca0f39100e5c9a1f509

Store filestem in a pre-formatted form

view details

Mark Rousskov

commit sha dc97181a0966cd1686a70ce06849a19c196f72eb

Do not base path to append extension We already have ownership of the base path, so no need to clone it (within Path::with_extension).

view details

push time in a month

push eventsinkuu/rust

Mark Rousskov

commit sha 3fb66750981c575ee694750e5ad9361a2505981f

Privatize private fields of OutputFilenames

view details

Mark Rousskov

commit sha c866e3f8e3606eddb46e829c08355eb7854c148d

Store filestem in a pre-formatted form

view details

Mark Rousskov

commit sha 6804e2fbf9abee6384107954e70b4440ba56106b

Do not base path to append extension We already have ownership of the base path, so no need to clone it (within Path::with_extension).

view details

push time in a month

PR opened rust-lang/rust

Micro-optimize OutputFilenames

For example, its methods consume 6% of time during debug-compiling a warp example: Screenshot (debug-compiling a  example)

This PR optimize them a bit by using PathBuf::set_extension instead of Path::with_extension, to avoid cloning PathBuf excessively.

+9 -4

0 comment

1 changed file

pr created time in a month

create barnchsinkuu/rust

branch : temp_path

created branch time in a month

issue openedrust-lang/rust-clippy

Inefficient usage of PathBuf

PathBuf comes with inherent mutating methods like push, set_extension, etc. along with methods come from Deref<Target = Path> like join, with_extension, etc.

Each usage of the latter group of methods throws current PathBuf away and creates a new one:

let mut p: PathBuf;

// bad (in terms of performance)
p
 .join("x")              // &PathBuf -> PathBuf
 .with_extension("txt"); // &PathBuf -> PathBuf

// good
p.push("x");
p.set_extension("txt");

The lint to detect this situation may be under perf, but we might as well make it pedantic since the former code looks more clean and idiomatic.

created time in a month

startedudoprog/checkers

started time in a month

PR opened seanmonstar/warp

Update README to use async/await
+3 -3

0 comment

1 changed file

pr created time in a month

create barnchsinkuu/warp

branch : readme

created branch time in a month

fork sinkuu/warp

A super-easy, composable, web server framework for warp speeds.

https://seanmonstar.com/post/176530511587/warp

fork in a month

fork sinkuu/crev-proofs

Crev proof repository

fork in a month

pull request commentrust-lang/rust

remove redundant clones, found by clippy

There's clone_on_copy lint.

matthiaskrgr

comment created time in a month

Pull request review commentrust-analyzer/rust-analyzer

More UI friendly labels

 impl<'a, DB: HirDatabase> AssistCtx<'a, DB> {         f: impl FnOnce(&mut AssistBuilder),     ) -> Option<Assist> {         let label = AssistLabel { label: label.into(), id };+        assert_eq!(+            label.label.chars().nth(0).and_then(|c| Some(c.is_uppercase())).unwrap(),

It can also be label.label.starts_with(char::is_uppercase), though this ignores empty strings.

kjeremy

comment created time in a month

issue commentrust-lang/rust-clippy

New lint: Use `Into`/`TryInto` in bounds as opposed to `From`/`TryFrom`

re_balance_coherence feature will be stabilized in 1.41. Beta version of doc says "Prior to Rust 1.40, if the destination type was not part of the current crate...".

Kixunil

comment created time in a month

delete branch sinkuu/rust-clippy

delete branch : mir_no_opt_fallout

delete time in a month

delete branch sinkuu/smol_str

delete branch : impr

delete time in a month

PR opened rust-analyzer/smol_str

Improve `Arc<str>` creation

While using Into<String> could avoid an allocation in str -> String, converting Box<str> into Arc<str> deallocates it and allocates new anyway.

The 1st commit is a drive-by simplification.

+8 -6

0 comment

1 changed file

pr created time in a month

push eventsinkuu/smol_str

Shotaro Yamada

commit sha 312b3a0cdc47c63c484ddc4ce1a45e100803c7c9

Improve `Arc<str>` creation While using `Into` could avoid an allocation in `String` -> `Box<str>`, converting `Box<str>` into `Arc<str>` deallocates and re-allocates anyway.

view details

push time in a month

create barnchsinkuu/smol_str

branch : impr

created branch time in a month

PR opened rust-lang/rust-clippy

Lint vectored IO in unused_io_amount lint

read_vectored & write_vectored require handling returned value likewise non-vectored methods. https://github.com/rust-lang/rust/issues/68041


changelog: lint vectored IO in unused_io_amount lint

+38 -15

0 comment

3 changed files

pr created time in a month

create barnchsinkuu/rust-clippy

branch : vectored_io

created branch time in a month

create barnchsinkuu/syntax_fuzz

branch : master

created branch time in a month

created repositorysinkuu/syntax__fuzz

created time in a month

PR opened rust-lang/rust

Cleanup
+1 -34

0 comment

10 changed files

pr created time in a month

more