Extern mod extra


#1

Hello
I wanted to test md4.rs
It starts with :

extern mod extra;

which generates an error :

src/md4.rs:12:8: 12:11 error: expected one of crate, fn, or {, found mod
src/md4.rs:12 extern mod extra;

I then change to :

extern mod extra;

which generates many errors :

src/md4.rs:16:31: 16:33 error: invalid suffix u for numeric lite
src/md4.rs:16 static DIGEST_BUF_LEN: uint = 4u; // 4 32-bit words

I’m a beginner and don’t know how I can specify to use extra module ?

Can someone helps .


#2

Hm, there is no such thing as extern mod.

You can have either an extern crate foo, if you have a foo package specified in your Cargo.toml or you can have mod foo; which is a shorthand for mod foo { /* contents of foo.rs goes here */ }


#3

Hm, looks like extern mod used to be a valid syntax a loooong time ago. Are you sure that you are not following some very outdated tutorial? It is a problem with Rust that a lot of pre 1.0 information is still there. The recent documentation is available in the Rust book.


#4

"extra’ also used to be a module in the standard library, or more accurate, was an “extra” layer, on top of the standard library, years back.

So yes, @Harvey, I bet you’re seeing some information that’s outdated. What’s the full code?


#5

Hi Steve,
Hi Aleksey,
Thanks for your help
I was looking for some example with md4 on rust and found : alco/rust-digest/blob/master/md4.rs
As a newbie I ignored that there was already obsolete coding.
I found a different example on searchcode.com/codesearch/view/8665452/
I will try it.


#6

@Harvey if you really really need md4, your best bet is to look at this PR. Out of curiosity, why do you need MD4? Looks like it is an obsolete crypto algorithm and that it should not be used any more (that’s why it’s hard to find a Rust implementation of it).


#7

Hi,
It’s only to use with an old project using MD4
I downloaded

but got error :sob:

\projects\rust-libcore>cargo build
Compiling kernel32-sys v0.2.2
Compiling time v0.1.35
Compiling rust-crypto v0.2.31 (file:///C:/Users/FPIPON/projects/rust-libcore)

failed to run custom build command for rust-crypto v0.2.31 (file:///C:/Users/FP IPON/projects/rust-libcore)
Process didn’t exit successfully: C:\Users\FPIPON\projects\rust-libcore\target\ debug\build\rust-crypto-93e74c414ab2d430\build-script-build (exit code: 101)
— stdout
TARGET = Some(“x86_64-pc-windows-msvc”)
OPT_LEVEL = Some(“0”)
PROFILE = Some(“debug”)
TARGET = Some(“x86_64-pc-windows-msvc”)
debug=true opt-level=0
HOST = Some(“x86_64-pc-windows-msvc”)
TARGET = Some(“x86_64-pc-windows-msvc”)
TARGET = Some(“x86_64-pc-windows-msvc”)
HOST = Some(“x86_64-pc-windows-msvc”)
CC_x86_64-pc-windows-msvc = None
CC_x86_64_pc_windows_msvc = None
HOST_CC = None
CC = None
TARGET = Some(“x86_64-pc-windows-msvc”)
HOST = Some(“x86_64-pc-windows-msvc”)
CFLAGS_x86_64-pc-windows-msvc = None
CFLAGS_x86_64_pc_windows_msvc = None
HOST_CFLAGS = None
CFLAGS = None
running: “C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC/bin\amd64\
cl.exe” “/nologo” “/MD” “/Z7” “/FoC:\Users\FPIPON\projects\rust-libcore\tar
get\debug\build\rust-crypto-93e74c414ab2d430\out\src\util_helpers.o” “/c”
"src/util_helpers.c"
util_helpers.c
src/util_helpers.c(77): error C2143: syntax error: missing ‘)’ before ':'
ExitStatus(ExitStatus(2))

command did not execute successfully, got: exit code: 2

**asm("" : : "g" (dst) : "memory");**

#8

Seems to be an issue with rust-crypto: https://github.com/DaGenix/rust-crypto/issues/324