Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

howto run the examples #1593

Merged
merged 1 commit into from
Feb 15, 2023
Merged
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
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