Skip to content

Commit

Permalink
Merge from rustc
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jun 16, 2023
2 parents 8e930fd + c84d5e7 commit 508675b
Show file tree
Hide file tree
Showing 839 changed files with 25,680 additions and 25,053 deletions.
18 changes: 4 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -383,25 +383,15 @@ jobs:
DIST_REQUIRE_ALL_TOOLS: 1
JEMALLOC_SYS_WITH_LG_PAGE: 14
os: macos-latest
- name: x86_64-msvc-1
- name: x86_64-msvc
env:
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-msvc --enable-profiler"
SCRIPT: make ci-subset-1
SCRIPT: make ci-msvc
os: windows-2019-8core-32gb
- name: x86_64-msvc-2
env:
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-msvc --enable-profiler"
SCRIPT: make ci-subset-2
os: windows-2019-8core-32gb
- name: i686-msvc-1
env:
RUST_CONFIGURE_ARGS: "--build=i686-pc-windows-msvc"
SCRIPT: make ci-subset-1
os: windows-2019-8core-32gb
- name: i686-msvc-2
- name: i686-msvc
env:
RUST_CONFIGURE_ARGS: "--build=i686-pc-windows-msvc"
SCRIPT: make ci-subset-2
SCRIPT: make ci-msvc
os: windows-2019-8core-32gb
- name: x86_64-msvc-cargo
env:
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_arena/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct ArenaChunk<T = u8> {

unsafe impl<#[may_dangle] T> Drop for ArenaChunk<T> {
fn drop(&mut self) {
unsafe { Box::from_raw(self.storage.as_mut()) };
unsafe { drop(Box::from_raw(self.storage.as_mut())) }
}
}

Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_ast_pretty/src/pprust/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ pub fn bounds_to_string(bounds: &[ast::GenericBound]) -> String {
State::new().bounds_to_string(bounds)
}

pub fn where_bound_predicate_to_string(where_bound_predicate: &ast::WhereBoundPredicate) -> String {
State::new().where_bound_predicate_to_string(where_bound_predicate)
}

pub fn pat_to_string(pat: &ast::Pat) -> String {
State::new().pat_to_string(pat)
}
Expand Down
7 changes: 7 additions & 0 deletions compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,13 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
Self::to_string(|s| s.print_type_bounds(bounds))
}

fn where_bound_predicate_to_string(
&self,
where_bound_predicate: &ast::WhereBoundPredicate,
) -> String {
Self::to_string(|s| s.print_where_bound_predicate(where_bound_predicate))
}

