Just as all materials have a mostly linear relationship between temperature change and length change, all materials also have a similar relationship between stress and change in length (often called strain). And this is part of the secret to continuous welded rail: restrained thermal expansion. You can overcome one with the other.