Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"src/intrinsic/llvm.rs"
],
"ignoreRegExpList": [
"/(FIXME|NOTE|TODO)\\([^)]+\\)/",
"/(FIXME|NOTE)\\([^)]+\\)/",
"__builtin_\\w*"
]
}
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ jobs:
- name: Check formatting
run: ./y.sh fmt --check

- name: Check todo
run: ./y.sh check-todo

- name: clippy
run: |
cargo clippy --all-targets -- -D warnings
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/failures.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# TODO: refactor to avoid duplication with the ci.yml file.
# FIXME: refactor to avoid duplication with the ci.yml file.
name: Failures

on:
Expand Down Expand Up @@ -94,15 +94,15 @@ jobs:
run: ./y.sh prepare

- name: Run tests
# TODO: re-enable those tests for libgccjit 12.
# FIXME: re-enable those tests for libgccjit 12.
if: matrix.libgccjit_version.gcc != 'libgccjit12.so'
id: tests
run: |
${{ matrix.libgccjit_version.env_extra }} ./y.sh test --release --clean --build-sysroot --test-failing-rustc ${{ matrix.libgccjit_version.extra }} 2>&1 | tee output_log
rg --text "test result" output_log >> $GITHUB_STEP_SUMMARY

- name: Run failing ui pattern tests for ICE
# TODO: re-enable those tests for libgccjit 12.
# FIXME: re-enable those tests for libgccjit 12.
if: matrix.libgccjit_version.gcc != 'libgccjit12.so'
id: ui-tests
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/m68k.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# TODO: check if qemu-user-static-binfmt is needed (perhaps to run some tests since it probably calls exec).
# FIXME: check if qemu-user-static-binfmt is needed (perhaps to run some tests since it probably calls exec).

name: m68k CI

Expand All @@ -24,7 +24,7 @@ jobs:
matrix:
commands: [
"--std-tests",
# TODO(antoyo): fix those on m68k.
# FIXME(antoyo): fix those on m68k.
#"--test-libcore",
#"--extended-rand-tests",
#"--extended-regex-example-tests",
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/stdarch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Install packages
run: sudo apt-get install ninja-build ripgrep

# TODO: remove when we have binutils version 2.43 in the repo.
# FIXME: remove when we have binutils version 2.43 in the repo.
- name: Install more recent binutils
run: |
echo "deb http://archive.ubuntu.com/ubuntu plucky main universe" | sudo tee /etc/apt/sources.list.d/plucky-copies.list
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
if: ${{ matrix.cargo_runner }}
run: |
# FIXME: these tests fail when the sysroot is compiled with LTO because of a missing symbol in proc-macro.
# TODO: remove --skip test_tile_ when it's implemented.
# FIXME: remove --skip test_tile_ when it's implemented.
STDARCH_TEST_SKIP_FUNCTION="xsave,xsaveopt,xsave64,xsaveopt64" STDARCH_TEST_EVERYTHING=1 CHANNEL=release CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="${{ matrix.cargo_runner }}" TARGET=x86_64-unknown-linux-gnu CG_RUSTFLAGS="-Ainternal_features" ./y.sh cargo test --manifest-path build/build_sysroot/sysroot_src/library/stdarch/Cargo.toml -- --skip rtm --skip tbm --skip sse4a --skip test_tile_

# Summary job for the merge queue.
Expand Down
7 changes: 6 additions & 1 deletion build_system/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ mod prepare;
mod rust_tools;
mod rustc_info;
mod test;
mod todo;
mod utils;
const BUILD_DIR: &str = "build";

Expand Down Expand Up @@ -45,7 +46,8 @@ Commands:
clone-gcc : Clones the GCC compiler from a specified source.
fmt : Runs rustfmt
fuzz : Fuzzes `cg_gcc` using rustlantis
abi-test : Runs the abi-cafe test suite on the codegen, checking for ABI compatibility with LLVM"
abi-test : Runs the abi-cafe test suite on the codegen, checking for ABI compatibility with LLVM
check-todo : Checks todo in the project"
);
}

Expand All @@ -61,6 +63,7 @@ pub enum Command {
Fmt,
Fuzz,
AbiTest,
CheckTodo,
}