fn pat_to_string(&self, pat: &ast::Pat) -> String {
Self::to_string(|s| s.print_pat(pat))
}
Expand Down
28 changes: 15 additions & 13 deletions compiler/rustc_ast_pretty/src/pprust/state/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,19 +623,8 @@ impl<'a> State<'a> {

pub fn print_where_predicate(&mut self, predicate: &ast::WherePredicate) {
match predicate {
ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate {
bound_generic_params,
bounded_ty,
bounds,
..
}) => {
self.print_formal_generic_params(bound_generic_params);
self.print_type(bounded_ty);
self.word(":");
if !bounds.is_empty() {
self.nbsp();
self.print_type_bounds(bounds);
}
ast::WherePredicate::BoundPredicate(where_bound_predicate) => {
self.print_where_bound_predicate(where_bound_predicate);
}
ast::WherePredicate::RegionPredicate(ast::WhereRegionPredicate {
lifetime,
Expand All @@ -658,6 +647,19 @@ impl<'a> State<'a> {
}
}

pub fn print_where_bound_predicate(
&mut self,
where_bound_predicate: &ast::WhereBoundPredicate,
) {
self.print_formal_generic_params(&where_bound_predicate.bound_generic_params);
self.print_type(&where_bound_predicate.bounded_ty);
self.word(":");
if !where_bound_predicate.bounds.is_empty() {
self.nbsp();
self.print_type_bounds(&where_bound_predicate.bounds);
}
}

fn print_use_tree(&mut self, tree: &ast::UseTree) {
match &tree.kind {
ast::UseTreeKind::Simple(rename) => {
Expand Down
16 changes: 1 addition & 15 deletions compiler/rustc_borrowck/src/type_check/input_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,21 +124,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
// Return types are a bit more complex. They may contain opaque `impl Trait` types.
let mir_output_ty = body.local_decls[RETURN_PLACE].ty;
let output_span = body.local_decls[RETURN_PLACE].source_info.span;
if let Err(terr) = self.eq_types(
normalized_output_ty,
mir_output_ty,
Locations::All(output_span),
ConstraintCategory::BoringNoLocation,
) {
span_mirbug!(
self,
Location::START,
"equate_inputs_and_outputs: `{:?}=={:?}` failed with `{:?}`",
normalized_output_ty,
mir_output_ty,
terr
);
};
self.equate_normalized_input_or_output(normalized_output_ty, mir_output_ty, output_span);
}

#[instrument(skip(self), level = "debug")]
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_codegen_cranelift/.cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
task:
name: freebsd
freebsd_instance:
image: freebsd-13-1-release-amd64
image: freebsd-13-2-release-amd64
setup_rust_script:
- pkg install -y curl git bash
- pkg install -y git bash
- curl https://sh.rustup.rs -sSf --output rustup.sh
- sh rustup.sh --default-toolchain none -y --profile=minimal
target_cache:
folder: target
prepare_script:
- . $HOME/.cargo/env
- ./y.rs prepare
- ./y.sh prepare
test_script:
- . $HOME/.cargo/env
- ./y.rs test
- ./y.sh test
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ jobs:
run: rustup set default-host x86_64-pc-windows-gnu

- name: Prepare dependencies
run: ./y.rs prepare
run: ./y.sh prepare

- name: Build
run: ./y.rs build --sysroot none
run: ./y.sh build --sysroot none

- name: Test abi-cafe
env:
TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
run: ./y.rs abi-cafe
run: ./y.sh abi-cafe
60 changes: 45 additions & 15 deletions compiler/rustc_codegen_cranelift/.github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Rustfmt
run: |
cargo fmt --check
rustfmt --check build_system/mod.rs
rustfmt --check build_system/main.rs
rustfmt --check example/*
Expand Down Expand Up @@ -91,22 +91,52 @@ jobs:
sudo apt-get install -y gcc-s390x-linux-gnu qemu-user
- name: Prepare dependencies
run: ./y.rs prepare
run: ./y.sh prepare

- name: Build
run: ./y.sh build --sysroot none

- name: Build without unstable features
- name: Test
env:
TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
# This is the config rust-lang/rust uses for builds
run: ./y.rs build --no-unstable-features
run: ./y.sh test

- name: Build
run: ./y.rs build --sysroot none
- name: Install LLVM standard library
run: rustup target add ${{ matrix.env.TARGET_TRIPLE }}

- name: Test
# This is roughly config rust-lang/rust uses for testing
- name: Test with LLVM sysroot
# Skip native x86_64-pc-windows-gnu. It is way too slow and cross-compiled
# x86_64-pc-windows-gnu covers at least part of the tests.
if: matrix.os != 'windows-latest' || matrix.env.TARGET_TRIPLE != 'x86_64-pc-windows-gnu'
env:
TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
run: ./y.rs test
run: ./y.sh test --sysroot llvm --no-unstable-features


# This job doesn't use cg_clif in any way. It checks that all cg_clif tests work with cg_llvm too.
test_llvm:
runs-on: ubuntu-latest
timeout-minutes: 60

defaults:
run:
shell: bash

steps:
- uses: actions/checkout@v3

- name: Prepare dependencies
run: ./y.rs prepare

- name: Disable JIT tests
run: |
sed -i 's/jit./#jit./' config.txt
- name: Test
env:
TARGET_TRIPLE: x86_64-unknown-linux-gnu
run: ./y.rs test --use-backend llvm

bench:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -135,13 +165,13 @@ jobs:
run: cargo install hyperfine || true

- name: Prepare dependencies
run: ./y.rs prepare
run: ./y.sh prepare

- name: Build
run: CI_OPT=1 ./y.rs build --sysroot none
run: CI_OPT=1 ./y.sh build --sysroot none

- name: Benchmark
run: CI_OPT=1 ./y.rs bench
run: CI_OPT=1 ./y.sh bench


dist:
Expand Down Expand Up @@ -194,13 +224,13 @@ jobs:
sudo apt-get install -y gcc-mingw-w64-x86-64 wine-stable
- name: Prepare dependencies
run: ./y.rs prepare
run: ./y.sh prepare

- name: Build backend
run: CI_OPT=1 ./y.rs build --sysroot none
run: CI_OPT=1 ./y.sh build --sysroot none

- name: Build sysroot
run: CI_OPT=1 ./y.rs build
run: CI_OPT=1 ./y.sh build

- name: Package prebuilt cg_clif
run: tar cvfJ cg_clif.tar.xz dist
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_cranelift/.github/workflows/rustc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}

- name: Prepare dependencies
run: ./y.rs prepare
run: ./y.sh prepare

- name: Test
run: ./scripts/test_bootstrap.sh
Expand All @@ -38,7 +38,7 @@ jobs:
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}

- name: Prepare dependencies
run: ./y.rs prepare
run: ./y.sh prepare

- name: Test
run: ./scripts/test_rustc_tests.sh
1 change: 1 addition & 0 deletions compiler/rustc_codegen_cranelift/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/target
/build_system/target
**/*.rs.bk
*.rlib
*.o
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_codegen_cranelift/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
"rust-analyzer.imports.granularity.enforce": true,
"rust-analyzer.imports.granularity.group": "module",
"rust-analyzer.imports.prefix": "crate",
"rust-analyzer.cargo.features": ["unstable-features", "__check_build_system_using_ra"],
"rust-analyzer.cargo.features": ["unstable-features"],
"rust-analyzer.linkedProjects": [
"./Cargo.toml",
"./build_system/Cargo.toml",
{
"crates": [
{
Expand Down
Loading

0 comments on commit 508675b

Please sign in to comment.