Skip to content

Commit fb4cc6f

Browse files
authored
howto run the examples (#1593)
1 parent 77aaf99 commit fb4cc6f

4 files changed

+17
-21
lines changed

Diff for: examples/README

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
For each example to compile, you will need to first run the following:
2+
3+
rustup component add rustc-dev llvm-tools
4+
5+
To create an executable:
6+
7+
rustc rustc-driver-example.rs
8+
9+
To run an executable:
10+
11+
rustup run nightly ./rustc-driver-example

Diff for: examples/rustc-driver-example.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
#![feature(rustc_private)]
22

3-
// NOTE: For the example to compile, you will need to first run the following:
4-
// rustup component add rustc-dev llvm-tools-preview
5-
6-
// version: rustc 1.68.0-nightly (935dc0721 2022-12-19)
7-
3+
extern crate rustc_driver;
84
extern crate rustc_error_codes;
95
extern crate rustc_errors;
106
extern crate rustc_hash;
117
extern crate rustc_hir;
128
extern crate rustc_interface;
139
extern crate rustc_session;
1410
extern crate rustc_span;
15-
extern crate rustc_driver;
1611

1712
use std::{path, process, str};
1813

@@ -47,9 +42,9 @@ fn main() {
4742
"#
4843
.into(),
4944
},
50-
output_dir: None, // Option<PathBuf>
51-
output_file: None, // Option<PathBuf>
52-
file_loader: None, // Option<Box<dyn FileLoader + Send + Sync>>
45+
output_dir: None, // Option<PathBuf>
46+
output_file: None, // Option<PathBuf>
47+
file_loader: None, // Option<Box<dyn FileLoader + Send + Sync>>
5348
lint_caps: FxHashMap::default(), // FxHashMap<lint::LintId, lint::Level>
5449
// This is a callback from the driver that is called when [`ParseSess`] is created.
5550
parse_sess_created: None, //Option<Box<dyn FnOnce(&mut ParseSess) + Send>>

Diff for: examples/rustc-driver-getting-diagnostics.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
#![feature(rustc_private)]
22

3-
// NOTE: For the example to compile, you will need to first run the following:
4-
// rustup component add rustc-dev llvm-tools-preview
5-
6-
// version: rustc 1.68.0-nightly (935dc0721 2022-12-19)
7-
3+
extern crate rustc_driver;
84
extern crate rustc_error_codes;
95
extern crate rustc_errors;
106
extern crate rustc_hash;
117
extern crate rustc_hir;
128
extern crate rustc_interface;
139
extern crate rustc_session;
1410
extern crate rustc_span;
15-
extern crate rustc_driver;
1611

1712
use rustc_errors::registry;
1813
use rustc_session::config::{self, CheckCfg};

Diff for: examples/rustc-driver-interacting-with-the-ast.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
#![feature(rustc_private)]
22

3-
// NOTE: For the example to compile, you will need to first run the following:
4-
// rustup component add rustc-dev llvm-tools-preview
5-
6-
// version: rustc 1.68.0-nightly (935dc0721 2022-12-19)
7-
83
extern crate rustc_ast_pretty;
4+
extern crate rustc_driver;
95
extern crate rustc_error_codes;
106
extern crate rustc_errors;
117
extern crate rustc_hash;
128
extern crate rustc_hir;
139
extern crate rustc_interface;
1410
extern crate rustc_session;
1511
extern crate rustc_span;
16-
extern crate rustc_driver;
1712

1813
use std::{path, process, str};
1914

0 commit comments

Comments
 (0)