Contribute to Open Source. Search issue labels to find the right project for you!

Can't get ARM output in the Rust compiler

mattgodbolt/compiler-explorer

I was hoping that adding --target=arm-unknown-linux-gnueabihf to the rust compiler flags would get me arm output, but I get: error[E0463]: can't find crate for `std` | = note: the `arm-unknown-linux-gnueabihf` target may not be installed error: aborting due to previous error Compiler exited with result code 101 Same issue for thumbv7em-none-eabi, and all the arm prefixes targets in this list (output truncated for readability): `--> rustup target list aarch64-apple-ios aarch64-linux-android aarch64-unknown-fuchsia aarch64-unknown-linux-gnu arm-linux-androideabi arm-unknown-linux-gnueabi arm-unknown-linux-gnueabihf arm-unknown-linux-musleabi arm-unknown-linux-musleabihf armv7-apple-ios armv7-linux-androideabi armv7-unknown-linux-gnueabihf armv7-unknown-linux-musleabihf armv7s-apple-ios

Is there any way to have the standard libraries installed for at least armv7-unknown-linux-gnueabihf and arm-unknown-linux-gnueabihf? I haven’t read through the setup code for the images which run godbolt, but if you’re just using docker or something similar, it should be as easy as adding these lines to the setup scripts (assuming you’re using rustup): rustup target add arm-unknown-linux-gnueabihf rustup target add armv7-unknown-linux-gnueabihf

Anyway, I’ll take a look and see how painful it is to add it myself and generate the PR, but I figured I would create the issue to track the problem regardless!

Updated 17/08/2017 10:10 1 Comments

Rust: Support external crates

mesonbuild/meson

I was told that support of Rust was experimental so I can expect hickups and that’s understandable but currently it seems external crates are not supported. Since you can’t really do much in Rust without external crates, it basically means that Meson doesn’t really support Rust. IMO until this issue is addressed in some way, support for Rust shouldn’t be advertised at all.

Updated 11/08/2017 17:47 17 Comments

CHAIN support (OAE2)

miscreant/miscreant

This is a tracking issue for adding support for the CHAIN OAE2 construction as described in the paper Online Authenticated-Encryption and its Nonce-Reuse Misuse-Resistance (Section 6, p. 12):

CHAIN Diagram

Design Status

Work is needed to specify the design and test vectors for CHAIN. This work is not likely to happen until after STREAM has been implemented: https://github.com/miscreant/miscreant/issues/32

Implementation Status

Language Support
Go :no_entry:
Python :no_entry:
Ruby :no_entry:
Rust :no_entry:
TypeScript :no_entry:
Updated 29/07/2017 19:56 1 Comments

STREAM support (Nonce-based OAE)

miscreant/miscreant

This is a tracking issue for adding support for the STREAM OAE1 construction as described in the paper Online Authenticated-Encryption and its Nonce-Reuse Misuse-Resistance (Section 7, p. 14):

STREAM Diagram

Design Status

More clarification is needed on the exact nonce format to be used. See the comments below.

Implementation Status

This is a tracking issue for adding STREAM support to the various language-specific implementations in this project:

Language Support
Go :no_entry:
Python :no_entry:
Ruby :no_entry:
Rust :no_entry:
TypeScript :no_entry:
Updated 29/07/2017 19:57 1 Comments

Raw string literals

hngnaig/notes

raw string không xử lý bất kỳ escapes nào. Raw string được bắt đầu bằng ký tự r bắt buộc, theo sau đó ký tự # (U+0023) và double-quote " (U+0022), có thể có một hoặc nhiều #" liên tiếp nhau, và kết thúc "#, số ký tự ", # sẽ phụ thuộc vào số ký tự bắt đầu.

r#"foo"#; // foo
r#""foo""#; // "foo"
r####""""foo""""####; // """foo"""
r#"\x56"#; // \x56foo; not vfoo;
"\\x56"; // \x56
Updated 23/06/2017 10:25

Bảng escapes ở Rust

hngnaig/notes

Byte escapes

code Name
\x7F 8-bit character code (exactly 2 digits)
\n Newline
\r Carriage return
\t tab
\\ Backslash
\0 Null

Unicode escapes

Code Name
\u{7FFF} 24-bit unicode character code (up to 6 digits)

