profile
viewpoint

ecstatic-morse/enum-utils 6

A set of useful proc macros for enums

ecstatic-morse/ksuid 5

A small utility for dealing with Segment.io KSUIDs

ecstatic-morse/atdf 1

A parser for AVR's system description files (.atdf).

ecstatic-morse/fixed-bitset 1

A bitset whose size is fixed at compile-time

ecstatic-morse/anglistic-sched 0

A scheduler for matching students to presentation time slots by preference

ecstatic-morse/blog.rust-lang.org 0

The Rust Programming Language Blog

ecstatic-morse/cargo 0

The Rust package manager

ecstatic-morse/competitive-coding-demo 0

An example of a solution to a coding problem

ecstatic-morse/compiler-team 0

A home for compiler team planning documents, meeting minutes, and other such things.

ecstatic-morse/const-eval 0

home for proposals in and around compile-time function evaluation

Pull request review commentrust-lang/rust

Avoid deleting temporary files on error

+use std::mem::ManuallyDrop;+use std::path::Path;+use tempfile::TempDir;++/// This is used to avoid TempDir being dropped on error paths unintentionally.+#[derive(Debug)]+pub struct MaybeTempDir {+    dir: ManuallyDrop<TempDir>,+    // Whether the TempDir should be deleted on drop.+    keep: bool,+}++impl Drop for MaybeTempDir {+    fn drop(&mut self) {+        // Safety: We are in the destructor, and no further access will+        // occur.+        let dir = unsafe { ManuallyDrop::take(&mut self.dir) };

...otherwise we leak the PathBuf inside TempDir. Whoops. I'm all caught up now.

Mark-Simulacrum

comment created time in 5 hours

Pull request review commentrust-lang/rust

Avoid deleting temporary files on error

+use std::mem::ManuallyDrop;+use std::path::Path;+use tempfile::TempDir;++/// This is used to avoid TempDir being dropped on error paths unintentionally.+#[derive(Debug)]+pub struct MaybeTempDir {+    dir: ManuallyDrop<TempDir>,+    // Whether the TempDir should be deleted on drop.+    keep: bool,+}++impl Drop for MaybeTempDir {+    fn drop(&mut self) {+        // Safety: We are in the destructor, and no further access will+        // occur.+        let dir = unsafe { ManuallyDrop::take(&mut self.dir) };

Oh NVM, we can't move out of it in the destructor. I would probably have done this with ManuallyDrop::drop, but that's also unsafe.

Mark-Simulacrum

comment created time in 7 hours

Pull request review commentrust-lang/rust

Avoid deleting temporary files on error

+use std::mem::ManuallyDrop;+use std::path::Path;+use tempfile::TempDir;++/// This is used to avoid TempDir being dropped on error paths unintentionally.+#[derive(Debug)]+pub struct MaybeTempDir {+    dir: ManuallyDrop<TempDir>,+    // Whether the TempDir should be deleted on drop.+    keep: bool,+}++impl Drop for MaybeTempDir {+    fn drop(&mut self) {+        // Safety: We are in the destructor, and no further access will+        // occur.+        let dir = unsafe { ManuallyDrop::take(&mut self.dir) };

No need for unsafe. Just drop(self.dir.into_inner()) if keep is false.

Mark-Simulacrum

comment created time in 7 hours

Pull request review commentrust-lang/rust

