Allow static regions in type_name.#146310
Merged
bors merged 1 commit intorust-lang:masterfrom Sep 8, 2025
Merged
Conversation
Collaborator
This comment has been minimized.
This comment has been minimized.
Contributor
Author
|
@lcnr: I don't know if this static region is expected or not, I just assumed it was ok. |
Contributor
|
Another test case: struct Foo<T>(T);
impl Foo<&'static i32> {
fn bar() {
let f = || {};
dbg!(std::any::type_name_of_val(&f));
}
}
fn main() {
<Foo<_>>::bar();
} |
Contributor
|
Another two test cases: trait Trait {
type Assoc;
}
impl<'a> dyn Trait<Assoc = &'static i32> + 'a {
fn bar() {
let f = || {};
dbg!(std::any::type_name_of_val(&f));
}
}
fn main() {
<dyn Trait<Assoc = &'static i32>>::bar();
}struct Thing<T, U>(T, U);
trait Trait {
type Assoc<T>;
}
impl Trait for () {
type Assoc<T> = ();
}
impl<T: Trait> Thing<T, T::Assoc<&'static i32>> {
fn bar() {
let f = || {};
dbg!(std::any::type_name_of_val(&f));
}
}
fn main() {
Thing::<(), ()>::bar();
} |
Contributor
Author
|
Thanks for the extra test cases. I checked; they are all fixed by this PR's change. |
lcnr
reviewed
Sep 8, 2025
2b8a395 to
9a52a83
Compare
Collaborator
|
Contributor
|
@bors r+ rollup |
Collaborator
lqd
reviewed
Sep 8, 2025
| // even though the `for` is omitted by the pretty printer. | ||
| // E.g. `for<'a, 'b> fn(&'a u32, &'b u32)` is printed as "fn(&'_ u32, &'_ u32)". | ||
| let kind = region.kind(); | ||
| match region.kind() { |
Member
There was a problem hiding this comment.
since kind now exists, maybe
Suggested change
| match region.kind() { | |
| match kind { |
could be good?
Contributor
Author
There was a problem hiding this comment.
Whoops, yes, it was meant to be like that.
bors
added a commit
that referenced
this pull request
Sep 8, 2025
Rollup of 7 pull requests Successful merges: - #146111 (Migrate more things in the new solver to specific `DefId`s) - #146298 (GVN: Ensure indirect is first projection in try_as_place.) - #146299 (docs(std): add error docs for path canonicalize) - #146310 (Allow static regions in `type_name`.) - #146313 (Some `rustc_middle` cleanups) - #146319 (Fix typo in default.rs) - #146320 (rustc-dev-guide subtree update) r? `@ghost` `@rustbot` modify labels: rollup
github-actions bot
pushed a commit
to rust-lang/rustc-dev-guide
that referenced
this pull request
Sep 22, 2025
Rollup of 7 pull requests Successful merges: - rust-lang/rust#146111 (Migrate more things in the new solver to specific `DefId`s) - rust-lang/rust#146298 (GVN: Ensure indirect is first projection in try_as_place.) - rust-lang/rust#146299 (docs(std): add error docs for path canonicalize) - rust-lang/rust#146310 (Allow static regions in `type_name`.) - rust-lang/rust#146313 (Some `rustc_middle` cleanups) - rust-lang/rust#146319 (Fix typo in default.rs) - rust-lang/rust#146320 (rustc-dev-guide subtree update) r? `@ghost` `@rustbot` modify labels: rollup
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.
Fixes #146249.
r? @lcnr