-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
Conversation
tests/ui/cfg/diagnostics-reexport.rs
Outdated
@@ -1,7 +1,7 @@ | |||
pub mod inner { | |||
#[cfg(FALSE)] | |||
#[cfg(FALSE)] //~ NOTE the item is gated here |
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.
I don't think this is correct? no one ever references this item.
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 is because uwu
under inner::gone
now gets included for inner
(because gone
is cfg
d out) when trying to access inner::uwu
. I believe this is the right thing to do. If the user had written inner::gone::uwu
, the output is:
error[E0433]: failed to resolve: could not find `gone` in `inner`
--> tests/ui/cfg/diagnostics-reexport.rs:38:12
|
38 | inner::gone::uwu(); //~ ERROR cannot find function
| ^^^^ could not find `gone` in `inner`
|
note: found an item that was configured out
--> tests/ui/cfg/diagnostics-reexport.rs:3:9
|
3 | mod gone {
| ^^^^
note: the item is gated here
--> tests/ui/cfg/diagnostics-reexport.rs:2:5
|
2 | #[cfg(FALSE)] //~ NOTE the item is gated here
| ^^^^^^^^^^^^^
but if it is inner::gon::uwu
then the output is
error[E0433]: failed to resolve: could not find `gon` in `inner`
--> tests/ui/cfg/diagnostics-reexport.rs:38:12
|
38 | inner::gon::uwu(); //~ ERROR cannot find function
| ^^^ could not find `gon` in `inner`
We might actually want to still search for cfg
d out items both with levenshtein distance (but the signal there is much weaker) and by looking at the very last path segment (to find the cfg
d out uwu
).
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.
I tend to agree with @Noratrieb: the user wrote inner::uwu
, which refers to the use super::uwu
below, which already failed to resolve without suggesting gone
. Either both suggest gone::uwu
, or none of them.
We are doing more work on a good path here. |
This comment has been minimized.
This comment has been minimized.
Detect more `cfg`d out items in resolution errors Use a visitor to collect *all* items (including those nested) that were stripped behind a `cfg` condition. ``` error[E0425]: cannot find function `f` in this scope --> $DIR/nested-cfg-attrs.rs:4:13 | LL | fn main() { f() } | ^ not found in this scope | note: found an item that was configured out --> $DIR/nested-cfg-attrs.rs:2:4 | LL | fn f() {} | ^ note: the item is gated here --> $DIR/nested-cfg-attrs.rs:1:35 | LL | #[cfg_attr(all(), cfg_attr(all(), cfg(FALSE)))] | ^^^^^^^^^^ ```
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (623e6c7): comparison URL. Overall result: ❌✅ regressions and improvements - ACTION NEEDEDBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)Results (primary 2.6%, secondary 1.5%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (secondary -2.9%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeResults (primary 0.1%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: 749.153s -> 748.829s (-0.04%) |
It might make sense to limit the visitor to two levels of nesting at most, as a way to attempt to reduce the impact on crates that have large modules |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Detect more `cfg`d out items in resolution errors Use a visitor to collect *all* items (including those nested) that were stripped behind a `cfg` condition. ``` error[E0425]: cannot find function `f` in this scope --> $DIR/nested-cfg-attrs.rs:4:13 | LL | fn main() { f() } | ^ not found in this scope | note: found an item that was configured out --> $DIR/nested-cfg-attrs.rs:2:4 | LL | fn f() {} | ^ note: the item is gated here --> $DIR/nested-cfg-attrs.rs:1:35 | LL | #[cfg_attr(all(), cfg_attr(all(), cfg(FALSE)))] | ^^^^^^^^^^ ```
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (811a696): comparison URL. Overall result: ❌✅ regressions and improvements - ACTION NEEDEDBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)Results (primary 1.6%, secondary 2.3%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (secondary -2.9%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeResults (primary 0.1%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: 753.9s -> 754.227s (0.04%) |
This comment was marked as resolved.
This comment was marked as resolved.
@Noratrieb @Urgau given you left some comments, do you have capacity to help reviewing here? I am going to reroll the review assignment but feel free to take it 🙂 thanks r? compiler |
With previous reviews, this looks good to me, r=me after rebase. |
Use a visitor to collect *all* items (including those nested) that were stripped behind a `cfg` condition. ``` error[E0425]: cannot find function `f` in this scope --> $DIR/nested-cfg-attrs.rs:4:13 | LL | fn main() { f() } | ^ not found in this scope | note: found an item that was configured out --> $DIR/nested-cfg-attrs.rs:2:4 | LL | fn f() {} | ^ note: the item is gated here --> $DIR/nested-cfg-attrs.rs:1:35 | LL | #[cfg_attr(all(), cfg_attr(all(), cfg(FALSE)))] | ^^^^^^^^^^ ```
``` error[E0433]: failed to resolve: could not find `doesnt_exist` in `inner` --> $DIR/diagnostics-cross-crate.rs:18:23 | LL | cfged_out::inner::doesnt_exist::hello(); | ^^^^^^^^^^^^ could not find `doesnt_exist` in `inner` | note: found an item that was configured out --> $DIR/auxiliary/cfged_out.rs:6:13 | LL | #[cfg(false)] | ----- the item is gated here LL | pub mod doesnt_exist { | ^^^^^^^^^^^^ ```
@bors r=davidtwco |
☀️ Test successful - checks-actions |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing c23f07d (parent) -> 889701d (this PR) Test differencesShow 12 test diffs12 doctest diffs were found. These are ignored, as they are noisy. Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 889701db1ff614160314734fe4138c2f820a95bb --output-dir test-dashboard And then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
Finished benchmarking commit (889701d): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 6.9%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -3.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 468.795s -> 467.526s (-0.27%) |
Use a visitor to collect all items (including those nested) that were stripped behind a
cfg
condition.