Commit Graph

137 Commits

Author SHA1 Message Date
Matthias Krüger
7a7c313312
Rollup merge of #129620 - WaffleLapkin:flake, r=Noratrieb
Provide a more convinient way of developing rustc on NixOS

This PR adds envrc files which, once symlinked as  `.envrc` will activates a dev shell from `src/tools/nix-dev-shell/flake.nix` or `src/tools/nix-dev-shell/shell.nix`.

This is based on
- [Current rustc dev guide recommendation for NixOS](https://rustc-dev-guide.rust-lang.org/building/suggested.html?highlight=nix#using-nix-shell)
- https://github.com/oxalica/rust-overlay?tab=readme-ov-file#use-in-devshell-for-nix-develop
- [Nora's `x` nix package](26ea68e1a0/custom-pkgs/x)
- https://github.com/rust-lang/rustup/pull/2891
- [Direnv: use flake/nix according to availability](https://discourse.nixos.org/t/direnv-use-flake-nix-according-to-availability/29825)

This is something that I plan to use personally, but I thought it might be worth upstreaming :)

r? Noratrieb
2024-10-17 20:47:29 +02:00
Orion Gonzalez
510e262deb add nix files to gitignore 2024-10-03 11:09:44 +02:00
Orion Gonzalez
3a0ed0c6e3 add direnv to gitignore 2024-10-03 11:09:44 +02:00
Kajetan Puchalski
a1846ec22f
gitignore: Add eglot LSP config file 2024-09-27 17:29:31 +01:00
Maybe Lapkin
a31ef1059f Add flake.nix and .envrc 2024-09-20 11:43:36 +02:00
Pavel Grigorenko
c29e328f6a gitignore: ignore ICE reports regardless of directory 2024-08-25 14:19:05 +03:00
Kajetan Puchalski
6ef0ac2b5c gitignore: Add Zed and Helix editors 2024-08-09 21:26:27 +01:00
Jane Losare-Lusby
5212c75907 Add -Zerror-metrics=PATH to save diagnostic metadata to disk 2024-08-07 11:16:55 -07:00
bjorn3
1f3be75f56 Move the standard library to a separate workspace
This ensures that the Cargo.lock packaged for it in the rust-src
component is up-to-date, allowing rust-analyzer to run cargo metadata on
the standard library even when the rust-src component is stored in a
read-only location as is necessary for loading crates.io dependencies of
the standard library.

This also simplifies tidy's license check for runtime dependencies as it
can now look at all entries in library/Cargo.lock without having to
filter for just the dependencies of runtime crates. In addition this
allows removing an exception in check_runtime_license_exceptions that
was necessary due to the compiler enabling a feature on the object crate
which pulls in a dependency not allowed for the standard library.

While cargo workspaces normally enable dependencies of multiple targets
to be reused, for the standard library we do not want this reusing to
prevent conflicts between dependencies of the sysroot and of tools that
are built using this sysroot. For this reason we already use an unstable
cargo feature to ensure that any dependencies which would otherwise be
shared get a different -Cmetadata argument as well as using separate
build dirs.

This doesn't change the situation around vendoring. We already have
several cargo workspaces that need to be vendored. Adding another one
doesn't change much.

There are also no cargo profiles that are shared between the root
workspace and the library workspace anyway, so it doesn't add any extra
work when changing cargo profiles.
2024-08-02 10:48:12 +00:00
Michael Goulet
6a9110aa5a Don't output test artifacts into working directory 2024-07-21 13:45:55 -04:00
Oli Scherer
dce98c52ff Avoid follow-up errors and ICEs after missing lifetime errors on data structures 2024-07-11 11:00:15 +00:00
Trevor Gross
475b63fa28 Add /rustc-ice*/ to .gitignore` 2024-06-17 23:00:33 -05:00
Ralf Jung
ec1d04967d don't globally ignore rustc-ice files 2023-09-16 09:44:44 +02:00
Oli Scherer
ad4dd759d8 Ignore ICE dumps in git 2023-08-07 10:09:20 +00:00
bors
9d0eac4d02 Auto merge of #108148 - parthopdas:master, r=oli-obk
Implementing "<test_binary> --list --format json" for use by IDE test explorers / runners

Fixes #107307

PR 1 of 2 - wiring up just the new information + implement the command line changes i.e. --format json + tests

upcoming:
PR 2 of 2 - clean up "#[cfg(not(bootstrap))]" from PR 1

As per the discussions on
- MCP: https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Implementing.20.22.3Ctest_binary.3E.20--list.20--form.E2.80.A6.20compiler-team.23592/near/328747548
- preRFC: https://internals.rust-lang.org/t/pre-rfc-implementing-test-binary-list-format-json-for-use-by-ide-test-explorers-runners/18308
- FYI on Discord: https://discord.com/channels/442252698964721669/459149169546887178/1075581549409484820
2023-03-20 03:24:27 +00:00
Joshua Nelson
675c4aa2c1 address review comments 2023-03-18 00:43:37 -05:00
Partha P. Das
3720753632
Implementing "<test_binary> --list --format json" #107307 #49359 2023-03-15 14:20:20 -04:00
Joshua Nelson
1cccf2dd4c Ignore things in .gitignore in tidy
- Switch from `walkdir` to `ignore`. This required various changes to
  make `skip` thread-safe.
- Ignore `build` anywhere in the source tree, not just at the top-level.
  We support this in bootstrap, we should support it in tidy too.

As a nice side benefit, this also makes tidy a bit faster.

Before:
```
; hyperfine -i '"/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0-tools-bin/rust-tidy" "/home/gh-jyn514/rust2" "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0/bin/cargo" "/home/gh-jyn514/rust2/build" "32"'
Benchmark 1: "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0-tools-bin/rust-tidy" "/home/gh-jyn514/rust2" "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0/bin/cargo" "/home/gh-jyn514/rust2/build" "32"
  Time (mean ± σ):      1.080 s ±  0.008 s    [User: 2.616 s, System: 3.243 s]
  Range (min … max):    1.069 s …  1.099 s    10 runs
```

After:
```
; hyperfine '"/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0-tools-bin/rust-tidy" "/home/gh-jyn514/rust2" "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0/bin/cargo" "/home/gh-jyn514/rust2/build" "32"'
Benchmark 1: "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0-tools-bin/rust-tidy" "/home/gh-jyn514/rust2" "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0/bin/cargo" "/home/gh-jyn514/rust2/build" "32"
  Time (mean ± σ):     705.0 ms ±   1.4 ms    [User: 3179.1 ms, System: 1517.5 ms]
  Range (min … max):   702.3 ms … 706.9 ms    10 runs
```
2023-03-05 05:44:13 -06:00
Albert Larsan
40ba0e84d5
Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
Matthias Krüger
1c0561aca6
Rollup merge of #101072 - tmandry:llvm-is-vanilla, r=Mark-Simulacrum
bootstrap: Add llvm-has-rust-patches target option

This is so you can check out an upstream commit in src/llvm-project and
have everything just work.

This simplifies the logic in `is_rust_llvm` a bit; it doesn't need to
check for download-ci-llvm because we would have already errored if both
that and llvm-config were specified on the host platform.
2022-09-01 21:37:09 +02:00
Tyler Mandry
73958fdf14 Ignore cargo target folder in src/bootstrap
Needed after changes in #97513.
2022-08-29 16:23:19 -07:00
Nilstrieb
0c3ed968a2 Add /build-rust-analyzer/ to .gitignore
To avoid rust-analyzer and rustc having to wait for each other,
the dev guide mentions using another build directory for RA.

We should also put this into the .gitignore, just like the normal `build`.
2022-08-20 21:07:13 +02:00
Joshua Nelson
d16187c47f Remove references to ./tmp in-tree
These used to be used by codegen-units tests, but were switched from manually specifying directories
to just using `// incremental` in https://github.com/rust-lang/rust/pull/89101.
Remove the old references.
2022-06-26 23:25:12 -05:00
Guillaume Gomez
ed88e615c4 Add package.json in gitignore 2022-02-01 17:14:59 +01:00
Canop
e5cfe844c9 Fix invalid rules in .gitignore
`**node_modules` in a .gitignore is the same than
`*node_modules` or `*****node_modules`.

It matches every file whose name ends with `node_modules`,
including `not_node_modules`.

The intent here was obviously to have `**/node_modules`
which is the same than just `node_modules`.
2021-10-12 15:09:28 +02:00
Guillaume Gomez
da6d82e465 Simplify build system for rustdoc-gui test crates 2021-07-12 19:03:59 +02:00
Christiaan Dirkx
c0d05d2162 Remove "Version control" 2021-04-22 11:36:12 +02:00
Christiaan Dirkx
3794fc9ce9 Clean up .gitignore 2021-04-22 11:33:19 +02:00
Camelid
68f50c8025
Ignore Vim swap files 2021-03-10 18:28:05 -08:00
Guillaume Gomez
fa131845bc Ignore nodejs/npm files 2021-02-21 14:21:38 +01:00
Casey Rodarmor
5fc22f1431
Add a tool to run x.py from any subdirectory
This adds a binary called `x` in `src/tools/x`. All it does is check the
current directory and its ancestors for a file called `x.py`, and if it
finds one, runs it.

By installing x, you can easily `x.py` from any subdirectory.

It can be installed globally with `cargo install --path src/tools/x`
2020-11-03 19:40:02 -08:00
Vadim Petrochenkov
10d3f8a484 Move rustllvm into rustc_llvm 2020-09-09 23:05:43 +03:00
Ben Boeckel
1dc722c292 gitignore: allow target to be a symlink
Following rust-lang/cargo#4944.
2020-03-25 17:30:40 -04:00
Mark Rousskov
064f8885d5 Add unicode table generator 2020-01-14 19:11:15 -05:00
Josh Triplett
00e7ff44ca .gitignore: Don't ignore a file that exists in the repository
.gitignore should not ignore files that exist in the repository. The
ignore of .cargo applies to the committed .cargo directory used in an
example:

$ git ls-files --exclude-standard --ignored
src/test/run-make/thumb-none-qemu/example/.cargo/config

Explicitly un-ignore that file.
2019-12-15 23:17:06 -08:00
Ralf Jung
ebc9a1ab10 expand comment 2019-10-21 18:05:48 +02:00
Ralf Jung
55b787e675 keep the root dir clean from debugging 2019-10-21 10:30:35 +02:00
Dylan MacKenzie
efcae577bf Ignore DOT files in .gitignore 2019-10-20 11:03:13 -07:00
Mazdak Farrokhzad
83b837a7f9
.gitignore: Explain why /obj/ is ignored 2019-08-10 10:39:40 +02:00
Mazdak Farrokhzad
87a8c5706d
Explain why /tmp/ is ignored 2019-08-10 10:01:03 +02:00
Mazdak Farrokhzad
352c6d036f
.gitignore: Readd /tmp/
It is produced during `./x.py test`
2019-08-10 08:47:22 +02:00
Ralf Jung
798767ca21 more alphabetical 2019-08-08 19:43:44 +02:00
Ralf Jung
4bde056ed2 tweak ignores 2019-08-08 19:42:46 +02:00
Ralf Jung
fcb186d0fe
fix typo in .gitignore
Co-Authored-By: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2019-08-08 11:19:44 +02:00
Ralf Jung
9cea446c6c Cargo.toml is at the root these days 2019-08-08 11:19:09 +02:00
Ralf Jung
58c231dce7 gitignore: remove some things that look ancient 2019-08-08 09:11:32 +02:00
Ralf Jung
b9978e9220 explain what we want and what not in .gitignore 2019-08-08 08:49:58 +02:00
Ralf Jung
7c374cf7d2 don't ignore mir_dump folder 2019-08-05 22:30:13 +02:00
Mazdak Farrokhzad
327c54ed02
Rollup merge of #60081 - pawroman:cleanup_unicode_script, r=varkor
Refactor unicode.py script

Hi, I noticed that the `unicode.py` script used some deprecated escapes in regular expressions. E.g. `\d`, `\w`, `\.` will be illegal in the future without "raw strings". This is now fixed. I have also cleaned up the script quite a bit.

## Escape deprecation

OK (note the `r`):
`re.compile(r"\d")`

Deprecated (from Python 3.6 onwards, see [here][link1] and [here][link2]):
`re.compile("\d")`.

[link1]: https://docs.python.org/3.6/whatsnew/3.6.html#deprecated-python-behavior
[link2]: https://bugs.python.org/issue27364

This was evident running the script using Python 3.7 like so:

```
$ python3 -Wall unicode.py
unicode.py:227: DeprecationWarning: invalid escape sequence \w
  re1 = re.compile("^ *([0-9A-F]+) *; *(\w+)")
unicode.py:228: DeprecationWarning: invalid escape sequence \.
  re2 = re.compile("^ *([0-9A-F]+)\.\.([0-9A-F]+) *; *(\w+)")
unicode.py:453: DeprecationWarning: invalid escape sequence \d
  pattern = "for Version (\d+)\.(\d+)\.(\d+) of the Unicode"
```

The documentation states that
> A backslash-character pair that is not a valid escape sequence now generates a DeprecationWarning. Although this will eventually become a SyntaxError, that will not be for several Python releases.

## Testing

To test my changes, I had to add support for choosing the Unicode version to use. The script will default to latest release (which is 12.0.0 at the moment, repo has 11.0.0 checked in).

The script generates the exact same output for version 11.0.0 with Python 2.7 and 3.7 and no longer generates any deprecation warnings:

```
$ python3 -Wall unicode.py -v 11.0.0
Using Unicode version: 11.0.0
Regenerated tables.rs.
$ git diff tables.rs
$ python2 -Wall unicode.py -v 11.0.0
Using Unicode version: 11.0.0
Regenerated tables.rs.
$ git diff tables.rs
$ python2 --version
Python 2.7.16
$ python3 --version
Python 3.7.3
```

## Extra functionality

Furthermore, the script will check and download the latest Unicode version by default (without the `-v` argument). The `--help` is below:

```
$ ./unicode.py --help
usage: unicode.py [-h] [-v VERSION]

Regenerate Unicode tables (tables.rs).

optional arguments:
  -h, --help            show this help message and exit
  -v VERSION, --version VERSION
                        Unicode version to use (if not specified, defaults to
                        latest available final release).
```

## Cleanups

I have cleaned up the code quite a bit, with Python best practices and code style in mind. I'm happy to provide more details and rationale for all my changes if the reviewers so desire.

One externally visible change is that the Unicode data will now be downloaded into `src/libcore/unicode/downloaded` directory suffixed by Unicode version:

```
$ pwd
.../rust/src/libcore/unicode
$ exa -T downloaded/
downloaded
├── 11.0.0
│  ├── DerivedCoreProperties.txt
│  ├── DerivedNormalizationProps.txt
│  ├── PropList.txt
│  ├── ReadMe.txt
│  ├── Scripts.txt
│  ├── SpecialCasing.txt
│  └── UnicodeData.txt
└── 12.0.0
   ├── DerivedCoreProperties.txt
   ├── DerivedNormalizationProps.txt
   ├── PropList.txt
   ├── ReadMe.txt
   ├── Scripts.txt
   ├── SpecialCasing.txt
   └── UnicodeData.txt
```
2019-07-06 22:14:33 +02:00
Oliver Scherer
d85e866c0d Ignore .vscode even if it is a symlink 2019-05-25 10:07:01 +02:00