Mb/36812 ich function interfaces#36974
Conversation
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @michaelwoerister (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
|
Thank you so much! I'll take a look at this ASAP. |
michaelwoerister
left a comment
There was a problem hiding this comment.
This is excellent work! I like how you included SawTyComponent even though we didn't explicitly talk about it. I think this has already caught quite a few bugs before we had to find out about them the hard way.
I've left a few comments about things that need to change. But this almost ready to merge.
| // Change Parameter Order ------------------------------------------------------ | ||
|
|
||
| #[cfg(cfail1)] | ||
| fn order_of_parameters(p1: i32, p2: i32) {} |
There was a problem hiding this comment.
Could you give p2 a different type than p1?
| // Return Impl Trait ----------------------------------------------------------- | ||
|
|
||
| #[cfg(cfail1)] | ||
| fn return_impl_trait() -> i32 { |
There was a problem hiding this comment.
I'm wondering if it would make more sense to have it change from impl Clone to impl Copy instead? It's probably best to add a separate test case for that.
| // Second Lifetime Bound ------------------------------------------------------- | ||
|
|
||
| #[cfg(cfail1)] | ||
| fn second_lifetime_bound<'a, T: 'a>() {} |
There was a problem hiding this comment.
Can you add 'b also to the cfail1 version so that we are really just testing for the addition of a bound (as opposed to a bound and a new lifetime parameter)?
| // Inline Never ---------------------------------------------------------------- | ||
|
|
||
| #[cfg(cfail1)] | ||
| fn inline_never() {} |
There was a problem hiding this comment.
Can you add an #[inline(always)] attribute to the cfail1 version? I'd like this to test whether changing the kind of inline hint is detected.
| #[rustc_clean(label="Hir", cfg="cfail3")] | ||
| #[rustc_metadata_dirty(cfg="cfail2")] | ||
| #[rustc_metadata_clean(cfg="cfail3")] | ||
| #[linkage] |
There was a problem hiding this comment.
I'm surprised this compiles :)
Can you change that to #[linkage="weak_odr"] so we actually specify an explicit linkage?
| // Lifetime Bound -------------------------------------------------------------- | ||
|
|
||
| #[cfg(cfail1)] | ||
| fn lifetime_bound<T>() {} |
There was a problem hiding this comment.
Can you add 'a to the cfail1 version too? (See a similar case with the second lifetime bound)
| SawTyArray, | ||
| SawTyPtr(Mutability), | ||
| SawTyRptr(Mutability), | ||
| SawTyBareFn, |
There was a problem hiding this comment.
The BareFnTy contained in TyBareFn also contains an unsafety and an abi field that should be added here.
|
Thanks, will incorporate your remarks. |
| TyRptr(_, ref mty) => SawTyRptr(mty.mutbl), | ||
| TyBareFn(..) => SawTyBareFn, | ||
| TyBareFn(ref barefnty) => { | ||
| let ref fnty = *barefnty; |
There was a problem hiding this comment.
This seems redundant. Can't you just write SawTyBareFn(barefnty.unsafety, barefnty.abi) in the line below? Should do the same thing.
There was a problem hiding this comment.
You're right. I'm very new to Rust, still a lot to learn :)
|
Thanks, I think all my comments have been addressed. |
|
@bors r+ |
|
📌 Commit 0e40dbb has been approved by |
…Interfaces, r=michaelwoerister Mb/36812 ich function interfaces r? @michaelwoerister This PR contains fixes for rust-lang#36812 and rust-lang#36914
|
🎉 |
|
Feels nice to be able to contribute, up to the next! Thanks! |
…ests, r=nikomatsakis ICH: Enable some cases in trait definition hashing. Enable some test cases originally written by @eulerdisk. The tests can be enabled now because @MathieuBordere has fixed the underlying problem in rust-lang#36974. r? @nikomatsakis
r? @michaelwoerister
This PR contains fixes for #36812 and #36914