Before Google announced the Pixel 2 and Pixel 2 XL, it pushed a new app listing to the Play Store that offered some details about the rumored always-on music ID feature. It turns out there's another interesting tidbit in that listing: the Pixel 2 will be able to automatically toggle on Do Not Disturb mode when you're driving.
The listing in question is called Pixel Ambient Services, which is a nice, vague name. Two of the screens are related to the music feature, but one of them references DND mode. There's a "driving" settings screen as part of this services app. When you turn that on, Do Not Disturb will activate when you are driving (based on the phone's sensors).
The drawback with this feature is that it most likely can't actually tell if you are the one driving. The sensor input from the phone will look the same if you're a passenger as if you're behind the wheel. It's also supposed to use Bluetooth to determine if you're in the car, so perhaps you'll also need to be connected to the car for this feature to trigger. There will be a toggle, so at least you can turn it off should this feature not work the way you want. We'll be able to test this and see how accurate it is when the Pixel 2 is available.
Google has added some new information to the support page about how this feature works. The driving rules are rather buried under Settings > Sound > Do Not Disturb preferences, and then you need to tap the "Add more" option. In that popup is the driving rule. According to Google, Driving mode will block interruptions when you are connected to a car via Bluetooth or the phone thinks you're in a moving car. So yes, it'll trigger driving mode if you're just a passenger. That's not very handy, Google.