fn main() {
Expand All @@ -80,6 +83,7 @@ fn main() {
Some("info") => Command::Info,
Some("clone-gcc") => Command::CloneGcc,
Some("abi-test") => Command::AbiTest,
Some("check-todo") => Command::CheckTodo,
Some("fmt") => Command::Fmt,
Some("fuzz") => Command::Fuzz,
Some("--help") => {
Expand All @@ -106,6 +110,7 @@ fn main() {
Command::Fmt => fmt::run(),
Command::Fuzz => fuzz::run(),
Command::AbiTest => abi_test::run(),
Command::CheckTodo => todo::run(),
} {
eprintln!("Command failed to run: {e}");
process::exit(1);
Expand Down
2 changes: 1 addition & 1 deletion build_system/src/prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ fn prepare_libcore(
Ok(())
}

// TODO: remove when we can ignore warnings in rustdoc tests.
// FIXME: remove when we can ignore warnings in rustdoc tests.
fn prepare_rand() -> Result<(), String> {
// Apply patch for the rand crate.
let file_path = "patches/crates/0001-Remove-deny-warnings.patch";
Expand Down
12 changes: 6 additions & 6 deletions build_system/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ fn build_sysroot(env: &Env, args: &TestArg) -> Result<(), String> {
Ok(())
}

// TODO(GuillaumeGomez): when rewriting in Rust, refactor with the code in tests/lang_tests_common.rs if possible.
// FIXME(GuillaumeGomez): when rewriting in Rust, refactor with the code in tests/lang_tests_common.rs if possible.
fn maybe_run_command_in_vm(
command: &[&dyn AsRef<OsStr>],
env: &Env,
Expand Down Expand Up @@ -648,16 +648,16 @@ fn test_projects(env: &Env, args: &TestArg) -> Result<(), String> {
"https://github.com/BurntSushi/memchr",
"https://github.com/dtolnay/itoa",
"https://github.com/rust-lang/cfg-if",
//"https://github.com/rust-lang-nursery/lazy-static.rs", // TODO: re-enable when the
//"https://github.com/rust-lang-nursery/lazy-static.rs", // FIXME: re-enable when the
//failing test is fixed upstream.
//"https://github.com/marshallpierce/rust-base64", // FIXME: one test is OOM-killed.
// TODO: ignore the base64 test that is OOM-killed.
// FIXME: ignore the base64 test that is OOM-killed.
//"https://github.com/time-rs/time", // FIXME: one test fails (https://github.com/time-rs/time/issues/719).
"https://github.com/rust-lang/log",
"https://github.com/bitflags/bitflags",
//"https://github.com/serde-rs/serde", // FIXME: one test fails.
//"https://github.com/rayon-rs/rayon", // TODO: very slow, only run on master?
//"https://github.com/rust-lang/cargo", // TODO: very slow, only run on master?
//"https://github.com/rayon-rs/rayon", // FIXME: very slow, only run on master?
//"https://github.com/rust-lang/cargo", // FIXME: very slow, only run on master?
];

let mut env = env.clone();
Expand Down Expand Up @@ -699,7 +699,7 @@ fn test_libcore(env: &Env, args: &TestArg) -> Result<(), String> {
println!("[TEST] libcore");
let path = get_sysroot_dir().join("sysroot_src/library/coretests");
let _ = remove_dir_all(path.join("target"));
// TODO(antoyo): run in release mode when we fix the failures.
// FIXME(antoyo): run in release mode when we fix the failures.
run_cargo_command(&[&"test"], Some(&path), env, args)?;
Ok(())
}
Expand Down
87 changes: 87 additions & 0 deletions build_system/src/todo.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
use std::ffi::OsStr;
use std::fs;
use std::path::{Path, PathBuf};
use std::process::Command;

const EXTENSIONS: &[&str] =
&["rs", "py", "js", "sh", "c", "cpp", "h", "md", "css", "ftl", "toml", "yml", "yaml"];
const SKIP_FILES: &[&str] = &["build_system/src/todo.rs", ".github/workflows/ci.yml"];

fn has_supported_extension(path: &Path) -> bool {
path.extension().is_some_and(|ext| EXTENSIONS.iter().any(|e| ext == OsStr::new(e)))
}

fn is_editor_temp(path: &Path) -> bool {
path.file_name().is_some_and(|name| name.to_string_lossy().starts_with(".#"))
}

fn list_tracked_files() -> Result<Vec<PathBuf>, String> {
let output = Command::new("git")
.args(["ls-files", "-z"])
.output()
.map_err(|e| format!("Failed to run `git ls-files`: {e}"))?;

if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr);
return Err(format!("`git ls-files` failed: {stderr}"));
}

let mut files = Vec::new();
for entry in output.stdout.split(|b| *b == 0) {
if entry.is_empty() {
continue;
}
let path = std::str::from_utf8(entry)
.map_err(|_| "Non-utf8 path returned by `git ls-files`".to_string())?;
files.push(PathBuf::from(path));
}

Ok(files)
}

pub(crate) fn run() -> Result<(), String> {
let files = list_tracked_files()?;
let mut errors = Vec::new();
// Avoid embedding the task marker in source so greps only find real occurrences.
let todo_marker = "todo".to_ascii_uppercase();

for file in files {
if is_editor_temp(&file) {
continue;
}
if SKIP_FILES.iter().any(|skip| file.ends_with(Path::new(skip))) {
continue;
}
if !has_supported_extension(&file) {
continue;
}

let bytes =
fs::read(&file).map_err(|e| format!("Failed to read `{}`: {e}", file.display()))?;
let Ok(contents) = std::str::from_utf8(&bytes) else {
continue;
};

for (i, line) in contents.split('\n').enumerate() {
let trimmed = line.trim();
if trimmed.contains(&todo_marker) {
errors.push(format!(
"{}:{}: {} is used for tasks that should be done before merging a PR; if you want to leave a message in the codebase use FIXME",
file.display(),
i + 1,
todo_marker
));
}
}
}

if errors.is_empty() {
return Ok(());
}

for err in &errors {
eprintln!("{err}");
}

Err(format!("found {} {}(s)", errors.len(), todo_marker))
}
2 changes: 1 addition & 1 deletion doc/debugging-libgccjit.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ Maybe by calling the following at the beginning of gdb:
set substitute-path /usr/src/debug/gcc /path/to/gcc-repo/gcc
```

TODO(antoyo): but that's not what I remember I was doing.
FIXME(antoyo): but that's not what I remember I was doing.
2 changes: 1 addition & 1 deletion doc/subtree.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ git push
PATH="$HOME/bin:$PATH" ~/bin/git-subtree push -P compiler/rustc_codegen_gcc/ ../rustc_codegen_gcc/ sync_branch_name
```

TODO: write a script that does the above.
FIXME: write a script that does the above.

https://rust-lang.zulipchat.com/#narrow/stream/301329-t-devtools/topic/subtree.20madness/near/258877725
2 changes: 1 addition & 1 deletion example/mini_core_hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ fn main() {
}
}

// TODO(antoyo): to make this work, support weak linkage.
// FIXME(antoyo): to make this work, support weak linkage.
//unsafe { assert_eq!(ABC as usize, 0); }

&mut (|| Some(0 as *const ())) as &mut dyn FnMut() -> Option<*const ()>;
Expand Down
4 changes: 2 additions & 2 deletions src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub struct FnAbiGcc<'gcc> {
}

pub trait FnAbiGccExt<'gcc, 'tcx> {
// TODO(antoyo): return a function pointer type instead?
// FIXME(antoyo): return a function pointer type instead?
fn gcc_type(&self, cx: &CodegenCx<'gcc, 'tcx>) -> FnAbiGcc<'gcc>;
fn ptr_to_gcc_type(&self, cx: &CodegenCx<'gcc, 'tcx>) -> Type<'gcc>;
#[cfg(feature = "master")]
Expand Down Expand Up @@ -260,7 +260,7 @@ pub fn conv_to_fn_attribute<'gcc>(conv: CanonAbi, arch: &Arch) -> Option<FnAttri
&Arch::Nvptx64 => FnAttribute::NvptxKernel,
arch => panic!("Arch {arch} does not support GpuKernel calling convention"),
},
// TODO(antoyo): check if those AVR attributes are mapped correctly.
// FIXME(antoyo): check if those AVR attributes are mapped correctly.
CanonAbi::Interrupt(interrupt_kind) => match interrupt_kind {
InterruptKind::Avr => FnAttribute::AvrSignal,
InterruptKind::AvrNonBlocking => FnAttribute::AvrInterrupt,
Expand Down
4 changes: 2 additions & 2 deletions src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ fn create_wrapper_function(
)));

if tcx.sess.must_emit_unwind_tables() {
// TODO(antoyo): emit unwind tables.
// FIXME(antoyo): emit unwind tables.
}

let block = func.new_block("entry");
Expand Down Expand Up @@ -138,6 +138,6 @@ fn create_wrapper_function(
block.end_with_void_return(None);
}

// TODO(@Commeownist): Check if we need to emit some extra debugging info in certain circumstances
// FIXME(@Commeownist): Check if we need to emit some extra debugging info in certain circumstances
// as described in https://github.com/rust-lang/rust/commit/77a96ed5646f7c3ee8897693decc4626fe380643
}
Loading