-
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
rustc_target: pass contexts by reference, not value. #55665
Conversation
@bors r+ |
📌 Commit d42d783863bda3a192e32e7c89d7779b4a76b093 has been approved by |
☔ The latest upstream changes (presumably #55393) made this pull request unmergeable. Please resolve the merge conflicts. |
d42d783
to
d00d42d
Compare
📌 Commit d00d42d has been approved by |
rustc_target: pass contexts by reference, not value. `LayoutOf` now takes `&self` instead of `self`, and so does every method generic over a context that implements `LayoutOf` and/or other traits, like `HasDataLayout`, `HasTyCtxt`, etc. Originally using by-value `Copy` types was relevant because `TyCtxt` was one of those types, but now `TyCtxt::layout_of` is separate from `LayoutOf`, and `TyCtxt` is not an often used layout context. Passing these context by reference is a lot nicer for miri, which has `self: &mut EvalContext`, and needed `f(&self)` (that is, creating `&&mut EvalContext` references) for layout purposes. Now, the `&mut EvalContext` can be passed to a function expecting `&C`, directly. This should help with #54012 / #55627 (to not need `where &'a T::Cx: LayoutOf` bounds). r? @nikomatsakis or @oli-obk or @nagisa cc @sunfishcode
☀️ Test successful - status-appveyor, status-travis |
📣 Toolstate changed by #55665! Tested on commit e6c5cf9. 💔 clippy-driver on windows: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk, @rust-lang/infra). |
Tested on commit rust-lang/rust@e6c5cf9. Direct link to PR: <rust-lang/rust#55665> 💔 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 @Xanewok, @rust-lang/infra). 💔 rls on linux: test-pass → build-fail (cc @nrc @Xanewok, @rust-lang/infra).
3411: rustup rust-lang/rust#55665 (pass contexts by reference) r=matthiaskrgr a=matthiaskrgr Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
Fixes clippy toolstate. Changes: ```` rustup rust-lang#55665 (pass contexts by reference) Fix typo Improve clippy_dev help text RIIR update lints: Generate lint group registrations Test clippy_dev on CI and fix test RIIR update lints: Generate modules section ````
submodules: update clippy from 71ec4ff to d8b4269 Fixes clippy toolstate. Changes: ```` rustup #55665 (pass contexts by reference) Fix typo Improve clippy_dev help text RIIR update lints: Generate lint group registrations Test clippy_dev on CI and fix test RIIR update lints: Generate modules section ````
Fixes clippy toolstate. Changes: ```` rustup rust-lang/rust#55665 (pass contexts by reference) Fix typo Improve clippy_dev help text RIIR update lints: Generate lint group registrations Test clippy_dev on CI and fix test RIIR update lints: Generate modules section ````
LayoutOf
now takes&self
instead ofself
, and so does every method generic over a context that implementsLayoutOf
and/or other traits, likeHasDataLayout
,HasTyCtxt
, etc.Originally using by-value
Copy
types was relevant becauseTyCtxt
was one of those types, but nowTyCtxt::layout_of
is separate fromLayoutOf
, andTyCtxt
is not an often used layout context.Passing these context by reference is a lot nicer for miri, which has
self: &mut EvalContext
, and neededf(&self)
(that is, creating&&mut EvalContext
references) for layout purposes.Now, the
&mut EvalContext
can be passed to a function expecting&C
, directly.This should help with #54012 / #55627 (to not need
where &'a T::Cx: LayoutOf
bounds).r? @nikomatsakis or @oli-obk or @nagisa cc @sunfishcode