About an hour before the Labor Department released its closely watched jobs number Friday, President Donald Trump was already talking up the results.

"Looking forward to seeing the employment numbers at 8:30 this morning," he tweeted at 7:21 a.m. ET.

The May jobs report was in fact a good one for a president who likes to brag about the strong jobs market. Unemployment fell to 3.8%, which matched the lowest rate in nearly a half century. Employers added 223,000 jobs in the month, more than more economists were forecasting.

But investors weren't waiting for the official report. Stock futures, bond yields and the value of the dollar all jumped higher immediately after his tweet.

And that might be why the tweet was a problem.

Looking forward to seeing the employment numbers at 8:30 this morning. — Donald J. Trump (@realDonaldTrump) June 1, 2018

The Labor Department works hard to keep the market-moving numbers a secret ahead of their 8:30 a.m. ET release. Reporters who get access to the data ahead of time are in a "lock-up," without the ability to communicate with the outside world.

And there is a federal rule dictating that federal employees who know the jobs numbers ahead of time must keep them secret.

"All employees of the executive branch who receive prerelease distribution of information and data estimates...are responsible for assuring that there is no release prior to the official release time," says the rule, which has been in effect since at least 1985.

The question is whether the president's comment "looking forward to" constitutes commenting on the data. The tweet certainly suggested that a good number was coming.

"This certainly was a no-no," tweeted Ari Fleisher, who was press secretary for President George W. Bush. "The advance info is sacrosanct - not to be shared."

This certainly was a no-no. The advance info is sacrosanct - not to be shared. https://t.co/FjxVKklRSH — Ari Fleischer (@AriFleischer) June 1, 2018

The rule further specifies that federal employees other than Labor Department staff charged with issuing the report cannot publicly comment on the data for the first hour after the release time, let alone ahead of the report.

Related: Unemployment rate matches lowest point in a half a century

The rule also specifies that the president should get the prereleased data as soon as it is available.

Larry Kudlow, the director of the president's National Economic Council, confirmed in an interview Friday on CNBC that he had told Trump on Thursday what would be in the jobs report, but that he didn't think the tweet violated the rule because it did not include any numbers or details.

"You can read into that 10 different things," Kudlow said. "I don't think he gave anything away incidentally."

There have been controversies in the past when federal officials have made more innocuous comments about the general state of the labor market in the hours ahead of the report, without referring to the jobs report itself, said William Rodgers, who served as the chief economist of the Labor Department.

"Perception is reality," said Rodgers, now a professor at Rutgers University. "Any public official should know that and practice discretion."

Ironically, candidate Donald Trump used to regularly dismiss the accuracy of the numbers in the jobs report his administration is now eager to brag about. He called the unemployment rates that at the time were about 5% a "joke" or a "hoax." But once he took office he was happy to attest to their accuracy.

"He said to quote him very clearly: 'They may have been phony in the past, but it's very real now," said Sean Spicer, his first press secretary, soon after Trump took office.

-- CNNMoney's Matt Egan contributed to this report.