1195 Commits

Author SHA1 Message Date
David Tolnay
fd68e562fa
Write builtins directly to Builtins frontmatter 2020-10-31 22:56:02 -07:00
David Tolnay
8c14d9a638
Add content block inside Builtins 2020-10-31 22:56:02 -07:00
David Tolnay
8810a54d80
Move frontmatter content into Includes 2020-10-31 22:56:02 -07:00
David Tolnay
cb2189f3b1
Make section and block methods available on Content 2020-10-31 22:56:02 -07:00
David Tolnay
12af7e48a7
Move writing includes to write.rs 2020-10-31 22:56:01 -07:00
David Tolnay
b9da1468b6
Combine include-pick loop 2020-10-31 22:56:01 -07:00
David Tolnay
528200fa16
Merge two functions picking includes and builtins 2020-10-31 22:56:01 -07:00
David Tolnay
ec66d11dc4
Split detection and writing of builtins 2020-10-31 22:56:01 -07:00
David Tolnay
d5a5f447e1
Merge pull request #393 from dtolnay/builtin
Move builtin tracking bools to module
2020-10-31 22:55:53 -07:00
David Tolnay
3be0e1f53b
Move builtin tracking bools to module 2020-10-31 22:46:29 -07:00
David Tolnay
ef0473a628
Clean up redundant child_ns_entries borrows
NamespaceEntries::children returns an iterator of (&Ident, &NamespaceEntries)
so these child_ns_entries are already borrows.
2020-10-31 22:44:55 -07:00
David Tolnay
04b8165b8c
Keep OutFile consistently the first parameter 2020-10-31 22:43:25 -07:00
David Tolnay
ce5a91f214
Remove unneeded header parameter 2020-10-31 22:42:08 -07:00
David Tolnay
4d14842342
Remove unneeded Types parameter 2020-10-31 22:41:37 -07:00
David Tolnay
0aa9c773a1
Merge pull request #392 from adetaylor/namespace-forward-declarations
Namespace forward declarations
2020-10-31 22:39:47 -07:00
Adrian Taylor
f9213628a5 Fix namespace forward declarations.
This fixes the case where a lexicographically early namespace
has a reference to a type in a lexicographically later namespace.
2020-10-31 22:25:42 -07:00
Adrian Taylor
9238b706a8 Test for namespace order sensitivity. 2020-10-31 22:15:24 -07:00
David Tolnay
630af88717
Clean up unneeded explicit iter() 2020-10-31 22:03:47 -07:00
David Tolnay
a4eb943093
Write impl<Str> more selectively 2020-10-31 20:36:38 -07:00
David Tolnay
0356d33acb
Pass Str in PtrLen representation
MSVC is hesitant about passing private fields in an extern "C" signature.
Repro:

    struct Str1 {
      const char *ptr;
      size_t len;
    };

    struct Str2 {
    private:
      const char *ptr;
      size_t len;
    };

    extern "C" {
      Str1 str1();
      Str2 str2();
    }

Warning from MSVC v19.27:

    warning C4190: 'str2' has C-linkage specified, but returns UDT 'Str2' which is incompatible with C
2020-10-31 20:33:39 -07:00
David Tolnay
54742b7ced
Make PtrLen usable for non-char data 2020-10-31 19:43:25 -07:00
David Tolnay
5b1ee1fc4e
Inline some Str accessors into the header 2020-10-31 18:21:39 -07:00
David Tolnay
9ed15c6f69
Add static assertions for Str trivial operations 2020-10-31 18:02:03 -07:00
David Tolnay
2d7f117494
Make Str, Slice trivially copy assignable 2020-10-31 17:58:31 -07:00
David Tolnay
09d2cd9f37
Merge pull request #391 from dtolnay/str
Eliminate Str::Repr struct
2020-10-31 17:43:27 -07:00
David Tolnay
5df1f06eb8
Eliminate Str::Repr struct 2020-10-31 17:31:44 -07:00
David Tolnay
1549106cb0
Add move assignment operator for Error 2020-10-31 17:26:23 -07:00
David Tolnay
7c6ac7195e
Add copy assignment operator for Error 2020-10-31 17:24:32 -07:00
David Tolnay
e58f4270ed
Merge pull request #389 from dtolnay/error
Fill in Error base class constructor calls
2020-10-31 17:22:36 -07:00
David Tolnay
23c2319bc8
Fill in Error base class constructor calls 2020-10-31 17:11:48 -07:00
David Tolnay
d5712ee32c
Use member initializer lists for Error constructors 2020-10-31 17:10:00 -07:00
David Tolnay
59c5dc2891
Merge pull request #388 from dtolnay/error
Decouple Error from Str::Repr
2020-10-31 17:09:02 -07:00
David Tolnay
d68dfa8ee7
Decouple exception catch from Str::Repr 2020-10-31 16:59:29 -07:00
David Tolnay
84ddf9e27f
Move "impl" into anonymous namespace 2020-10-31 16:59:29 -07:00
David Tolnay
a0c9bc7167
Decouple Error from Str::Repr
It was misleading to use Str (which ordinarily represents borrowed
strings) also for owned error messages.
2020-10-31 16:59:29 -07:00
David Tolnay
5b41479aeb
Fix stray delete in Error move constructor 2020-10-31 16:58:14 -07:00
David Tolnay
504cf3cfb8
Fix unqualified strncpy call 2020-10-31 16:09:18 -07:00
David Tolnay
cc1ae76bd0
Remove redundant header branch from write_cxx_function_shim
These shims only get emitted in the non-header case in the first place.
2020-10-31 15:53:53 -07:00
David Tolnay
4852122f35
Fill in some missing final specifiers 2020-10-31 14:59:42 -07:00
David Tolnay
a53086ba51
Merge pull request #387 from dtolnay/trivial
Guarantee trivial copy constructor and destructor for Str and Slice
2020-10-31 12:31:50 -07:00
David Tolnay
de9a5b12b3
Guarantee trivial copy constructor and destructor for Str and Slice
Repro:

    const char *ptr(Str str) { return str.repr.ptr; }
    size_t len(Str str) { return str.repr.len; }

Before:

    ptr(Str):
        mov     rax, qword ptr [rdi]
        ret
    len(Str):
        mov     rax, qword ptr [rdi + 8]
        ret

After:

    ptr(Str):
        mov     rax, rdi
        ret
    len(Str):
        mov     rax, rsi
        ret
2020-10-31 12:17:42 -07:00
David Tolnay
cedcde1ddd
Fill in missing const on operator Repr 2020-10-31 11:47:14 -07:00
David Tolnay
5fedc9a359
Use a less strange return type for NamespaceEntries::children 2020-10-30 21:46:17 -07:00
David Tolnay
a7c2ea10f1
Avoid passing Types around everywhere 2020-10-30 21:40:14 -07:00
David Tolnay
b560a0fabf
Make type information accessible through OutFile 2020-10-30 21:40:03 -07:00
David Tolnay
598154250c
Remove unneeded derives on ResolvableName 2020-10-30 21:24:05 -07:00
David Tolnay
be7e30e0c9
Clarify name struct comments 2020-10-30 21:21:23 -07:00
David Tolnay
abff2d5ed0
Rewrap name struct comments to 80 columns 2020-10-30 21:20:07 -07:00
David Tolnay
9071c264e2
Collect name-related structs to the bottom of syntax tree definition 2020-10-30 21:18:54 -07:00
David Tolnay
50de2c4813
Remove various Ident type aliases
I don't see these being particularly helpful to maintaining correctness.
Where needed, we should clarify the meaning of a field with a comment
rather than writing its type as an alias.
2020-10-30 21:16:05 -07:00