These are chat archives for rust-lang/rust

15th
Feb 2018
Peter Atashian
@retep998
Feb 15 2018 04:49
@alteous What sort of weird situation do you have where you need both of them?
If you do have a genuine use case then please comment on the tracking issues because it will be very helpful in deciding what to do with that in the future.
It's only forbidden right now because msvc and gcc differ in how they handle that combination and nobody wanted to pick one over the other, and no good solution was found to allow both styles.
sken
@floreslorca
Feb 15 2018 08:53
hi, im trying to download through cmake a particular distro for rust (rust-1.16.0) im not sure if the problem is my makefile or im giving the wrong sha256 hash
2018-02-15 02:42:21 URL:https://static.rust-lang.org/dist/rust-1.16.0-x86_64-pc-windows-gnu.tar.gz [111798351/111798351] -> "/usr/src/BitcoinPrivate/depends/work/download/rust-1.16.0/rust-1.16.0-x86_64-pc-windows-gnu.tar.gz.temp" [1]
sha256sum: /usr/src/BitcoinPrivate/depends/work/download/rust-1.16.0/.rust-1.16.0-x86_64-pc-windows-gnu.tar.gz.hash: no properly formatted SHA256 checksum lines found
funcs.mk:242: recipe for target '/usr/src/BitcoinPrivate/depends/sources/download-stamps/.stamp_fetched-rust-rust-1.16.0-x86_64-pc-windows-gnu.tar.gz.hash' failed
make: *** [/usr/src/BitcoinPrivate/depends/sources/download-stamps/.stamp_fetched-rust-rust-1.16.0-x86_64-pc-windows-gnu.tar.gz.hash] Error 1
where can i see if i have the right hash
Denis Lisov
@tanriol
Feb 15 2018 09:06
@floreslorca How do you download it?
sken
@floreslorca
Feb 15 2018 09:07
i guess thats what im trying to do
through the make file
but it then fails when it tries to compare
the checksum
Denis Lisov
@tanriol
Feb 15 2018 09:08
...with some checksum you've hardcoded?
sken
@floreslorca
Feb 15 2018 09:08
@tanriol from reading above it does seem i download rust-1.16.0-x86_64-pc-windows-gnu.tar.gz succesfuly
yeah
the checksum is hc in a mk file
Denis Lisov
@tanriol
Feb 15 2018 09:09
Could you show the fragments of the makefile with (a) the checksum, (b) download and check command?
sken
@floreslorca
Feb 15 2018 09:10
package=rust
$(package)_version=1.16.0
$(package)_download_path=https://static.rust-lang.org/dist
$(package)_file_name=rust-$($(package)_version)-x86_64-pc-windows-gnu.tar.gz
$(package)_sha256_hash=523cd248363afdc4e2c0e1f219607897b6925294a33154d7e67224addfd15eb0

define $(package)_stage_cmds
  ./install.sh --destdir=$($(package)_staging_dir) --prefix=$(host_prefix)/native --disable-ldconfig
endef
thats the mk file
disregard the #
hm nvm
i think there was a typo somewhere
because its working now
thanks
Nicolas Almy
@almynic
Feb 15 2018 11:46
    #[allow(dead_code)]
    #[derive(Debug)]
    pub struct Graph<'a> {
        pub vertices: Vec<&'a Vertex>,
        pub edges: Vec<Edge<'a>>,
        pub directed: bool,
    }

    #[derive(Debug)]
    pub struct Vertex {
        pub id: String,
    }
    #[derive(Debug)]
    pub struct Edge<'a> {
        pub source_vertex: &'a Vertex,
        pub target_vertex: &'a Vertex,
    }

    impl<'a> Edge<'a> {
        pub fn new(source_vertex: &'a Vertex, target_vertex: &'a Vertex) -> Edge<'a> {
            Edge { source_vertex, target_vertex }
        }
    }

    pub fn print_graph(graph: &Graph) {
        for edge in graph.edges.iter() {
            if graph.directed {
                println!("{} -> {}", edge.source_vertex.id, edge.target_vertex.id);
            } else {
                println!("{} - {}", edge.source_vertex.id, edge.target_vertex.id);
            }
        }
    }
