-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for bound types #55330
Add support for bound types #55330
Conversation
@bors try |
⌛ Trying commit 235c848 with merge 2b86a36d9530d0a26855c5a8ec6759e21fce2efc... |
☀️ Test successful - status-travis |
@rust-timer build 2b86a36 |
Insufficient permissions to issue commands to rust-timer. |
@rust-timer build 2b86a36 |
Please provide the full 40 character commit hash. |
@rust-timer build 2b86a36d9530d0a26855c5a8ec6759e21fce2efc |
Success: Queued 2b86a36d9530d0a26855c5a8ec6759e21fce2efc with parent f99911a, comparison URL. |
Finished benchmarking try commit 2b86a36d9530d0a26855c5a8ec6759e21fce2efc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Left some nits.
let r2 = substitute_value(self.tcx, &result_subst, &r2); | ||
if k1 != r2.into() { | ||
Some(ty::Binder::bind(ty::OutlivesPredicate(k1, r2))) | ||
let ty::OutlivesPredicate(k1, r2) = r_c.skip_binder(); // reconstructed below |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this binder shuffling feels a bit complex. I think I micro-optimized this, though not necessarily for very good reason. Mostly I think I was trying to avoid allocating a whole vector of substituted results and instead substitute them lazilly. I wonder if it'd be simpler to do:
let r_c = substitute_value(self.tcx, &result_substs, r_c);
// Screen out `'a: 'a` cases -- we skip the binder here but
// only care the inner values to one another, so they are still at
// consistent binding levels.
let ty::OutlivesPredicate(k1, r2) = r_c.skip_binder();
if k1 != r2.into() {
Some(r_c)
} else {
None
}
src/librustc/ty/sty.rs
Outdated
/// regions with anonymous late bound regions. This method asserts that | ||
/// we have an anonymous late bound region, which hence may refer to | ||
/// a canonical variable. | ||
pub fn as_bound_var(&self) -> BoundVar { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we call this assert_bound_var()
? I forget how consistently we use this convention, but I like it (since you are not returning an Option
here...)
@bors r+ |
📌 Commit 2b205dc has been approved by |
Add support for bound types This PR may have some slight performance impacts, I don't know how hot is the code I touched. Also, this breaks clippy and miri. r? @nikomatsakis
☔ The latest upstream changes (presumably #55305) made this pull request unmergeable. Please resolve the merge conflicts. |
@bors r=nikomatsakis |
📌 Commit a38a6d09b101dfe0afa1ef9475ed71cd78a9e203 has been approved by |
Use the new `BoundVarReplacer` to perform canonical substitutions.
@bors r=nikomatsakis p=1 |
📌 Commit c5ed72f has been approved by |
The failure above comes from a renaming that I made in this PR. It went unnoticed because my branch was not even with rust's master, hence some recently added commits were still using the "old" name. I'm setting p=1 to prevent this from happening again |
Add support for bound types This PR may have some slight performance impacts, I don't know how hot is the code I touched. Also, this breaks clippy and miri. r? @nikomatsakis
☀️ Test successful - status-appveyor, status-travis |
📣 Toolstate changed by #55330! Tested on commit 2ad8c7b. 💔 clippy-driver on windows: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk, @rust-lang/infra). |
Tested on commit rust-lang/rust@2ad8c7b. Direct link to PR: <rust-lang/rust#55330> 💔 clippy-driver on windows: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk, @rust-lang/infra). 💔 clippy-driver on linux: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk, @rust-lang/infra). 💔 rls on windows: test-pass → build-fail (cc @nrc, @rust-lang/infra). 💔 rls on linux: test-pass → build-fail (cc @nrc, @rust-lang/infra).
I'll open PRs to fix what I broke :p |
3404: rustup rust-lang/rust#55330 r=phansch a=matthiaskrgr Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
3404: rustup rust-lang/rust#55330 r=phansch a=matthiaskrgr Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
Should fix clippy toolstat. Changes: ```` rustup rust-lang#55330 Update stderr Rename test files Also lint cfg_attr(.., rustfmt::skip) Add tests from rustfmt::skip test file Run update_lints.py script Add test for non-crate-level inner attributes Differ between inner and outer attributes Add tests Add cfg_attr(rustfmt) lint Addressed comments. Fix dogfood error. Added lints `into_iter_on_ref` and `into_iter_on_array`. Fix rust-lang#1565. Allow single_match_else Update stderr Add copyright statement© Fix typos Fix dogfood error Fix typo and indentation run update_lints script Add tests for unknwon_clippy_lints lint Add new lint: unknwon_clippy_lintsg clippy: fix pedantic warnings and run clippy::pedantic lints on the codebase. Fix a false-positive of needless_borrow UI test cleanup: Extract match_overlapping_arm tests UI test cleanup: Extract expect_fun_call tests Add missing code of conduct file Use slice patterns instead of padding Fix dogfood and pedantic lints ci: when installing rust-toolchain-installer-master, install it in debug mode to save some time in ci. RIIR update lints: Generate deprecated lints Replace big if/else expression with match ````
submodules: update clippy from a20599a to 71ec4ff Should fix clippy toolstat. Changes: ```` rustup #55330 Update stderr Rename test files Also lint cfg_attr(.., rustfmt::skip) Add tests from rustfmt::skip test file Run update_lints.py script Add test for non-crate-level inner attributes Differ between inner and outer attributes Add tests Add cfg_attr(rustfmt) lint Addressed comments. Fix dogfood error. Added lints `into_iter_on_ref` and `into_iter_on_array`. Fix #1565. Allow single_match_else Update stderr Add copyright statement© Fix typos Fix dogfood error Fix typo and indentation run update_lints script Add tests for unknwon_clippy_lints lint Add new lint: unknwon_clippy_lintsg clippy: fix pedantic warnings and run clippy::pedantic lints on the codebase. Fix a false-positive of needless_borrow UI test cleanup: Extract match_overlapping_arm tests UI test cleanup: Extract expect_fun_call tests Add missing code of conduct file Use slice patterns instead of padding Fix dogfood and pedantic lints ci: when installing rust-toolchain-installer-master, install it in debug mode to save some time in ci. RIIR update lints: Generate deprecated lints Replace big if/else expression with match ````
Should fix clippy toolstat. Changes: ```` rustup rust-lang/rust#55330 Update stderr Rename test files Also lint cfg_attr(.., rustfmt::skip) Add tests from rustfmt::skip test file Run update_lints.py script Add test for non-crate-level inner attributes Differ between inner and outer attributes Add tests Add cfg_attr(rustfmt) lint Addressed comments. Fix dogfood error. Added lints `into_iter_on_ref` and `into_iter_on_array`. Fix rust-lang#1565. Allow single_match_else Update stderr Add copyright statement© Fix typos Fix dogfood error Fix typo and indentation run update_lints script Add tests for unknwon_clippy_lints lint Add new lint: unknwon_clippy_lintsg clippy: fix pedantic warnings and run clippy::pedantic lints on the codebase. Fix a false-positive of needless_borrow UI test cleanup: Extract match_overlapping_arm tests UI test cleanup: Extract expect_fun_call tests Add missing code of conduct file Use slice patterns instead of padding Fix dogfood and pedantic lints ci: when installing rust-toolchain-installer-master, install it in debug mode to save some time in ci. RIIR update lints: Generate deprecated lints Replace big if/else expression with match ````
This PR may have some slight performance impacts, I don't know how hot is the code I touched.
Also, this breaks clippy and miri.
r? @nikomatsakis