What it will happend if i will connect an output on 10Volts rail?

Perhaps is a silly question but i want to know the answer.

If i set a pin on an Arduino as output, and connect it on a positive DC rail with voltage of 10 Volts.
What it will happen?
Will it destroy the pin or the Arduino?

billys7:
Will it destroy the pin or the Arduino?

Yes.
Assuming the voltage source has enough current capabilities.

When the output pin is set to LOW, the 'sink' mosfet (rated for 40mA) will try to channel this current to ground.
When the pin is set to HIGH, the pin protection diode (not rated) will try to channel the current to VCC.
Leo..

billys7:
Perhaps is a silly question but i want to know the answer.

If i set a pin on an Arduino as output, and connect it on a positive DC rail with voltage of 10 Volts.
What it will happen?
Will it destroy the pin or the Arduino?

The phrase "absolute maximum" in the datasheet is there to answer such questions!

For pins its -0.5V to Vcc+0.5V, and for Vcc its 6.0V. So the absolute highest voltage on a
pin is 6.5V if Vcc is 6.0V.

Above that and you definitely risk damage. 10V will instantly destroy any device in the CMOS
process used for the ATmega chips I suspect. 7V and you might get away with it, you might
send the chip into CMOS latch-up and then cook it, who knows? You might only cause minor
damage leading to performance dropping below the normal guarantees of the datasheet for
small amounts of over voltage - for instance you might fry the pin's protection diode but leave
the pad driver intact.

The susceptability of any one device will depend on the manufacturing batch, so this isn't something
you can reliably determine by experiment - you just know the bounds the manufacturer places on
every batch manufactured.