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

Rollup of 10 pull requests #59487

Merged
merged 29 commits into from
Mar 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
36bcbc3
Add FromStr impl for NonZero types
hellow554 Feb 25, 2019
ce30d4e
replaced nonzeroparseerror with regular interror
hellow554 Feb 27, 2019
912ad68
fixed nonzero tests
hellow554 Feb 28, 2019
ad240ea
add feature flag to test
hellow554 Feb 28, 2019
7330525
fixed tests again
hellow554 Feb 28, 2019
f4742f4
Add def getting methods to librustc/ty/context
Mar 15, 2019
6648385
rustc: Update linker flavor inference from filename
alexcrichton Mar 19, 2019
0e94541
rustc: Allow using `clang` for wasm32 targets
alexcrichton Mar 19, 2019
8ea435c
ffi: rename VaList::copy to VaList::with_copy
dlrobertson Mar 22, 2019
3eb4eae
Fixes #59361
peterjoel Mar 22, 2019
02b8533
Add a way to track Rustfix UI test coverage
phansch Mar 24, 2019
695dfe7
compiletest: make path normalization smarter
euclio Mar 13, 2019
d485ebf
Fix two bootstrap tests
phansch Mar 25, 2019
98d7c54
s/lints/diagnostics
phansch Mar 25, 2019
d808bd4
Save coverage file in build_base path, not /tmp
phansch Mar 25, 2019
4bad56e
When moving out of a for loop head, suggest borrowing it in nll mode
estebank Mar 26, 2019
0b7b454
Combine input and eval_always query types
Zoxc Mar 10, 2019
629e3a3
Make crate_variances a regular query
Zoxc Mar 14, 2019
8f3e862
fixed shift overflow
hellow554 Mar 28, 2019
f90ac4f
Rollup merge of #58717 - hellow554:nonzero_parse, r=oli-obk
Centril Mar 28, 2019
edad34b
Rollup merge of #59091 - Zoxc:eval_always, r=michaelwoerister
Centril Mar 28, 2019
4720fca
Rollup merge of #59216 - stepnivlk:type_dependent_defs-wrappers, r=ol…
Centril Mar 28, 2019
f6d2a3f
Rollup merge of #59318 - alexcrichton:check-for-clang, r=michaelwoeri…
Centril Mar 28, 2019
9ca8f6a
Rollup merge of #59320 - alexcrichton:wasm-clang, r=sanxiyn
Centril Mar 28, 2019
f591d25
Rollup merge of #59363 - peterjoel:issue_59361_edition_opt_shortlist,…
Centril Mar 28, 2019
a92d689
Rollup merge of #59371 - dlrobertson:rename_va_list_copy, r=joshtriplett
Centril Mar 28, 2019
b75b165
Rollup merge of #59398 - phansch:rustfix_coverage, r=oli-obk
Centril Mar 28, 2019
06a9196
Rollup merge of #59408 - euclio:compiletest-normalization, r=oli-obk
Centril Mar 28, 2019
0f26958
Rollup merge of #59429 - estebank:for-loop-move-nll, r=petrochenkov
Centril Mar 28, 2019
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
2 changes: 2 additions & 0 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1856,6 +1856,7 @@ mod __test {
doc_tests: DocTests::No,
bless: false,
compare_mode: None,
rustfix_coverage: false,
};

let build = Build::new(config);
Expand Down Expand Up @@ -1897,6 +1898,7 @@ mod __test {
doc_tests: DocTests::No,
bless: false,
compare_mode: None,
rustfix_coverage: false,
};

