Issue 1:
$ cargo build
Compiling libc v0.1.10
Compiling log v0.3.2
Compiling link-crash v0.1.0 (file:///C:/Users/%D0%90%D0%BB%D0%B5%D0%BA%D1%81%D0%B0%D0%BD%D0%B4%D1%80/Document
s/link-crash)
error: linking with `link.exe` failed: exit code: 1120
note: "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC/bin\\link.exe" "/LIBPATH:C:\\Program Files (x86
)\\Microsoft Visual Studio 14.0\\VC/lib\\" "/LIBPATH:C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.10150.
0\\ucrt\\x86" "/LIBPATH:C:\\Program Files (x86)\\Windows Kits\\8.1\\Lib\\winv6.3\\um\\x86" "/NOLOGO" "/NXCOMPAT"
"/LIBPATH:C:\\Program Files\\rust-nightly-i686-pc-windows-msvc\\rustc\\bin\\rustlib\\i686-pc-windows-msvc\\lib"
"C:\\Users\\\u{410}\u{43b}\u{435}\u{43a}\u{441}\u{430}\u{43d}\u{434}\u{440}\\Documents\\link-crash\\target\\deb
ug\\link_crash.0.o" "/OUT:C:\\Users\\\u{410}\u{43b}\u{435}\u{43a}\u{441}\u{430}\u{43d}\u{434}\u{440}\\Documents\
\link-crash\\target\\debug\\link_crash.exe" "/OPT:REF,ICF" "/DEBUG" "C:\\Users\\\u{410}\u{43b}\u{435}\u{43a}\u{4
41}\u{430}\u{43d}\u{434}\u{440}\\Documents\\link-crash\\target\\debug\\liblink_crash.rlib" "C:\\Users\\\u{410}\u
{43b}\u{435}\u{43a}\u{441}\u{430}\u{43d}\u{434}\u{440}\\Documents\\link-crash\\target\\debug\\deps\\liblog-f18a3
e885170bd3f.rlib" "C:\\Users\\\u{410}\u{43b}\u{435}\u{43a}\u{441}\u{430}\u{43d}\u{434}\u{440}\\Documents\\link-c
rash\\target\\debug\\deps\\liblibc-144c435538abd757.rlib" "C:\\Program Files\\rust-nightly-i686-pc-windows-msvc\
\rustc\\bin\\rustlib\\i686-pc-windows-msvc\\lib\\libstd-35017696.rlib" "C:\\Program Files\\rust-nightly-i686-pc-
windows-msvc\\rustc\\bin\\rustlib\\i686-pc-windows-msvc\\lib\\libcollections-35017696.rlib" "C:\\Program Files\\
rust-nightly-i686-pc-windows-msvc\\rustc\\bin\\rustlib\\i686-pc-windows-msvc\\lib\\librustc_unicode-35017696.rli
b" "C:\\Program Files\\rust-nightly-i686-pc-windows-msvc\\rustc\\bin\\rustlib\\i686-pc-windows-msvc\\lib\\libran
d-35017696.rlib" "C:\\Program Files\\rust-nightly-i686-pc-windows-msvc\\rustc\\bin\\rustlib\\i686-pc-windows-msv
c\\lib\\liballoc-35017696.rlib" "C:\\Program Files\\rust-nightly-i686-pc-windows-msvc\\rustc\\bin\\rustlib\\i686
-pc-windows-msvc\\lib\\liballoc_system-35017696.rlib" "C:\\Program Files\\rust-nightly-i686-pc-windows-msvc\\rus
tc\\bin\\rustlib\\i686-pc-windows-msvc\\lib\\liblibc-35017696.rlib" "C:\\Program Files\\rust-nightly-i686-pc-win
dows-msvc\\rustc\\bin\\rustlib\\i686-pc-windows-msvc\\lib\\libcore-35017696.rlib" "/LIBPATH:C:\\Users\\\u{410}\u
{43b}\u{435}\u{43a}\u{441}\u{430}\u{43d}\u{434}\u{440}\\Documents\\link-crash\\target\\debug" "/LIBPATH:C:\\User
s\\\u{410}\u{43b}\u{435}\u{43a}\u{441}\u{430}\u{43d}\u{434}\u{440}\\Documents\\link-crash\\target\\debug\\deps"
"/LIBPATH:C:\\Program Files\\rust-nightly-i686-pc-windows-msvc\\rustc\\bin\\rustlib\\i686-pc-windows-msvc\\lib"
"/LIBPATH:C:\\Users\\\u{410}\u{43b}\u{435}\u{43a}\u{441}\u{430}\u{43d}\u{434}\u{440}\\Documents\\link-crash\\.ru
st\\bin\\i686-pc-windows-msvc" "/LIBPATH:C:\\Users\\\u{410}\u{43b}\u{435}\u{43a}\u{441}\u{430}\u{43d}\u{434}\u{4
40}\\Documents\\link-crash\\bin\\i686-pc-windows-msvc" "kernel32.lib" "shell32.lib" "msvcrt.lib" "ws2_32.lib" "u
serenv.lib" "advapi32.lib" "kernel32.lib" "shell32.lib" "msvcrt.lib" "compiler-rt.lib"
Could not compile `link-crash`.

To learn more, run the command again with --verbose.

$ rustc -vV
rustc 1.4.0-nightly (f3f23bf9c 2015-08-30)
binary: rustc
commit-hash: f3f23bf9c5ee16dab8c25bb5d301d689fbbe0cf1
commit-date: 2015-08-30
host: i686-pc-windows-msvc
release: 1.4.0-nightly

Here is the minimal test case:

Cargo.toml:

[package]
name = "link-crash"
version = "0.1.0"
authors = ["Alexander Bulaev <alexbool@yandex-team.ru>"]

[dependencies]
log = "*"

src/lib.rs:

#[macro_use]
extern crate log;

use std::fmt::Debug;

pub struct Logger<E: Debug> {
field: E,
}

impl<E: Debug> Logger<E> {
pub fn new(field: E) -> Logger<E> {
Logger {
field: field
}
}

pub fn do_log(&self) {
info!("This is the message: {:?}", self.field);
}
}

src/main.rs:

extern crate link_crash;

fn main() {
link_crash::Logger::new("123").do_log();
}

Issue 2:
Currently the compiler makes basically no attempt to correctly use dllimport. As a bit of a refresher, the Windows linker requires that if you're importing symbols from a DLL that they're tagged with dllimport. This helps wire things up correctly at runtime and link-time. To help us out, though, the linker will patch up a few cases where dllimport is missing where it would otherwise be required. If a function in another DLL is linked to without dllimport then the linker will inject a local shim which adds a bit of indirection and runtime overhead but allows the crate to link correctly. For importing constants from other DLLs, however, MSVC linker requires that dllimport is annotated correctly. MinGW linkers can sometimes workaround it (see this commit description.

If we're targeting windows, then the compiler currently puts dllimport on all imported constants from external crates, regardless of whether it's actually being imported from another crate. We rely on the linker fixing up all imports of functions. This ends up meaning that some crates don't link correctly, however (see this comment: #26591 (comment)).

We should fix the compiler's handling of dllimport in a few ways:

Functions should be tagged with dllimport where appropriate

FFI functions should also be tagged with dllimport where appropriate

Constants should not always be tagged with dllimport if they're not actually being imported from a DLL.

I currently have a few thoughts running around in my head for fixing this, but nothing seems plausible enough to push on.

EDIT: Updated as @mati865 requested here.