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;
16181618 "# ] ] ,
16191619 ) ;
16201620}
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(
703703) -> Option < ImportCandidate > {
704704 Some ( match qualifier {
705705 Some ( qualifier) => match sema. resolve_path ( & qualifier) {
706- None => {
706+ Some ( PathResolution :: Def ( ModuleDef :: BuiltinType ( _ ) ) ) | None => {
707707 if qualifier. first_qualifier ( ) . map_or ( true , |it| sema. resolve_path ( & it) . is_none ( ) ) {
708708 let qualifier = qualifier
709709 . segments ( )
Original file line number Diff line number Diff line change @@ -197,7 +197,9 @@ fn structure_token(token: SyntaxToken) -> Option<StructureNode> {
197197 if let Some ( comment) = ast:: Comment :: cast ( token) {
198198 let text = comment. text ( ) . trim ( ) ;
199199
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+ {
201203 return Some ( StructureNode {
202204 parent : None ,
203205 label : region_name. to_owned ( ) ,
Original file line number Diff line number Diff line change 5555//! size_of: sized
5656//! sized:
5757//! slice:
58+ //! str:
5859//! sync: sized
5960//! transmute:
6061//! try: infallible
@@ -1368,6 +1369,14 @@ pub mod iter {
13681369}
13691370// endregion:iterator
13701371
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+
13711380// region:panic
13721381mod panic {
13731382 pub macro panic_2021 {
You can’t perform that action at this time.
0 commit comments