Commit Graph
436 Commits
Author SHA1 Message Date
Jon Ross-Perkins 6dce164c49 Change the bazel-out structure to avoid busybox symlinks. (#4505)
As described in symlink_helpers.bzl, copied here for visibility:

Symlinking busybox things needs special logic.

This is because Bazel doesn't cache the actual symlink, resulting in
essentially resolved symlinks being produced in place of the expected
tool. As a consequence, we can't rely on the symlink name when dealing
with busybox entries.

An example repro of this using a local build cache is:

    bazel build //toolchain
    bazel clean
    bazel build //toolchain

We could in theory get reasonable behavior with
`ctx.actions.declare_symlink`, but that's disallowed in our `.bazelrc`
for cross-environment compatibility.

The particular approach here uses the Python script as a launching pad
so that the busybox still receives an appropriate location in argv[0],
allowing it to find other files in the lib directory. Arguments are
inserted to get equivalent behavior as if symlink resolution had
occurred.

The underlying bug is noted at:
https://github.com/bazelbuild/bazel/issues/23620
2024-11-08 22:08:50 +00:00
Jon Ross-PerkinsandChandler Carruth 9af06cc988 Adjust some build troubleshooting notes (#4471)
Came up due to [libc++ install
issues](https://discord.com/channels/655572317891461132/655577725347561492/1302023663155023905)

We've discussed clang version verification, and adding that as long as
I'm in here. The more significant bit is the libc++ check, which if it's
not installed should fail like:

```
(tons of output)
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/llvm-16/lib/clang/16/include
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
/usr/local/google/home/jperkins/.cache/bazel/_bazel_jperkins/85deb7d9d96f7e0e80b42618a55969d7/external/_main~clang_toolchain_extension~bazel_cc_toolchain/_temp:6:2: error: "No libc++ install found!"
#error "No libc++ install found!"
 ^
1 error generated.
ERROR: Analysis of target '//toolchain:toolchain' failed; build aborted: Analysis failed
INFO: Elapsed time: 0.265s, Critical Path: 0.08s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
```

pre-commit runs bazel, and GitHub runners have an old clang by default
(caught by the new check), so I'm installing here for a consistent
version.

---------

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2024-11-04 16:03:09 +00:00
josh11bandJosh L 4994e13068 Document that extend base must appear early in a class definition (#4401)
Note: some of this is from the principle of information accumulation,
and some is from [proposal
#2760](https://github.com/carbon-language/carbon-lang/blob/trunk/proposals/p2760.md#class-inheritance).

Also: change terminology from "virtual override keywords" to "virtual
modifier keywords", to be consistent with our other modifier keywords.

---------

Co-authored-by: Josh L <josh11b@users.noreply.github.com>
2024-10-11 19:51:15 +00:00
josh11bandJosh L b0cde707f8 Rename "partial facet" and to "partial class type" (#4402)
See [2024-10-01 discussion on #typesystem in
Discord](https://discord.com/channels/655572317891461132/708431657849585705/1290774105498325122).

Co-authored-by: Josh L <josh11b@users.noreply.github.com>
2024-10-11 18:25:18 +00:00
Céline Dedaj bb874f21f7 Update conduct team member list (#4394)
deleted @flysand7 from the conduct team member list after they left the
team
2024-10-10 20:02:05 +00:00
Chandler Carruth 33954d1f20 Improve -c dbg, enabling Split DWARF and other enhancements (#4382)
This should substantially reduce the total build size of `-c dbg`
builds, and especially improve cache hits during incremental
development. I'm seeing over 50% reduction total on Linux in just the
raw size of a complete debug build. Even on macOS where we can't use
split DWARF there are substantial reductions.

Note that LLDB and GDB want slightly different flags to have the best
experience with split debug information, and so the build and
documentation have been updated to enable LLDB's flags by default but
provide clear instructions for switching to GDB's flags, and they are
structured so that this can be done persistently for an individual
developer.
2024-10-09 03:58:47 +00:00
Jon Ross-PerkinsandChandler Carruth 434ee32515 Style notes on passing and storing object addresses (#4310)
[Context](https://discord.com/channels/655572317891461132/821113559755784242/1283516297686286377).
Some relevant Google C++ style is at [Inputs and
Outputs](https://google.github.io/styleguide/cppguide.html#Inputs_and_Outputs).
#4301 is an example application of the style.

---------

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2024-09-20 23:53:02 +00:00
josh11bandJosh L db78450c61 Fix singular/plural mismatch in design README (#4326)
Co-authored-by: Josh L <josh11b@users.noreply.github.com>
2024-09-19 20:58:57 +00:00
Jon Ross-PerkinsandChandler Carruth 8b0154ce85 Getting commit access (#4246)
Establish a process for getting commit access. We will:

-   Grant access based on a developer's commit history.
- Someone with commit access should nominate, and a contributor may ask.
    -   A lead will approve nominations. Only one lead is needed.
-   Remove commit access once someone is idle for 6 months.
- "Idle" means no significant project activity on any of GitHub,
Discord,
        or in meetings.
    -   Access removed due to being idle will be restored on request.

---------

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2024-09-03 23:41:22 +00:00
David Blaikie 2971e129ad Add TODO breadcrumb from for design to semantics proposal (#4271) 2024-09-03 19:17:37 +00:00
Jon Ross-Perkins b9e9e66cee Update group documentation (#4250)
I'm trying to use this just to document the de facto state. This is
linked to #4246, but I'm trying to keep the two arranged to allow
independent merges.
2024-08-28 08:10:56 +00:00
5d73743971 Add link for coherence appendix to Swift forums (#4241)
Co-authored-by: Josh L <josh11b@users.noreply.github.com>
Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2024-08-24 19:44:07 +00:00
Jon Ross-Perkinsandjosh11b 89be57ffc3 Add documentation for entity declaration design work (#4230)
Trying to pull in key elements of #3762, #3763, and #3980 (decl matching
and `extern`, essentially). These aren't specific to any particular
declaration type, but are common to entities, so suggesting a new doc
oriented on that.

There's probably more that could be said here, I'm just focused on
getting the recent formal discussion mirrored into the design.

---------

Co-authored-by: josh11b <15258583+josh11b@users.noreply.github.com>
2024-08-21 22:21:07 +00:00
Jon Ross-PerkinsandChandler Carruth b6396e97f8 Build a website. (#4189)
Demo site: https://jonmeow.carbon-lang.dev/

I'm trying to keep work under the `/website` subdirectory so that the
misc files don't interfere with unrelated views of the repository. The
`prebuild.py` script does some work to move things around and add
frontmatter, helping the jekyll generation.

I'm using the "just-the-docs" theme because I think it's a decent match
for what we want, and getting jekyll up and running with it wasn't too
difficult. Note #1526 proposed using Docusaurus; I started out there,
but was having trouble getting it working with newer versions. The
plugins in particular I got stuck trying to make work, which sent me
looking for options that we could have working with less customization.
I do lean towards jekyll though, because it's what GH uses so hopefully
we can get a more consistent experience.

Having a website has been approved for a while under #1492, but hasn't
been a priority. I'm mainly doing this because I want to just be able to
point people to carbon-lang.dev and have easy links that way.

---------

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2024-08-20 17:53:06 +00:00
Jon Ross-PerkinsandChandler Carruth 0a4b0f33e3 Add docs for raw identifier syntax. (#4223)
Feature approved in #3797

---------

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2024-08-19 21:50:13 +00:00
Jon Ross-PerkinsandChandler Carruth d5ac724266 Document the export keyword (#4224)
This was approved in #3938

---------

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2024-08-19 20:51:37 +00:00
Jon Ross-Perkins 56332fcfac Fix a couple fn declarations in generics details (#4214)
I think this is just a typo.
2024-08-13 18:09:59 +00:00
c5b5d36e8b Change operator precedence (#4075)
Update the operator precedence to achieve a few goals:

-   Form operators into groups which behave similarly
- Make the group of operators ("top-level operators") that capture
everything to the right, like `if`...`then`...`else`, behave similarly
to the left, so that rearranging expressions won't change how they
group.
- Add the `where` operator, used to specify constraints on facet types,
to the precedence chart, to define how it interacts with other
operators.
- Make the operator precedence diagram prettier, so that it eventually
can be made into a poster that Carbon programmers can hang on their
walls.

---------

Co-authored-by: Josh L <josh11b@users.noreply.github.com>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2024-08-10 00:15:37 +00:00
Jon Ross-Perkins b73387fc84 Update workflows for security hardening. (#4192)
Also a small pass on workflow names.

Note, I'm a little concerned that the test/nightly release/pre-commit
endpoints may be fragile. At the same time, it's also where it may be
most useful, to prevent network access by arbitrary test code. I think
this is imperfect, but maybe we can try it out and see if it's much of
an issue.

Note, the discord wiki action is currently broken, this should fix it.
2024-08-06 23:14:23 +00:00
Brymer Meneses 70c20be91b docs: add a note on setting up clangd (#4135)
This PR adds a note on how to generate `compile_commands.json` which is
necessary for having `clangd` generate accurate diagnostics
2024-07-25 16:40:27 +00:00
Jon Ross-Perkins 407b9e4dcd Add a run_bazelisk wrapper script for linux. (#4129)
I was considering making a "/bazel" alias for this, but I'm really on
the fence about whether that's a good choice. However, I do think this
is good to have to simplify installs.

Fixes #3071 and #3896
2024-07-15 17:18:18 +00:00
Chandler CarruthandRichard Smith 2fcff24100 Establish toolchain and language versioning (#4105)
Proposal for how Carbon version numbers work:

- A single version across language, standard library, compiler, linker,
etc.
-   Semantic Versioning (SemVer) based
- Details of how SemVer criteria for major, minor, and patch should
apply to
    Carbon
- Details of how we will operate before 1.0 and how this connects to
Carbon's
    milestones
- Directional guidance for future work including post-1.0 versions, LTS
    versions, and standardization

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2024-07-14 06:28:46 +00:00
Jon Ross-Perkins 006e31238e Adjust driver references to use the install version. (#4126)
Also makes an alias so that this is easier to find. Verified that
running the alias still finds prelude files.

Note the actual target is printed when building (although a symlink is
also created, using that symlink confuses file-finding).

```
╚╡bazel build :carbon
...
Target //toolchain/install:prefix_root/bin/carbon up-to-date:
  bazel-bin/toolchain/install/prefix_root/bin/carbon
```
2024-07-12 22:06:55 +00:00
4132c6a65f Merge the suffix ops into a single box in the operator precedence mermaid diagram (#4067)
The current approach was done to work-around a limitation that we can
only have a single link per box, but is unscalable. Instead have a
single link to a new sections of the document that describes the box,
and has multiple links.

---------

Co-authored-by: Josh L <josh11b@users.noreply.github.com>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2024-06-20 21:17:25 +00:00
Jon Ross-Perkins 23ae2a7190 Update images from snippet changes. (#4061)
Note, to see the results, here's a [README
link](https://github.com/carbon-language/carbon-lang/blob/654a06e0af7886dc43f52d35f4d11f32c5e8da9d/README.md)
(note this is for the 654a06e commit)

Enumerating changes:

- Finish the work started in #3735 by updating the images.
- Reverts changes to vector initialization style made in #3735, instead
preferring https://abseil.io/tips/88 style
- Switch array syntax to match [#syntax
discussion](https://discord.com/channels/655572317891461132/709488742942900284/1219410082719207444)
- Some nuanced highlighting changes to try matching what I'm seeing in
GitHub.
- The original intent was to match GitHub's highlighting, at least for
C++; Carbon highlighting is expected to be poor because it's not a
supported language.
2024-06-18 19:01:33 +00:00
74d7d49bcf Include function call and subscripting/indexing in the operator list and precedence chart (#4052)
Co-authored-by: Josh L <josh11b@users.noreply.github.com>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2024-06-17 22:19:02 +00:00
Jon Ross-PerkinsandRichard Smith cdc0ca14ec Be a little more prescriptive about {} initialization in style. (#4009)
Following discussions around #3958, try to provide more specific
semantics. Note we currently don't follow this everywhere, particularly
in AddInst calls, but the intent is to shift. Per discussion, designated
initializers are preferred when possible. And the
`google-readability-casting` diagnostics are poor, but with this may
primarily flag cases which should be using a different constructor
syntax, so are just a rocky way to get there.

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2024-05-31 16:22:25 +00:00
Rajat Roy e60df54a4f Replace image file in /docs/images/ directory and update the svg edit to reflect proposal #3927. (#3981)
Replace image file in /docs/images/ directory and update the svg editing
document to reflect the change to package syntax from proposal #3927

Closes #3969
2024-05-23 21:35:33 +00:00
Richard Smith 6bbbd4ec1f More consistent package syntax (#3927)
Change the syntax for `package` declarations from:

```carbon
[package Foo] [library "bar"] api;
[package Foo] [library "bar"] impl;
```

to

```carbon
[package Foo] [library "bar"];
impl [package Foo] [library "bar"];
```
2024-05-16 00:55:37 +00:00
21fb6f5802 Update broken links (#3786)
Update broken links to aid in following links while perusing the
documentation. Closes #3778

I don't imagine I got every one of these right. Some 404s may be
reported due to permissions.

Using the lychee command in #3778, only the following link is reported
as not found, but it's just a permission issue:

```
[proposals/p1367.md]:
✗ [404] https://github.com/carbon-language/carbon-lang/settings/access | Failed: Network error: Not Found
```

I tried to get it down to as few as possible, partially so that future
link scans won't run into repeat errors.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
Co-authored-by: Carbon Infra Bot <carbon-external-infra@google.com>
2024-03-22 18:42:20 +00:00
Nathan Youngman 10189bbb78 rephrase a few sentences (#3766)
Minor tweaks while reading through the docs to hopefully improve
readability.
2024-03-13 22:03:34 +00:00
Nathan Youngman 50e5dd7754 Homebrew recommends installing pre-commit directly (#3764)
On macOS, Homebrew recommends `pipx` to install Python binaries, or
installing `pre-commit` directly, since it is available.

Here is the message in full. 

```console
❯ pip3 install pre-commit

error: externally-managed-environment
 × This environment is externally managed
╰─> To install Python packages system-wide, try brew install
    xyz, where xyz is the package you are trying to
    install.

    If you wish to install a non-brew-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip.
    
    If you wish to install a non-brew packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.
```

~~Also, unless there is a compelling reason to install a particular 3.x
version of Python, it may be better to let Homebrew use whatever version
people may already have installed (or let it automatically install the
version they've tested).~~

Here are the details of the pre-commit Homebrew package:

```
❯ brew info pre-commit
==> pre-commit: stable 3.6.2 (bottled), HEAD
Framework for managing multi-language pre-commit hooks
https://pre-commit.com/
/opt/homebrew/Cellar/pre-commit/3.6.2 (679 files, 9.9MB) *
  Poured from bottle using the formulae.brew.sh API on 2024-03-08 at 22:22:11
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/p/pre-commit.rb
License: MIT
==> Dependencies
Required: libyaml ✔, python@3.12 ✔
```

Installing directly with Homebrew is a supported option in the
pre-commit documentation. https://pre-commit.com/#install
2024-03-11 23:25:19 +00:00
Patrick Johnston e936f18401 Fix up the C++ snippet to reflect the carbon snippet (#3735)
Offers a more precise apples-to-apples language comparison. Replaces the
non-portable `M_PI` and removes the extraneous arg parameters. It does
use C++23, so I can understand if that's unacceptable for the time
being.
2024-03-04 23:40:15 +00:00
cui fliter fea2651e7c chore: fix typos (#3738)
Signed-off-by: cui fliter <imcusg@gmail.com>
2024-03-04 16:27:31 +00:00
Jon Ross-Perkins 0a117f6e73 Switch example code from Create to Make (#3705)
There's not explicit guidance about this, but there was an [old
discussion](https://discord.com/channels/655572317891461132/963846118964350976/998010464237785189)
that loosely settled on Make for now.
2024-02-21 16:43:52 +00:00
Richard Smith cb849cf165 Integrate description of tuple indexing into member access better. (#3679)
Improve the exposition of the design changes from #3646 to integrate
better into the overall description of member access design.

This fixes the incorrect description of the rules for `->` by instead
relying on the general rule that `->` is rewritten to use `*` and `.`
before any other processing is done, and generally makes
*integer-literal* names be less of a special case.
2024-02-03 08:40:03 +00:00
Richard Smith a1655b6858 Tuples and tuple indexing (#3646)
Add support for extracting elements of a tuple by their numerical index.

Also formally add the well-established basic syntactic and semantic
rules for
tuples, for which we have had leads issues but no proposal, into the
design.
2024-01-31 23:42:11 +00:00
Chandler Carruthandjosh11b da7533ae7f Update project to require Clang 16 or newer. (#3649)
This should also unblock our switch to C++20 and other improvements.

There are three core parts of the change --

1) Updating our infrastructure to fetch and find Clang-16.
2) Updating our documentation to reflect this and help folks with any
   system issues they encounter.

The infrastructure change is unfortunately tricky. We can't get Clang 16
easily on GitHub's runner images, and in the past we've had persistent
problems with flakiness when our actions download this much during their
runs. Due to the flakiness, we've previously removed all downloading of
dependencies outside of Bazel itself, and added retry loops around Bazel
specifically to overcome flaky downloads.

This change tries to address these problems by populating the Clang and
LLVM toolchain in a place that we can then cache using the built-in
GitHub action caching infrastructure. This seems like by far the least
likely to flake way of downloading extra things into our runs. And since
these are relatively slow moving dependencies, we should populate this
cache very, very rarely.

For Linux, this downloads the binary release artifact from GitHub,
prunes out large parts of it that we don't need, and then caches this as
a local toolchain. This proves both small and fast.

For macOS, this uses a trick to cache the destination of Homebrew
installs. It unfortunately caches the *entire* Homebrew installation
though, and so it also goes to some lengths to prune and minimize how
much is installed from Homebrew. The result is "only" a 2gb cache image.
Because of the size and slower download and filesystem, the macOS runs
see a 1 - 2 minute slowdown.

We might extend the Linux infrastructure here usefully if we want to
test multiple LLVM versions. We might also extend the macOS version to
get a cheaper way to prune parts of the system and free up disk space,
or to cache other Homebrew installed tools if needed.

Last but not least, this brought to the forefront an issue with our C++
toolchain integration which relied on a specific CMake build option
being set in the LLVM toolchain install. This option isn't used in the
official release artifacts. Instead, switch to a more robust approach to
linking libc++abi statically that shouldn't have these problems.

Beyond the infrastructure changes, this also updates the documentation
to reflect requiring Clang 16 or newer, and adds some extra tips for
folks that are missing this.

The documentation is also updated to address a problem with getting the
right libc++abi files installed to support the more robust linking
strategy. This may reduce the problems we've seen in the past around
libc++abi and linking on other Linux distros as well.

---------

Co-authored-by: josh11b <josh11b@users.noreply.github.com>
2024-01-25 01:23:09 +00:00
Rayyan Kandjonmeow a1d03b1f56 Fixed var keyword in Carbon code example. Incorrect keyword color. (#3600)
This PR is changing the color of the var keyword in the `PrintTotalArea`
source example which is referenced in the README. The original color was
white and changed to `#FF7B72`.

---------

Co-authored-by: jonmeow <jperkins@google.com>
2024-01-19 22:30:23 +00:00
8ba24bbe41 Roadmap for 2024 and a retrospective for 2023 (#3564)
We propose a roadmap for 2024 focused on a working Carbon toolchain that
supports Carbon ↔ C++ interop.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2024-01-12 01:14:48 +00:00
Richard Smith dfb27ded9c Update setup instructions for recent debian / ubuntu (#3571)
`pip3 install` refuses to perform a system-wide installation, but we can
install `pre-commit` with `apt` instead.
2024-01-05 00:19:09 +00:00
Nicolas Gonzalez b659f2d9c0 Fix minor grammatical error in docs (#3537)
Use "an" instead of "a" when the following word starts with a vowel
sound.
2023-12-21 22:05:47 +00:00
Jon Ross-Perkins 75ef947a4f Change contribution_tools.md to refer to toolchain instead of explorer (#3499) 2023-12-20 22:29:43 +00:00
Chandler Carruth 6fecf7539f Focus implementation effort on the toolchain (#3532)
Proposal to focus implementation effort for the next 1-2 years on the
Carbon
toolchain instead of the explorer. This will impact the explorer in a
few ways:

- We will keep the explorer's code in place, building, and passing its
basic
    tests. It can remain a good baseline for exploring Carbon's language
    features.
- We won't prioritize expanding the explorer's coverage of Carbon
features or
other improvements -- it is good enough for what we need until the
toolchain
    catches up.
- We will stop actively fuzzing and expanding test coverage for the
explorer.
- Eventually, when we want to resume work on the explorer, we'll
evaluate the
best platform to build on -- the current explorer codebase or on top of
the
    toolchain's semantic IR.

Also tries to update the core readme and contributing docs to reflect
this.
2023-12-20 02:13:51 +00:00
Jon Ross-Perkins f4f18d871c Drop zlib notes from contribution_tools (#3531)
The underlying issue should have been addressed by #3526; the install
shouldn't be needed.
2023-12-19 19:14:16 +00:00
Christopher Di Bella 8282595bf8 updates conduct_team.md to use work Discord account (#3510) 2023-12-14 19:16:54 +00:00
Jon Ross-Perkins 4605b1d3e1 Style note for explicit constructors. (#3457)
This stems from an [old
discussion](https://discord.com/channels/655572317891461132/821113559755784242/1070759074112741447),
I think this is the resolution that never got added here.
2023-12-06 00:10:33 +00:00
Sree Dananjay S 1603edc359 Added Documentation support for Bazel installation in Linux distros (#3441)
This Pull Request added support for Bazel installation and setup in the
contribution_tools.md file un the docs directory. It added a link to the
releases page of the bazel repository for debian/ubuntu users to
download the binary and execute the commands provided in the
documentation.

Closes #3439
2023-12-01 00:53:23 +00:00
Chandler Carruth 01e12111a8 Auto-update pre-commit repositories and fix. (#3427)
The version of `flake8` was too old to support with Python 3.12 -- there
is new F-string support that caused false positives sadly. The updated
version has fixes for all of these.

This in turn updates codespell which has picked up several new fixes
that actually fire in our code, so also fix everything. While we don't
do more in-depth updates to old proposals, similar to simply fixing
broken links, fixing automatically detected typos seems scalable and
fine.

All edits were automatically generated here.
2023-11-28 17:17:28 +00:00
6c812db05c Clarify name bindings in namespaces. (#3407)
-   Require namespace members be declared in the same name scope as the
    namespace is declared.
-   Allow binding patterns to directly declare names in namespaces.
-   Disallow using different namespaces in the same binding pattern.

---------

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2023-11-22 22:52:08 +00:00