Quote escapes

Code Name
\' Single quote
\" Double quote
Updated 23/06/2017 09:42

Characters and strings literal

hngnaig/notes

Một vài cách khai báo với strings và characters rust // character let _ = 'H'; // string let _ = "string"; // raw let _ = r#"hello"#; // byte let _ = b'H'; // byte string let _ = b"hello"; // byte raw string // let _ = br#"hello"#;

Updated 23/06/2017 10:03

Escape \n String

hngnaig/notes

Khi bạn có một chuỗi (string), nếu bạn escape ký tự xuống dòng \n bằng cách thêm \ vào giữa string như sau: rust let b = "some\ thing"; thì trong chuỗi trên escape sẽ bị bỏ qua và sẽ bằng với chuỗi sau: ```rust let a = “something”;

assert_eq!(a, b); ```

Updated 23/06/2017 09:09

Decide whether to use Groth16 or PHGR13/BCTV14 for Sapling

zcash/zcash

PHGR13/BCTV14 is our current proving system. (See section 5.7 of the protocol spec and references there. The minor differences from the PHGR13 paper include adapting to Type 3 pairings, and a slight change to the verification key.)

Groth16 is a more recent proving system designed by Jens Groth and described in https://eprint.iacr.org/2016/260 . It has smaller proofs (about <sup>4</sup>/<sub>9</sub> the size of PHGR13/BCTV14 for a given curve), and faster proving and verification. It is proven secure in the Subversion Generic Bilinear Group Model (Sub-GBGM); see https://eprint.iacr.org/2017/599 . (The Sub-GBGM is a more realistic model than the GBGM used in Groth’s paper, so this is a stronger result than the original one by Groth. The changes made by Abdolmaleki et al are only to the CRS generation and verification, not to proving or verifying.)

Proofs in the Sub-GBGM model a Type 3 pairing abstractly, only allowing the adversary to use certain operations on group elements (group addition in G<sub>1</sub> or G<sub>2</sub>; multiplication in G<sub>T</sub>; pairing; picking a random G<sub>{1, 2, T}</sub> element with unknown discrete log; and comparison of group elements). Of course a real adversary is not limited to using these operations when manipulating group elements, so proofs in this model are only proofs of the difficulty of a certain class of generic attacks. The realism of the model is therefore an issue when assessing the value of the security proof, relative to security proofs based only on standard and/or knowledge assumptions which are available for PHGR13/BCTV14.

@ebfull has implemented Groth16 (several times! :-) ) in Rust. It’s likely that we would be using a Rust implementation if we switched to Groth16; also, it’s likely that we would be using the BLS12-381 curve. However we could also do each of these things (switch to Groth16, BLS12-381, or Rust) independently, so we need to consider the concrete performance improvement (and other features; see Sean’s comment below) of Groth16 while holding other factors constant, before making a decision about whether any risk associated with using the newer proving system is justified.

Updated 10/07/2017 18:28 18 Comments

Trait FromStr

hngnaig/notes
pub trait FromStr {
    type Err;
    fn from_str(s: &str) -> Result<Self, Self::Err> {}
}

Nếu implement trait này, chúng ta có thể convert một string nào đó sang type chúng ta muốn. Ví dụ:

let ip = "127.0.0.1".parse().unwrap();
println!("Debug: {:?}", ip);
/// IpAddress::V4("127.0.0.1")

hoặc: rust let two = "2".parse::<i32>().unwrap(); println!("{}", two); // 2 Hay nói cách khác thì i32 đã implement trait này như sau: ```rust impl FromStr for i32 { type Err = ParseErrror; fn from_str(s: &str) -> Result<i32, Self::Err> { unimplemted; } }

Updated 23/06/2017 09:15

Tạo document ở Rust

hngnaig/notes

Phần notes sẽ nói về comment và document.


Comment

grammar comment : block_comment | line_comment ; block_comment : "/*" block_comment_body * "*/" ; block_comment_body : [block_comment | character] * ; line_comment : "//" non_eol * ;

Example ```rust // line comment

/ block coment line 1 line 2 / ```

Updated 22/06/2017 14:08

[query] Add type-hinting functions

mozilla/mentat