Avoid deleting temporary files on error

 pub fn link_binary<'a, B: ArchiveBuilder<'a>>(             }         }); -        let tmpdir = TempFileBuilder::new()-            .prefix("rustc")-            .tempdir()-            .unwrap_or_else(|err| sess.fatal(&format!("couldn't create a temp dir: {}", err)));-         if outputs.outputs.should_codegen() {+            let tmpdir = TempFileBuilder::new()+                .prefix("rustc")+                .tempdir()+                .unwrap_or_else(|err| sess.fatal(&format!("couldn't create a temp dir: {}", err)));+            let path = TempDir::new(tmpdir, sess.opts.cg.save_temps);

Can we use a different name for this? MaybeTempDir or something? The boolean argument to new is surprising if you're used to tempfile::TempDir.

Mark-Simulacrum

comment created time in 20 hours

Pull request review commentrust-lang/rust

Avoid deleting temporary files on error

+use std::path::{Path, PathBuf};+use tempfile::TempDir as TempDirReal;++/// This is used to avoid TempDir being dropped on error paths unintentionally.+#[derive(Debug)]+pub struct TempDir {+    path: PathBuf,+    // This is `None` if the directory should not be deleted; used for+    // -Csave-temps. We don't just pass around a PathBuf to keep type safety+    // (only creating files in temporary locations).+    dir: Option<TempDirReal>,

This is a tad convoluted. Why not ManuallyDrop<TempDirReal> alongside a boolean flag?

Mark-Simulacrum

comment created time in 20 hours

pull request commentrust-lang/rust

Change the type of `AssertModuleSource::available_cgus`.

@bors r+ rollup

nnethercote

comment created time in 3 days

pull request commentrust-lang/rust

Keep stdout open in limit_vector_count test

cc @adamreichold

tmiasko

comment created time in 3 days

pull request commentrust-lang/rust

Avoid `unwrap_or_else` in str indexing

@bors retry

tmiasko

comment created time in 3 days

pull request commentrust-lang/rust

Keep stdout open in limit_vector_count test

@bors r+ p=5

tmiasko

comment created time in 3 days

pull request commentrust-lang/rust

Handle projection predicates in the param env for auto-trait docs

r? @nikomatsakis

Aaron1011

comment created time in 3 days

pull request commentrust-lang/rust

Remove unused FromInner impl for Ipv4Addr

@bors retry rollup

lzutao

comment created time in 3 days

pull request commentrust-lang/rust

adds [*mut|*const] ptr::set_ptr_value

@bors retry

oliver-giersch

comment created time in 3 days

pull request commentrust-lang/rust

Avoid `unwrap_or_else` in str indexing

Different I/O failure on Android builder.

@bors retry

tmiasko

comment created time in 3 days

pull request commentrust-lang/rust

Fix typo in `librustc_feature/active.rs`

@bors r=ecstaticmorse rollup

WaffleLapkin

comment created time in 3 days

PullRequestEvent

PR closed rust-lang/rust

Fix typo in `librustc_feature/active.rs` S-waiting-on-author
+1 -1

5 comments

1 changed file

WaffleLapkin

pr closed time in 3 days

pull request commentrust-lang/rust

Avoid `unwrap_or_else` in str indexing

@bors retry

tmiasko

comment created time in 3 days

pull request commentrust-lang/rust

Fix typo in `librustc_feature/active.rs`

@bors r- yield

WaffleLapkin

comment created time in 3 days

pull request commentrust-lang/rust

Change the type of `AssertModuleSource::available_cgus`.

#65657 changed the InternedString here to a Symbol, which would have changed the output order of the error message. Incremental tests aren't blessed, so this didn't cause any failures, but presumably it's nice to have modules be in some order for people debugging. It should have become a SymbolStr or preferably just String since SymbolStr is not really sound when put on the heap and performance doesn't matter here.

nnethercote

comment created time in 3 days

pull request commentrust-lang/rust

Add `#[cfg(panic = '...')]`

@davidhewitt BTW, have you tried a -C panic=abort test in the compile-fail directory?

davidhewitt

comment created time in 4 days

pull request commentrust-lang/rust

Fix typo in `librustc_feature/active.rs`

@bors r+ rollup

WaffleLapkin

comment created time in 4 days

pull request commentrust-lang/rust

forbid `#[track_caller]` on main

@bors r- The stdarch bump got added back in the last commit. git add -p is your friend :smile:.

lcnr

comment created time in 5 days

pull request commentrust-lang/rust

forbid `#[track_caller]` on main

r=me with the error message tweaked.

lcnr

comment created time in 5 days

Pull request review commentrust-lang/rust

forbid `#[track_caller]` on main

 fn check_start_fn_ty(tcx: TyCtxt<'_>, start_def_id: LocalDefId) {                         .emit();                         error = true;                     }++                    for attr in it.attrs {+                        if attr.check_name(sym::track_caller) {+                            tcx.sess+                                .struct_span_err(+                                    attr.span,+                                    "start is not allowed to be `#[track_caller]`",
                                    "`start` is not allowed to be `#[track_caller]`",

Same below. Also, maybe this should just say "program entry point is not allowed..."? Up to you.

lcnr

comment created time in 5 days

pull request commentrust-lang/rust

Replace a recursive algorithm with an iterative one and a stack.

@bors rollup

@oli-obk r=me when you're happy

oli-obk

comment created time in 9 days

Pull request review commentrust-lang/rust

Replace a recursive algorithm with an iterative one and a stack.

 impl<'a, 'tcx> CfgSimplifier<'a, 'tcx> {             } if statements.is_empty() => terminator.take(),             // if `terminator` is None, this means we are in a loop. In that             // case, let all the loop collapse to its entry.-            _ => return,-        };--        let target = match terminator {-            Some(Terminator { kind: TerminatorKind::Goto { ref mut target }, .. }) => {-                self.collapse_goto_chain(target, changed);-                *target-            }-            _ => unreachable!(),-        };-        self.basic_blocks[*start].terminator = terminator;--        debug!("collapsing goto chain from {:?} to {:?}", *start, target);--        *changed |= *start != target;+            _ => None,+        }+    } -        if self.pred_count[*start] == 1 {-            // This is the last reference to *start, so the pred-count to-            // to target is moved into the current block.-            self.pred_count[*start] = 0;-        } else {-            self.pred_count[target] += 1;-            self.pred_count[*start] -= 1;+    // Collapse a goto chain starting from `start`+    fn collapse_goto_chain(&mut self, start: &mut BasicBlock, changed: &mut bool) {+        let mut terminators: SmallVec<[_; 1]> = Default::default();

Sounds good. It shouldn't matter much either way, maybe leave a comment?

oli-obk

comment created time in 9 days

Pull request review commentrust-lang/rust

Replace a recursive algorithm with an iterative one and a stack.

 impl<'a, 'tcx> CfgSimplifier<'a, 'tcx> {             } if statements.is_empty() => terminator.take(),             // if `terminator` is None, this means we are in a loop. In that             // case, let all the loop collapse to its entry.-            _ => return,-        };--        let target = match terminator {-            Some(Terminator { kind: TerminatorKind::Goto { ref mut target }, .. }) => {-                self.collapse_goto_chain(target, changed);-                *target-            }-            _ => unreachable!(),-        };-        self.basic_blocks[*start].terminator = terminator;--        debug!("collapsing goto chain from {:?} to {:?}", *start, target);--        *changed |= *start != target;+            _ => None,+        }+    } -        if self.pred_count[*start] == 1 {-            // This is the last reference to *start, so the pred-count to-            // to target is moved into the current block.-            self.pred_count[*start] = 0;-        } else {-            self.pred_count[target] += 1;-            self.pred_count[*start] -= 1;+    // Collapse a goto chain starting from `start`+    fn collapse_goto_chain(&mut self, start: &mut BasicBlock, changed: &mut bool) {+        let mut terminators: SmallVec<[_; 1]> = Default::default();+        let mut current = *start;+        while let Some(terminator) = self.extract_terminator(current) {+            let target = match terminator {+                Terminator { kind: TerminatorKind::Goto { target }, .. } => target,+                _ => unreachable!(),+            };+            terminators.push((current, terminator));+            current = target;         }+        let last = current;+        *start = last;+        while let Some((current, mut terminator)) = terminators.pop() {+            let target = match terminator {+                Terminator { kind: TerminatorKind::Goto { ref mut target }, .. } => target,+                _ => unreachable!(),+            };+            *target = last;+            debug!("collapsing goto chain from {:?} to {:?}", current, target); -        *start = target;+            if self.pred_count[current] == 1 {+                // This is the last reference to current, so the pred-count to+                // to target is moved into the current block.+                self.pred_count[current] = 0;+            } else {+                self.pred_count[*target] += 1;+                self.pred_count[current] -= 1;+            }+            *changed |= current != *target;

If you don't wanna lump it into this PR, that's fine too. It just doesn't quite make sense to me.

oli-obk

comment created time in 9 days

Pull request review commentrust-lang/rust

Replace a recursive algorithm with an iterative one and a stack.

 impl<'a, 'tcx> CfgSimplifier<'a, 'tcx> {             } if statements.is_empty() => terminator.take(),             // if `terminator` is None, this means we are in a loop. In that             // case, let all the loop collapse to its entry.-            _ => return,-        };--        let target = match terminator {-            Some(Terminator { kind: TerminatorKind::Goto { ref mut target }, .. }) => {-                self.collapse_goto_chain(target, changed);-                *target-            }-            _ => unreachable!(),-        };-        self.basic_blocks[*start].terminator = terminator;--        debug!("collapsing goto chain from {:?} to {:?}", *start, target);--        *changed |= *start != target;+            _ => None,+        }+    } -        if self.pred_count[*start] == 1 {-            // This is the last reference to *start, so the pred-count to-            // to target is moved into the current block.-            self.pred_count[*start] = 0;-        } else {-            self.pred_count[target] += 1;-            self.pred_count[*start] -= 1;+    // Collapse a goto chain starting from `start`+    fn collapse_goto_chain(&mut self, start: &mut BasicBlock, changed: &mut bool) {+        let mut terminators: SmallVec<[_; 1]> = Default::default();+        let mut current = *start;+        while let Some(terminator) = self.extract_terminator(current) {+            let target = match terminator {+                Terminator { kind: TerminatorKind::Goto { target }, .. } => target,+                _ => unreachable!(),+            };+            terminators.push((current, terminator));+            current = target;         }+        let last = current;+        *start = last;+        while let Some((current, mut terminator)) = terminators.pop() {+            let target = match terminator {+                Terminator { kind: TerminatorKind::Goto { ref mut target }, .. } => target,+                _ => unreachable!(),+            };+            *target = last;+            debug!("collapsing goto chain from {:?} to {:?}", current, target); -        *start = target;+            if self.pred_count[current] == 1 {+                // This is the last reference to current, so the pred-count to+                // to target is moved into the current block.+                self.pred_count[current] = 0;+            } else {+                self.pred_count[*target] += 1;+                self.pred_count[current] -= 1;+            }+            *changed |= current != *target;

Preexisting I know, but why do we only mark the MIR as changed if current != target? If current == target then we are inserting a self-loop, but it's possible for this to represent a change in the MIR if we had a cycle involving several Gotos.

oli-obk

comment created time in 9 days

Pull request review commentrust-lang/rust

Replace a recursive algorithm with an iterative one and a stack.

 impl<'a, 'tcx> CfgSimplifier<'a, 'tcx> {             } if statements.is_empty() => terminator.take(),             // if `terminator` is None, this means we are in a loop. In that             // case, let all the loop collapse to its entry.-            _ => return,-        };--        let target = match terminator {-            Some(Terminator { kind: TerminatorKind::Goto { ref mut target }, .. }) => {-                self.collapse_goto_chain(target, changed);-                *target-            }-            _ => unreachable!(),-        };-        self.basic_blocks[*start].terminator = terminator;--        debug!("collapsing goto chain from {:?} to {:?}", *start, target);--        *changed |= *start != target;+            _ => None,+        }+    } -        if self.pred_count[*start] == 1 {-            // This is the last reference to *start, so the pred-count to-            // to target is moved into the current block.-            self.pred_count[*start] = 0;-        } else {-            self.pred_count[target] += 1;-            self.pred_count[*start] -= 1;+    // Collapse a goto chain starting from `start`+    fn collapse_goto_chain(&mut self, start: &mut BasicBlock, changed: &mut bool) {+        let mut terminators: SmallVec<[_; 1]> = Default::default();

Why the SmallVec here? In the common case, start will not refer to a Goto with no statements, so terminators will be empty.

oli-obk

comment created time in 9 days

Pull request review commentrust-lang/rust

Replace a recursive algorithm with an iterative one and a stack.

 impl<'a, 'tcx> CfgSimplifier<'a, 'tcx> {         }     } -    // Collapse a goto chain starting from `start`-    fn collapse_goto_chain(&mut self, start: &mut BasicBlock, changed: &mut bool) {-        let mut terminator = match self.basic_blocks[*start] {+    fn extract_terminator(&mut self, bb: BasicBlock) -> Option<Terminator<'tcx>> {

Can we use a more descriptive name for this? take_terminator_if_simple_goto or so?

oli-obk

comment created time in 9 days

push eventecstatic-morse/rust

Dylan MacKenzie

commit sha 96c84ac3cbc4f2c81580893dacf263d00306649c

Test `Option::unwrap` in a const context

view details

push time in 10 days

pull request commentrust-lang/rust

Make `Option::unwrap` unstably const

The error annotations in the test are a bit weird, but it's more of a problem for compiletest than for users.

ecstatic-morse

comment created time in 10 days

PR opened rust-lang/rust

Make `Option::unwrap` unstably const

This is lumped into the const_option feature gate (#67441), which enables a potpourri of Option methods.

cc @rust-lang/wg-const-eval

r? @oli-obk

+37 -1

0 comment

4 changed files

pr created time in 10 days

create barnchecstatic-morse/rust

branch : const-option-unwrap

created branch time in 10 days

issue commentrust-lang/rust

Error about drop in `const fn` without any dropping happening

This particular example is fixed by #![feature(const_precise_live_drops)] (#73255), which moves live drop checking for constants after drop elaboration. I think we can close this?

oli-obk

comment created time in 10 days

pull request commentrust-lang/rust

Improve diagnostics when constant pattern is too generic

Thanks!

@bors r+ rollup

nbdd0121

comment created time in 10 days

delete branch ecstatic-morse/rust

delete branch : const-size-align-of-val

delete time in 10 days

pull request commentrust-lang/rust

Make `mem::size_of_val` and `mem::align_of_val` unstably const

Please also open a PR against miri, removing the intrinsics there

Resolved in rust-lang/miri#1912 (thanks Ralf!)

ecstatic-morse

comment created time in 10 days

push eventecstatic-morse/rust

Dylan MacKenzie

commit sha 88fd4943a65fe7b18c0468255c54f9dee591dd1b

Test `{align,size}_of_val` in a const context

view details

push time in 11 days

push eventecstatic-morse/rust

Dylan MacKenzie

commit sha 34eaffb3546113b3935390e8f31226435a0178fd

Test `{align,size}_of_val` in a const context

view details

push time in 11 days

PR opened rust-lang/rust

Make `mem::size_of_val` and `mem::align_of_val` unstably const

Implements #46571 but does not stabilize it. I wanted this while working on something today.

The only reason not to immediately stabilize are concerns around custom DSTs. That proposal has made zero progress in the last two years and const eval is rich enough to support pretty much any user-defined len function as long as nightly features are allowed (raw_ptr_deref).

r? @oli-obk

cc @rust-lang/wg-const-eval

+97 -3

0 comment

7 changed files

pr created time in 11 days

push eventecstatic-morse/rust

Dylan MacKenzie

commit sha 9caf0b52229ff935a17ff42f91e843b3d3d264e8

Make `{align,size}_of_val` `const`

view details

Dylan MacKenzie

commit sha 7f4a5c066f86d70f176a86446fca74fe7187755b

Test `{align,size}_of_val` in a const context

view details

push time in 11 days

create barnchecstatic-morse/rust

branch : const-size-align-of-val

created branch time in 11 days

pull request commentrust-lang/rust

Add `#[cfg(panic = '...')]`

I'd like to see a test verifying that -C panic=abort actually causes the cfg(panic = "abort") code to run and vice versa. Also, I think this needs sign off from @rust-lang/lang, but an RFC is probably overkill.

davidhewitt

comment created time in 11 days

pull request commentrust-lang/rust

Make closures and generators a must use types

@bors rollup

tmiasko

comment created time in 11 days

pull request commentrust-lang/rust

Make closures and generators a must use types

LGTM. Thanks!

@bors r+

tmiasko

comment created time in 11 days

pull request commentrust-lang/rust

Rewrite the `Visitor` for `non_ssa_locals`

I made the requested changes @eddyb, can you take another look?

ecstatic-morse

comment created time in 15 days

push eventecstatic-morse/rust

Dylan MacKenzie

commit sha d9df24c5b2809acc23a0c4634fa1f2d967da6aae

Use loop instead of visitor to check for invalid projections

view details

Dylan MacKenzie

commit sha 8d8e59e6ee1c71d710a04e02aab4b9300c4dc23c

`first_assignment` no longer needs a getter

view details

Dylan MacKenzie

commit sha 647d788dc7061e13109d6323076fb4379e7cb96d

Ignore `VarDebugInfo` when forcing locals on the stack

view details

Dylan MacKenzie

commit sha 86bf63aa07d635a926b898a28ae53c6762b0a46f

Remove outdated comment

view details

push time in 18 days

push eventecstatic-morse/rust

Dylan MacKenzie

commit sha 3c904a78d049f8e62d330ca2eacd65b588c8a96f

Use loop instead of visitor to check for invalid projections

view details

Dylan MacKenzie

commit sha 1b018b61714724d2b68d23b08ab8e3d3099e9e38

`first_assignment` no longer needs a getter

view details

Dylan MacKenzie

commit sha f3219f4cb84364d906f2bcfdc0f5960898f0855b

Ignore `VarDebugInfo` when forcing locals on the stack

view details

Dylan MacKenzie

commit sha 8f82918bdf11862d6aa8ce32fb457335f558cceb

Remove outdated comment

view details

push time in 18 days

push eventecstatic-morse/rust

Dylan MacKenzie

commit sha edb0939aec60a040a49b778344a2bbeb85b538f1

Use loop instead of visitor to check for invalid projections

view details

Dylan MacKenzie

commit sha 62e1ecadee04f43930db26ff844c4679a1764b41

`first_assignment` no longer needs a getter

view details

Dylan MacKenzie

commit sha bd7b64a30b65695e8d96b0fa1794f788943a774d

Ignore `VarDebugInfo` when forcing locals on the stack

view details

Dylan MacKenzie

commit sha 8a754fa489d750c5dae06ec38e32df727df43c3d

Remove outdated comment

view details

push time in 18 days

push eventecstatic-morse/rust

Dylan MacKenzie

commit sha 844fcc8034301ae992b5a837099bbaff5b5f7cc0

Use loop instead of visitor to check for invalid projections

view details

Dylan MacKenzie

commit sha 00225de6ce27e00ff88f01e3a3ae86398b942f2b

`first_assignment` no longer needs a getter

view details

Dylan MacKenzie

commit sha 7d12dacae0a99803055823dc003ed984d571468c

Ignore `VarDebugInfo` when forcing locals on the stack

view details

Dylan MacKenzie

commit sha ffb4f0a691ed8c6d48594d0043a3db9088521a70

Remove outdated comment

view details

push time in 18 days

issue commentrust-lang/rust

error: could not compile `gkrust` since Rust 1.43 on SPARC Solaris

Plus I believe ASan is not available for SPARC.

Oof. This is gonna be a tough one to figure out.

This kind of issues are often caught by LLVM assertions.

CI builds and tests rustc with LLVM assertions enabled for all tier 1 platforms. I'd be surprised if we were violating an assertion late enough in the compilation pipeline that it only triggered on SPARC, but it doesn't hurt to check.

psumbera

comment created time in 18 days

push eventecstatic-morse/rust

Dylan MacKenzie

commit sha 73c954aec58ad8d7b73735fe91f3668fa4217f5e

Revert "Ignore `VarDebugInfo` when forcing locals on the stack" This reverts commit f54be2ba0fb6d430abace1b049ac72471386c2b2.

view details

push time in 18 days

PR closed rust-lang/rust

Bail out early from `truncate` if the new length is equal to the old S-waiting-on-review

truncate should do nothing for collections if the new length is equal to the current length, but this is not explicitly stated in the code. Instead, control flow continues in this case until an empty slice is passed to drop_in_place. While this is equivalent and likely optimizes to the same code, it is not as clear and edit: results in slightly worse codegen for vectors containing types with Drop glue.

+23 -9

5 comments

3 changed files

ecstatic-morse

pr closed time in 18 days

pull request commentrust-lang/rust

Advertise correct stable version for const control flow

@bors r=jonas-schievink

Sorry. This fell off the radar.

ecstatic-morse

comment created time in 18 days

push eventecstatic-morse/rust

Yoshua Wuyts

commit sha a31f103fd27bde3f83b9dd54af8e41d64e5001f4

Add core::future::{poll_fn, PollFn}

view details

Caio

commit sha 187aea7c34adf06b0db39f688d60d3fdac8e7e3e

Impl Default for ranges

view details

Mohsen Zohrevandi

commit sha c4b02659c16d2ad0ac36d2c8602edd002e559f7a

Enable some timeouts in SGX platform This would partially resolve https://github.com/fortanix/rust-sgx/issues/31

view details

Mohsen Zohrevandi

commit sha d7dc64bdfea4fbf8974774800ab51e04eaa4f082

Handle spurious wakeups in wait_timeout_sgx

view details

Mohsen Zohrevandi

commit sha c5d1fcd2309b6903fed82aba6e0fdc2fa85bc874

Allow more ui tests for SGX

view details

Alexis Bourget

commit sha 049f6eaa792fbbf2b727fc278ddd23d1e11d57bd

Fixing broken link for the Eq trait

view details

Teddy_Wang

commit sha 40ee620e51c86c72e3c2b65df71f5f0a4a79797f

Added a lint for .map(|x| x)

view details

Mohsen Zohrevandi

commit sha 3442d23c1a12f1f01a0e07b6bec72b58998f49ef

Improve wait_timeout_sgx, simplify usercalls::wait

view details

CAD97

commit sha 7779a11448927e208ed6eb9bb609dd23595f77ce

Use step_unchecked more liberally

view details

Alexis Bourget

commit sha 6e8251742071d56545b6ce160ed71bb60597ee01

Documenting the separate behaviors of edition 2015 and 2018

view details

Alexis Bourget

commit sha 59701360dc0c76bfa45204d307ac5055f8bff538

Fix some small mistakes

view details

flip1995

commit sha 80bcbf521c7ff95e38a7567432b5519cc18e5b2a

Merge commit 'c2c07fa9d095931eb5684a42942a7b573a0c5238' into clippyup

view details

Teddy_Wang

commit sha fb4f9a0ad7a4656beb01c85b02b3e6ef15d914ec

Fix pattern match of ExprKind::MethodCall

view details

bors

commit sha 583d64493484f72425ecac55eaf5eddbba10b132

Auto merge of #5694 - wangtheo:issue-5626, r=matthiaskrgr #5626: lint iterator.map(|x| x) changelog: adds a new lint for iterator.map(|x| x) (see https://github.com/rust-lang/rust-clippy/issues/5626) The code also lints for result.map(|x| x) and option.map(|x| x). Also, I'm not sure if I'm checking for type adjustments correctly and I can't think of an example where .map(|x| x) would apply type adjustments.

view details

Ayaz Hafiz

commit sha 7c1b3aa0ddb81954a804455ca45fcf09fdb17dd8

Record span of `const` kw in GenericParamKind Context: this is needed to fix https://github.com/rust-lang/rustfmt/issues/4263, which currently records the span of a const generic param incorrectly because the location of the `const` kw is not known. I am not sure how to add tests for this; any guidance in how to do so would be appreciated :slightly_smiling_face:

view details

Eduardo Broto

commit sha 5987c7d4041ce5d72c8412d2ad73fe3b63308b51

cmp_owned: avoid FP when PartialEq is not implemented symmetrically

view details

Eduardo Broto

commit sha b498e1d71537a79e7aff5378da625aca8b4eef96

cmp_owned: reverse operands if necessary

view details

Tim Nielens

commit sha 6bf5434e19ce6d2a501589d1fcbc0d1748c531a6

copy_on_clone - add machine applicability

view details

bors

commit sha a14eab389f6e9f8bdaffbba184b20220041b036f

Auto merge of #5745 - montrivo:copy_on_clone, r=phansch clone_on_copy - add machine applicability Fix #4826. Change the applicability of the lint clone_on_copy. Split a test file and run rustfix on the clone_on_copy part. changelog: clone_on_copy - add machine applicability

view details

bors

commit sha 46d33043d5de0403a2a3dab9e7817041999bf9dd

Auto merge of #5701 - ebroto:4874_cmp_owned_fp, r=flip1995 cmp_owned: handle when PartialEq is not implemented symmetrically changelog: Handle asymmetrical implementations of PartialEq in [`cmp_owned`]. Fixes #4874

view details

push time in 18 days

issue commentrust-lang/rust

error: could not compile `gkrust` since Rust 1.43 on SPARC Solaris

This is concerning. To confirm, this occurs with recent nightlies as well?

The commit you bisected to (part of #69676) re-enabled the optimization around drop elaboration in #68528, which could have plausibly caused this kind of issue. There's nothing target-dependent about that PR, so while it's possible that #68528 triggered a SPARC-only LLVM bug, it's very possible that there's a latent miscompilation on other platforms as well that manifests as a segmentation fault due to some detail of SPARC. However, it's surprising that we didn't see any issues from users on Intel machines.

The innermost frame points to this implementation detail of Cstring::new. There's no match on a type that has a drop implementation along that code path, so presumably the root cause is elsewhere. My next step for debugging this would probably be ASan, although I haven't had to use it in anger on Rust code yet.

Nominating for @rust-lang/compiler discussion to put this on their radar, since it could affect tier 1 platforms as well.

psumbera

comment created time in 19 days

push eventecstatic-morse/rust

Chris Denton

commit sha 912963bd0856239828253af8d04e4f62e75cafd7

Remove legacy InnoSetup GUI installer On Windows the InnoSetup installer was superseded by the MSI installer. It's no longer needed.

view details

djugei

commit sha b4337ab8c387658b7012fa242e429f46c5f31141

added .collect() into String from Box<str> with fake feature/stability annotation

view details

Yoshua Wuyts

commit sha 8bc6b5b45c9f9710852e2b9c57eb3d44d08ad245

stabilize leading_trailing_ones

view details

Tomasz Miąsko

commit sha 291dce91b24d70382ebf1116fa836fd91960de84

Fallback to xml.etree.ElementTree The xml.etree.cElementTree has been deprecated since Python 3.3 and removed in Python 3.9 https://bugs.python.org/issue36543.

view details

Caleb Zulawski

commit sha 144206e6d8c1ab4ffdbaf6d7b0f5a4201c0f2da4

Don't implement Fn* traits for #[target_feature] functions

view details

Caleb Zulawski

commit sha c98b4c8fdde7812d7af5a060a1e22fd7e3775d3f

Add error note when trying fn as Fn trait

view details

pankajchaudhary5

commit sha 46bfc48272ba5312c439557e2901e1a4778e9487

Added proper explanation of ErrorCode-E0687

view details

mark

commit sha 3f6928f1f6eff367e6ddbfb63ebc5e568ffe0eb1

move contributing.md to rustc-dev-guide and point at getting started

view details

Matthias Krüger

commit sha 1d0378c454de72ddcfc08bcc105744923ef2d4d4

impl From<char> for String This allows us to write fn char_to_string() -> String { 'a'.into() } which was not possible before.

view details

Tomasz Miąsko

commit sha 5c20ef433b48fce78c07208710bcc8b53965eeb1

bootstrap: Configurable musl libdir Make it possible to customize the location of musl libdir using musl-libdir in config.toml, e.g., to use lib64 instead of lib.

view details

Matthias Krüger

commit sha 2cde4932c7e8bd6000378af41029299ccf6eea69

add test for char into string

view details

VillSnow

commit sha 4c8ce48a15c88715955e56c9c35959d9dffad5ec

Add partition_point

view details

VillSnow

commit sha c9b49157057a83a97801f9e726ed8051fb1d2231

fix: doc test

view details

VillSnow

commit sha 27b06f10dc01319c449d0f8c04218136431938c8

update: doc comment

view details

VillSnow

commit sha 8cc6998cd460f8534b3cf643a7620354bd007856

add: tests

view details

Anirban

commit sha 886f81e1d0883f67fbc81b8ece61b1c33f6923d2

Fix sentence structure Fixed grammar and sentence structure on appropriate instances.

view details

Dylan McKay

commit sha 50f20ec576ae72ceff6bf5a50c940cf574990e56

[AVR] Update the rust-lang/llvm-project submodule to include AVR fixes recently merged This commit updates rustc's LLVM submodule to include new AVR-specific fixes recently merged on the Rust LLVM 'rustc/10.0-2020-05-05' branch. All of these cherry-picked commits exist in upstream LLVM and were cherry-picked into Rust's LLVM fork in commit 6c040dd86ed. |- 6c040dd86ed Merge pull request #66 from dylanmckay/avr-pick-upstream-llvm-fixes |- 12dfdd3aed7 [AVR] Rewrite the function calling convention. |- 118ac53f12b [AVR] Don't adjust for instruction size |- bc27c282e13 [AVR] Fix miscompilation of zext + add |- cfbe205a7e8 [AVR] Remove faulty stack pushing behavior |- 143e1469e96 [AVR] Fix stack size in functions with a frame pointer |- 6b2445d841e [LLVM][AVR] Support for R_AVR_6 fixup |- 93ee4da19cf [AVR] Fix I/O instructions on XMEGA |- 962c2415ffb [AVR] Do not place functions in .progmem.data |- 65b8b170aef [AVR] Do not use divmod calls for bigger integers |- 93a3b595d1c [AVR] Generalize the previous interrupt bugfix to signal |- handlers too |- cc4286349b4 [AVR] Respect the 'interrupt' function attribute |- 954d0a92205 [AVR] Fix reads of uninitialized variables from constructor of AVRSubtarget |- 1c0ddae73c9 [AVR] Fix read of uninitialized variable AVRSubtarget:::ELFArch |- 0ed0823fe60 [AVR] Fix incorrect register state for LDRdPtr |- 96075fc433d [AVR] Don't adjust addresses by 2 for absolute values |- 6dfc55ba53b [AVR] Use correct register class for mul instructions These changes include both correctness fixes and LLVM assertion error fixes. Once all of these commits have been cherry-picked, all of the LLVM plumbing for rust-lang/master to compile the AVR blink program will be in place. Once this commit is merged, only PR rust-lang/rust#73270 will be blocking successful compilation and emission of the AVR LED blink program.

view details

Keno Fischer

commit sha 0c88dd663a7095ccc405a2036047a90981137a51

Update Box::from_raw example to generalize better I know very little about rust, so I saw this example and tried to generalize it by writing, ``` let layout = Layout::new::<T>(); let new_obj = unsafe { let ptr = alloc(layout) as *mut T; *ptr = obj; Box::from_raw(ptr) }; ``` for some more complicated `T`, which ended up crashing with SIGSEGV, because it tried to `drop_in_place` the previous object in `ptr` which is of course garbage. I also added a comment that explains why `.write` is used, but I think adding that comment is optional and may be too verbose here. I do however think that changing this example is a good idea to suggest the correct generalization. `.write` is also used in most of the rest of the documentation here, even if the example is `i32`, so it would additionally be more consistent.

view details

Anirban

commit sha 3b5d7f8cf66c6704d36b021f7173241d6351ad32

Minor correction to sentence structure

view details

David Hewitt

commit sha 6b95f3102d657a5cd0549213a073b28c7e0fe609

Add `format_args_capture` feature

view details

push time in 21 days

Pull request review commentrust-lang/rust

consult dlerror() only if a dl*() call fails

 mod dl {             // dlerror isn't thread safe, so we need to lock around this entire             // sequence             let _guard = (*LOCK).lock();++            // dlerror reports the most recent failure that occured during a+            // dynamic linking operation and then clears that error; we call+            // once in advance of our operation in an attempt to discard any+            // stale prior error report that may exist:             let _old_error = libc::dlerror();              let result = f(); -            let last_error = libc::dlerror() as *const _;-            if ptr::null() == last_error {+            // We should only check dlerror() in the event that the operation+            // fails, which we determine by checking for a NULL return.  This+            // covers at least dlopen() and dlsym().

For dlsym at least, the current approach is explicitly recommended on linux and seems to be necessary on illumos as well, since NULL can indicate either an error condition or a "symbol not found" error. We should be checking the return value of dlopen, but we will need to find a workaround here.

jclulow

comment created time in 21 days

push eventecstatic-morse/rust

Caleb Zulawski

commit sha 8e899b1cbe6209842e112f0b7ec450a3cdfdb36d

Don't implement Fn* for unsafe #[target_feature] functions

view details

Vadim Petrochenkov

commit sha 7055c23d2cb3baabbae6af7ab196e43035260856

ast_pretty: Pass some token streams and trees by reference

view details

David Hewitt

commit sha a1217cb29de22aae3cda717e78d1edd3e9d8ffd1

Add `format_args_capture` to the unstable book

view details

Tomasz Miąsko

commit sha 14d03702735ccca48f5b954db6c01e9cedb14f29

Remove defunct `-Z print-region-graph`

view details

James Box

commit sha 7231e575461d1246c247b2ac3e97c1adcab49737

Fix wording for anonymous parameter name help

view details

pierwill

commit sha 4595fa8a1baf95b0a19aae3d84e945344d8f8a44

Fix comma in debug_assert! docs

view details

Ivan Tham

commit sha 0e6f1093be08949b6ac4ba3d92ad4e97d0137dc5

Add preamable on rustc-attrs doc discussion

view details

Alexis Bourget

commit sha e611a3fb8423f178e856813fc1a1f2397980bd8a

Apply suggestions from code review

view details

Charles Lew

commit sha e8f5785bfc3123b67e79e509c76259062e214b97

Split and expand nonstandard-style lints unicode unit test.

view details

Dylan MacKenzie

commit sha 3c5ee3300f6c88f3d984d62ce704d17b7432f29c

Update tests

view details

Alexis Bourget

commit sha dfd454bd3843c4f4dee2e943297bf3d208252dc6

Apply suggestions, reformulating some paragraphs and improving some examples

view details

CAD97

commit sha db539c649866d9a25cb18a741436b3086b5d6e04

Use raw_ref_op in A|Rc::as_ptr

view details

CAD97

commit sha e4bdf47f4c0773bba93f50900612242b929eca0b

Do not require ptr validity in rc::data_offset

view details

CAD97

commit sha d8a9c61e1a23b73c04d3058a11d1b8b2a46d635e

Use impl for Weak::as_ptr that works for unsized T

view details

Alexis Bourget

commit sha 4224313e2bc3fc08e5eee0519d7b5813c3cad580

Fix small nits

view details

pierwill

commit sha 49c1018d139746f926f1af03d1d4282e0fed7115

Fix markdown rendering in librustc_lexer docs Use back-ticks instead of quotation marks in docs for the block comment variant of TokenKind.

view details

pierwill

commit sha 40c74a7eb709f3f072d35b4264c614a9a8f6c2f9

Edit cursor.prev() method docs in lexer Fix missing punctuation

view details

pierwill

commit sha 49662726afdd6f4538bada73db771b939d92bd22

Add newline to rustc MultiSpan docs Also adds back-ticks when referring to the contents of this collection.

view details

Alex Crichton

commit sha 3dfbf0bc738d1ba4ee0f084ce3f32074fceee3bb

rustbuild: Move compiler-builtins build logic to manifest This commit moves the compiler-builtins-specific build logic from `src/bootstrap/bin/rustc.rs` into the workspace `Cargo.toml`'s `[profile]` configuration. Now that rust-lang/cargo#7253 is fixed we can ensure that Cargo knows about debug assertions settings, and it can also be configured to specifically disable debug assertions unconditionally for compiler-builtins. This should improve rebuild logic when debug-assertions settings change and also improve build-std integration where Cargo externally now has an avenue to learn how to build compiler-builtins as well.

view details

Ivan Tham

commit sha 49b4804d291bc8cc93e7b4b8c24f344aa3e3f484

Ignore example compile in rustc-attrs doc

view details

push time in 21 days

pull request commentrust-lang/rust

do not try fetching the ancestors of errored trait impls

r? @matthewjasper

lcnr

comment created time in 21 days

pull request commentrust-lang/rust

consult dlerror() only if a dl*() call fails

r=me with nits addressed. I don't think you need to change the existing CStr conversion, although to_string_lossy would be more appropriate here.

jclulow

comment created time in 21 days

Pull request review commentrust-lang/rust

consult dlerror() only if a dl*() call fails

 mod dl {             // dlerror isn't thread safe, so we need to lock around this entire             // sequence             let _guard = (*LOCK).lock();++            // dlerror reports the most recent failure that occured during a+            // dynamic linking operation and then clears that error; we call+            // once in advance of our operation in an attempt to discard any+            // stale prior error report that may exist:             let _old_error = libc::dlerror();              let result = f(); -            let last_error = libc::dlerror() as *const _;-            if ptr::null() == last_error {+            // We should only check dlerror() in the event that the operation+            // fails, which we determine by checking for a NULL return.  This+            // covers at least dlopen() and dlsym().

Can you document these semantics at the function level? Specifically, if f returns a null pointer, this function returns Err with the string in dlerror.

Also, just to be sure, do all the functions we pass to this helper return NULL and only NULL to indicate an error? There's no (void *) 1 weirdness or something?

jclulow

comment created time in 21 days

Pull request review commentrust-lang/rust

consult dlerror() only if a dl*() call fails

 mod dl {             // dlerror isn't thread safe, so we need to lock around this entire             // sequence             let _guard = (*LOCK).lock();++            // dlerror reports the most recent failure that occured during a+            // dynamic linking operation and then clears that error; we call+            // once in advance of our operation in an attempt to discard any+            // stale prior error report that may exist:             let _old_error = libc::dlerror();              let result = f(); -            let last_error = libc::dlerror() as *const _;-            if ptr::null() == last_error {+            // We should only check dlerror() in the event that the operation+            // fails, which we determine by checking for a NULL return.  This+            // covers at least dlopen() and dlsym().+            //+            // While we are able to exclude other callers within this library,+            // we are not able to exclude external callers such as those in the+            // system libraries.  If dynamic linking activity is induced in+            // another thread, it may destroy our dlerror() report or it may+            // inject one that does not apply to us -- this error report must be+            // treated as advisory.+            if ptr::null() != result {                 Ok(result)             } else {

Since the else block now has a condition inside, could you switch to an early return for the happy path?

jclulow

comment created time in 21 days

Pull request review commentrust-lang/rust

consult dlerror() only if a dl*() call fails

 mod dl {             // dlerror isn't thread safe, so we need to lock around this entire             // sequence             let _guard = (*LOCK).lock();++            // dlerror reports the most recent failure that occured during a+            // dynamic linking operation and then clears that error; we call+            // once in advance of our operation in an attempt to discard any+            // stale prior error report that may exist:             let _old_error = libc::dlerror();

As @ollie27 said, there's no need to do this anymore if we don't use the return value of dlerror to determine whether an error occurred.

jclulow

comment created time in 21 days

pull request commentrust-lang/rust

Bail out early from `truncate` if the new length is equal to the old

I've replaced Vec::clear with the obvious implementation. The Vec methods in question are now faster or the same for all use-cases I've looked at. Notably, an optimized version of Vec::clone_from has one fewer branch. Unlike a bare truncate, I can actually see Vec::clone_from being called in a tight loop.

Old:

# %bb.0:
	push	rbp
	push	r15
	push	r14
	push	r13
	push	r12
	push	rbx
	push	rax
	mov	r12, rsi
	mov	r15, qword ptr [rsi + 16]
	mov	r13, qword ptr [rdi + 16]
	cmp	r13, r15
	jb	.LBB2_6             # EXTRA BRANCH HERE
# %bb.1:
	mov	rbx, qword ptr [rdi]
	mov	qword ptr [rdi + 16], r15
	jne	.LBB2_3      
# %bb.2:
	mov	r13, r15
	jmp	.LBB2_8

.LBB2_3:
	mov	qword ptr [rsp], rdi    # 8-byte Spill
	lea	rbp, [8*r15]
	shl	r13, 3
	mov	r14, qword ptr [rip + __rust_dealloc@GOTPCREL]

.LBB2_4:                                # =>This Inner Loop Header: Depth=1
	mov	rdi, qword ptr [rbx + rbp]
	mov	esi, 4
	mov	edx, 4
	call	r14
	add	rbp, 8
	cmp	r13, rbp
	jne	.LBB2_4
# %bb.5:
	mov	rdi, qword ptr [rsp]    # 8-byte Reload
	mov	r13, qword ptr [rdi + 16]

.LBB2_6:
	cmp	r15, r13
	jb	.LBB2_17
# %bb.7:
	mov	rbx, qword ptr [rdi]

.LBB2_8:
	mov	rcx, qword ptr [r12]
	lea	rsi, [rcx + 8*r13]
	sub	r15, r13
	test	r13, r13
	je	.LBB2_16
# %bb.9:
	lea	rdx, [r13 - 1]
	mov	r8d, r13d
	and	r8d, 3
	cmp	rdx, 3
	jae	.LBB2_11
# %bb.10:
	xor	edx, edx
	jmp	.LBB2_13

.LBB2_11:
	sub	r13, r8
	xor	edx, edx

.LBB2_12:                               # =>This Inner Loop Header: Depth=1
	mov	rax, qword ptr [rbx + 8*rdx]
	mov	rbp, qword ptr [rcx + 8*rdx]
	mov	ebp, dword ptr [rbp]
	mov	dword ptr [rax], ebp
	mov	rax, qword ptr [rbx + 8*rdx + 8]
	mov	rbp, qword ptr [rcx + 8*rdx + 8]
	mov	ebp, dword ptr [rbp]
	mov	dword ptr [rax], ebp
	mov	rax, qword ptr [rbx + 8*rdx + 16]
	mov	rbp, qword ptr [rcx + 8*rdx + 16]
	mov	ebp, dword ptr [rbp]
	mov	dword ptr [rax], ebp
	mov	rax, qword ptr [rbx + 8*rdx + 24]
	mov	rbp, qword ptr [rcx + 8*rdx + 24]
	add	rdx, 4
	mov	ebp, dword ptr [rbp]
	mov	dword ptr [rax], ebp
	cmp	r13, rdx
	jne	.LBB2_12

.LBB2_13:
	test	r8, r8
	je	.LBB2_16
# %bb.14:
	lea	rcx, [rcx + 8*rdx]
	lea	rdx, [rbx + 8*rdx]
	xor	eax, eax

.LBB2_15:                               # =>This Inner Loop Header: Depth=1
	mov	rbp, qword ptr [rdx + 8*rax]
	mov	rbx, qword ptr [rcx + 8*rax]
	mov	ebx, dword ptr [rbx]
	mov	dword ptr [rbp], ebx
	add	rax, 1
	cmp	r8, rax
	jne	.LBB2_15

.LBB2_16:
	mov	rdx, r15
	add	rsp, 8
	pop	rbx
	pop	r12
	pop	r13
	pop	r14
	pop	r15
	pop	rbp
	jmp	alloc::vec::Vec<T>::extend_from_slice # TAILCALL

.LBB2_17:
	lea	rdx, [rip + .L__unnamed_1]
	mov	rdi, r13
	mov	rsi, r15
	call	qword ptr [rip + core::slice::slice_index_len_fail@GOTPCREL]
	ud2
                                        # -- End function

New:

# %bb.0:
	push	rbp
	push	r15
	push	r14
	push	r13
	push	r12
	push	rbx
	push	rax
	mov	r12, rsi
	mov	r15, qword ptr [rsi + 16]
	mov	r13, qword ptr [rdi + 16]
	cmp	r13, r15
	jbe	.LBB3_4    
# %bb.1:
	mov	rbx, qword ptr [rdi]
	mov	qword ptr [rsp], rdi    # 8-byte Spill
	mov	qword ptr [rdi + 16], r15
	lea	rbp, [8*r15]
	shl	r13, 3
	mov	r14, qword ptr [rip + __rust_dealloc@GOTPCREL] 

.LBB3_2:                                # =>This Inner Loop Header: Depth=1
	mov	rdi, qword ptr [rbx + rbp]
	mov	esi, 4
	mov	edx, 4
	call	r14
	add	rbp, 8
	cmp	r13, rbp
	jne	.LBB3_2
# %bb.3:
	mov	rdi, qword ptr [rsp]    # 8-byte Reload
	mov	r13, qword ptr [rdi + 16]

.LBB3_4:
	mov	rdx, r15
	sub	rdx, r13
	jb	.LBB3_14
# %bb.5:
	mov	r9, qword ptr [r12]
	lea	rsi, [r9 + 8*r13]
	test	r13, r13
	je	.LBB3_13
# %bb.6:
	mov	rcx, qword ptr [rdi]
	lea	rax, [r13 - 1]
	mov	r8d, r13d
	and	r8d, 3
	cmp	rax, 3
	jae	.LBB3_8
# %bb.7:
	xor	eax, eax
	jmp	.LBB3_10

.LBB3_8:
	sub	r13, r8
	xor	eax, eax

.LBB3_9:                                # =>This Inner Loop Header: Depth=1
	mov	rbp, qword ptr [rcx + 8*rax]
	mov	rbx, qword ptr [r9 + 8*rax]
	mov	ebx, dword ptr [rbx]
	mov	dword ptr [rbp], ebx
	mov	rbp, qword ptr [rcx + 8*rax + 8]
	mov	rbx, qword ptr [r9 + 8*rax + 8]
	mov	ebx, dword ptr [rbx]
	mov	dword ptr [rbp], ebx
	mov	rbp, qword ptr [rcx + 8*rax + 16]
	mov	rbx, qword ptr [r9 + 8*rax + 16]
	mov	ebx, dword ptr [rbx]
	mov	dword ptr [rbp], ebx
	mov	rbp, qword ptr [rcx + 8*rax + 24]
	mov	rbx, qword ptr [r9 + 8*rax + 24]
	add	rax, 4
	mov	ebx, dword ptr [rbx]
	mov	dword ptr [rbp], ebx
	cmp	r13, rax
	jne	.LBB3_9

.LBB3_10:
	test	r8, r8
	je	.LBB3_13
# %bb.11:
	lea	r9, [r9 + 8*rax]
	lea	rax, [rcx + 8*rax]
	xor	ecx, ecx

.LBB3_12:                               # =>This Inner Loop Header: Depth=1
	mov	rbp, qword ptr [rax + 8*rcx]
	mov	rbx, qword ptr [r9 + 8*rcx]
	mov	ebx, dword ptr [rbx]
	mov	dword ptr [rbp], ebx
	add	rcx, 1
	cmp	r8, rcx
	jne	.LBB3_12

.LBB3_13:
	add	rsp, 8
	pop	rbx
	pop	r12
	pop	r13
	pop	r14
	pop	r15
	pop	rbp
	jmp	alloc::vec::Vec<T>::extend_from_slice # TAILCALL

.LBB3_14:
	lea	rdx, [rip + .L__unnamed_1]
	mov	rdi, r13
	mov	rsi, r15
	call	qword ptr [rip + core::slice::slice_index_len_fail@GOTPCREL]
	ud2
                                        # -- End function
ecstatic-morse

comment created time in a month

push eventecstatic-morse/rust

Dylan MacKenzie

commit sha d88f09ba9720df92610c66ac81ea69fd8f964a7e

Implement `Vec::clear` by hand The new version of `truncate` compiles up a branch when called with a constant `0` and `T: !Drop`.

view details

push time in a month

issue commentrust-lang/rust

`VecDeque` implementation creates a slice pointing to possibly uninitialized memory

This one seems so obvious that I'm wondering if I've overlooked something.

I need to stop hedging :smile:.

I also had assumed that the question of whether &T required T to be valid was more settled than the discussion in rust-lang/unsafe-code-guidelines#77 suggests. With that in mind, how do we want to prioritize this? I think it's not unprecedented for the standard library to rely on behavior that is technically undefined when there is active discussion about the rules and we aren't relying on that property for optimizations. That seems to be the case here?

ecstatic-morse

comment created time in a month

issue commentrust-lang/rust

Handle generic associated constants in const qualification for structural match

@lcnr Sorry I missed your comment.

it should be possible to change ConstQualifs::custom_eq to Option<&'tcx [Ty<'tcx>]> where all the Ty<'tcx> are projections/opaque types which are required to be structurally match but are still too generic.

This is indeed possible, although not with the current dataflow framework, which only works on BitSets of some index type. We would need to extend it to work on arbitrary lattices (in this case the set of all projections/opaque types ordered by inclusion). I've had this on the backburner for some time, but I might get around to it soon.

If we were to go this route, const qualification will become slower and more memory hungry, so like you I would prefer to avoid it. Given that, it seems we would need to break code like this to convert fully to a const-qualification-based approach. Presumably, having two layers of associated constants in a pattern is presumably something very few users care about. However, I don't think this meets the requirements for a breaking change, since the code isn't actually unsound.

ecstatic-morse

comment created time in a month

issue openedrust-lang/rust

`VecDeque` implementation creates a slice pointing to possibly uninitialized memory

VecDeque has an internal method called buffer_as_slice, which returns an &[T] containing the entire capacity of the VecDeque. This is undefined behavior if the VecDeque is not full, since some elements of the backing RawVec may be uninitialized. However, this invariant is not documented on buffer_as_slice and is not respected in practice. For example, VecDeque::iter calls buffer_on_slice unconditionally:

https://github.com/rust-lang/rust/blob/34c5cd9a64d8537236626c4ccbed39a924cd38e2/src/liballoc/collections/vec_deque.rs#L959-L962

This one seems so obvious that I'm wondering if I've overlooked something. cc @rust-lang/wg-unsafe-code-guidelines

created time in a month

pull request commentrust-lang/rust

Bail out early from `truncate` if the new length is equal to the old

Seems like this results in an additional branch for Vec::truncate(0) (AKA Vec::clear) for vectors of Copy types. In the code that motivated this PR, equality was the common case, and this change does result in slightly better code when the elements are not Copy (note the extra branch in foo).

Maybe we just want to close this? Or I could implement Vec::clear by hand? I don't expect it's common for people to need Vec::truncate in a tight loop.

ecstatic-morse

comment created time in a month

pull request commentrust-lang/rust

[WIP] Support MIR dataflow problems on arbitrary lattices

@bors try @rust-timer queue

ecstatic-morse

comment created time in a month

PR opened rust-lang/rust

Bail out early from `truncate` if the new length is equal to the old

truncate should do nothing for collections if the new length is equal to the current length, but this is not explicitly stated in the code. Instead, control flow continues in this case until an empty slice is passed to drop_in_place. While this is equivalent and likely optimizes to the same code, it is not as clear.

+10 -8

0 comment

3 changed files

pr created time in a month

push eventecstatic-morse/rust

Dylan MacKenzie

commit sha 8d0eded7ec508b40681979cb2bc8a9676be2752d

Don't truncate if new length is equal to old `truncate` should do nothing for collections if the new length is equal to the current length, but this was not reflected in the code. Instead, control flow continued until an empty slice was passed to `drop_in_place`.

view details

push time in a month

push eventecstatic-morse/rust

Dylan MacKenzie

commit sha 698e870f75710152309158342fd18461531cc0fb

Stop adding unreachable basic blocks to dataflow work queue Also adds some debug assertions to prevent API consumers from visiting those basic blocks by accident.

view details

push time in a month

push eventecstatic-morse/rust

Dylan MacKenzie

commit sha 0d3deca34f25a29b19dd2d2ab03a62e9b62614ab

WIP

view details

push time in a month

push eventecstatic-morse/rust

push time in a month

push eventecstatic-morse/rust

Dylan MacKenzie

commit sha d3357a9a26f602c7d03c6f6b4b4d288a6648dd81

WIP

view details

Dylan MacKenzie

commit sha 5f849400e1426c02d2db016ae5bfad8c353af18f

pplattice

view details

push time in a month

create barnchecstatic-morse/rust

branch : truncate-len-eq

created branch time in a month

PR opened rust-lang/rust

[WIP] Support MIR dataflow problems on arbitrary lattices

Still a ways off. Needs a perf run for the dynamic dispatch.

r? @ghost

+540 -328

0 comment

19 changed files

pr created time in a month

create barnchecstatic-morse/rust

branch : dataflow-lattice

created branch time in a month

PR opened rust-lang/rust

Stop processing unreachable blocks when solving dataflow

...instead we debug_assert that the user is not checking the dataflow state for an unreachable block. This resolves a FIXME in the dataflow engine. The old behavior was an artifact of the previous dataflow framework. Things should run a tiny bit faster now, but I suspect not enough to show up in benchmarks. AFAIK, only the generator transform runs dataflow on MIR with unreachable basic blocks.

This PR also adds some utility methods to mir::traversal.

r? @pnkfelix

+42 -14

0 comment

5 changed files

pr created time in a month

push eventecstatic-morse/rust

Dylan MacKenzie

commit sha efe634f14c20661216c57322b319c1cac1f9704f

Add `reachable` and friends to `mir::traversal` module

view details

Dylan MacKenzie

commit sha a971007047bc4dd1814b11bcd0bb1db5280c2521

Stop adding unreachable basic blocks to dataflow work queue Also adds some debug assertions to prevent API consumers from visiting those basic blocks by accident.

view details

push time in a month

create barnchecstatic-morse/rust

branch : dataflow-unreachable

created branch time in a month

startedbodil/smartstring

started time in a month

pull request commentrust-lang/rust

Optimize is_ascii for str and [u8].

I would have added a fast path for when slice.len() < mem::size_of::<usize>() to the align_to version since your version has a similar check that makes it fast on the small benchmark. I will note that the margin of error for both versions overlaps, but I would call your version meaningfully more efficient on x86 at least. Thanks for doing the work.

thomcc

comment created time in a month

pull request commentrust-lang/rust

Optimize is_ascii for str and [u8].

Simple code is good code, and people running ARM may also want to check whether their strings are ASCII-only. If your more complex version is meaningfully more efficient, then fine, but I suspect it's not.

thomcc

comment created time in a month

pull request commentrust-lang/rust

Optimize is_ascii for str and [u8].

You should have a look at slice::align_to.

thomcc

comment created time in a month

pull request commentrust-lang/rust

Clean up errors caused by `::` -> `:` typos

I'm not familiar with this part of the code base.

r? @petrochenkov maybe?

estebank

comment created time in a month

pull request commentrust-lang/rust

Eliminate `ObligationCauseData`.

Is there a semantic difference between dummy and misc? We could try to unify the two instead.

nnethercote

comment created time in a month

pull request commentrust-lang/rust

Avoid `unwrap_or_else` in `RawVec::allocate_in`.

@bors r=Amanieu

nnethercote

comment created time in a month

PullRequestEvent

PR closed rust-lang/rust

Avoid `unwrap_or_else` in `RawVec::allocate_in`. S-waiting-on-author

This reduces the amount of LLVM IR generated by up to 1 or 2%.

r? @Amanieu

+14 -3

18 comments

1 changed file

nnethercote

pr closed time in a month

pull request commentrust-lang/rust

Avoid `unwrap_or_else` in `RawVec::allocate_in`.

@bors r-

nnethercote

comment created time in a month

pull request commentrust-lang/rust

Avoid `unwrap_or_else` in `RawVec::allocate_in`.

Or maybe bors is just borked? This still isn't in the queue.

nnethercote

comment created time in a month

pull request commentrust-lang/rust

Avoid `unwrap_or_else` in `RawVec::allocate_in`.

@bors r=Amanieu

(@Manishearth I think "retry" retried the r-?)

nnethercote

comment created time in a month

pull request commentrust-lang/rust

Handle inactive enum variants in `MaybeUninitializedPlaces`

@bors rollup=never (perf)

ecstatic-morse

comment created time in a month

pull request commentrust-lang/rust

Handle inactive enum variants in `MaybeUninitializedPlaces`

r? @oli-obk cc @eddyb

ecstatic-morse

comment created time in a month

Pull request review commentrust-lang/rust

Const floating point bitcasts and classification

+// -Zmir-opt-level=0+// run-pass++#![feature(const_panic)]+#![feature(const_if_match)]+#![feature(const_float_bits_conv)]+#![feature(const_float_classify)]++// Don't promote+const fn nop<T>(x: T) -> T { x }++macro_rules! const_assert {+    ($a:expr, $b:expr) => {+        {+            const _: () = assert!($a == $b);+            assert_eq!(nop($a), nop($b));+        }+    };+}++macro_rules! suite {+    ( $( $tt:tt )* ) => {+        fn f32() {+            suite_inner!(f32 $($tt)*);+        }++        fn f64() {+            suite_inner!(f64 $($tt)*);+        }+    }++}++macro_rules! suite_inner {+    (+        $ty:ident [$( $fn:ident ),*]+        $val:expr => [$($out:ident),*]++        $( $tail:tt )*+    ) => {+        $( const_assert!($ty::$fn($val), $out); )*+        suite_inner!($ty [$($fn),*] $($tail)*)+    };++    ( $ty:ident [$( $fn:ident ),*]) => {};+}++suite! {+                   [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]+     -0.0 / 0.0 => [  true,       false,     false,     false,             true,            false]+      0.0 / 0.0 => [  true,       false,     false,     false,             true,            false]+            1.0 => [ false,       false,      true,      true,             true,            false]+           -1.0 => [ false,       false,      true,      true,            false,             true]+            0.0 => [ false,       false,      true,     false,             true,            false]+           -0.0 => [ false,       false,      true,     false,            false,             true]+      1.0 / 0.0 => [ false,        true,     false,     false,             true,            false]+     -1.0 / 0.0 => [ false,        true,     false,     false,            false,             true]

This is LLVMs const propagation. I think I need to rewrite this test to not assume anything about NaN signedness, since it's likely to fail on other platforms.

ecstatic-morse

comment created time in a month

push eventecstatic-morse/rust

Dylan MacKenzie

commit sha eb4d28bce0a73ddbdbcd107dd7875ddd97a603d8

Bless mir-opt tests

view details

push time in a month

more