Cover up zeroes in a list

Jelly, non-competing

3 bytes This answer is non-competing, since it uses features that postdate the challenge.

o@\

Try it online!

How it works

o      Take the logical OR of its arguments.
 @     Reverse the argument order of the link to the left.
  \    Do a cumulative reduce, using the link to the left.

Pyth, 6 bytes

mJ|dJQ

Demonstration

m ... Q means this maps a function over the input. The function being mapped is J|dJ. That means J = d or J in Python, since J is implicity assigned to the following value on first use. Unlike Python, assignment expressions return the value assigned in Pyth, so the map returns each successive value of J, as desired.


Ruby, 25 bytes

->a{a.map{|x|x==0?a:a=x}}

This is actually really evil.

Specifically, the snippet x==0 ? a : (a=x).

If I had used any other variable name for a (the previous nonzero value)—let's say y—I would have to declare it outside the map (because y=x would only have a scope of inside that single map iteration). That would use four chars more (y=0;).

But if I use the variable name a... yep, you guessed it. I'm actually reassigning to the argument that we got as input (the original array).

map doesn't care because it only cares about the original value of the thing its being called on, so this actually works.