Skip to content

Commit f6cb47d

Browse files
authored
Update to nightly-2024-12-15 (#33)
1 parent e87e1b8 commit f6cb47d

File tree

8 files changed

+21
-20
lines changed

8 files changed

+21
-20
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
[![docs](https://img.shields.io/badge/docs-built-blue)][docs]
55

66

7-
`rustc_plugin` is a framework for writing programs that use the Rust compiler API. We wrote `rustc_plugin` to support our research on experimental Rust tools like [Flowistry] and [Aquascope]. `rustc_plugin` is a kind of generalized version of the infrastructure in [Clippy].
7+
`rustc_plugin` is a framework for writing programs that use the Rust compiler API. We wrote `rustc_plugin` to support our research on experimental Rust tools like [Flowistry], [Aquascope], [Paralegal], and [Argus]. `rustc_plugin` provides a kind of generalized version of the Cargo integration infrastructure in [Clippy], along with a miscellany of utilities in the `rustc_utils` crate.
88

99
## Installation
1010

1111
The Rust compiler's interface is not stable, so the only sensible way to develop a Rust compiler plugin is by pinning to a specific nightly. Each version of `rustc_plugin` is pinned to one nightly, and you *have* to use the same nightly version that we do. Therefore each release of `rustc_plugin` has a semantic version number (e.g. `0.1.0`) and the nightly version is added as a prerelease label (e.g. `-nightly-2023-08-25`). You can add a dependency to your `Cargo.toml` like this:
1212

1313
```toml
14-
rustc_plugin = "=0.11.0-nightly-2024-12-01"
14+
rustc_plugin = "=0.12.0-nightly-2024-12-15"
1515
```
1616

1717
We will treat a change to the nightly version as a breaking change, so the semantic version will be correspondingly updated as a breaking update.
@@ -44,6 +44,7 @@ The `rustc_plugin` framework is responsible for marshalling arguments from the t
4444

4545
Normally, Rust libraries have a [minimum supported Rust version][msrv] because they promise to not use any breaking features implemented after that version. Rust compiler plugins are the opposite — they have a **maximum** supported Rust version (MaxSRV). A compiler plugin cannot analyze programs that use features implemented after the release date of the plugin's toolchain. The MaxSRV for every version of `rustc_plugin` is listed below:
4646

47+
* v0.12 (`nightly-2024-12-15`) - rustc 1.84
4748
* v0.11 (`nightly-2024-12-01`) - rustc 1.84
4849
* v0.10 (`nightly-2024-05-20`) - rustc 1.79
4950
* v0.9 (`nightly-2024-01-24`) - rustc 1.76
@@ -54,9 +55,10 @@ Normally, Rust libraries have a [minimum supported Rust version][msrv] because t
5455

5556
[Flowistry]: https://github.com/willcrichton/flowistry/
5657
[Aquascope]: https://github.com/cognitive-engineering-lab/aquascope
58+
[Paralegal]: https://github.com/brownsys/paralegal
59+
[Argus]: https://github.com/cognitive-engineering-lab/argus
5760
[Clippy]: https://github.com/rust-lang/rust-clippy
5861
[example]: https://github.com/cognitive-engineering-lab/rustc_plugin/tree/main/crates/rustc_plugin/examples/print-all-items
5962
[docs]: https://cognitive-engineering-lab.github.io/rustc_plugin/v0.11.0-nightly-2024-12-01/rustc_plugin/
6063
[docs-utils]: https://cognitive-engineering-lab.github.io/rustc_plugin/v0.11.0-nightly-2024-12-01/rustc_utils/
6164
[msrv]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field
62-
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2024-01-24"
2+
channel = "nightly-2024-12-15"
33
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

crates/rustc_plugin/examples/print-all-items/src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ impl RustcPlugin for PrintAllItemsPlugin {
6363
) -> rustc_interface::interface::Result<()> {
6464
let mut callbacks = PrintAllItemsCallbacks { args: plugin_args };
6565
let compiler = rustc_driver::RunCompiler::new(&compiler_args, &mut callbacks);
66-
compiler.run()
66+
compiler.run();
67+
Ok(())
6768
}
6869
}
6970

@@ -75,10 +76,10 @@ impl rustc_driver::Callbacks for PrintAllItemsCallbacks {
7576
// At the top-level, the Rustc API uses an event-based interface for
7677
// accessing the compiler at different stages of compilation. In this callback,
7778
// all the type-checking has completed.
78-
fn after_analysis<'tcx>(
79+
fn after_analysis(
7980
&mut self,
8081
_compiler: &rustc_interface::interface::Compiler,
81-
tcx: TyCtxt<'tcx>,
82+
tcx: TyCtxt<'_>,
8283
) -> rustc_driver::Compilation {
8384
// We call our top-level function with access to the type context `tcx` and the CLI arguments.
8485
print_all_items(tcx, &self.args);

crates/rustc_plugin/src/driver.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ run_on_all_crates={run_on_all_crates}, \
161161
primary_package={primary_package}, \
162162
is_target_crate={is_target_crate}"
163163
);
164-
rustc_driver::RunCompiler::new(&args, &mut DefaultCallbacks).run()
164+
rustc_driver::RunCompiler::new(&args, &mut DefaultCallbacks).run();
165+
Ok(())
165166
}
166167
}))
167168
}

