Skip to content

add several resolution test cases #120195

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jan 24, 2024

Conversation

bvanjoi
Copy link
Contributor

@bvanjoi bvanjoi commented Jan 21, 2024

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 21, 2024
@petrochenkov
Copy link
Contributor

The tests/ui/imports/ambiguous-4.rs change can also be moved to this PR.
@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 21, 2024
@bvanjoi bvanjoi force-pushed the add-some-resolution-test-case branch from eb8dbbe to 6fc06b8 Compare January 22, 2024 15:48
@bvanjoi
Copy link
Contributor Author

bvanjoi commented Jan 22, 2024

Do you think we should create an issue addressing the edge case mentioned in #114682 (comment)?

@petrochenkov
Copy link
Contributor

Maybe, I just don't understand what is the issue with #114682 (comment).
The import should refer to both extern_crate::d::max and extern_crate::e::max in different namespaces, but that comment only considers one namespace.

@bvanjoi
Copy link
Contributor Author

bvanjoi commented Jan 23, 2024

// extern-crate.rs
mod d {
    pub fn max() {}
    pub(crate) mod max {}
}

mod e {
    pub type max = i32;
}

pub use self::d::*;
pub use self::e::*;

// code.rs
use extern_crate::max; // refer to the fn `extern_crate::d::max`

fn main() {}

Given the current logic, (Mod(roo_in_extern_crate), Ns(Type), Ident(max)) is identified as an ambiguous item and hence, omitted in the local crate. However, in my opinion, (Mod(root_in_local_crate), Ns(Type), Ident(max)) should point to extern_crate::e::max. This is because extern_crate::d::max has been restricted within extern_crate. Yet, this is not currently being reflected.

@petrochenkov
Copy link
Contributor

In any case, adding a test for this would be useful.

@bvanjoi bvanjoi force-pushed the add-some-resolution-test-case branch from 6fc06b8 to 851d4c4 Compare January 23, 2024 16:02
@bvanjoi
Copy link
Contributor Author

bvanjoi commented Jan 23, 2024

Additional details have been appended to issue-114682-2.rs.

@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Jan 23, 2024

📌 Commit 851d4c4 has been approved by petrochenkov

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 23, 2024
fmease added a commit to fmease/rust that referenced this pull request Jan 23, 2024
…ase, r=petrochenkov

add several resolution test cases

r? `@petrochenkov`
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 23, 2024
Rollup of 12 pull requests

Successful merges:

 - rust-lang#112806 (Small code improvements in `collect_intra_doc_links.rs`)
 - rust-lang#119460 (coverage: Never emit improperly-ordered coverage regions)
 - rust-lang#119766 (Split tait and impl trait in assoc items logic)
 - rust-lang#120062 (llvm: change data layout bug to an error and make it trigger more)
 - rust-lang#120099 (linker: Refactor library linking methods in `trait Linker`)
 - rust-lang#120139 (Do not normalize closure signature when building `FnOnce` shim)
 - rust-lang#120160 (Manually implement derived `NonZero` traits.)
 - rust-lang#120171 (Fix assume and assert in jump threading)
 - rust-lang#120183 (Add `#[coverage(off)]` to closures introduced by `#[test]` and `#[bench]`)
 - rust-lang#120195 (add several resolution test cases)
 - rust-lang#120259 (Split Diagnostics for Uncommon Codepoints: Add List to Display Characters Involved)
 - rust-lang#120261 (Provide structured suggestion to use trait objects in some cases of `if` arm type divergence)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 23, 2024
Rollup of 9 pull requests

Successful merges:

 - rust-lang#112806 (Small code improvements in `collect_intra_doc_links.rs`)
 - rust-lang#119766 (Split tait and impl trait in assoc items logic)
 - rust-lang#120139 (Do not normalize closure signature when building `FnOnce` shim)
 - rust-lang#120160 (Manually implement derived `NonZero` traits.)
 - rust-lang#120171 (Fix assume and assert in jump threading)
 - rust-lang#120183 (Add `#[coverage(off)]` to closures introduced by `#[test]` and `#[bench]`)
 - rust-lang#120195 (add several resolution test cases)
 - rust-lang#120259 (Split Diagnostics for Uncommon Codepoints: Add List to Display Characters Involved)
 - rust-lang#120261 (Provide structured suggestion to use trait objects in some cases of `if` arm type divergence)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7ee8142 into rust-lang:master Jan 24, 2024
@rustbot rustbot added this to the 1.77.0 milestone Jan 24, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 24, 2024
Rollup merge of rust-lang#120195 - bvanjoi:add-some-resolution-test-case, r=petrochenkov

add several resolution test cases

r? ``@petrochenkov``
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants