Skip to content
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

Expand libstd struct case misspelling diagnostics #72988

Closed

Conversation

chrissimpkins
Copy link
Member

@chrissimpkins chrissimpkins commented Jun 4, 2020

Closes #72641

This PR adds an additional fallback librustc_resolve diagnostic with libstd struct suggestions for case misspelling errors under the following conditions:

  • libstd struct with correct spelling was not brought into scope (they are already handled with a different diagnostics approach)
  • struct is not imported in the Rust prelude (they are already handled with a different diagnostics approach)
  • not a primitive type (they are already handled with a different diagnostics approach)
  • struct is not nightly-only
  • case-insensitive struct name does not match a macro name (the macro name suggestion has precedence with the current approach here and these suggestions are not displayed)
  • struct is not deprecated (e.g., std::str::LinesAny)
  • struct is not an error type (arbitrary decision)

Behavior: A user who enters a struct name with a libstd struct case misspelling for a type that is not in scope will receive the matching libstd struct(s) in a new suggestion. This approach was originally requested in #72641 for Hashmap -> HashMap only. These changes broaden the scope of that report to cover many/most libstd structs with any case misspelling error, and support multiple struct suggestions when there are multiple case-insensitive name matches across the standard library. This is only used when the Levenshtein algorithm does not identify a typo candidate match.

Before:

error[E0412]: cannot find type `Hashmap` in this scope
 --> src/main.rs:4:9
  |
4 |     hm: Hashmap<String, ()>,
  |         ^^^^^^^ not found in this scope

error: aborting due to previous error

For more information about this error, try `rustc --explain E0412`.

After:

error[E0412]: cannot find type `Hashmap` in this scope
 --> src/main.rs:4:9
  |
4 |     hm: Hashmap<String, ()>,
  |         ^^^^^^^
  |         |
  |         not found in this scope
  |         help: found a std struct with a similar name: `std::collections::HashMap`

error: aborting due to previous error

@rust-highfive
Copy link
Collaborator

r? @matthewjasper

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 4, 2020
@chrissimpkins chrissimpkins changed the title Add libstd struct case misspelling diagnostics Expand libstd struct case misspelling diagnostics Jun 4, 2020
@rust-highfive

This comment has been minimized.

add tests


broaden libstd support


add tests


fmt


eliminate match attempts on names < 2 chars

addresses CI errors during match attempts against generic type names like "N".  These will not be the correct suggestions.

remove *Debug structs, overlaps with debug macro


typo


refactor match approach


filter on the type namespace and filter out tool mod types


update tests
@chrissimpkins
Copy link
Member Author

chrissimpkins commented Jun 5, 2020

@matthewjasper I think that this is ready for review after some edits to address issues that came up in other UI tests following the initial push. CI is failing on some UI tests that I did not add. Assuming that these changes are acceptable, let me know how you feel we should approach the Drain issue. The only other outstanding issues are the HashMap UI tests and IMO these are OK. I can --bless them if you agree. Recommended changes to the HashMap suggestions that are not part of this PR are described in #72642 and work is happening on this in #73023. (cc @ayushmishra2005 @davidtwco)

Will wait on doing anything further until you have a chance to review. Let me know if there is anything that you need from me. Thanks!

@euclio
Copy link
Contributor

euclio commented Jun 6, 2020

Generally we try to avoid "did you mean" in diagnostic suggestions. Instead, I would word this to indicate what we're suggesting and why we're suggesting it. Something like "the standard library contains a <item type> with a similar name".

@chrissimpkins
Copy link
Member Author

chrissimpkins commented Jun 6, 2020

Generally we try to avoid "did you mean" in diagnostic suggestions. Instead, I would word this to indicate what we're suggesting and why we're suggesting it. Something like "the standard library contains a with a similar name".

We have some work to do... ;)

Happy to change it. Thanks for the feedback.

@rust-highfive

This comment has been minimized.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-8 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
##[section]Starting: Linux x86_64-gnu-llvm-8
##[section]Starting: Initialize job
Agent name: 'Azure Pipelines 63'
Agent machine name: 'fv-az578'
Current agent version: '2.169.1'
##[group]Operating System
16.04.6
LTS
LTS
##[endgroup]
##[group]Virtual Environment
Environment: ubuntu-16.04
Version: 20200517.1
Included Software: https://github.com/actions/virtual-environments/blob/ubuntu16/20200517.1/images/linux/Ubuntu1604-README.md
##[endgroup]
Agent running as: 'vsts'
Prepare build directory.
Set build variables.
Download all required tasks.
Download all required tasks.
Downloading task: Bash (3.163.3)
Checking job knob settings.
   Knob: AgentToolsDirectory = /opt/hostedtoolcache Source: ${AGENT_TOOLSDIRECTORY} 
   Knob: AgentPerflog = /home/vsts/perflog Source: ${VSTS_AGENT_PERFLOG} 
