For most jobs, former employers are legally bound to say nothing about your character if a screening agency or a prospective employer calls about you. They can say whether or not you are eligible for rehire or not. Positions of public trust can circumvent this legality. Jobs such as fire fighters, law enforcement, medical workers, corrections, legal support can request a former employer sign a waiver and they can ask anything from the color of your shit to your drinking habits. Some federal jobs can "flag" you for being ineligible for rehire. This flag might lead lead an employer to learn about a failed drug test.
I had a situation many years ago where I had an awesome job opportunity arise. I traveled, interviewed, took a battery of screening tests, thought things went great. The company rep called and told me I didi not get the job. I found out soon after my current employer had given me a bad recommendation. This was 2 weeks after I had received a promotion and a pay raise. The nature of the prospective job prevented me from filing a rebuttal as I had received my info from an anonymous source. What I did do was I used a reference checking service to check my current employer and find out what he saying about me. I later found out he had done this to several other employees who he felt had used him to work their way up the ladder and find better jobs.
If you are worried about a failed drug test. You could use a reference checking service. I think I payed a little over one hundred buks for the service. This would give you an idea what your past employer will say. If the job is for one with high security, I'm pretty sure that they will find out. Good luck.