let build = Build::new(config);
Expand Down
15 changes: 15 additions & 0 deletions src/bootstrap/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ pub enum Subcommand {
rustc_args: Vec<String>,
fail_fast: bool,
doc_tests: DocTests,
rustfix_coverage: bool,
},
Bench {
paths: Vec<PathBuf>,
Expand Down Expand Up @@ -188,6 +189,12 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`"
"mode describing what file the actual ui output will be compared to",
"COMPARE MODE",
);
opts.optflag(
"",
"rustfix-coverage",
"enable this to generate a Rustfix coverage file, which is saved in \
`/<build_base>/rustfix_missing_coverage.txt`",
);
}
"bench" => {
opts.optmulti("", "test-args", "extra arguments", "ARGS");
Expand Down Expand Up @@ -363,6 +370,7 @@ Arguments:
test_args: matches.opt_strs("test-args"),
rustc_args: matches.opt_strs("rustc-args"),
fail_fast: !matches.opt_present("no-fail-fast"),
rustfix_coverage: matches.opt_present("rustfix-coverage"),
doc_tests: if matches.opt_present("doc") {
DocTests::Only
} else if matches.opt_present("no-doc") {
Expand Down Expand Up @@ -467,6 +475,13 @@ impl Subcommand {
}
}

pub fn rustfix_coverage(&self) -> bool {
match *self {
Subcommand::Test { rustfix_coverage, .. } => rustfix_coverage,
_ => false,
}
}

pub fn compare_mode(&self) -> Option<&str> {
match *self {
Subcommand::Test {
Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1284,6 +1284,10 @@ impl Step for Compiletest {
cmd.arg("--android-cross-path").arg("");
}

if builder.config.cmd.rustfix_coverage() {
cmd.arg("--rustfix-coverage");
}

builder.ci_env.force_coloring_in_ci(&mut cmd);

let _folder = builder.fold_output(|| format!("test_{}", suite));
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ impl<'a> VaList<'a> {
reason = "the `c_variadic` feature has not been properly tested on \
all supported platforms",
issue = "44930")]
pub unsafe fn copy<F, R>(&self, f: F) -> R
pub unsafe fn with_copy<F, R>(&self, f: F) -> R
where F: for<'copy> FnOnce(VaList<'copy>) -> R {
#[cfg(any(all(not(target_arch = "aarch64"), not(target_arch = "powerpc"),
not(target_arch = "x86_64")),
Expand Down
24 changes: 24 additions & 0 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,24 @@ nonzero_integers! {
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroIsize(isize);
}

macro_rules! from_str_radix_nzint_impl {
($($t:ty)*) => {$(
#[stable(feature = "nonzero_parse", since = "1.35.0")]
impl FromStr for $t {
type Err = ParseIntError;
fn from_str(src: &str) -> Result<Self, Self::Err> {
Self::new(from_str_radix(src, 10)?)
.ok_or(ParseIntError {
kind: IntErrorKind::Zero
})
}
}
)*}
}

from_str_radix_nzint_impl! { NonZeroU8 NonZeroU16 NonZeroU32 NonZeroU64 NonZeroU128 NonZeroUsize
NonZeroI8 NonZeroI16 NonZeroI32 NonZeroI64 NonZeroI128 NonZeroIsize }

/// Provides intentionally-wrapped arithmetic on `T`.
///
/// Operations like `+` on `u32` values is intended to never overflow,
Expand Down Expand Up @@ -4768,6 +4786,11 @@ pub enum IntErrorKind {
Overflow,
/// Integer is too small to store in target integer type.
Underflow,
/// Value was Zero
///
/// This variant will be emitted when the parsing string has a value of zero, which
/// would be illegal for non-zero types.
Zero,
}

impl ParseIntError {
Expand All @@ -4790,6 +4813,7 @@ impl ParseIntError {
IntErrorKind::InvalidDigit => "invalid digit found in string",
IntErrorKind::Overflow => "number too large to fit in target type",
IntErrorKind::Underflow => "number too small to fit in target type",
IntErrorKind::Zero => "number would be zero for non-zero type",
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/libcore/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#![feature(slice_internals)]
#![feature(slice_partition_dedup)]
#![feature(copy_within)]
#![feature(int_error_matching)]

extern crate core;
extern crate test;
Expand Down
26 changes: 23 additions & 3 deletions src/libcore/tests/nonzero.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use core::num::{NonZeroU32, NonZeroI32};
use core::option::Option;
use core::option::Option::{Some, None};
use core::num::{IntErrorKind, NonZeroI32, NonZeroI8, NonZeroU32, NonZeroU8};
use core::option::Option::{self, None, Some};
use std::mem::size_of;

#[test]
Expand Down Expand Up @@ -126,3 +125,24 @@ fn test_from_signed_nonzero() {
let num: i32 = nz.into();
assert_eq!(num, 1i32);
}

#[test]
fn test_from_str() {
assert_eq!("123".parse::<NonZeroU8>(), Ok(NonZeroU8::new(123).unwrap()));
assert_eq!(
"0".parse::<NonZeroU8>().err().map(|e| e.kind().clone()),
Some(IntErrorKind::Zero)
);
assert_eq!(
"-1".parse::<NonZeroU8>().err().map(|e| e.kind().clone()),
Some(IntErrorKind::InvalidDigit)
);
assert_eq!(
"-129".parse::<NonZeroI8>().err().map(|e| e.kind().clone()),
Some(IntErrorKind::Underflow)
);
assert_eq!(
"257".parse::<NonZeroU8>().err().map(|e| e.kind().clone()),
Some(IntErrorKind::Overflow)
);
}
78 changes: 30 additions & 48 deletions src/librustc/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ macro_rules! is_anon_attr {
($attr:ident) => (false);
}

macro_rules! is_input_attr {
(input) => (true);
($attr:ident) => (false);
}

macro_rules! is_eval_always_attr {
(eval_always) => (true);
($attr:ident) => (false);
Expand All @@ -99,10 +94,6 @@ macro_rules! contains_anon_attr {
($($attr:ident),*) => ({$(is_anon_attr!($attr) | )* false});
}

macro_rules! contains_input_attr {
($($attr:ident),*) => ({$(is_input_attr!($attr) | )* false});
}

macro_rules! contains_eval_always_attr {
($($attr:ident),*) => ({$(is_eval_always_attr!($attr) | )* false});
}
Expand Down Expand Up @@ -151,7 +142,7 @@ macro_rules! define_dep_nodes {
}
}

// FIXME: Make `is_anon`, `is_input`, `is_eval_always` and `has_params` properties
// FIXME: Make `is_anon`, `is_eval_always` and `has_params` properties
// of queries
#[inline(always)]
pub fn is_anon(&self) -> bool {
Expand All @@ -162,15 +153,6 @@ macro_rules! define_dep_nodes {
}
}

#[inline(always)]
pub fn is_input(&self) -> bool {
match *self {
$(
DepKind :: $variant => { contains_input_attr!($($attr),*) }
)*
}
}

#[inline(always)]
pub fn is_eval_always(&self) -> bool {
match *self {
Expand Down Expand Up @@ -438,17 +420,17 @@ rustc_dep_node_append!([define_dep_nodes!][ <'tcx>
// suitable wrapper, you can use `tcx.dep_graph.ignore()` to gain
// access to the krate, but you must remember to add suitable
// edges yourself for the individual items that you read.
[input] Krate,
[eval_always] Krate,

// Represents the body of a function or method. The def-id is that of the
// function/method.
[input] HirBody(DefId),
[eval_always] HirBody(DefId),

// Represents the HIR node with the given node-id
[input] Hir(DefId),
[eval_always] Hir(DefId),

// Represents metadata from an extern crate.
[input] CrateMetadata(CrateNum),
[eval_always] CrateMetadata(CrateNum),

// Represents different phases in the compiler.
[] RegionScopeTree(DefId),
Expand Down Expand Up @@ -481,7 +463,7 @@ rustc_dep_node_append!([define_dep_nodes!][ <'tcx>
[] CollectModItemTypes(DefId),

[] Reachability,
[eval_always] CrateVariances,
[] CrateVariances,

// Nodes representing bits of computed IR in the tcx. Each shared
// table in the tcx (or elsewhere) maps to one of these
Expand Down Expand Up @@ -534,7 +516,7 @@ rustc_dep_node_append!([define_dep_nodes!][ <'tcx>
// The set of impls for a given trait.
[] TraitImpls(DefId),

[input] AllLocalTraitImpls,
[eval_always] AllLocalTraitImpls,

[anon] TraitSelect,

Expand All @@ -546,7 +528,7 @@ rustc_dep_node_append!([define_dep_nodes!][ <'tcx>
// to make type debuginfo to be source location independent. Declaring
// DefSpan an input makes sure that changes to these are always detected
// regardless of HIR hashing.
[input] DefSpan(DefId),
[eval_always] DefSpan(DefId),
[] LookupStability(DefId),
[] LookupDeprecationEntry(DefId),
[] ConstIsRvaluePromotableToStatic(DefId),
Expand All @@ -564,10 +546,10 @@ rustc_dep_node_append!([define_dep_nodes!][ <'tcx>
[] IsCompilerBuiltins(CrateNum),
[] HasGlobalAllocator(CrateNum),
[] HasPanicHandler(CrateNum),
[input] ExternCrate(DefId),
[eval_always] ExternCrate(DefId),
[] Specializes { impl1: DefId, impl2: DefId },
[input] InScopeTraits(DefIndex),
[input] ModuleExports(DefId),
[eval_always] InScopeTraits(DefIndex),
[eval_always] ModuleExports(DefId),
[] IsSanitizerRuntime(CrateNum),
[] IsProfilerRuntime(CrateNum),
[] GetPanicStrategy(CrateNum),
Expand All @@ -580,10 +562,10 @@ rustc_dep_node_append!([define_dep_nodes!][ <'tcx>
[] EntryFn(CrateNum),
[] PluginRegistrarFn(CrateNum),
[] ProcMacroDeclsStatic(CrateNum),
[input] CrateDisambiguator(CrateNum),
[input] CrateHash(CrateNum),
[input] OriginalCrateName(CrateNum),
[input] ExtraFileName(CrateNum),
[eval_always] CrateDisambiguator(CrateNum),
[eval_always] CrateHash(CrateNum),
[eval_always] OriginalCrateName(CrateNum),
[eval_always] ExtraFileName(CrateNum),

[] ImplementationsOfTrait { krate: CrateNum, trait_id: DefId },
[] AllTraitImplementations(CrateNum),
Expand All @@ -592,16 +574,16 @@ rustc_dep_node_append!([define_dep_nodes!][ <'tcx>
[] IsDllimportForeignItem(DefId),
[] IsStaticallyIncludedForeignItem(DefId),
[] NativeLibraryKind(DefId),
[input] LinkArgs,
[eval_always] LinkArgs,

[] ResolveLifetimes(CrateNum),
[] NamedRegion(DefIndex),
[] IsLateBound(DefIndex),
[] ObjectLifetimeDefaults(DefIndex),

[] Visibility(DefId),
[input] DepKind(CrateNum),
[input] CrateName(CrateNum),
[eval_always] DepKind(CrateNum),
[eval_always] CrateName(CrateNum),
[] ItemChildren(DefId),
[] ExternModStmtCnum(DefId),
[eval_always] GetLibFeatures,
Expand All @@ -610,24 +592,24 @@ rustc_dep_node_append!([define_dep_nodes!][ <'tcx>
[] DefinedLangItems(CrateNum),
[] MissingLangItems(CrateNum),
[] VisibleParentMap,
[input] MissingExternCrateItem(CrateNum),
[input] UsedCrateSource(CrateNum),
[input] PostorderCnums,

[input] Freevars(DefId),
[input] MaybeUnusedTraitImport(DefId),
[input] MaybeUnusedExternCrates,
[input] NamesImportedByGlobUse(DefId),
[eval_always] MissingExternCrateItem(CrateNum),
[eval_always] UsedCrateSource(CrateNum),
[eval_always] PostorderCnums,

[eval_always] Freevars(DefId),
[eval_always] MaybeUnusedTraitImport(DefId),
[eval_always] MaybeUnusedExternCrates,
[eval_always] NamesImportedByGlobUse(DefId),
[eval_always] StabilityIndex,
[eval_always] AllTraits,
[input] AllCrateNums,
[eval_always] AllCrateNums,
[] ExportedSymbols(CrateNum),
[eval_always] CollectAndPartitionMonoItems,
[] IsCodegenedItem(DefId),
[] CodegenUnit(InternedString),
[] BackendOptimizationLevel(CrateNum),
[] CompileCodegenUnit(InternedString),
[input] OutputFilenames,
[eval_always] OutputFilenames,
[] NormalizeProjectionTy(CanonicalProjectionGoal<'tcx>),
[] NormalizeTyAfterErasingRegions(ParamEnvAnd<'tcx, Ty<'tcx>>),
[] ImpliedOutlivesBounds(CanonicalTyGoal<'tcx>),
Expand All @@ -646,11 +628,11 @@ rustc_dep_node_append!([define_dep_nodes!][ <'tcx>
[] SubstituteNormalizeAndTestPredicates { key: (DefId, SubstsRef<'tcx>) },
[] MethodAutoderefSteps(CanonicalTyGoal<'tcx>),

[input] TargetFeaturesWhitelist,
[eval_always] TargetFeaturesWhitelist,

[] InstanceDefSizeEstimate { instance_def: InstanceDef<'tcx> },

[input] Features,
[eval_always] Features,

[] ForeignModules(CrateNum),

Expand Down
Loading