Start tracking orphan processes.
##[section]Finishing: Initialize job
##[section]Starting: Configure Job Name
==============================================================================
---
========================== Starting Command Output ===========================
[command]/bin/bash --noprofile --norc /home/vsts/work/_temp/42fe7ee6-7291-48fc-837e-da08082b38ef.sh

##[section]Finishing: Disable git automatic line ending conversion
##[section]Starting: Checkout rust-lang/rust@refs/pull/72988/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
---
##[command]git remote add origin https://github.com/rust-lang/rust
##[command]git config gc.auto 0
##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
##[command]git config --get-all http.proxy
##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/72988/merge:refs/remotes/pull/72988/merge
---
 ---> cb2676f08729
Step 5/8 : ENV RUST_CONFIGURE_ARGS       --build=x86_64-unknown-linux-gnu       --llvm-root=/usr/lib/llvm-8       --enable-llvm-link-shared       --set rust.thin-lto-import-instr-limit=10
 ---> Using cache
 ---> df25ce111862
Step 6/8 : ENV SCRIPT python2.7 ../x.py test --exclude src/tools/tidy &&            python2.7 ../x.py test src/test/mir-opt --pass=build                                   --target=armv5te-unknown-linux-gnueabi &&            python2.7 ../x.py test src/tools/tidy
 ---> 599b9ac96b27
Step 7/8 : ENV NO_DEBUG_ASSERTIONS=1
 ---> Using cache
 ---> 091087e35a36
---
   Compiling rustc_parse_format v0.0.0 (/checkout/src/librustc_parse_format)
   Compiling chalk-rust-ir v0.10.0
   Compiling rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
   Compiling rustc_hir v0.0.0 (/checkout/src/librustc_hir)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
   Compiling chalk-solve v0.10.0
   Compiling rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
   Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
   Compiling rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
   Compiling rustc_parse_format v0.0.0 (/checkout/src/librustc_parse_format)
   Compiling chalk-rust-ir v0.10.0
   Compiling rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
   Compiling rustc_hir v0.0.0 (/checkout/src/librustc_hir)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
   Compiling chalk-solve v0.10.0
   Compiling rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
   Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
   Compiling rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
............................i...............i....................................................... 5200/10316
.................................................................................................... 5300/10316
............................................................................i....................... 5400/10316
......................................................................i............................. 5500/10316
.......................................................................................ii.ii........ 5600/10316
i...i............................................................................................... 5700/10316
.....................................................................i.............................. 5900/10316
.................................................................................................... 6000/10316
.......................ii.....................................i..................................... 6100/10316
.................................................................................................... 6200/10316
.................................................................................................... 6200/10316
.................................................................................................... 6300/10316
.....................................................................................ii...i..ii..... 6400/10316
.................................................................................................... 6600/10316
.................................................................................................... 6700/10316
.................................................................................................... 6800/10316
.................................................................................................... 6800/10316
..................i..ii............................................................................. 6900/10316
.................................................................................................... 7100/10316
........................................................................i........................... 7200/10316
.................................................................................................... 7300/10316
.................................................................................................... 7400/10316
---
.................................................................................................... 8200/10316
...................................................................FF............................... 8300/10316
.................................................................................................... 8400/10316
...........i........................................................................................ 8500/10316
............................F....................................iiiiii.iiiiii.i.................... 8600/10316
....................i............................................................................... 8800/10316
.................................................................................................... 8900/10316
.................................................................................................... 9000/10316
.................................................................................................... 9100/10316
---
9 LL | use std::collections::HashMap;


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/derived-errors/issue-31997-1/issue-31997-1.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args derived-errors/issue-31997-1.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/derived-errors/issue-31997-1.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/derived-errors/issue-31997-1" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/derived-errors/issue-31997-1/auxiliary"
------------------------------------------

------------------------------------------
stderr:
---
24    |             ^^^^^^^ not found in this scope
25    |
+ help: found a std struct with a similar name
+    |
+ LL |     let y1: std::collections::HashMap;
26 help: consider importing one of these items
27    |
28 LL | use std::collections::HashMap;



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/resolve/use_suggestion/use_suggestion.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args resolve/use_suggestion.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/resolve/use_suggestion.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/resolve/use_suggestion" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/resolve/use_suggestion/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0433]: failed to resolve: use of undeclared type or module `GooMap`
   |
   |
