-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1297 from google/dyn-trait-test
Testing and documenting dynamic dispatch for CppRef.
- Loading branch information
Showing
4 changed files
with
147 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2023 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// It would be nice to use the rustversion crate here instead, | ||
// but that doesn't work with inner attributes. | ||
fn main() { | ||
if let Some(ver) = rustc_version() { | ||
if ver.contains("nightly") { | ||
println!("cargo:rustc-cfg=nightly") | ||
} | ||
} | ||
} | ||
|
||
fn rustc_version() -> Option<String> { | ||
let rustc = std::env::var_os("RUSTC")?; | ||
let output = std::process::Command::new(rustc) | ||
.arg("--version") | ||
.output() | ||
.ok()?; | ||
let version = String::from_utf8(output.stdout).ok()?; | ||
Some(version) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters