Canada has warned its citizens of the risk of "arbitrary enforcement" of local laws in China after a Canadian man convicted of drug trafficking was suddenly retried and sentenced to death, and Beijing denied another detained Canadian diplomatic immunity.

China responded angrily on Tuesday denouncing Canadian Prime Minister Justin Trudeau for making "irresponsible" remarks.

The Canadian government on Monday updated its travel advisory for China, telling citizens to exercise a high degree of caution while in the country.

The update noted the highlighted the severe penalties for drug offences, including death.

It came hours after a court in China's Liaoning province sentenced Robert Lloyd Schellenberg to be executed for drug smuggling following a day-long retrial in which the 36-year-old Canadian had declared his innocence.

"The court completely rejects the accused person's explanation and defence because it is completely at odds with the facts," the chief judge said in a courtroom packed with observers, including Canadian embassy officials.

Schellenberg had the right to appeal to Liaoning High Court within 10 days upon receiving the ruling, according to a statement by the Dalian Intermediate People's Court.

Trudeau said in Ottawa he was concerned China had chosen to "arbitrarily" apply the death penalty to a Canadian citizen.

The Canadian government has said it is following the case "very closely" and has provided Schellenberg with consular assistance.

Schellenberg was detained in 2014 and sentenced to 15 years in prison two years later. But last month, an appeal by prosecutors claiming the sentence was too lenient was suddenly given the go-ahead. Monday's retrial was scheduled with just four days' notice.

Analysts and rights groups said retrials were rare in China, especially ones calling for a harsher sentence.

"China is going to face lots of questions about why this particular person, of this particular nationality, had to be retried at this particular time," Sophie Richardson, the Washington-based China director for Human Rights Watch, told Reuters news agency.

Prosecutors said Schellenberg was the principal suspect in a case involving an international syndicate that planned to send some 222kg of methamphetamine to Australia, hidden in plastic pellets concealed in rubber tyres.

Two Chinese men have also been tried. One was given a life sentence and the other a suspended death sentence.

But Schellenberg's lawyer, Zhang Dongshuo, said prosecutors had not produced any new evidence to justify a heavier sentence. He said he planned to lodge an appeal.

China has executed other foreigners for drug-related crimes in the past, including a Japanese national in 2014 and a Filipina in 2013. Beijing considers the number of people executed in China each year to be a state secret. International human rights organisations estimate the figure at about 2,000.

Beijing on Tuesday slammed Trudeau's comments.

"We urge the Canadian side to respect the rule of law, respect China's judicial sovereignty, correct their mistakes, and stop making such irresponsible remarks," foreign ministry spokeswoman Hua Chunying said at a press briefing.

Hua also dismissed suggestions by human rights groups that Beijing had seized on the case to put pressure on Ottawa over Canada's arrest of a top executive of Chinese telecom giant Huawei in December.

"I think such remarks are malicious smearing and unwarranted accusations," Hua said, adding it is "extremely clear" which side is politicising judicial issues.

"Canada should remind its own citizens to definitely not engage in drug smuggling in China," she added.

Canada detained Meng Wanzhou, Huawei's chief financial officer, on a US extradition request related to alleged Iran sanctions violations. Meng, which denies wrongdoing, has been released on bail and extradition proceedings are due to start next month.

Chinese authorities later detained two Canadian nationals - a former diplomat and a business consultant - on suspicion of endangering national security, in what has been seen by analysts as retaliation for Meng's arrest.

'Difficult not to see a link'

Hua said on Monday that Michael Kovrig, a former Canadian diplomat taken into custody the day after Meng's arrest, was not eligible for diplomatic immunity as Trudeau has maintained.

A senior Canadian government official said Chinese officials have been questioning Kovrig about his diplomatic work in China, which is a major reason why Trudeau is asserting diplomatic immunity.

The official, who was not authorised to comment publicly about the case, spoke on the condition of anonymity.

Kovrig, a Northeast Asia analyst for the International Crisis Group, was on leave of absence from the Canadian government at the time of his arrest last month.

Hua told reporters Kovrig is no longer a diplomat and entered China on an ordinary passport and business visa.

"According to the Vienna Convention of Diplomatic Relations and international law, he is not entitled to diplomatic immunity," Hua said at a daily briefing. "I suggest that the relevant Canadian person carefully study the Vienna Convention ... before commenting on the cases, or they would only expose themselves to ridicule with such specious remarks."

A former Canadian ambassador to China, Guy Saint-Jacques, said interrogating Kovrig about his time as a diplomat in China would violate Vienna Convention protections of residual diplomatic immunity that mean a country is not allowed to question someone on the work they did when they were a diplomat.

"It's difficult not to see a link" between the case and Canada's arrest of Meng, Saint-Jacques told The Associated Press news agency.

Hua insisted the allegation that China arbitrarily detained Canadian citizens is "totally groundless".

Canada has embarked on a campaign with allies to win the release of Kovrig and Spavor. The United States, Britain, the European Union and Australia have issued statements in support.

Trudeau called US President Donald Trump about the detentions last week and the White House called the arrests "unlawful".