LL |     let x2 = GooMap::new(); //~ ERROR failed to resolve
   |              ^^^^^^ use of undeclared type or module `GooMap`
error[E0433]: failed to resolve: use of undeclared type or module `HashMap`
  --> /checkout/src/test/ui/resolve/use_suggestion.rs:2:14
   |
LL |     let x1 = HashMap::new(); //~ ERROR failed to resolve
---

error[E0412]: cannot find type `HashMap` in this scope
  --> /checkout/src/test/ui/resolve/use_suggestion.rs:5:13
   |
LL |     let y1: HashMap; //~ ERROR cannot find type
   |
help: found a std struct with a similar name
   |
   |
LL |     let y1: std::collections::HashMap; //~ ERROR cannot find type
help: consider importing one of these items
   |
LL | use std::collections::HashMap;
   |
   |
LL | use std::collections::hash_map::HashMap;
   |

error[E0412]: cannot find type `GooMap` in this scope
   |
   |
LL |     let y2: GooMap; //~ ERROR cannot find type

error: aborting due to 4 previous errors

Some errors have detailed explanations: E0412, E0433.
---

---- [ui] ui/resolve/use_suggestion_placement.rs stdout ----
diff of stderr:

26 LL |     type Dict<K, V> = HashMap<K, V>;
28    |
+ help: found a std struct with a similar name
+    |
+    |
+ LL |     type Dict<K, V> = std::collections::HashMap<K, V>;
29 help: consider importing one of these items
30    |
31 LL | use std::collections::HashMap;



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/resolve/use_suggestion_placement/use_suggestion_placement.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args resolve/use_suggestion_placement.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/resolve/use_suggestion_placement.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/resolve/use_suggestion_placement" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/resolve/use_suggestion_placement/auxiliary"
------------------------------------------

------------------------------------------
stderr:
---

error[E0412]: cannot find type `HashMap` in this scope
  --> /checkout/src/test/ui/resolve/use_suggestion_placement.rs:27:23
   |
LL |     type Dict<K, V> = HashMap<K, V>; //~ ERROR cannot find
   |
help: found a std struct with a similar name
   |
   |
LL |     type Dict<K, V> = std::collections::HashMap<K, V>; //~ ERROR cannot find
help: consider importing one of these items
   |
LL | use std::collections::HashMap;
   |
---

---- [ui] ui/rust-2018/issue-52202-use-suggestions.rs stdout ----
diff of stderr:

4 LL |     let _d = Drain {};
6    |
+ help: found a std struct with a similar name
+    |
+    |
+ LL |     let _d = std::string::Drain {};
7 help: consider importing one of these items
8    |
9 LL | use crate::plumbing::Drain;



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rust-2018/issue-52202-use-suggestions/issue-52202-use-suggestions.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args rust-2018/issue-52202-use-suggestions.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/rust-2018/issue-52202-use-suggestions.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rust-2018/issue-52202-use-suggestions" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2018" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rust-2018/issue-52202-use-suggestions/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0422]: cannot find struct, variant or union type `Drain` in this scope
  --> /checkout/src/test/ui/rust-2018/issue-52202-use-suggestions.rs:11:14
   |
LL |     let _d = Drain {};
   |
help: found a std struct with a similar name
   |
   |
LL |     let _d = std::string::Drain {};
help: consider importing one of these items
   |
LL | use crate::plumbing::Drain;
   |
---
thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:348:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-8/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "8.0.0" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --exclude src/tools/tidy
Build completed unsuccessfully in 1:06:33
Build completed unsuccessfully in 1:06:33
== clock drift check ==
  local time: Sat Jun  6 16:31:09 UTC 2020
  network time: Sat, 06 Jun 2020 16:31:09 GMT
== end clock drift check ==

##[error]Bash exited with code '1'.
##[section]Finishing: Run build
##[section]Starting: Checkout rust-lang/rust@refs/pull/72988/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
Author       : Microsoft
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
Cleaning any cached credential from repository: rust-lang/rust (GitHub)
##[section]Finishing: Checkout rust-lang/rust@refs/pull/72988/merge to s
Cleaning up task key
Start cleaning up orphan processes.
Terminate orphan process: pid (3505) (python)
##[section]Finishing: Finalize Job

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @rust-lang/infra. (Feature Requests)

@chrissimpkins
Copy link
Member Author

@davidtwco David is this something that you would be willing to review? This is related to #73023 that you recently reviewed.

@davidtwco
Copy link
Member

davidtwco commented Jun 11, 2020

r? @davidtwco

I'll take a look at this shortly.

@chrissimpkins
Copy link
Member Author

