-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Check that #[may_dangle]
is properly applied
#129235
Conversation
r? @fee1-dead rustbot has assigned @fee1-dead. Use |
This comment has been minimized.
This comment has been minimized.
f1febc1
to
5069128
Compare
This comment has been minimized.
This comment has been minimized.
5069128
to
a47711f
Compare
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.
Couple tiny tweaks, otherwise LGTM
&& let hir::Node::Item(item) = self.tcx.hir_node(parent_hir_id) | ||
&& let hir::ItemKind::Impl(impl_) = item.kind | ||
&& let Some(trait_) = impl_.of_trait |
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.
&& let hir::Node::Item(item) = self.tcx.hir_node(parent_hir_id) | |
&& let hir::ItemKind::Impl(impl_) = item.kind | |
&& let Some(trait_) = impl_.of_trait | |
&& let hir::Node::Item(hir::Item { kind: hir::ItemKind::Impl(impl_), .. }) = self.tcx.hir_node(parent_hir_id) | |
&& let Some(trait_) = impl_.of_trait |
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.
This leads to somewhat ugly formatting:
&& let hir::Node::Item(hir::Item { kind: hir::ItemKind::Impl(impl_), .. }) =
self.tcx.hir_node(parent_hir_id)
I think the current version is nicer, but I don’t feel that strong about it, so I can make this change if you prefer it.
It's only valid when applied to a type or lifetime parameter in `Drop` trait implementation.
a47711f
to
df6cb95
Compare
@bors r+ rollup |
…piler-errors Check that `#[may_dangle]` is properly applied It's only valid when applied to a type or lifetime parameter in `Drop` trait implementation. Tracking issue: rust-lang#34761 cc rust-lang#34761 (comment)
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#125854 (Move ZST ABI handling to `rustc_target`) - rust-lang#127623 (fix: fs::remove_dir_all: treat internal ENOENT as success) - rust-lang#128084 (Suggest adding Result return type for associated method in E0277.) - rust-lang#128902 (doc: std::env::var: Returns None for names with '=' or NUL byte) - rust-lang#129187 (bootstrap: fix clean's remove_dir_all implementation) - rust-lang#129235 (Check that `#[may_dangle]` is properly applied) - rust-lang#129245 (Typo) r? `@ghost` `@rustbot` modify labels: rollup
…piler-errors Check that `#[may_dangle]` is properly applied It's only valid when applied to a type or lifetime parameter in `Drop` trait implementation. Tracking issue: rust-lang#34761 cc rust-lang#34761 (comment)
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#128084 (Suggest adding Result return type for associated method in E0277.) - rust-lang#128902 (doc: std::env::var: Returns None for names with '=' or NUL byte) - rust-lang#129187 (bootstrap: fix clean's remove_dir_all implementation) - rust-lang#129194 (Fix bootstrap test `detect_src_and_out` on Windows) - rust-lang#129231 (improve submodule updates) - rust-lang#129235 (Check that `#[may_dangle]` is properly applied) - rust-lang#129245 (Typo) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#129194 (Fix bootstrap test `detect_src_and_out` on Windows) - rust-lang#129217 (safe transmute: check lifetimes) - rust-lang#129223 ( Fix wrong argument for `get_fn_decl`) - rust-lang#129235 (Check that `#[may_dangle]` is properly applied) - rust-lang#129245 (Fix a typo in `rustc_hir` doc comment) - rust-lang#129271 (Prevent double panic in query system, improve diagnostics) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#129235 - GoldsteinE:check-may-dangle, r=compiler-errors Check that `#[may_dangle]` is properly applied It's only valid when applied to a type or lifetime parameter in `Drop` trait implementation. Tracking issue: rust-lang#34761 cc rust-lang#34761 (comment)
It's only valid when applied to a type or lifetime parameter in
Drop
trait implementation.Tracking issue: #34761
cc #34761 (comment)