These are chat archives for rust-lang/rust

30th
Jan 2018
Kelly Thomas Kline
@kellytk
Jan 30 2018 07:57
Would there be an advantage or disadvantage to changing Self::Err of line 3 at https://play.integer32.com/?gist=84ffdba40adf2a6be210557e03da614c&version=stable to InputError?
Michal 'vorner' Vaner
@vorner
Jan 30 2018 10:27

Hello. I have a problem and I'd like an advice how to hunt it down. I have tests and one of them fails on appveyor. Notable things:

  • Only one platform and only on stable fails, all others succeed.
  • The tests fail only in release mode, not in debug mode.
  • The stack trace from the failure is just mad ‒ two frames are listed as ASCII_CHARACTER_CLASS, according to it, the panic comes from within <log::NopLogger as log::Log>::log (that one is actually twice on the stack).
  • Unfortunately, I didn't manage to reproduce locally. Part of that is, I currently don't have access to any windows machine.

These aim to either a miscompilation or UB. The later would be possible, I have some unsafe in the code. I think it is correct, but I might be wrong there. Is there a tool that could help me confirm the UB, or find out what happens? I might try sprinkling the code with println calls, but that doesn't feel like very systematic way to debug it.

If someone would like to have a look, I can help explaining what the code does and exactly where it fails.

Joonas Koivunen
@koivunej
Jan 30 2018 11:19

does anyone know how to read from an fd under windows and mingw? like for example in linux (and windows mingw bash) target/debug/mybinary <(cat foo) will cause the first argument to be /dev/fd/somenumber which is not a path in windows. under windows mingw bash cat <(cat somefile) does work so I am assuming this works in general but haven't yet checked how MSYS cat handles this, or if there is some common libc that does this magically.

by "mingw bash" i mean the bash that comes with git for windows.

TatriX
@TatriX
Jan 30 2018 13:40
I'm looking for intermediate resources on designing rust code and best practices. Especially about traits and generics.
Books, articles, videos. Everything is cool. Thanks!
Maciej Gorywoda
@makingthematrix
Jan 30 2018 13:45
Me too! :)
刘雨培
@LYP951018
Jan 30 2018 13:51
<log::NopLogger as log::Log>::log
What's this syntax?
Denis Lisov
@tanriol
Jan 30 2018 13:52
@LYP951018 UFCS
刘雨培
@LYP951018
Jan 30 2018 13:52
@tanriol Thanks!
Steve Klabnik
@steveklabnik
Jan 30 2018 14:07
it's no longer called UFCS
刘雨培
@LYP951018
Jan 30 2018 15:44
@steveklabnik Thanks!
image.png
image.png
Is this a typo or something ...
Sorry for sending the image twice ...
Jonas Platte
@jplatte
Jan 30 2018 16:47
@LYP951018 I don't see an obvious typo in that bit of code, what do you mean exactly?
ecstatic-morse
@ecstatic-morse
Jan 30 2018 18:25
let person = Human;
and
let person = Human{};
mean the same thing
Jeremy Lempereur
@o0Ignition0o
Jan 30 2018 18:32
Oh and humans can fly, only once, downwards, and for short distances
Kelly Thomas Kline
@kellytk
Jan 30 2018 19:49
@steveklabnik What you suggest at https://twitter.com/steveklabnik/status/958378045152342019, as I understand it, would be helpful with what I'm currently working on. If someone takes initiative and they use Gitter you're welcome to point them to me for my use-case and API opinions
Kelly Thomas Kline
@kellytk
Jan 30 2018 20:13
Steve Klabnik
@steveklabnik
Jan 30 2018 20:14
oh cool :)
i will do
i have vaguely heard of it, but have basically stuck to clap
and structopt
Kelly Thomas Kline
@kellytk
Jan 30 2018 20:19
To be sure there's the overlap I think there is, you're not referring to parsing OS/shell command/arguments (tool -h|--happy), rather the syntax (and easy parsing) of and within a console-based program (tool -> >) correct?
Steve Klabnik
@steveklabnik
Jan 30 2018 20:20
i find writing out Command builders to be kind of a pain
Kelly Thomas Kline
@kellytk
Jan 30 2018 20:20
Yes
Steve Klabnik
@steveklabnik
Jan 30 2018 20:20
so yeah, it's not really about parsing the actual details
Kelly Thomas Kline
@kellytk
Jan 30 2018 20:22
How could it be much easier [and better]?
Steve Klabnik
@steveklabnik
Jan 30 2018 20:22
i haven't worked through the details in my head yet
Moggers
@Moggers
Jan 30 2018 22:54
is it possible to ask a struct if it implements a trait at runtime?