Skip to content

Commit

Permalink
howto run the examples (#1593)
Browse files Browse the repository at this point in the history
  • Loading branch information
tshepang authored Feb 15, 2023
1 parent 77aaf99 commit fb4cc6f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
11 changes: 11 additions & 0 deletions examples/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
For each example to compile, you will need to first run the following:

rustup component add rustc-dev llvm-tools

To create an executable:

rustc rustc-driver-example.rs

To run an executable:

rustup run nightly ./rustc-driver-example
13 changes: 4 additions & 9 deletions examples/rustc-driver-example.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
#![feature(rustc_private)]

// NOTE: For the example to compile, you will need to first run the following:
// rustup component add rustc-dev llvm-tools-preview

// version: rustc 1.68.0-nightly (935dc0721 2022-12-19)

extern crate rustc_driver;
extern crate rustc_error_codes;
extern crate rustc_errors;
extern crate rustc_hash;
extern crate rustc_hir;
extern crate rustc_interface;
extern crate rustc_session;
extern crate rustc_span;
extern crate rustc_driver;

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

Expand Down Expand Up @@ -47,9 +42,9 @@ fn main() {
"#
.into(),
},
output_dir: None, // Option<PathBuf>
output_file: None, // Option<PathBuf>
file_loader: None, // Option<Box<dyn FileLoader + Send + Sync>>
output_dir: None, // Option<PathBuf>
output_file: None, // Option<PathBuf>
file_loader: None, // Option<Box<dyn FileLoader + Send + Sync>>
lint_caps: FxHashMap::default(), // FxHashMap<lint::LintId, lint::Level>
// This is a callback from the driver that is called when [`ParseSess`] is created.
parse_sess_created: None, //Option<Box<dyn FnOnce(&mut ParseSess) + Send>>
Expand Down
7 changes: 1 addition & 6 deletions examples/rustc-driver-getting-diagnostics.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
#![feature(rustc_private)]

// NOTE: For the example to compile, you will need to first run the following:
// rustup component add rustc-dev llvm-tools-preview

// version: rustc 1.68.0-nightly (935dc0721 2022-12-19)

extern crate rustc_driver;
extern crate rustc_error_codes;
extern crate rustc_errors;
extern crate rustc_hash;
extern crate rustc_hir;
extern crate rustc_interface;
extern crate rustc_session;
extern crate rustc_span;
extern crate rustc_driver;

use rustc_errors::registry;
use rustc_session::config::{self, CheckCfg};
Expand Down
7 changes: 1 addition & 6 deletions examples/rustc-driver-interacting-with-the-ast.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
#![feature(rustc_private)]

// NOTE: For the example to compile, you will need to first run the following:
// rustup component add rustc-dev llvm-tools-preview

// version: rustc 1.68.0-nightly (935dc0721 2022-12-19)

extern crate rustc_ast_pretty;
extern crate rustc_driver;
extern crate rustc_error_codes;
extern crate rustc_errors;
extern crate rustc_hash;
extern crate rustc_hir;
extern crate rustc_interface;
extern crate rustc_session;
extern crate rustc_span;
extern crate rustc_driver;

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

Expand Down

0 comments on commit fb4cc6f

Please sign in to comment.