Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 10 pull requests #110546

Merged
merged 25 commits into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9aa3f05
'./configure' now checks if 'config.toml' exists before writing to th…
madsravn Apr 9, 2023
69b12ff
Merge remote-tracking branch 'upstream/master'
madsravn Apr 10, 2023
70ce74e
Spelling src/bootstrap
jsoref Apr 9, 2023
9c8d10a
Spelling src/ci
jsoref Apr 9, 2023
5a8b189
Don't special-case download-rustc in `maybe_install_llvm`
jyn514 Apr 19, 2023
abf9cbc
Fix `x test lint-docs` when download-rustc is enabled
jyn514 Apr 19, 2023
23cf3ce
Fix `tests/run-make-translation` when download-rustc is enabled
jyn514 Apr 19, 2023
16d061e
small type system cleanup
lcnr Apr 19, 2023
9876a11
Fix missing blanket impl if the trait is not directly public
GuillaumeGomez Apr 19, 2023
96f4f4e
Add regression test for #94183
GuillaumeGomez Apr 19, 2023
010d797
Changing position of early exit and using standard error method with …
madsravn Apr 19, 2023
6d07dbc
configure: Fix bug in `configure_top_level_key`
jyn514 Apr 19, 2023
0b6b72e
Fix wrong comment in rustc_hir/src/hir.rs
safinaskar Apr 19, 2023
b7607a9
configure: Set `profile = user` by default
jyn514 Apr 19, 2023
8a9668d
Update readme to suggest `./configure` instead of printf
jyn514 Apr 19, 2023
73bfa18
Rollup merge of #110123 - madsravn:master, r=jyn514
matthiaskrgr Apr 19, 2023
af92c6a
Rollup merge of #110429 - jsoref:spelling-src-bootstrap, r=albertlars…
matthiaskrgr Apr 19, 2023
dc0de09
Rollup merge of #110430 - jsoref:spelling-src-ci, r=albertlarsan68
matthiaskrgr Apr 19, 2023
6fdc121
Rollup merge of #110515 - jyn514:download-rustc-llvm, r=albertlarsan68
matthiaskrgr Apr 19, 2023
1de29ac
Rollup merge of #110521 - jyn514:test-lint-docs, r=albertlarsan68
matthiaskrgr Apr 19, 2023
9a13f4f
Rollup merge of #110525 - jyn514:translation-download-rustc, r=albert…
matthiaskrgr Apr 19, 2023
75de33c
Rollup merge of #110531 - lcnr:type-system-stuff, r=aliemjay
matthiaskrgr Apr 19, 2023
770f6cd
Rollup merge of #110533 - GuillaumeGomez:missing-blanket-impl-trait-n…
matthiaskrgr Apr 19, 2023
b59658c
Rollup merge of #110540 - safinaskar:patch-1, r=WaffleLapkin
matthiaskrgr Apr 19, 2023
0820e31
Rollup merge of #110541 - jyn514:fix-configure, r=ozkanonur
matthiaskrgr Apr 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 25 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Read ["Installation"] from [The Book].

The Rust build system uses a Python script called `x.py` to build the compiler,
which manages the bootstrapping process. It lives at the root of the project.
It also uses a file named `config.toml` to determine various configuration settings for the build.
You can see a full list of options in `config.example.toml`.

The `x.py` command can be run directly on most Unix systems in the following
format:
Expand Down Expand Up @@ -85,6 +87,8 @@ See [the rustc-dev-guide for more info][sysllvm].

### Building on a Unix-like system

#### Build steps

1. Clone the [source] with `git`:

```sh
Expand All @@ -96,18 +100,13 @@ See [the rustc-dev-guide for more info][sysllvm].

2. Configure the build settings:

The Rust build system uses a file named `config.toml` in the root of the
source tree to determine various configuration settings for the build.
Set up the defaults intended for distros to get started. You can see a full
list of options in `config.example.toml`.

```sh
printf 'profile = "user" \nchangelog-seen = 2 \n' > config.toml
./configure
```

If you plan to use `x.py install` to create an installation, it is
recommended that you set the `prefix` value in the `[install]` section to a
directory.
directory: `./configure --set install.prefix=<path>`

3. Build and install:

Expand All @@ -117,12 +116,25 @@ See [the rustc-dev-guide for more info][sysllvm].

When complete, `./x.py install` will place several programs into
`$PREFIX/bin`: `rustc`, the Rust compiler, and `rustdoc`, the
API-documentation tool. If you've set `profile = "user"` or
`build.extended = true`, it will also include [Cargo], Rust's package
manager.
API-documentation tool. By default, it will also include [Cargo], Rust's package manager.
You can disable this behavior by passing `--set build.extended=false` to `./configure`.

[Cargo]: https://github.com/rust-lang/cargo

#### Configure and Make

This project provides a configure script and makefile (the latter of which just invokes `x.py`).
`./configure` is the recommended way to programatically generate a `config.toml`. `make` is not
recommended (we suggest using `x.py` directly), but it is supported and we try not to break it
unnecessarily.

```sh
./configure
make && sudo make install
```

`configure` generates a `config.toml` which can also be used with normal `x.py` invocations.

### Building on Windows

On Windows, we suggest using [winget] to install dependencies by running the
Expand Down Expand Up @@ -186,7 +198,7 @@ toolchain.
4. Navigate to Rust's source code (or clone it), then build it:

```sh
./x.py build && ./x.py install
python x.py setup user && python x.py build && python x.py install
```

#### MSVC
Expand All @@ -204,6 +216,7 @@ With these dependencies installed, you can build the compiler in a `cmd.exe`
shell with:

```sh
python x.py setup user
python x.py build
```

Expand Down Expand Up @@ -232,21 +245,7 @@ Windows build triples are:

The build triple can be specified by either specifying `--build=<triple>` when
invoking `x.py` commands, or by creating a `config.toml` file (as described in
[Installing from Source](#installing-from-source)), and modifying the `build`
option under the `[build]` section.

### Configure and Make

While it's not the recommended build system, this project also provides a
configure script and makefile (the latter of which just invokes `x.py`).

```sh
./configure
make && sudo make install
```

`configure` generates a `config.toml` which can also be used with normal `x.py`
invocations.
[Building on a Unix-like system](#building-on-a-unix-like-system)), and passing `--set build.build=<triple>` to `./configure`.

## Building Documentation

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1960,7 +1960,7 @@ pub enum ExprKind<'hir> {
Lit(&'hir Lit),
/// A cast (e.g., `foo as f64`).
Cast(&'hir Expr<'hir>, &'hir Ty<'hir>),
/// A type reference (e.g., `Foo`).
/// A type ascription (e.g., `x: Foo`). See RFC 3307.
Type(&'hir Expr<'hir>, &'hir Ty<'hir>),
/// Wraps the expression in a terminating scope.
/// This makes it semantically equivalent to `{ let _t = expr; _t }`.
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_middle/src/ty/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ impl FlagComputation {

&ty::Alias(ty::Projection, data) => {
self.add_flags(TypeFlags::HAS_TY_PROJECTION);
self.add_projection_ty(data);
self.add_alias_ty(data);
}

&ty::Alias(ty::Opaque, ty::AliasTy { substs, .. }) => {
Expand Down Expand Up @@ -267,7 +267,7 @@ impl FlagComputation {
projection_ty,
term,
})) => {
self.add_projection_ty(projection_ty);
self.add_alias_ty(projection_ty);
self.add_term(term);
}
ty::PredicateKind::WellFormed(arg) => {
Expand Down Expand Up @@ -372,8 +372,8 @@ impl FlagComputation {
}
}

fn add_projection_ty(&mut self, projection_ty: ty::AliasTy<'_>) {
self.add_substs(projection_ty.substs);
fn add_alias_ty(&mut self, alias_ty: ty::AliasTy<'_>) {
self.add_substs(alias_ty.substs);
}

fn add_substs(&mut self, substs: &[GenericArg<'_>]) {
Expand Down
31 changes: 11 additions & 20 deletions compiler/rustc_trait_selection/src/traits/wf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,29 +170,20 @@ pub fn predicate_obligations<'tcx>(
ty::PredicateKind::WellFormed(arg) => {
wf.compute(arg);
}
ty::PredicateKind::ObjectSafe(_) => {}
ty::PredicateKind::ClosureKind(..) => {}
ty::PredicateKind::Subtype(ty::SubtypePredicate { a, b, a_is_expected: _ }) => {
wf.compute(a.into());
wf.compute(b.into());
}
ty::PredicateKind::Coerce(ty::CoercePredicate { a, b }) => {
wf.compute(a.into());
wf.compute(b.into());
}

ty::PredicateKind::ConstEvaluatable(ct) => {
wf.compute(ct.into());
}
ty::PredicateKind::ConstEquate(c1, c2) => {
wf.compute(c1.into());
wf.compute(c2.into());
}
ty::PredicateKind::Ambiguous => {}
ty::PredicateKind::TypeWellFormedFromEnv(..) => {
bug!("TypeWellFormedFromEnv is only used for Chalk")
}
ty::PredicateKind::AliasRelate(..) => {
bug!("We should only wf check where clauses and `AliasRelate` is not a `Clause`")

ty::PredicateKind::ObjectSafe(_)
| ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::Subtype(..)
| ty::PredicateKind::Coerce(..)
| ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::Ambiguous
| ty::PredicateKind::AliasRelate(..)
| ty::PredicateKind::TypeWellFormedFromEnv(..) => {
bug!("We should only wf check where clauses, unexpected predicate: {predicate:?}")
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ def fix_bin_or_dylib(self, fname):
]
patchelf_args = ["--set-rpath", ":".join(rpath_entries)]
if not fname.endswith(".so"):
# Finally, set the corret .interp for binaries
# Finally, set the correct .interp for binaries
with open("{}/nix-support/dynamic-linker".format(nix_deps_dir)) as dynamic_linker:
patchelf_args += ["--set-interpreter", dynamic_linker.read().rstrip()]

Expand Down
8 changes: 4 additions & 4 deletions src/bootstrap/bootstrap_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def serialize_and_parse(self, args):
def test_no_args(self):
build = self.serialize_and_parse([])
self.assertEqual(build.get_toml("changelog-seen"), '2')
self.assertEqual(build.get_toml("profile"), 'user')
self.assertIsNone(build.get_toml("llvm.download-ci-llvm"))

def test_set_section(self):
Expand All @@ -107,10 +108,9 @@ def test_set_target(self):
build = self.serialize_and_parse(["--set", "target.x86_64-unknown-linux-gnu.cc=gcc"])
self.assertEqual(build.get_toml("cc", section="target.x86_64-unknown-linux-gnu"), 'gcc')

# Uncomment when #108928 is fixed.
# def test_set_top_level(self):
# build = self.serialize_and_parse(["--set", "profile=compiler"])
# self.assertEqual(build.get_toml("profile"), 'compiler')
def test_set_top_level(self):
build = self.serialize_and_parse(["--set", "profile=compiler"])
self.assertEqual(build.get_toml("profile"), 'compiler')

if __name__ == '__main__':
SUITE = unittest.TestSuite()
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,7 @@ impl<'a> Builder<'a> {

// Add extra cfg not defined in/by rustc
//
// Note: Altrough it would seems that "-Zunstable-options" to `rustflags` is useless as
// Note: Although it would seems that "-Zunstable-options" to `rustflags` is useless as
// cargo would implicitly add it, it was discover that sometimes bootstrap only use
// `rustflags` without `cargo` making it required.
rustflags.arg("-Zunstable-options");
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub enum GitInfo {
/// If the info should be used (`omit_git_hash` is false), this will be
/// `Some`, otherwise it will be `None`.
Present(Option<Info>),
/// This is not a git repostory, but the info can be fetched from the
/// This is not a git repository, but the info can be fetched from the
/// `git-commit-info` file.
RecordedForTarball(Info),
}
Expand Down
10 changes: 9 additions & 1 deletion src/bootstrap/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,8 @@ def parse_example_config(known_args, config):
# Avoid using quotes unless it's necessary.
targets[target][0] = targets[target][0].replace("x86_64-unknown-linux-gnu", "'{}'".format(target) if "." in target else target)

if 'profile' not in config:
set('profile', 'user', config)
configure_file(sections, top_level_keys, targets, config)
return section_order, sections, targets

Expand Down Expand Up @@ -475,7 +477,7 @@ def configure_section(lines, config):
def configure_top_level_key(lines, top_level_key, value):
for i, line in enumerate(lines):
if line.startswith('#' + top_level_key + ' = ') or line.startswith(top_level_key + ' = '):
lines[i] = "{} = {}".format(top_level_key, value)
lines[i] = "{} = {}".format(top_level_key, to_toml(value))
return

raise RuntimeError("failed to find config line for {}".format(top_level_key))
Expand Down Expand Up @@ -521,8 +523,14 @@ def write_config_toml(writer, section_order, targets, sections):
else:
writer = write_uncommented(sections[section], writer)

def quit_if_file_exists(file):
if os.path.isfile(file):
err("Existing '" + file + "' detected.")

if __name__ == "__main__":
# If 'config.toml' already exists, exit the script at this point
quit_if_file_exists('config.toml')

p("processing command line")
# Parse all known arguments into a configuration structure that reflects the
# TOML we're going to write out
Expand Down
14 changes: 0 additions & 14 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1965,20 +1965,6 @@ fn maybe_install_llvm(builder: &Builder<'_>, target: TargetSelection, dst_libdir
}
}

// FIXME: for reasons I don't understand, the LLVM so in the `rustc` component is different than the one in `rust-dev`.
// Only the one in `rustc` works with the downloaded compiler.
if builder.download_rustc() && target == builder.build.build {
let src_libdir = builder.ci_rustc_dir(target).join("lib");
for entry in t!(std::fs::read_dir(&src_libdir)) {
let entry = t!(entry);
if entry.file_name().to_str().unwrap().starts_with("libLLVM-") {
install_llvm_file(builder, &entry.path(), dst_libdir);
return !builder.config.dry_run();
}
}
panic!("libLLVM.so not found in src_libdir {}!", src_libdir.display());
}

// On macOS, rustc (and LLVM tools) link to an unversioned libLLVM.dylib
// instead of libLLVM-11-rust-....dylib, as on linux. It's not entirely
// clear why this is the case, though. llvm-config will emit the versioned
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,7 @@ impl Step for Libunwind {
run.builder.ensure(Libunwind { target: run.target });
}

/// Build linunwind.a
/// Build libunwind.a
fn run(self, builder: &Builder<'_>) -> Self::Output {
builder.update_submodule(&Path::new("src/llvm-project"));

Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/render_tests.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! This module renders the JSON output of libtest into a human-readable form, trying to be as
//! similar to libtest's native output as possible.
//!
//! This is needed because we need to use libtest in JSON mode to extract granluar information
//! This is needed because we need to use libtest in JSON mode to extract granular information
//! about the executed tests. Doing so suppresses the human-readable output, and (compared to Cargo
//! and rustc) libtest doesn't include the rendered human-readable output as a JSON field. We had
//! to reimplement all the rendering logic in this module because of that.
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub fn check(build: &mut Build) {
Couldn't find required command: cmake

You should install cmake, or set `download-ci-llvm = true` in the
`[llvm]` section section of `config.toml` to download LLVM rather
`[llvm]` section of `config.toml` to download LLVM rather
than building it.
"
);
Expand Down
2 changes: 1 addition & 1 deletion src/ci/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ For targets: `armv7-unknown-linux-gnueabihf`
(\*) These options have been selected to match the configuration of the arm
toolchains shipped with Ubuntu 15.10
(+) These options have been selected to match the gcc flags we use to compile C
libraries like jemalloc. See the mk/cfg/arm(v7)-uknown-linux-gnueabi{,hf}.mk
libraries like jemalloc. See the mk/cfg/arm(v7)-unknown-linux-gnueabi{,hf}.mk
file in Rust's source code.

### `aarch64-linux-gnu.config`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Remove stime() function calls

stime() has been deprecated in glibc 2.31 and replaced with
clock_settime(). Let's replace the stime() function calls with
clock_settime() in preperation.
clock_settime() in preparation.

function old new delta
rdate_main 197 224 +27
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ CT_CC_GCC_DEC_FLOAT_AUTO=y
CT_CC_GCC_HAS_ARCH_OPTIONS=y

#
# archictecture-specific options
# architecture-specific options
#
CT_CC_GCC_mips_llsc=m
CT_CC_GCC_mips_synci=m
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ CT_CC_GCC_DEC_FLOAT_AUTO=y
CT_CC_GCC_HAS_ARCH_OPTIONS=y

#
# archictecture-specific options
# architecture-specific options
#
CT_CC_GCC_mips_llsc=m
CT_CC_GCC_mips_synci=m
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ CT_CC_GCC_DEC_FLOAT_AUTO=y
CT_CC_GCC_HAS_ARCH_OPTIONS=y

#
# archictecture-specific options
# architecture-specific options
#
CT_CC_GCC_mips_llsc=m
CT_CC_GCC_mips_synci=m
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ CT_CC_GCC_DEC_FLOAT_AUTO=y
CT_CC_GCC_HAS_ARCH_OPTIONS=y

#
# archictecture-specific options
# architecture-specific options
#
CT_CC_GCC_mips_llsc=m
CT_CC_GCC_mips_synci=m
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# A quick smoke test to make sure publish_tooolstate.py works.
# A quick smoke test to make sure publish_toolstate.py works.

set -euo pipefail
IFS=$'\n\t'
Expand Down
2 changes: 1 addition & 1 deletion src/ci/docker/scripts/qemu-bare-bones-rcS
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mount -t sysfs none /sys
/addentropy < /addentropy
cat /dev/urandom | head -n 2048 | /addentropy

# Set up IP that qemu expects. This confgures eth0 with the public IP that QEMU
# Set up IP that qemu expects. This configures eth0 with the public IP that QEMU
# will communicate to as well as the loopback 127.0.0.1 address.
ifconfig eth0 10.0.2.15
ifconfig lo up
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/clean/blanket_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
trace!("get_blanket_impls({:?})", ty);
let mut impls = Vec::new();
for trait_def_id in cx.tcx.all_traits() {
if !cx.cache.effective_visibilities.is_directly_public(cx.tcx, trait_def_id)
if !cx.cache.effective_visibilities.is_reachable(cx.tcx, trait_def_id)
|| cx.generated_synthetics.get(&(ty.0, trait_def_id)).is_some()
{
continue;
Expand Down
Loading