crates/rustc_utils/src/hir/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl<'tcx> TyExt<'tcx> for Ty<'tcx> {
5151

5252
fn is_copyable(self, tcx: TyCtxt<'tcx>, typing_env: TypingEnv<'tcx>) -> bool {
5353
let ty = tcx.erase_regions(self);
54-
ty.is_copy_modulo_regions(tcx, typing_env)
54+
tcx.type_is_copy_modulo_regions(typing_env, ty)
5555
}
5656
}
5757

crates/rustc_utils/src/mir/control_dependencies.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc_data_structures::graph::{
1313
DirectedGraph, Predecessors, StartNode, Successors,
1414
};
1515
use rustc_index::{
16-
bit_set::{BitSet, ChunkedBitSet, SparseBitMatrix},
16+
bit_set::{BitSet, SparseBitMatrix},
1717
Idx,
1818
};
1919
use smallvec::SmallVec;
@@ -194,7 +194,7 @@ impl<Node: Idx + Ord> ControlDependencies<Node> {
194194
}
195195

196196
/// Returns the set of all node that are control-dependent on the given `node`.
197-
pub fn dependent_on(&self, node: Node) -> Option<&ChunkedBitSet<Node>> {
197+
pub fn dependent_on(&self, node: Node) -> Option<&BitSet<Node>> {
198198
self.0.row(node)
199199
}
200200
}

crates/rustc_utils/src/test_utils.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,8 @@ impl CompileBuilder {
118118
rustc_driver::catch_fatal_errors(|| {
119119
let mut compiler = rustc_driver::RunCompiler::new(&args, &mut callbacks);
120120
compiler.set_file_loader(Some(Box::new(StringLoader(self.input.clone()))));
121-
compiler.run()
121+
compiler.run();
122122
})
123-
.unwrap()
124123
.unwrap();
125124
}
126125
}
@@ -193,15 +192,13 @@ where
193192
config.override_queries = Some(borrowck_facts::override_queries);
194193
}
195194

196-
fn after_expansion<'tcx>(
195+
fn after_analysis(
197196
&mut self,
198197
_compiler: &rustc_interface::interface::Compiler,
199-
queries: &'tcx rustc_interface::Queries<'tcx>,
198+
tcx: TyCtxt<'_>,
200199
) -> rustc_driver::Compilation {
201-
queries.global_ctxt().unwrap().enter(|tcx| {
202-
let callback = self.callback.take().unwrap();
203-
callback(tcx);
204-
});
200+
let callback = self.callback.take().unwrap();
201+
callback(tcx);
205202
rustc_driver::Compilation::Stop
206203
}
207204
}

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2024-12-01"
2+
channel = "nightly-2024-12-15"
33
components = ["clippy", "rust-src", "rustc-dev", "llvm-tools-preview"]

0 commit comments

Comments
 (0)