I am writting a graph application in Rust and I don't know what the best way is for saving the graph to disk. Did someone something similar?
Daniel Bischof
@dbischof90
Feb 15 2018 11:49
How important would be read-performance?
Nicolas Almy
@almynic
Feb 15 2018 11:50
as fast as possible this is for a minimal graph database
Daniel Bischof
@dbischof90
Feb 15 2018 11:51
Hm, okay
Nicolas Almy
@almynic
Feb 15 2018 11:51
reading is more important than write speed though
Daniel Bischof
@dbischof90
Feb 15 2018 11:52
So one thing which is fast to write but possibly slow to read would be just to serialize it into some blob and dump it to your file system
Has the pro that you can save large amounts of data quite compact.
But has of course rather terrible read and reconstruction times compared to other things.
I am not a particular expert in that topic but that could be an application for a NoSQL database.
Heard of MongoDB? Since all your Nodes could be seen as "documents" in the interpretation of that DB, that could be a rather natural framework
Daniel Bischof
@dbischof90
Feb 15 2018 11:57
Denis Lisov
@tanriol
Feb 15 2018 11:57
@almynic Do you expect to store all the database in memory or to have only part of it loaded at any moment?
Nicolas Almy
@almynic
Feb 15 2018 12:01
Only a part of it, we should have multiple graphs in the database and be able to edit and read one graph at a time.
Dylan DPC
@Dylan-DPC
Feb 15 2018 14:05
Can't login with Github on crates.io. I get:Failed to log in: invalid state parameter. Anyone else facing this?
Zakarum
@omni-viral
Feb 15 2018 14:57
I got this too Just reloaded the page and everything worked
Moggers
@Moggers
Feb 15 2018 15:33
is it possible to turn an Arc<T> into an Rc<T> without having to first take ownership of it?
Michal 'vorner' Vaner
@vorner
Feb 15 2018 15:34
@Moggers That wouldn't be safe. So, if you find a way to do that, report it as a bug.
Ed Page
@epage
Feb 15 2018 15:39
What is the correct venue for wanting changes to compiler warning groups?
Is that handled at the RFC level or just rustc issue / PR level?
Steve Klabnik
@steveklabnik
Feb 15 2018 15:39
changes to lints generally require an RFC
Ed Page
@epage
Feb 15 2018 15:39
Ok
I want to change it so warning groups are evolved on epoch boundaries but so far no one has acknowledged my comment
https://github.com/rust-lang/rust/issues/44581#issuecomment-361468776
Trying to determine the best route to move forward with this
Steve Klabnik
@steveklabnik
Feb 15 2018 15:41
@nikomatsakis ^ ?
Michael Jansen
@mjjansen
Feb 15 2018 15:41
I am trying to add /Profile to my linker options on windows. I've been searching, but can't seem to find it. is there a quick way to do this? thank you!
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.12.25827\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "/NXCOMPAT" "/Profile"
Niko Matsakis
@nikomatsakis
Feb 15 2018 15:41
@epage somehow missed that comment
@epage oh, never mind, I did see it, I just hadn't decided what I thought about it
I'll try to write a response. I'm not sure what the best plan there.
Ed Page
@epage
Feb 15 2018 15:42
Thanks!
Steve Klabnik
@steveklabnik
Feb 15 2018 15:43
Ed Page
@epage
Feb 15 2018 15:43
My main interest is trying to make CIs easy to manage. Right now the only way to have a stable CI is to explicitly list every warning
See https://github.com/rust-unofficial/patterns/blob/master/anti_patterns/deny-warnings.md
Michael Jansen
@mjjansen
Feb 15 2018 15:43
@steveklabnik let me try that
Michael Jansen
@mjjansen
Feb 15 2018 16:07
@steveklabnik that worked :smile:, but now the MSVC profiler is giving another error Error VSP1033 does not contain a recognized executable image. probably nothing I can do about that one for now.
Steve Klabnik
@steveklabnik
Feb 15 2018 16:39
hm
yeah never seen that
Hayden Pope
@TheStilbruch
Feb 15 2018 16:48
Is there any way that I can connect the stdin and stdout of a command with a socket
Kindof like with dup2 in C?
Hayden Pope
@TheStilbruch
Feb 15 2018 17:16
After doing some looking it seems I might be able to connect the two with file descriptors, but I am not sure how to get the FD of my socket
Denis Lisov
@tanriol
Feb 15 2018 17:43
@TheStilbruch stdin and stdout of the same command?
Hayden Pope
@TheStilbruch
Feb 15 2018 17:43
Yeah, but I managed to get it working.
Peter Atashian
@retep998
Feb 15 2018 18:04
@mjjansen You can still use sampling profilers to profile your code. I just don't think instrumented profiling works currently.
David Harvey-Macaulay
@alteous
Feb 15 2018 18:15
@retep998 The std140 stuff I was talking about on rust-gamedev. This is the problem: https://play.rust-lang.org/?gist=bd2cbd27d79343a3d4d0957144099966&version=nightly
Peter Atashian
@retep998
Feb 15 2018 18:17
@alteous In order to make that padding available for fields after it, you'd have to only have an alignment of 4 for Vec3, not 16
David Harvey-Macaulay
@alteous
Feb 15 2018 18:17
Under the current rules, yes.
Peter Atashian
@retep998
Feb 15 2018 18:17
Those rules aren't going to change, because that's how alignment works in C
By setting the alignment of Vec3 to 16, the size is also forced to 16, and you'll never be able to reuse that padding, even if you could use the packed repr.
David Harvey-Macaulay
@alteous
Feb 15 2018 18:18
The #[repr(C)] attribute is applied to stop rustc from re-ordering things.
Not even with #[repr(packed)]?
Peter Atashian
@retep998
Feb 15 2018 18:19
Nope
David Harvey-Macaulay
@alteous
Feb 15 2018 18:21
That's unexpected. I don't understand the requirement for alignment being necessarily equal to size outside of the de facto C ABI.
As far as I know, there's nothing illegal about packing the extra float in the padding of the vector since the float is still aligned correctly.
Denis Lisov
@tanriol
Feb 15 2018 19:12
@alteous AFAIU, the structure's size is also the distance between two sequential elements in an array of these structures. If the size was not a multiple of alignment, one of them would be misaligned.
Michael Jansen
@mjjansen
Feb 15 2018 19:15
@retep998 thank you. I used https://github.com/VerySleepy/verysleepy and it worked very well. CodeXL would not give me the calling function. and MSVC did not show anything. as an aside... ok_or(Error::new(ErrorKind::Other, format!("Cannot read field_name: {} from record: {:?}", field_name, record))) was causing 1/2 my speed problem. I had 3 calls like these that were slowing down my stream processing code by 5x!
Peter Atashian
@retep998
Feb 15 2018 19:18
@mjjansen Stuff like ok_or will still execute that code even if it doesn't fail. If you want that code to only execute on failure, which in this case you do because it is allocating and stuff, then you need ok_or_else
Michael Jansen
@mjjansen
Feb 15 2018 19:18
thank you. switching to it now :smile:
David Harvey-Macaulay
@alteous
Feb 15 2018 19:55
@tanriol The size is a multiple of the alignment. What I'm looking for is support for layouts like this (psuedo-code) :
#[repr(packed, no_reorder)]
struct Foo {
    // offset 0
    #[repr(align(16))]
    bar: [f32; 3],

    // offset 12
    #[repr(align(4))]
    baz: f32,

    // offset 16
}

I'm not going to ponder over this much longer because of this excerpt from the Khronos wiki):

Warning: Implementations sometimes get the std140 layout wrong for vec3 components. You are advised to manually pad your structures/arrays out and avoid using vec3 at all.

Denis Lisov
@tanriol
Feb 15 2018 22:19
@alteous As a wild guess, I'm not sure whether rustc/LLVM can guarantee that do_some_math(&my_foo.bar) does not write into the padding destroying my_foo.baz.