-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Detect more cfg
d out items in resolution errors
#129183
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,8 +37,8 @@ mod placeholder { | |
//~| NOTE could not find `doesnt_exist` in `inner` | ||
} | ||
|
||
#[cfg(i_dont_exist_and_you_can_do_nothing_about_it)] | ||
pub fn vanished() {} | ||
#[cfg(i_dont_exist_and_you_can_do_nothing_about_it)] //~ NOTE the item is gated here | ||
pub fn vanished() {} //~ NOTE found an item that was configured out | ||
|
||
fn main() { | ||
// There is no uwu at this path - no diagnostic. | ||
|
@@ -49,18 +49,16 @@ fn main() { | |
inner::uwu(); //~ ERROR cannot find function | ||
//~| NOTE not found in `inner` | ||
|
||
// The module isn't found - we would like to get a diagnostic, but currently don't due to | ||
// the awkward way the resolver diagnostics are currently implemented. | ||
// The module isn't found - we get a diagnostic. | ||
inner::doesnt_exist::hello(); //~ ERROR failed to resolve | ||
//~| NOTE could not find `doesnt_exist` in `inner` | ||
|
||
// It should find the one in the right module, not the wrong one. | ||
inner::right::meow(); //~ ERROR cannot find function | ||
//~| NOTE not found in `inner::right | ||
|
||
// Exists in the crate root - we would generally want a diagnostic, | ||
// but currently don't have one. | ||
// Not that it matters much though, this is highly unlikely to confuse anyone. | ||
// Exists in the crate root - we show a diagnostic because we treat "no module DefId" as "crate | ||
// root DefId". | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this is correct? it should be the current module def id instead There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's been a while since I last looked at this code, but I think this was referring to https://github.com/rust-lang/rust/pull/129183/files#diff-0e459b4cbb41dd93274d7c68b18a2a3eab7152e9aea107839a7bddff0b4e9195R819 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh yeah I didn't clarify, the comment matches the implementation but I think the implementation is wrong |
||
vanished(); //~ ERROR cannot find function | ||
//~^ NOTE not found in this scope | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
//@ compile-flags: --cfg foo --check-cfg=cfg(foo,bar) | ||
|
||
#[cfg(all(foo, bar))] // foo AND bar | ||
fn foo() {} | ||
//~^ NOTE the item is gated here | ||
fn foo() {} //~ NOTE found an item that was configured out | ||
|
||
fn main() { | ||
foo(); //~ ERROR cannot find function `foo` in this scope | ||
//~^ NOTE not found in this scope | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#[cfg_attr(all(), cfg_attr(all(), cfg(FALSE)))] | ||
fn f() {} | ||
#[cfg_attr(all(), cfg_attr(all(), cfg(FALSE)))] //~ NOTE the item is gated here | ||
fn f() {} //~ NOTE found an item that was configured out | ||
|
||
fn main() { f() } //~ ERROR cannot find function `f` in this scope | ||
//~^ NOTE not found in this scope |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#[cfg(doc)] | ||
pub struct Foo; | ||
#[cfg(doc)] //~ NOTE the item is gated here | ||
pub struct Foo; //~ NOTE found an item that was configured out | ||
|
||
fn main() { | ||
let f = Foo; //~ ERROR | ||
let f = Foo; //~ ERROR cannot find value `Foo` in this scope | ||
//~^ NOTE not found in this scope | ||
} |
Uh oh!
There was an error while loading. Please reload this page.