]> git.lizzy.rs Git - rust.git/commitdiff
rustc_resolve: don't allow `::crate_name` to bypass `extern_prelude`.
authorEduard-Mihai Burtescu <edy.burt@gmail.com>
Fri, 24 Aug 2018 15:51:32 +0000 (18:51 +0300)
committerEduard-Mihai Burtescu <edy.burt@gmail.com>
Sat, 15 Sep 2018 19:48:10 +0000 (22:48 +0300)
35 files changed:
src/librustc_resolve/resolve_imports.rs
src/test/run-make-fulldeps/save-analysis-rfc2126/Makefile
src/test/ui/issues/issue-52489.rs
src/test/ui/issues/issue-52489.stderr
src/test/ui/rfc-2126-extern-absolute-paths/non-existent-1.rs
src/test/ui/rfc-2126-extern-absolute-paths/non-existent-1.stderr
src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.rs
src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.stderr
src/test/ui/rfc-2126-extern-absolute-paths/non-existent-3.rs
src/test/ui/rfc-2126-extern-absolute-paths/non-existent-3.stderr
src/test/ui/rfc-2126-extern-absolute-paths/single-segment.rs
src/test/ui/rfc-2126-extern-absolute-paths/single-segment.stderr
src/test/ui/rfc-2126-extern-in-paths/non-existent-1.rs
src/test/ui/rfc-2126-extern-in-paths/non-existent-1.stderr
src/test/ui/rfc-2126-extern-in-paths/non-existent-2.rs
src/test/ui/rfc-2126-extern-in-paths/non-existent-2.stderr
src/test/ui/rfc-2126-extern-in-paths/non-existent-3.rs
src/test/ui/rfc-2126-extern-in-paths/non-existent-3.stderr
src/test/ui/rfc-2126-extern-in-paths/single-segment.rs
src/test/ui/rfc-2126-extern-in-paths/single-segment.stderr
src/test/ui/run-pass/issues/issue-52140/main.rs
src/test/ui/run-pass/issues/issue-52141/main.rs
src/test/ui/run-pass/issues/issue-52705/main.rs
src/test/ui/run-pass/rfcs/rfc-2126-extern-absolute-paths/basic.rs
src/test/ui/run-pass/rfcs/rfc-2126-extern-absolute-paths/extern.rs
src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.fixed
src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.rs
src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.stderr
src/test/ui/rust-2018/extern-crate-idiomatic.fixed
src/test/ui/rust-2018/extern-crate-idiomatic.rs
src/test/ui/rust-2018/issue-54006.rs [new file with mode: 0644]
src/test/ui/rust-2018/issue-54006.stderr [new file with mode: 0644]
src/test/ui/rust-2018/remove-extern-crate.fixed
src/test/ui/rust-2018/remove-extern-crate.rs
src/test/ui/rust-2018/remove-extern-crate.stderr

index e7d3a8ef661673f4d98afddd55d8ea9930e4cbcd..c86d430faceabb10337264a77d8beb9bccb5ddcd 100644 (file)
@@ -196,7 +196,11 @@ pub fn resolve_ident_in_module_unadjusted(&mut self,
                     }
 
                     // Fall back to resolving to an external crate.
