Skip to content

Commit 801f474

Browse files
celinvaloli-obk
authored andcommitted
Fix compilation after changes to trait and run
The following PRs needed to be addressed: - rust-lang/rust#119833 - rust-lang/rust#119790 Note that the rustc tests are no longer passing, but the failures are unrelated to these changes and need further investigation.
1 parent 8ec26c6 commit 801f474

File tree

5 files changed

+10
-23
lines changed

5 files changed

+10
-23
lines changed

.github/scripts/run_rustc_tests.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ function run_tests() {
104104
--target=${HOST} \
105105
--llvm-filecheck="${FILE_CHECK}" \
106106
--channel=nightly \
107+
--git-repository="rust-lang/project-stable-mir" \
108+
--nightly-branch="main" \
107109
--target-rustcflags="--smir-check" \
108110
--host-rustcflags="--smir-check"
109111
done

tests/fixme/associated-items/methods.stderr

Lines changed: 0 additions & 2 deletions
This file was deleted.

tools/test-drive/src/main.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22
33
#![feature(rustc_private)]
44
#![feature(assert_matches)]
5-
#![feature(result_option_inspect)]
65

76
mod sanity_checks;
87

98
extern crate rustc_driver;
109
extern crate rustc_interface;
11-
extern crate rustc_middle;
10+
#[macro_use]
1211
extern crate rustc_smir;
1312
extern crate stable_mir;
1413

15-
use rustc_middle::ty::TyCtxt;
1614
use rustc_smir::{run, rustc_internal};
1715
use stable_mir::CompilerError;
1816
use std::ops::ControlFlow;
@@ -50,9 +48,9 @@ fn main() -> ExitCode {
5048
smir_args.contains(&FIXME_ARG.to_string()),
5149
Ordering::Relaxed,
5250
);
53-
run!(rustc_args, tcx, test_stable_mir(tcx))
51+
run!(rustc_args, test_stable_mir)
5452
} else {
55-
run!(rustc_args, ControlFlow::<()>::Continue(()))
53+
run!(rustc_args, || ControlFlow::<()>::Continue(()))
5654
};
5755
if result.is_ok() || matches!(result, Err(CompilerError::Skipped)) {
5856
ExitCode::SUCCESS
@@ -78,7 +76,7 @@ fn info(msg: String) {
7876

7977
/// This function invoke other tests and process their results.
8078
/// Tests should avoid panic,
81-
fn test_stable_mir(_tcx: TyCtxt<'_>) -> ControlFlow<()> {
79+
fn test_stable_mir() -> ControlFlow<()> {
8280
let mut results = Vec::from(run_tests![
8381
sanity_checks::test_entry_fn,
8482
sanity_checks::test_all_fns,

tools/test-drive/src/sanity_checks.rs

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
//! These checks should only depend on StableMIR APIs. See other modules for tests that compare
55
//! the result between StableMIR and internal APIs.
66
use crate::TestResult;
7+
use stable_mir::ty::{ImplDef, TraitDef};
78
use stable_mir::{self, mir, mir::MirVisitor, ty, CrateDef};
89
use std::collections::HashSet;
910
use std::fmt::Debug;
@@ -60,24 +61,12 @@ pub fn test_all_fns() -> TestResult {
6061
Ok(())
6162
}
6263

63-
/// Using these structures will always follow calls to get more details about those structures.
64-
/// Unless user is trying to find a specific type, this will get repetitive.
64+
/// Test that we can retrieve information about the trait declaration for every trait implementation.
6565
pub fn test_traits() -> TestResult {
66-
// FIXME: All trait declarations only return local traits.
67-
// See https://github.com/rust-lang/project-stable-mir/issues/37
68-
let all_traits = stable_mir::all_trait_decls();
69-
for trait_decl in all_traits.iter().map(stable_mir::trait_decl) {
70-
// Can't compare trait_decl, so just compare a field for now.
71-
check_equal(
72-
stable_mir::trait_decl(&trait_decl.def_id).specialization_kind,
73-
trait_decl.specialization_kind,
74-
"external crate mismatch",
75-
)?;
76-
}
77-
66+
let all_traits = HashSet::<TraitDef>::from_iter(stable_mir::all_trait_decls().into_iter());
7867
for trait_impl in stable_mir::all_trait_impls()
7968
.iter()
80-
.map(stable_mir::trait_impl)
69+
.map(ImplDef::trait_impl)
8170
{
8271
check(
8372
all_traits.contains(&trait_impl.value.def_id),

0 commit comments

Comments
 (0)