It would be convenient to have a way to constrain the types of variables explicitly:

[:find ?x :where
 [(uuid ?v)]
 [?x _ ?v]]

This hinting/constraining would be useful for queries like the above — find all entities associated with any UUID — but also allows for ground (and potentially other functions) to accept ambiguous EDN input. We don’t have a good way right now to distinguish between 10 the Long and 10 the entid.

These functions are very straightforward to implement.

Updated 16/06/2017 19:17 1 Comments

Port llvm-hs to Rust

glaebhoerl/personal

llvm-hs-pure -> llvm-ast llvm-hs -> ?

Depend on llvm-sys for FFI.

Use language-haskell-syntax and output raw Rust (as string) to automate bulk of grunt work?

AST: Box, Rc, Arc? Can we abstract it? (Fake HKTs with associated types? How about &'a T or Cow?) [a] -> Vec<T>? Or Cow<'a, [T]>?

https://hackage.haskell.org/package/llvm-hs https://hackage.haskell.org/package/llvm-hs-pure

Updated 23/05/2017 09:41

new verifier implemented in Rust

zcash/zcash

Write a new verifier for the Zcash v1 (“Sapling”) ZK-proofs from the ground up in Rust. Run both the current verifier unchanged and the new verifier in parallel so that it doesn’t take anymore time (typically), even though it takes more CPU. Wait til both verifiers have completed. If they both return true, then the combo returns true. If they both return false then the combo returns false. If they return different things than each other, then the combo logs a detailed error message (including the proof in question and the current message and so on) and then aborts the process.

(This aborting-the-process part raises questions about blockchain forks and forward progress, but I’m pretty sure it is far more important to alert users and developers and to prevent users from accidentally accepting invalid payments than it is to minimize chances of a blockchain fork. Also, as the Zcash employees well learned during the recent security incident (https://z.cash/blog/security-announcement-2017-04-13.html), I’m firmly of the opinion that the only way to communicate with most users is to abort the process.)

Updated 04/08/2017 13:42 14 Comments

Update FasterPath code for Windows compatibility

danielpclark/faster_path

Appveyor tests have been added and have shown 23 errors in FasterPath tests on Windows. This is without monkey patches or the WITH_REGRESSION environment flag.

Started with run options --seed 43247
AbsoluteTest
 FAIL (0.00s) :: test_it_determins_absolute_path
Expected false to be truthy.
C:/projects/faster-path/test/absolute_test.rb:9:in `test_it_determins_absolute_path'
 FAIL (0.00s) :: test_it_returns_similar_results_to_pathname_absolute?
Expected: true
Actual: false
C:/projects/faster-path/test/absolute_test.rb:15:in `block in test_it_returns_similar_results_to_pathname_absolute?'
C:/projects/faster-path/test/absolute_test.rb:14:in `each'
C:/projects/faster-path/test/absolute_test.rb:14:in `test_it_returns_similar_results_to_pathname_absolute?'
 PASS (0.00s) :: test_it_safely_takes_nil
DirnameTest
 PASS (0.00s) :: test_it_does_not_modify_its_argument
 FAIL (0.04s) :: test_it_returns_the_return_all_the_components_of_filename_except_the_last_one_unix_format
--- expected
+++ actual
@@ -1,2 +1,2 @@
-# encoding: UTF-8
-"/"
+# encoding: ASCII-8BIT
+"."
C:/projects/faster-path/test/dirname_test.rb:30:in `test_it_returns_the_return_all_the_components_of_filename_except_the_last_one_unix_format'
 FAIL (0.01s) :: test_it_ignores_a_trailing_slash
--- expected
+++ actual
@@ -1,2 +1,2 @@
-# encoding: UTF-8
-"/foo"
+# encoding: ASCII-8BIT
+"."
C:/projects/faster-path/test/dirname_test.rb:25:in `test_it_ignores_a_trailing_slash'
 PASS (0.00s) :: test_it_gets_dirnames_correctly
 FAIL (0.01s) :: test_it_returns_all_the_components_of_filename_except_the_last_one
--- expected
+++ actual
@@ -1,2 +1,2 @@
-# encoding: UTF-8
-"/home"
+# encoding: ASCII-8BIT
+"."
C:/projects/faster-path/test/dirname_test.rb:5:in `test_it_returns_all_the_components_of_filename_except_the_last_one'
 FAIL (0.01s) :: test_it_returns_the_return_all_the_components_of_filename_except_the_last_one_edge_cases
--- expected
+++ actual
@@ -1,2 +1,2 @@
-# encoding: UTF-8
-"./b"
+# encoding: ASCII-8BIT
+"."
C:/projects/faster-path/test/dirname_test.rb:40:in `test_it_returns_the_return_all_the_components_of_filename_except_the_last_one_edge_cases'
 PASS (0.00s) :: test_it_returns_a_string
DirectoryRefinementTest
 PASS (0.00s) :: test_refines_pathname_directory?
 PASS (0.00s) :: test_nil_behaves_the_same
DirectoryTest
 PASS (0.00s) :: test_of_Cs
 FAIL (0.01s) :: test_of_Bs
Expected: false
Actual: true
C:/projects/faster-path/test/directory_test.rb:42:in `test_of_Bs'
 PASS (0.00s) :: test_of_As
 PASS (0.00s) :: test_nil_for_directory?
RelativeRefinementTest
 PASS (0.00s) :: test_nil_behaves_the_same
 FAIL (0.00s) :: test_refines_pathname_relative?
Expected true to not be truthy.
C:/projects/faster-path/test/refinements/relative_test.rb:14:in `test_refines_pathname_relative?'
HasTrailingSeparatorTest
 FAIL (0.00s) :: test_has_trailing_separator_against_pathname_implementation
Expected: true
Actual: false
C:/projects/faster-path/test/has_trailing_separator_test.rb:17:in `test_has_trailing_separator_against_pathname_implementation'
 PASS (0.00s) :: test_has_trailing_separator?
 PASS (0.00s) :: test_has_trailing_separator_with_nil
HasTrailingSeparatorRefinementTest
 PASS (0.00s) :: test_refines_pathname_has_trailing_separator?
JoinTest
 PASS (0.00s) :: test_join
ChopBasenameTest
 FAIL (0.00s) :: test_of_Cs
Expected: ["http://", "www.example.com"]
Actual: ["", "http://www.example.com"]
C:/projects/faster-path/test/chop_basename_test.rb:130:in `test_of_Cs'
 PASS (0.00s) :: test_nil_inputs
 FAIL (0.00s) :: test_of_As
Expected: ["aa/a//", "a"]
Actual: ["", "aa/a//a"]
C:/projects/faster-path/test/chop_basename_test.rb:83:in `test_of_As'
 PASS (0.00s) :: test_it_fixes_blank_results_to_pathname_chop_basename
 FAIL (0.02s) :: test_it_returns_similar_results_to_pathname_chop_basename_for_dot_files
a: .hello/world/ and b: .
--- expected
+++ actual
@@ -1,2 +1,2 @@
-# encoding: UTF-8
-".hello/world/"
+# encoding: ASCII-8BIT
+""
C:/projects/faster-path/test/chop_basename_test.rb:71:in `block (2 levels) in test_it_returns_similar_results_to_pathname_chop_basename_for_dot_files'
C:/projects/faster-path/test/chop_basename_test.rb:70:in `each'
C:/projects/faster-path/test/chop_basename_test.rb:70:in `block in test_it_returns_similar_results_to_pathname_chop_basename_for_dot_files'
C:/projects/faster-path/test/chop_basename_test.rb:67:in `each'
C:/projects/faster-path/test/chop_basename_test.rb:67:in `test_it_returns_similar_results_to_pathname_chop_basename_for_dot_files'
 FAIL (0.01s) :: test_it_chops_basename_
--- expected
+++ actual
@@ -1,2 +1,2 @@
-# encoding: ASCII-8BIT
-"/hello/world.txt"
+# encoding: UTF-8
+"world.txt"
C:/projects/faster-path/test/chop_basename_test.rb:11:in `test_it_chops_basename_'
 FAIL (0.01s) :: test_it_returns_similar_results_to_pathname_chop_basename
a: hello/world/ and b: .
--- expected
+++ actual
@@ -1,2 +1,2 @@
-# encoding: UTF-8
-"hello/world/"
+# encoding: ASCII-8BIT
+""
C:/projects/faster-path/test/chop_basename_test.rb:28:in `block (2 levels) in test_it_returns_similar_results_to_pathname_chop_basename'
C:/projects/faster-path/test/chop_basename_test.rb:27:in `each'
C:/projects/faster-path/test/chop_basename_test.rb:27:in `block in test_it_returns_similar_results_to_pathname_chop_basename'
C:/projects/faster-path/test/chop_basename_test.rb:24:in `each'
C:/projects/faster-path/test/chop_basename_test.rb:24:in `test_it_returns_similar_results_to_pathname_chop_basename'
 FAIL (0.00s) :: test_of_Bs
Expected: ["../", "."]
Actual: ["", ".././"]
C:/projects/faster-path/test/chop_basename_test.rb:106:in `test_of_Bs'
 PASS (0.00s) :: test_it_returns_similar_results_to_pathname_chop_basename_for_slash
DelTrailingSeparatorTest
 PASS (0.00s) :: test_del_trailing_separator
 PASS (0.00s) :: test_del_trailing_separator_in_dosish_context
InstallBuildTest
 PASS (0.14s) :: test_cache_file
 SKIP (0.10s) :: test_install_gem_in_bundler_vendor
 SKIP (0.10s) :: test_install_gem_in_rvm_gemset
BlankTest
 PASS (0.00s) :: test_it_is_blank?
AddTrailingSeparatorTest
 PASS (0.00s) :: test_refines_pathname_add_trailing_separator_in_dosish_context
 FAIL (0.02s) :: test_add_trailing_separator_against_pathname_implementation
--- expected
+++ actual
@@ -1,2 +1,2 @@
-# encoding: UTF-8
-"hello/"
+# encoding: ASCII-8BIT
+"hello\\"
C:/projects/faster-path/test/add_trailing_separator_test.rb:43:in `test_add_trailing_separator_against_pathname_implementation'
 PASS (0.00s) :: test_it_handles_nil
 PASS (0.00s) :: test_refines_pathname_add_trailing_separator
 FAIL (0.01s) :: test_add_trailing_separator_in_dosish_context
--- expected
+++ actual
@@ -1,2 +1,2 @@
-# encoding: ASCII-8BIT
-"A:\\"
+# encoding: UTF-8
+"A:/"
C:/projects/faster-path/test/add_trailing_separator_test.rb:23:in `test_add_trailing_separator_in_dosish_context'
 FAIL (0.01s) :: test_add_trailing_separator
--- expected
+++ actual
@@ -1,2 +1,2 @@
-# encoding: ASCII-8BIT
-"hello\\"
+# encoding: UTF-8
+"hello/"
C:/projects/faster-path/test/add_trailing_separator_test.rb:12:in `test_add_trailing_separator'
AbsoluteRefinementTest
 PASS (0.00s) :: test_nil_behaves_the_same
 FAIL (0.00s) :: test_refines_pathname_absolute?
Expected false to be truthy.
C:/projects/faster-path/test/refinements/absoulte_test.rb:14:in `test_refines_pathname_absolute?'
CleanpathConservativeTest
 PASS (0.00s) :: test_clean_conservative_dosish_stuff
 PASS (0.00s) :: test_clean_conservative_defaults
PbenchTest
 FAIL (0.19s) :: test_it_calculates_the_correct_percentage
Expected 40..60 to include -8.9.
C:/projects/faster-path/test/pbench_test.rb:7:in `test_it_calculates_the_correct_percentage'
ExtnameTest
 PASS (0.00s) :: test_extname
 PASS (0.00s) :: test_extname_edge_cases
 PASS (0.00s) :: test_nil_inputs
 FAIL (0.01s) :: test_substitutability_of_rust_and_ruby_impls
--- expected
+++ actual
@@ -1,2 +1,2 @@
# encoding: ASCII-8BIT
-""
+".bar/baz"
C:/projects/faster-path/test/extname_test.rb:43:in `test_substitutability_of_rust_and_ruby_impls'
EntriesTest
 PASS (0.00s) :: test_it_returns_similar_results_to_pathname_entries_as_strings
RelativeTest
 FAIL (0.00s) :: test_it_knows_its_relativeness
Expected true to not be truthy.
C:/projects/faster-path/test/relative_test.rb:9:in `test_it_knows_its_relativeness'
 FAIL (0.00s) :: test_it_knows_its_relativeness_in_dos_like_drive_letters
Expected true to not be truthy.
C:/projects/faster-path/test/relative_test.rb:26:in `test_it_knows_its_relativeness_in_dos_like_drive_letters'
 PASS (0.00s) :: test_it_takes_nil_safely
ChopBasenameRefinementTest
 PASS (0.00s) :: test_refines_pathname_chop_basename
MonkeyPatchesTest
 PASS (0.00s) :: test_it_redefines_relative?
 PASS (0.00s) :: test_it_redefines_has_trailing_separator
 PASS (0.00s) :: test_it_redefines_absolute?
 PASS (0.00s) :: test_it_redefines_add_trailing_separator
 PASS (0.00s) :: test_it_does_not_redefine_directory?
 PASS (0.00s) :: test_it_redefines_chop_basename
CleanpathAggressiveTest
 PASS (0.00s) :: test_plus
 PASS (0.00s) :: test_clean_aggressive_dosish_stuff
 PASS (0.00s) :: test_clean_aggresive_defaults
 PASS (0.00s) :: test_clean_aggressive_defaults
BasenameTest
 PASS (0.00s) :: test_it_does_the_same_as_file_basename
 PASS (0.00s) :: test_it_creates_basename_correctly
 PASS (0.00s) :: test_nil_inputs
FasterPathTest
 PASS (0.00s) :: test_it_build_linked_library
Finished in 0.73281s
72 tests, 302 assertions, 23 failures, 0 errors, 2 skips
Updated 31/05/2017 00:52 2 Comments

[query] Implement simple aggregation

mozilla/mentat

We can support simple aggregation in our queries simply by creating appropriate GROUP BY clauses (see #311) and projecting aggregate expressions directly in SQL.

The usual aggregate function symbols map directly to SQL aggregate functions:

(def aggregate-functions
  {:avg :avg
   :count :count
   :max :max
   :min :min
   :sum :total
   })

and the ClojureScript implementation offers a lot of guidance.

Updated 16/06/2017 19:20

[tx] Wrap positive integer entids in an Entid newtype

mozilla/mentat

This is follow-up to https://github.com/mozilla/mentat/pull/171#discussion_r96086384 and #170. Right now, I’m representing positive integer entids as i64, since SQLite doesn’t have an unsigned u64 type. It’s an interesting challenge to really represent entids as an Entid newtype that is really u63. When I started, I didn’t understand the rusqlite traits FromSql and ToSql; now that I do, this should be straight-forward. I’m filing this as a [good next bug], I guess, since it’s not trivial. Use OrderedFloat for inspiration and remember that it never makes sense to do arithmetic on entids.

As a side benefit/hindrance while testing: this might allow Mentat to control the introduction of entids. The Clojure version accepted any integer as an entid, which was handy for testing but did not agree with Datomic. We might be able to make the only way to allocate an entid be via a tempid, which has good correctness properties: it’ll be harder to make errors in transactions, and it’ll be harder to pollute a datom store with disconnected components.

Updated 09/06/2017 22:51 2 Comments

Spacemacs freezes while trying to start a line of comment in rust mode

syl20bnr/spacemacs

Description :octocat:

Spacemacs freezes while trying to start a line of comment in rust mode.

Reproduction guide :beetle:

  • Start Emacs
  • Open a buffer with .rs ending that enables rust mode, e.g. test.rs
  • Try to start a line of comment by typing two / characters

Observed behaviour: :eyes: :broken_heart: Emacs freezes with 100% CPU usage. Using C-G might get out of the freeze but it doesn’t succeed all the time.

Expected behaviour: :heart: :smile: The editing continues normally.

System Info :computer:

  • OS: gnu/linux
  • Emacs: 26.0.50.2
  • Spacemacs: 0.200.7
  • Spacemacs branch: develop (rev. 0c3afd5)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers: elisp (helm speed-reading auto-completion better-defaults spell-checking syntax-checking semantic rcirc git github version-control (shell :variables shell-default-height 30 shell-default-position 'bottom shell-default-term-shell "/bin/zsh" shell-enable-smart-eshell t) (ranger :variables ranger-show-preview t ranger-show-literal nil ranger-parent-depth 3 ranger-cleanup-eagerly t ranger-show-dotfiles t ranger-max-preview-size 10) (typography :variables typography-enable-typographic-editing t) wakatime chrome search-engine restclient dash fasd pandoc colors themes-megapack gtags imenu-list vim-powerline evil-snipe emacs-lisp fsharp (haskell :variables haskell-completion-backend 'intero haskell-enable-hindent-style "gibiansky") elixir org latex markdown clojure python html yaml shell-scripts sql javascript ruby (c-c :variables c-c -default-mode-for-headers 'c -mode c-c -enable-clang-support t) rust)
  • System configuration features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES XWIDGETS LIBSYSTEMD

Backtrace :paw_prints:

Since Emacs freezes, I wasn’t able to get any backtrace.

Updated 20/06/2017 01:33 2 Comments

Easy methods to start learning Rust with

danielpclark/faster_path

If you see a method you would like to implement open a new issue and get started with the outline below.

Good starter methods

  • <strike>Pathname#has_trailing_separator?</strike>
  • <strike>Pathname#add_trailing_separator</strike>
  • Pathname#del_trailing_separator
  • <strike>Pathname#extname</strike>

    Outline

  • Write Rust implementation of Pathname to FasterPath
  • Write refinements and monkey-patches for Pathname and map implementation to FasterPath
  • Write tests proving FasterPath operates the same as Pathname
  • Write benchmarks in test/benches and compare the performance. And make a copy of the tests for test/pbench in the pbench_suite.rb file (the outline is in the file).
  • Also compare both the original to the new method to verify compatibility. (See chop_basename A,B,C tests)
Updated 31/05/2017 05:50 4 Comments

Implement Pathname#join

danielpclark/faster_path

Rust seems to have it’s own path joining methods. http://rustbyexample.com/std_misc/path.html This “may” do exactly what we want. - [ ] Write Rust implementation of Pathname#join to FasterPath.join - [ ] Write refinements and monkey-patches for Pathname#join and map implementation to Pathname.new(result) - [ ] Write tests proving FasterPath.join operates the same as Pathname#join - [ ] Write benchmarks in test/benches and compare the performance. - [ ] Copy benchmarks to test/pbench/pbench_suite.rb

Updated 31/05/2017 05:50 2 Comments

Implement Pathname#plus

danielpclark/faster_path

This is a rather long method and highly used one. It would be great to have a Rust implementation of it. Here’s the current Ruby source:

def plus(path1, path2) # -> path # :nodoc:
  prefix2 = path2
  index_list2 = []
  basename_list2 = []
  while r2 = chop_basename(prefix2)
    prefix2, basename2 = r2
    index_list2.unshift prefix2.length
    basename_list2.unshift basename2
  end
  return path2 if prefix2 != ''
  prefix1 = path1
  while true
    while !basename_list2.empty? && basename_list2.first == '.'
      index_list2.shift
      basename_list2.shift
    end
    break unless r1 = chop_basename(prefix1)
    prefix1, basename1 = r1
   next if basename1 == '.'
    if basename1 == '..' || basename_list2.empty? || basename_list2.first != '..'
      prefix1 = prefix1 + basename1
      break
   end
    index_list2.shift
    basename_list2.shift
  end
  r1 = chop_basename(prefix1)
  if !r1 && /#{SEPARATOR_PAT}/o =~ File.basename(prefix1)
    while !basename_list2.empty? && basename_list2.first == '..'
      index_list2.shift
      basename_list2.shift
    end
  end
  if !basename_list2.empty?
    suffix2 = path2[index_list2.first..-1]
    r1 ? File.join(prefix1, suffix2) : prefix1 + suffix2
  else
    r1 ? prefix1 : File.dirname(prefix1)
  end
end
private :plus

At the moment I’m not using regex in the library so it would be great if we could implement if !r1 && /#{SEPARATOR_PAT}/o =~ File.basename(prefix1) with something like str.contains(MAIN_SEPARATOR).

Better yet if you look into Rust’s path implementation you may find something that does all of this for you. We’ll need to have tests to confirm the same behavior is achieved.

Updated 31/05/2017 05:50 5 Comments

Fork me on GitHub