Basic electronic: frequency in power supplies, and feeding 400Hz to a 50Hz device
Just to correct an assumption: -


  As much as I understand, AC is more efficient for long distance
  transmission


No, it isn't as good as DC for long distance travel (skin and proximity effects) but, because you can use a transformer it becomes the only feasible practical option.


  what happens if you feed a (for example) 50Hz device with a 400Hz
  supply? Is there something implicit in the rectifier so that it can
  work only at specific frequencies?


To a certain extent there is something about common garden diodes that tend to make them less suitable as the frequency rises and that is called the reverse recovery time: -



So, as the voltage waveform goes from forward conduction to reverse conduction, a diode won't immediately turn into a blocking component and a reverse current will flow.

For a 1N400x rectifier this is about 30 us (some manufacturers): -



See also my answer to this related question.

At 400 Hz, the period is 2.5 ms and half a period is obviously 1.25 ms. 30 us represents 2.4% of the half cycle so it's starting to become a problem. Answer: use better and faster diodes.

For devices that use a mains transformer, operating at higher frequencies means more eddy current induction in the laminates and potential overheating. Answer: use thinner laminates.