iomentum / cargo-breaking

Mozilla Public License 2.0
112 stars 7 forks source link

Handle function argument types #37

Closed scrabsha closed 3 years ago

scrabsha commented 3 years ago

This PR adds the ability to detect the following change:

Previous:

fn foo(input: &str) {}

Next:

fn foo(input: String) {}

More formally, we now handle any ABI change, unsafety change and argument or return type change. Type handling is a bit limited to now, and may be sometimes incorrect. This is caused by the fact that we're comparing types with == and the fact that we don't handle bindings for now.

Some changes were needed. The biggest one is that we now may borrow data from the TyCtxt produced by rustc. This introduces a bunch of lifetimes here and there.