Skip to content

Commit 1303392

Browse files
committed
Addressed a couple more feedback items.
1 parent 001f3e1 commit 1303392

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

text/0000-import-trait-associated-functions.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ When
116116
```rust
117117
use Trait::func as m;
118118
```
119-
occurs, a new item `m` is made available in the function namespace of the current module. Any attempts to call this item are treated calling the associated function explicitly qualified. As always, the `as` qualifier is optional, in which case the name of the new item is identical with the name of the associated function in the trait. In other words, the example:
119+
occurs, a new item `m` is made available in the value namespace of the current module. Any attempts to call this item are treated calling the associated function explicitly qualified. As always, the `as` qualifier is optional, in which case the name of the new item is identical with the name of the associated function in the trait. In other words, the example:
120120

121121
```rust
122122
use Default::default;
@@ -165,6 +165,10 @@ is sugar for
165165
```rust
166166
use some_module::Trait;
167167
```
168+
to allow importing a trait and its methods at the same time, e.g:
169+
```rust
170+
use Default::{self, default};
171+
```
168172

169173
The restriction on importing parent trait associated functions is a consequence of this desugaring, see https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=51bef9ba69ce1fc20248e987bf106bd4 for examples of the errors you get when you try to call parent trait associated functions through a child trait. We will likely want better error messages than this if a user tries to import a parent function.
170174

0 commit comments

Comments
 (0)