r? @davidtwco

I'll take a look at this shortly.

Tyvm!

/// This is used for type checking diagnostics in cases when
/// the type is not in scope and the name includes case
/// misspelling (e.g., `Hashmap`, not `HashMap`).
fn get_case_insensitive_libstd_structs_matches(&self, needle: &str) -> Vec<String> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should take a different approach - I'd rather we avoid hard-coding std type names in the compiler (the compiler shouldn't need to be updated when std is changed for this diagnostic to continue to work) and I think we can make this more general, so it works for more than just std.


As you note in the PR description, we do Levenshtein matching on things that are already in-scope and suggest fixes in that case. We also already have suggestions for things that aren't in scope but where the name matches exactly.

The snippet below is where the compiler decides to make "did you mean to import this" suggestions:

if ident.name == lookup_ident.name
&& ns == namespace
&& !ptr::eq(in_module, parent_scope.module)
{
let res = name_binding.res();
if filter_fn(res) {
// create the path
let mut segms = path_segments.clone();
if lookup_ident.span.rust_2018() {
// crate-local absolute paths start with `crate::` in edition 2018
// FIXME: may also be stabilized for Rust 2015 (Issues #45477, #44660)
segms.insert(0, ast::PathSegment::from_ident(crate_name));
}
segms.push(ast::PathSegment::from_ident(ident));
let path = Path { span: name_binding.span, segments: segms };
// the entity is accessible in the following cases:
// 1. if it's defined in the same crate, it's always
// accessible (since private entities can be made public)
// 2. if it's defined in another crate, it's accessible
// only if both the module is public and the entity is
// declared as public (due to pruning, we don't explore
// outside crate private modules => no need to check this)
if !in_module_is_extern || name_binding.vis == ty::Visibility::Public {
let did = match res {
Res::Def(DefKind::Ctor(..), did) => this.parent(did),
_ => res.opt_def_id(),
};
if candidates.iter().all(|v: &ImportSuggestion| v.did != did) {
candidates.push(ImportSuggestion { did, descr: res.descr(), path });
}
}
}
}

On line 660 is where it checks for an exact match - I'd experiment with doing a exact match or checking for a Levenshtein distance from that name that's under some threshold (look into lev_distance and find_best_match_for_name to see what can be re-used). I'd hope that would detect cases like this where we can import a name that's very similar. Alternatively, we could just change the comparison to compare the names without considering the case (as I understand it, that would be equivalent to what you're doing here?).

What we might also want to do is thread this information through in some way - e.g. changing ImportSuggestion to be an enum with Exact and Almost (you can come up with a better name than this) variants so that we can make the diagnostic separate these two types of suggestions:

error[E0412]: cannot find type `Hashmap` in this scope
 --> src/main.rs:2:8
  |
2 |     m: Hashmap<String, ()>,
  |        ^^^^^^^ not found in this scope
  |
help: consider importing one of these items
  |
1 | use some::made:up::module::Hashmap;
  |
help: consider importing one of these similarly named items
  |
1 | use std::collections::HashMap;
  |

This should be easier to maintain because we don't have to keep a list of types like you've got here, and it'd work for non-std types too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tyvm David! I will look into it this week. I really appreciate the review and will be in touch when I have updates.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nitpick on wording: help: consider importing one of these similarly named itemshelp: you might have meant to use {one of }the following similarly named item{s}.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrissimpkins How are you getting with this? Feel free to open a work-in-progress PR if you’re unsure how to proceed or want some early feedback!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay! Busy week last week. I will get back to this during the week and let you know if I run into any issues.

fn test_du16(_x: DecodeUTF16<()>){}
//~^ ERROR: cannot find type `DecodeUTF16` in this scope

fn test_edflt(_x: Escapedefault){}
Copy link
Member

@davidtwco davidtwco Jun 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd combine all of these tests into a single file - we're not gaining anything by having them separate - if we change the approach, it's very likely that if one fails then they all would and so having different tests just means we have more tests to run (likely to be marginally slower).

Also, feel free to --bless tests that you didn't add so that CI passes as soon as you update the PR - that way if all is well, we can just approve straight away.

@chrissimpkins chrissimpkins marked this pull request as draft July 4, 2020 17:14
@Muirrum
Copy link
Member

Muirrum commented Jul 24, 2020

@chrissimpkins This is a triage bump.

@chrissimpkins
Copy link
Member Author

@Muirrum Thanks for the reminder Owen. I don't know that any of this source will be used in what is required here based on the review. I'll close this and open a new PR when time permits me to dig into it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Suggest importable type that differs only in capitalization
8 participants