What happens when you’ve been kicking the fiscal can down the road for years, but the road suddenly hits a dead end? That’s what Chicago — and the state of Illinois — are about to find out.

Chicago’s immediate problem is yesterday’s credit downgrade by Moody’s Investors Services, which turned its debt to junk and could force the city to immediately come up with $2.2 billion to satisfy debts and other obligations.

It’s not clear how — or if — the city could come up with that money.

When big cities have had debt crises — such as Detroit’s recent problems or New York City’s epic problems in the 1970s — states typically rode to the rescue in one way or another. But Illinois, which has the lowest credit rating of any state in the nation, says it can’t help the stricken city.

The downgrade follows a Friday decision by the Illinois Supreme Court, which invalidated state limits on cost-of-living adjustments to state pensioners. The limits were part of a slate of reforms signed into law in 2013 by then-Gov. Pat Quinn, a Democrat, to deal with underfunded pensions.

Moody’s said the court decision was key to its downgrade because the city has been hoping to dig out of its own financial hole by reducing cost-of-living adjustments, which typically raise the cost of pensions by close to 50 percent.

Chicago’s predicament actually has its roots in a 2003 decision by Illinois to kick the pension can down the road — by borrowing money to fund pensions rather than trying to get the benefits reduced or to stepping up payments to make them financially sound.

In the ultimate can kick, the state borrowed a whopping $10 billion — the biggest bond issue in its history — on the premise that investing the proceeds would earn more than the interest on the bonds.

Unfortunately for Illinois taxpayers, the pension funds’ investments, hurt badly by the financial market meltdown of 2008–2009, have earned less than expected.

Even worse, the state gets to deduct interest and principal on the bonds — currently some $500 million to $600 million a year — from the contributions it makes to the pension funds.

The net effect: The funds are worse rather than better off as a result of the pension bonds. Unfunded liabilities swelled from $43 billion when the bonds were sold to $86 billion by 2010, state data show.

Despite that grim history, Illinois borrowed another $7.2 billion for pensions in 2010 and 2011. By the time Quinn signed reforms in 2013, the state was in major trouble, with unfunded liabilities of nearly $100 billion — about $7,500 per resident.

Illinois isn’t alone in turning to pension bonds.

In 1997, New Jersey tried to borrow its way out of pension fund problems with debts that are still being repaid. The California city of San Bernardino sought bankruptcy protection in 2012 under the weight of its pension costs, pension obligation bonds and other debts.

“The borrowing is taking the pressure off politicians from actually facing the actual reforms that need to happen on these pension systems,” said Ted Dabrowski, vice president of policy at the Illinois Policy Institute in Chicago. “You’ve got a situation where the system is no longer sustainable, whether it’s New Jersey or Illinois.”

But Chicago and Illinois are the biggest examples of what happens when you can no longer kick the pension-cost can down the road. They are unlikely to be the last examples.