Walk across a steel bridge and you may feel a tiny bump every few tens of metres. That is a gap on purpose. Steel grows when it warms, and a bridge that is not allowed to grow does something much worse than bump.
Heat makes atoms jiggle harder, so they push slightly further apart. Add it up along a beam and the whole thing lengthens. For steel the change is about 12 millionths of its length for each degree Celsius. That sounds like nothing. Take a 1 km steel rail and warm it by 40 °C, from a cold morning to a hot afternoon: 12 × 10⁻⁶ × 40 × 1000 m is roughly 0.48 m. Half a metre of extra rail, appearing from nowhere.
Below is a steel beam 100 m long. Slide the temperature. In Free mode its end slides into a gap. In Locked mode both ends are fixed and it cannot grow, so it pushes back instead.
Free mode: the beam simply slides into the gap.
If a steel bar cannot expand, it behaves as if something squashed it back to its old length. Steel is very stiff (Young's modulus about 200 GPa), so the squeeze is E × α × ΔT, or roughly 2.4 MPa for every degree. Warm a locked beam by 40 °C and it is pressing with about 96 MPa. On a beam with a cross-section of 100 cm² that is nearly 100 tonnes of force on each wall. Ordinary structural steel starts to yield somewhere around 250 MPa, so the squeeze alone can use up a large share of the beam's strength. And a long, slim piece squeezed from the ends does not politely stay straight; it bows sideways, as in why a squeezed ruler bows sideways.
Let it move. Bridges get expansion joints: toothed steel fingers or rubber seals that open and close with the seasons. Old railways left small gaps between rail ends, which gave the classic clickety-clack. Roller bearings let one end of a bridge deck slide while the other end stays put.
Or hold it and pre-load it. Modern railways usually weld rails into long continuous lengths with no gaps at all. The trick is to fasten the rail down at a chosen "neutral" temperature, so it sits stress-free around mid-range weather. Colder than that, the rail is stretched and pulls; hotter, it is squeezed. The track is built to resist the sideways bow, using heavy sleepers and stone ballast packed around them. If the rail is fixed at too low a temperature, or the ballast washes away, a hot day can push the track into a sudden sideways kink.
A continuous rail is fastened at a neutral temperature. Choose how well the track is held, then heat it up. The bar shows squeeze compared with what this toy track can resist.
Toy model: the limit is set at 60 MPa of squeeze, chosen to show the idea, not taken from any rule book. Real limits depend on the track and its ballast.
A solid thing is never quite the size you measured. It breathes with the weather, and the only choice is whether the structure is built to move or built to take the push. The gaps in a bridge, and the stones piled around a rail, are two ways of paying the same bill.