File tree Expand file tree Collapse file tree 4 files changed +28
-2
lines changed
src/tools/rust-analyzer/crates Expand file tree Collapse file tree 4 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -1618,3 +1618,18 @@ pub struct FooStruct;
1618
1618
"# ] ] ,
1619
1619
) ;
1620
1620
}
1621
+
1622
+ #[ test]
1623
+ fn primitive_mod ( ) {
1624
+ check (
1625
+ r#"
1626
+ //- minicore: str
1627
+ fn main() {
1628
+ str::from$0
1629
+ }
1630
+ "# ,
1631
+ expect ! [ [ r#"
1632
+ fn from_utf8_unchecked(…) (use core::str) const unsafe fn(&[u8]) -> &str
1633
+ "# ] ] ,
1634
+ ) ;
1635
+ }
Original file line number Diff line number Diff line change @@ -703,7 +703,7 @@ fn path_import_candidate(
703
703
) -> Option < ImportCandidate > {
704
704
Some ( match qualifier {
705
705
Some ( qualifier) => match sema. resolve_path ( & qualifier) {
706
- None => {
706
+ Some ( PathResolution :: Def ( ModuleDef :: BuiltinType ( _ ) ) ) | None => {
707
707
if qualifier. first_qualifier ( ) . map_or ( true , |it| sema. resolve_path ( & it) . is_none ( ) ) {
708
708
let qualifier = qualifier
709
709
. segments ( )
Original file line number Diff line number Diff line change @@ -197,7 +197,9 @@ fn structure_token(token: SyntaxToken) -> Option<StructureNode> {
197
197
if let Some ( comment) = ast:: Comment :: cast ( token) {
198
198
let text = comment. text ( ) . trim ( ) ;
199
199
200
- if let Some ( region_name) = text. strip_prefix ( "// region:" ) . map ( str:: trim) {
200
+ if let Some ( region_name) =
201
+ text. strip_prefix ( "// region:" ) . map ( str:: trim) . filter ( |it| !it. is_empty ( ) )
202
+ {
201
203
return Some ( StructureNode {
202
204
parent : None ,
203
205
label : region_name. to_owned ( ) ,
Original file line number Diff line number Diff line change 55
55
//! size_of: sized
56
56
//! sized:
57
57
//! slice:
58
+ //! str:
58
59
//! sync: sized
59
60
//! transmute:
60
61
//! try: infallible
@@ -1368,6 +1369,14 @@ pub mod iter {
1368
1369
}
1369
1370
// endregion:iterator
1370
1371
1372
+ // region:str
1373
+ pub mod str {
1374
+ pub const unsafe fn from_utf8_unchecked ( v : & [ u8 ] ) -> & str {
1375
+ ""
1376
+ }
1377
+ }
1378
+ // endregion:str
1379
+
1371
1380
// region:panic
1372
1381
mod panic {
1373
1382
pub macro panic_2021 {
You can’t perform that action at this time.
0 commit comments