-                    if !(ns == TypeNS && self.extern_prelude.contains(&ident.name)) {
+                    if !(
+                        ns == TypeNS &&
+                        !ident.is_path_segment_keyword() &&
+                        self.extern_prelude.contains(&ident.name)
+                    ) {
                         // ... unless the crate name is not in the `extern_prelude`.
                         return binding;
                     }
@@ -211,7 +215,11 @@ pub fn resolve_ident_in_module_unadjusted(&mut self,
                     )
                 {
                     self.resolve_crate_root(ident)
-                } else if ns == TypeNS && !ident.is_path_segment_keyword() {
+                } else if
+                    ns == TypeNS &&
+                    !ident.is_path_segment_keyword() &&
+                    self.extern_prelude.contains(&ident.name)
+                {
                     let crate_id =
                         self.crate_loader.process_path_extern(ident.name, ident.span);
                     self.get_module(DefId { krate: crate_id, index: CRATE_DEF_INDEX })
index 6a67b5862a815526ed7fb103d30d77333bdfcc0b..2b931d89f1fec5dd0a13fbc99625b1c32d2ea79b 100644 (file)
@@ -1,9 +1,11 @@
 -include ../tools.mk
 
 all: extern_absolute_paths.rs extern_in_paths.rs krate2
-       $(RUSTC) extern_absolute_paths.rs -Zsave-analysis --edition=2018
+       $(RUSTC) extern_absolute_paths.rs -Zsave-analysis --edition=2018 \
+               -Z unstable-options --extern krate2
        cat $(TMPDIR)/save-analysis/extern_absolute_paths.json | "$(PYTHON)" validate_json.py
-       $(RUSTC) extern_in_paths.rs -Zsave-analysis --edition=2018
+       $(RUSTC) extern_in_paths.rs -Zsave-analysis --edition=2018 \
+               -Z unstable-options --extern krate2
        cat $(TMPDIR)/save-analysis/extern_in_paths.json | "$(PYTHON)" validate_json.py
 
 krate2: krate2.rs
index c43cc12ca0229d187c51a91061a8189e8b9c6d54..f26392e82acbd59094a90c8bae12443848c91f67 100644 (file)
@@ -10,6 +10,7 @@
 
 // edition:2018
 // aux-build:issue-52489.rs
+// compile-flags:--extern issue_52489
 
 use issue_52489;
 //~^ ERROR use of unstable library feature 'issue_52489_unstable'
index 5b38a0789ad7fd78a1ba4e547f350fdeaeb622e7..b8c41d82643e838927cba76e8480796184b2ce6f 100644 (file)
@@ -1,5 +1,5 @@
 error[E0658]: use of unstable library feature 'issue_52489_unstable'
-  --> $DIR/issue-52489.rs:14:5
+  --> $DIR/issue-52489.rs:15:5
    |
 LL | use issue_52489;
    |     ^^^^^^^^^^^
index 826bf675bd699899da0638a33c1b7b8edd8ba420..a259266420a1de9e6fa89e50a40f0cd03de4401b 100644 (file)
@@ -10,6 +10,6 @@
 
 // edition:2018
 
-use xcrate::S; //~ ERROR can't find crate for `xcrate`
+use xcrate::S; //~ ERROR unresolved import `xcrate`
 
 fn main() {}
index 27a69ec1b1fafaa2d445fc5c500a65de13ae25f6..1a8ceec5dac068ddd8a4bffbc2f7e16686910ce4 100644 (file)
@@ -1,9 +1,9 @@
-error[E0463]: can't find crate for `xcrate`
+error[E0432]: unresolved import `xcrate`
   --> $DIR/non-existent-1.rs:13:5
    |
-LL | use xcrate::S; //~ ERROR can't find crate for `xcrate`
-   |     ^^^^^^ can't find crate
+LL | use xcrate::S; //~ ERROR unresolved import `xcrate`
+   |     ^^^^^^ Could not find `xcrate` in `{{root}}`
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0463`.
+For more information about this error, try `rustc --explain E0432`.
index 053bf92f4d196a2aa0108d5062a397a4ff995ea5..41adb974f21760a685fdc23069cbbb7c09fccfd0 100644 (file)
@@ -11,5 +11,6 @@
 // edition:2018
 
 fn main() {
-    let s = ::xcrate::S; //~ ERROR can't find crate for `xcrate`
+    let s = ::xcrate::S;
+    //~^ ERROR failed to resolve. Could not find `xcrate` in `{{root}}`
 }
index eb96d5f05d7a6eb47e11964fa2bba62def0e557a..b46576b01436784650a47092c6e8762f338dedcb 100644 (file)
@@ -1,9 +1,9 @@
-error[E0463]: can't find crate for `xcrate`
+error[E0433]: failed to resolve. Could not find `xcrate` in `{{root}}`
   --> $DIR/non-existent-2.rs:14:15
    |
-LL |     let s = ::xcrate::S; //~ ERROR can't find crate for `xcrate`
-   |               ^^^^^^ can't find crate
+LL |     let s = ::xcrate::S;
+   |               ^^^^^^ Could not find `xcrate` in `{{root}}`
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0463`.
+For more information about this error, try `rustc --explain E0433`.
index 1b9e5a75e83071f82bc8f0bccc067d6f85bf030d..0cbeb8cf50fe3db7704a73d4dea113d0797e518b 100644 (file)
@@ -10,6 +10,6 @@
 
 // edition:2018
 
-use ycrate; //~ ERROR can't find crate for `ycrate`
+use ycrate; //~ ERROR unresolved import `ycrate`
 
 fn main() {}
index 434bde79a8322659654267d0ddf75b0b6af1b392..31486e14bd2a88da47b8d794b1323ff3cd4f68ac 100644 (file)
@@ -1,9 +1,9 @@
-error[E0463]: can't find crate for `ycrate`
+error[E0432]: unresolved import `ycrate`
   --> $DIR/non-existent-3.rs:13:5
    |
-LL | use ycrate; //~ ERROR can't find crate for `ycrate`
-   |     ^^^^^^ can't find crate
+LL | use ycrate; //~ ERROR unresolved import `ycrate`
+   |     ^^^^^^ no `ycrate` external crate
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0463`.
+For more information about this error, try `rustc --explain E0432`.
index 69fc4b4f7f8fcb1dc41e82caf0132b888ac8421a..b5b1485f662c58393f1d9ce73fb3f6a3491b9081 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 // aux-build:xcrate.rs
+// compile-flags:--extern xcrate
 // edition:2018
 
 use crate; //~ ERROR crate root imports need to be explicitly named: `use crate as name;`
index cfb1a0ac39ac27de3bccaf19e9657625f9b5e720..b49291b9c0c61a0195299e097335c3abba2456f9 100644 (file)
@@ -1,17 +1,17 @@
 error: crate root imports need to be explicitly named: `use crate as name;`
-  --> $DIR/single-segment.rs:14:5
+  --> $DIR/single-segment.rs:15:5
    |
 LL | use crate; //~ ERROR crate root imports need to be explicitly named: `use crate as name;`
    |     ^^^^^
 
 error: cannot glob-import all possible crates
-  --> $DIR/single-segment.rs:15:5
+  --> $DIR/single-segment.rs:16:5
    |
 LL | use *; //~ ERROR cannot glob-import all possible crates
    |     ^
 
 error[E0423]: expected value, found module `xcrate`
-  --> $DIR/single-segment.rs:18:13
+  --> $DIR/single-segment.rs:19:13
    |
 LL |     let s = ::xcrate; //~ ERROR expected value, found module `xcrate`
    |             ^^^^^^^^ not a value
index 7eba02ed444bb89417aaad0c4c58da9605e32b81..c17e74c547c1840c0bfefb04b339d88d72693266 100644 (file)
@@ -10,6 +10,6 @@
 
 #![feature(extern_in_paths)]
 
-use extern::xcrate::S; //~ ERROR can't find crate for `xcrate`
+use extern::xcrate::S; //~ ERROR unresolved import `extern::xcrate`
 
 fn main() {}
index c25698c395e1c00dbb9ea4b794c02010082ba8f5..55b8b6255073ea6506c7fb90d2893879c8e38467 100644 (file)
@@ -1,9 +1,9 @@
-error[E0463]: can't find crate for `xcrate`
+error[E0432]: unresolved import `extern::xcrate`
   --> $DIR/non-existent-1.rs:13:13
    |
-LL | use extern::xcrate::S; //~ ERROR can't find crate for `xcrate`
-   |             ^^^^^^ can't find crate
+LL | use extern::xcrate::S; //~ ERROR unresolved import `extern::xcrate`
+   |             ^^^^^^ Could not find `xcrate` in `extern`
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0463`.
+For more information about this error, try `rustc --explain E0432`.
index 4d09a05253ec2c338abbdd9381c86d68a3a0e699..128ecf41a303df83d2cd3fe1f315629a3cd9259a 100644 (file)
@@ -11,5 +11,6 @@
 #![feature(extern_in_paths)]
 
 fn main() {
-    let s = extern::xcrate::S; //~ ERROR can't find crate for `xcrate`
+    let s = extern::xcrate::S;
+    //~^ ERROR failed to resolve. Could not find `xcrate` in `extern`
 }
index b7ca8890c19420f63d6a0641e601ff9f1cf437ad..7fbe50a92022b23661d1203295fddb2d56e00588 100644 (file)
@@ -1,9 +1,9 @@
-error[E0463]: can't find crate for `xcrate`
+error[E0433]: failed to resolve. Could not find `xcrate` in `extern`
   --> $DIR/non-existent-2.rs:14:21
    |
-LL |     let s = extern::xcrate::S; //~ ERROR can't find crate for `xcrate`
-   |                     ^^^^^^ can't find crate
+LL |     let s = extern::xcrate::S;
+   |                     ^^^^^^ Could not find `xcrate` in `extern`
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0463`.
+For more information about this error, try `rustc --explain E0433`.
index 402d294b2e324d98dea61b313dc39b72409cc941..350cca70487f3bc1332ef609e1fa2939f57fda9b 100644 (file)
@@ -10,6 +10,6 @@
 
 #![feature(extern_in_paths)]
 
-use extern::ycrate; //~ ERROR can't find crate for `ycrate`
+use extern::ycrate; //~ ERROR unresolved import `extern::ycrate`
 
 fn main() {}
index fbea89ae93a97b8d4b8b451bb4c2a47c38d9d38b..0a49d1721695bd364bf059810f8857916c09b58c 100644 (file)
@@ -1,9 +1,9 @@
-error[E0463]: can't find crate for `ycrate`
-  --> $DIR/non-existent-3.rs:13:13
+error[E0432]: unresolved import `extern::ycrate`
+  --> $DIR/non-existent-3.rs:13:5
    |
-LL | use extern::ycrate; //~ ERROR can't find crate for `ycrate`
-   |             ^^^^^^ can't find crate
+LL | use extern::ycrate; //~ ERROR unresolved import `extern::ycrate`
+   |     ^^^^^^^^^^^^^^ no `ycrate` external crate
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0463`.
+For more information about this error, try `rustc --explain E0432`.
index 017844a0252e274218fd12275d665839b59d5993..ea4488637031e316bf1135998992928107922fb2 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 // aux-build:xcrate.rs
+// compile-flags:--extern xcrate
 
 #![feature(extern_in_paths)]
 
index 8b1dd89fe3ca71e4c958aaad22c93a7415425dda..033bedb3b938b20ee746c9b54a0ff4e65dc3e81c 100644 (file)
@@ -1,17 +1,17 @@
 error: cannot glob-import all possible crates
-  --> $DIR/single-segment.rs:17:5
+  --> $DIR/single-segment.rs:18:5
    |
 LL | use extern::*; //~ ERROR cannot glob-import all possible crates
    |     ^^^^^^^^^
 
 error[E0432]: unresolved import `extern`
-  --> $DIR/single-segment.rs:15:5
+  --> $DIR/single-segment.rs:16:5
    |
 LL | use extern; //~ ERROR unresolved import `extern`
    |     ^^^^^^ no `extern` in the root
 
 error[E0423]: expected value, found module `extern::xcrate`
-  --> $DIR/single-segment.rs:20:13
+  --> $DIR/single-segment.rs:21:13
    |
 LL |     let s = extern::xcrate; //~ ERROR expected value, found module `extern::xcrate`
    |             ^^^^^^^^^^^^^^ not a value
index c17a4796555c736492915bd80d4758c299176f7b..3d727e2ad1b56139fb8792246a902e817ae422c9 100644 (file)
@@ -10,6 +10,7 @@
 
 // run-pass
 // aux-build:some_crate.rs
+// compile-flags:--extern some_crate
 // edition:2018
 
 mod foo {
index d1003bb2908af4d20888195c1e4e6fef66f5268b..20705dc38e1aec1413a285769e51980abc4b7016 100644 (file)
@@ -10,6 +10,7 @@
 
 // run-pass
 // aux-build:some_crate.rs
+// compile-flags:--extern some_crate
 // edition:2018
 
 use some_crate as some_name;
index 3d828ba60d3cdd6b4a890b89bba35a2ac564f671..00cb5ac103a9130709ffe15916ae8085cf9b2de0 100644 (file)
@@ -10,6 +10,7 @@
 
 // run-pass
 // aux-build:png2.rs
+// compile-flags:--extern png2
 // edition:2018
 
 mod png {
index c5a356d979d314072ba1dd2e551971c3ce08e3e4..b13602297a4af35a3934c24b7cb5e8447f0f1b2c 100644 (file)
@@ -10,6 +10,7 @@
 
 // run-pass
 // aux-build:xcrate.rs
+// compile-flags:--extern xcrate
 // edition:2018
 
 use xcrate::Z;
index 3d31c2d3a4dd105f753d799c97b1d9c0e4297384..0d84ccc3d322155f352a679da655a317fd808ace 100644 (file)
@@ -10,6 +10,7 @@
 
 // run-pass
 // aux-build:xcrate.rs
+// compile-flags:--extern xcrate
 
 #![feature(extern_in_paths)]
 
index fc81ab08f624d480ee5491354e3cfb911653f98a..36a837509c50cb3ea79ef3e3d98407b5d1ca0823 100644 (file)
@@ -10,6 +10,7 @@
 
 // aux-build:edition-lint-paths.rs
 // run-rustfix
+// compile-flags:--extern edition_lint_paths
 // edition:2018
 
 // The "normal case". Ideally we would remove the `extern crate` here,
index 72751f2080cc9b2d28f31ab179189438679dc9a1..9daa4145630b7b1d89f8f73444a90d266ab11243 100644 (file)
@@ -10,6 +10,7 @@
 
 // aux-build:edition-lint-paths.rs
 // run-rustfix
+// compile-flags:--extern edition_lint_paths
 // edition:2018
 
 // The "normal case". Ideally we would remove the `extern crate` here,
index 0ecfd4e4a2ca3076523bffe3ebf6a840dd5fcda9..b3afa2bd1d59289bb9c7ffd23a23829793436a7b 100644 (file)
@@ -1,18 +1,18 @@
 error: unused extern crate
-  --> $DIR/extern-crate-idiomatic-in-2018.rs:21:1
+  --> $DIR/extern-crate-idiomatic-in-2018.rs:22:1
    |
 LL | extern crate edition_lint_paths;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
    |
 note: lint level defined here
-  --> $DIR/extern-crate-idiomatic-in-2018.rs:18:9
+  --> $DIR/extern-crate-idiomatic-in-2018.rs:19:9
    |
 LL | #![deny(rust_2018_idioms)]
    |         ^^^^^^^^^^^^^^^^
    = note: #[deny(unused_extern_crates)] implied by #[deny(rust_2018_idioms)]
 
 error: `extern crate` is not idiomatic in the new edition
-  --> $DIR/extern-crate-idiomatic-in-2018.rs:24:1
+  --> $DIR/extern-crate-idiomatic-in-2018.rs:25:1
    |
 LL | extern crate edition_lint_paths as bar;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use`
index a874a62220298c7f81c4c051f09aa2daffcd714d..0be1f2cc72bb0eb9b1c4f22c43cc87e07e16db0d 100644 (file)
@@ -10,6 +10,7 @@
 
 // run-pass
 // aux-build:edition-lint-paths.rs
+// compile-flags:--extern edition_lint_paths
 // run-rustfix
 
 // The "normal case". Ideally we would remove the `extern crate` here,
index a874a62220298c7f81c4c051f09aa2daffcd714d..0be1f2cc72bb0eb9b1c4f22c43cc87e07e16db0d 100644 (file)
@@ -10,6 +10,7 @@
 
 // run-pass
 // aux-build:edition-lint-paths.rs
+// compile-flags:--extern edition_lint_paths
 // run-rustfix
 
 // The "normal case". Ideally we would remove the `extern crate` here,
diff --git a/src/test/ui/rust-2018/issue-54006.rs b/src/test/ui/rust-2018/issue-54006.rs
new file mode 100644 (file)
index 0000000..ee58d24
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// edition:2018
+
+#![no_std]
+#![crate_type = "lib"]
+
+use alloc::vec;
+//~^ ERROR unresolved import `alloc`
+
+pub fn foo() {
+    let mut xs = vec![];
+    //~^ ERROR cannot determine resolution for the macro `vec`
+    xs.push(0);
+}
diff --git a/src/test/ui/rust-2018/issue-54006.stderr b/src/test/ui/rust-2018/issue-54006.stderr
new file mode 100644 (file)
index 0000000..1183dc9
--- /dev/null
@@ -0,0 +1,17 @@
+error[E0432]: unresolved import `alloc`
+  --> $DIR/issue-54006.rs:16:5
+   |
+LL | use alloc::vec;
+   |     ^^^^^ Could not find `alloc` in `{{root}}`
+
+error: cannot determine resolution for the macro `vec`
+  --> $DIR/issue-54006.rs:20:18
+   |
+LL |     let mut xs = vec![];
+   |                  ^^^
+   |
+   = note: import resolution is stuck, try simplifying macro imports
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0432`.
index 995be4290b887cae86e11acdea047b44b76caa50..895da74afd76796f389f65b3178efb89d9b16ecd 100644 (file)
@@ -12,6 +12,7 @@
 // edition:2018
 // compile-pass
 // aux-build:remove-extern-crate.rs
+// compile-flags:--extern remove_extern_crate --extern core
 
 #![warn(rust_2018_idioms)]
 
index 3ab97a7428704d2304de0b72cad8154ceafd83e4..c03431a6b885253242116b2ab2857247536d2ade 100644 (file)
@@ -12,6 +12,7 @@
 // edition:2018
 // compile-pass
 // aux-build:remove-extern-crate.rs
+// compile-flags:--extern remove_extern_crate --extern core
 
 #![warn(rust_2018_idioms)]
 
index 752a7b180de138b6c31d7107ee165a5806649a72..064a853625f743e7a95d5d9e3fca049fc05e7b23 100644 (file)
@@ -1,24 +1,24 @@
 warning: unused extern crate
-  --> $DIR/remove-extern-crate.rs:18:1
+  --> $DIR/remove-extern-crate.rs:19:1
    |
 LL | extern crate core;
    | ^^^^^^^^^^^^^^^^^^ help: remove it
    |
 note: lint level defined here
-  --> $DIR/remove-extern-crate.rs:16:9
+  --> $DIR/remove-extern-crate.rs:17:9
    |
 LL | #![warn(rust_2018_idioms)]
    |         ^^^^^^^^^^^^^^^^
    = note: #[warn(unused_extern_crates)] implied by #[warn(rust_2018_idioms)]
 
 warning: `extern crate` is not idiomatic in the new edition
-  --> $DIR/remove-extern-crate.rs:19:1
+  --> $DIR/remove-extern-crate.rs:20:1
    |
 LL | extern crate core as another_name;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use`
 
 warning: `extern crate` is not idiomatic in the new edition
-  --> $DIR/remove-extern-crate.rs:32:5
+  --> $DIR/remove-extern-crate.rs:33:5
    |
 LL |     extern crate core;
    |     ^^^^^^^^^^^^^^^^^^ help: convert it to a `use`