Check that #[may_dangle] is properly applied#129235
Merged
bors merged 2 commits intorust-lang:masterfrom Aug 19, 2024
Merged
Conversation
Collaborator
|
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
compiler-errors
approved these changes
Aug 18, 2024
Contributor
compiler-errors
left a comment
There was a problem hiding this comment.
Couple tiny tweaks, otherwise LGTM
Comment on lines
+1386
to
+1387
| && 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 |
Contributor
There was a problem hiding this comment.
Suggested change
| && 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 |
Contributor
Author
There was a problem hiding this comment.
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
compiler-errors
approved these changes
Aug 18, 2024
Contributor
|
@bors r+ rollup |
Collaborator
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Aug 18, 2024
…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)
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Aug 18, 2024
…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
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Aug 18, 2024
…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)
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Aug 19, 2024
…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
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Aug 19, 2024
…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
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Aug 19, 2024
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It's only valid when applied to a type or lifetime parameter in
Droptrait implementation.Tracking issue: #34761
cc #34761 (comment)