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

Update --pretty=expanded to -Zunpretty=expanded #706

Merged
merged 2 commits into from
Jul 28, 2021
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
6 changes: 3 additions & 3 deletions docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ trailer = "/* Text to put at the end of the generated file */"
# default: doesn't emit an include guard
include_guard = "mozilla_wr_bindings_h"

# Whether to add a `#pragma once` guard
# Whether to add a `#pragma once` guard
# default: doesn't emit a `#pragma once`
pragma_once = true

Expand Down Expand Up @@ -937,7 +937,7 @@ include = ["webrender", "webrender_traits"]
# default: []
exclude = ["libc"]

# Whether to use a new temporary target directory when running `rustc --pretty=expanded`.
# Whether to use a new temporary target directory when running `rustc -Zunpretty=expanded`.
# This may be required for some build processes.
#
# default: false
Expand Down Expand Up @@ -982,7 +982,7 @@ features = ["cbindgen"]
[ptr]
# An optional string to decorate all pointers that are
# required to be non null. Nullability is inferred from the Rust type: `&T`,
# `&mut T` and `NonNull<T>` all require a valid pointer value.
# `&mut T` and `NonNull<T>` all require a valid pointer value.
non_null_attribute = "_Nonnull"

# Options specific to Cython bindings.
Expand Down
13 changes: 7 additions & 6 deletions src/bindgen/cargo/cargo_expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ extern crate tempfile;
use self::tempfile::Builder;

#[derive(Debug)]
/// Possible errors that can occur during `rustc --pretty=expanded`.
/// Possible errors that can occur during `rustc -Zunpretty=expanded`.
pub enum Error {
/// Error during creation of temporary directory
Io(io::Error),
/// Output of `cargo metadata` was not valid utf8
Utf8(Utf8Error),
/// Error during execution of `cargo rustc --pretty=expanded`
/// Error during execution of `cargo rustc -Zunpretty=expanded`
Compile(String),
}

Expand Down Expand Up @@ -92,7 +92,10 @@ pub fn expand(

cmd.arg("rustc");
cmd.arg("--lib");
cmd.arg("--profile=check");
// When build with the release profile we can't choose the `check` profile.
if profile != Profile::Release {
cmd.arg("--profile=check");
}
cmd.arg("--manifest-path");
cmd.arg(manifest_path);
if let Some(features) = expand_features {
Expand Down Expand Up @@ -127,9 +130,7 @@ pub fn expand(
cmd.arg(&package);
cmd.arg("--verbose");
cmd.arg("--");
cmd.arg("-Z");
cmd.arg("unstable-options");
cmd.arg("--pretty=expanded");
cmd.arg("-Zunpretty=expanded");
info!("Command: {:?}", cmd);
let output = cmd.output()?;

Expand Down
8 changes: 4 additions & 4 deletions src/bindgen/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,13 +717,13 @@ impl FromStr for Profile {

deserialize_enum_str!(Profile);

/// Settings to apply when running `rustc --pretty=expanded`
/// Settings to apply when running `rustc -Zunpretty=expanded`
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "snake_case")]
#[serde(deny_unknown_fields)]
#[serde(default)]
pub struct ParseExpandConfig {
/// The names of crates to parse with `rustc --pretty=expanded`
/// The names of crates to parse with `rustc -Zunpretty=expanded`
pub crates: Vec<String>,
/// Whether to enable all the features when expanding.
pub all_features: bool,
Expand Down Expand Up @@ -806,10 +806,10 @@ pub struct ParseConfig {
pub include: Option<Vec<String>>,
/// The names of crates to not parse
pub exclude: Vec<String>,
/// The configuration options for `rustc --pretty=expanded`
/// The configuration options for `rustc -Zunpretty=expanded`
#[serde(deserialize_with = "retrocomp_parse_expand_config_deserialize")]
pub expand: ParseExpandConfig,
/// Whether to use a new temporary target directory when running `rustc --pretty=expanded`.
/// Whether to use a new temporary target directory when running `rustc -Zunpretty=expanded`.
/// This may be required for some build processes.
pub clean: bool,
/// List of crate names which generate consts, statics, and fns. By default
Expand Down
2 changes: 1 addition & 1 deletion src/bindgen/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl fmt::Display for Error {
}
Error::CargoExpand(ref crate_name, ref error) => write!(
f,
"Parsing crate `{}`: couldn't run `cargo rustc --pretty=expanded`: {:?}",
"Parsing crate `{}`: couldn't run `cargo rustc -Zunpretty=expanded`: {:?}",
crate_name, error
),
Error::ParseSyntaxError {
Expand Down