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 12 pull requests #78328

Closed
wants to merge 56 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
16d65d0
revise Hermit's mutex interface to support the behaviour of StaticMutex
stlankes Oct 6, 2020
98fcc3f
using the latest version of libhermit-rs
stlankes Oct 6, 2020
d560b50
revise code to pass the format check
stlankes Oct 6, 2020
986c1fc
revise comments and descriptions of the helper functions
stlankes Oct 7, 2020
d6e955f
fix typos in new method
stlankes Oct 9, 2020
530f575
revise code to pass the format check
stlankes Oct 9, 2020
8d8a290
add hermit to the list of omit OS
stlankes Oct 9, 2020
33fd08b
remove obsolete function diverge
stlankes Oct 12, 2020
30c3dad
reuse implementation of the system provider "unsupported"
stlankes Oct 12, 2020
1741e5b
define required type 'MovableMutex'
stlankes Oct 12, 2020
bc6b2ac
move __rg_oom to the libos to avoid duplicated symbols
stlankes Oct 13, 2020
77d9831
minor changes to pass the format check
stlankes Oct 13, 2020
bf268fe
box mutex to get a movable mutex
stlankes Oct 13, 2020
3b37d94
Add some tests
Nadrieril Oct 17, 2020
bb81110
Destructure byte array constants to array patterns instead of keeping…
oli-obk Sep 29, 2020
c3d0445
Destructure byte slices and remove all the workarounds
oli-obk Oct 1, 2020
99852e0
A ConstantValue constructor with a slice pattern is an error
Nadrieril Oct 17, 2020
3708c86
Treat booleans as integers with valid range 0..=1
oli-obk Oct 2, 2020
f504e9a
Fix comment
Nadrieril Oct 17, 2020
aa41720
Handle ranges of float consistently
Nadrieril Oct 17, 2020
d1a784e
Treat string literals separately from other constants
Nadrieril Oct 17, 2020
da0ba2f
The only remaining constant patterns are opaque
Nadrieril Oct 18, 2020
c4ae6c2
Add comment
Nadrieril Oct 18, 2020
2780e35
Throw core::panic!("message") as &str instead of String.
m-ou-se Oct 19, 2020
9890217
Fix ui test for updated core::panic behaviour.
m-ou-se Oct 19, 2020
5bfd3e7
Accidentally fixed #78071
Nadrieril Oct 19, 2020
a4dc92b
Introduce a temporary for discriminant value in MatchBranchSimplifica…
tmiasko Oct 21, 2020
3519411
Add a test for #53708
Nadrieril Oct 21, 2020
faf8710
Explain the `Opaque` special case in specialization
Nadrieril Oct 21, 2020
3a58ad9
Update `compiler_builtins` to 0.1.36
JohnTitor Oct 21, 2020
4f7ffbf
Fix const core::panic!(non_literal_str).
m-ou-se Sep 5, 2020
7130127
Add test for const panic!(CONST).
m-ou-se Oct 18, 2020
0a4d948
Remove unused ProfileCategory.
cjgillot Jun 7, 2020
de76370
Remove unused category from macros.
cjgillot Oct 11, 2020
de7da7f
Unify query name and node name.
cjgillot Oct 11, 2020
e853cc0
Retire rustc_dep_node_force.
cjgillot Oct 11, 2020
57ba8ed
Retire rustc_dep_node_try_load_from_on_disk_cache.
cjgillot Oct 11, 2020
6ad140c
const_eval_checked: deal with unused nodes + div
lcnr Oct 23, 2020
7d30c53
Bump backtrace-rs to enable Mach-O support on iOS.
cutsoy Oct 23, 2020
47cb871
review
lcnr Oct 23, 2020
b334eef
Do not ICE with TraitPredicates containing [type error]
estebank Oct 14, 2020
f71e9ed
review comments
estebank Oct 23, 2020
6533d01
Don't generate multiple impl blocks
bugadani Oct 24, 2020
3e6acd8
Add `#[cfg(panic = "...")]`
davidhewitt Jul 25, 2020
61a37a3
Rollup merge of #74754 - davidhewitt:cfg-panic, r=ecstatic-morse
jonas-schievink Oct 24, 2020
16ba40e
Rollup merge of #77610 - hermitcore:dtors, r=m-ou-se
jonas-schievink Oct 24, 2020
d7ecead
Rollup merge of #77830 - cjgillot:remacro, r=oli-obk
jonas-schievink Oct 24, 2020
c816628
Rollup merge of #77930 - estebank:ice-77919, r=eddyb
jonas-schievink Oct 24, 2020
268d0f4
Rollup merge of #78069 - fusion-engineering-forks:core-const-panic-st…
jonas-schievink Oct 24, 2020
280cb9d
Rollup merge of #78072 - Nadrieril:cleanup-constant-matching, r=varkor
jonas-schievink Oct 24, 2020
1fdd40e
Rollup merge of #78119 - fusion-engineering-forks:panic-use-as-str, r…
jonas-schievink Oct 24, 2020
9a1fc6a
Rollup merge of #78191 - tmiasko:temp-match-branch-simplification, r=…
jonas-schievink Oct 24, 2020
b7cb948
Rollup merge of #78209 - JohnTitor:compiler-builtins, r=Amanieu
jonas-schievink Oct 24, 2020
d4e112e
Rollup merge of #78272 - lcnr:abstract-const-unused-node, r=oli-obk
jonas-schievink Oct 24, 2020
e13f2fb
Rollup merge of #78276 - cutsoy:bump-backtrace, r=nagisa
jonas-schievink Oct 24, 2020
fd038b5
Rollup merge of #78318 - bugadani:tyctx-impl, r=petrochenkov
jonas-schievink Oct 24, 2020
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
8 changes: 4 additions & 4 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -626,9 +626,9 @@ dependencies = [

[[package]]
name = "compiler_builtins"
version = "0.1.35"
version = "0.1.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3fcd8aba10d17504c87ef12d4f62ef404c6a4703d16682a9eb5543e6cf24455"
checksum = "7cd0782e0a7da7598164153173e5a5d4d9b1da094473c98dce0ff91406112369"
dependencies = [
"cc",
"rustc-std-workspace-core",
Expand Down Expand Up @@ -1366,9 +1366,9 @@ dependencies = [

[[package]]
name = "hermit-abi"
version = "0.1.15"
version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9"
checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8"
dependencies = [
"compiler_builtins",
"libc",
Expand Down
11 changes: 0 additions & 11 deletions compiler/rustc_data_structures/src/profiling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,6 @@ cfg_if! {

type Profiler = measureme::Profiler<SerializationSink>;

#[derive(Clone, Copy, Debug, PartialEq, Eq, Ord, PartialOrd)]
pub enum ProfileCategory {
Parsing,
Expansion,
TypeChecking,
BorrowChecking,
Codegen,
Linking,
Other,
}

bitflags::bitflags! {
struct EventFilter: u32 {
const GENERIC_ACTIVITIES = 1 << 0;
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_feature/src/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,9 @@ declare_features! (
/// Allow anonymous constants from an inline `const` block
(active, inline_const, "1.49.0", Some(76001), None),

/// Enables `#[cfg(panic = "...")]` config key.
(active, cfg_panic, "1.49.0", Some(77443), None),

// -------------------------------------------------------------------------
// feature-group-end: actual feature gates
// -------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_feature/src/builtin_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const GATED_CFGS: &[GatedCfg] = &[
),
(sym::sanitize, sym::cfg_sanitize, cfg_fn!(cfg_sanitize)),
(sym::version, sym::cfg_version, cfg_fn!(cfg_version)),
(sym::panic, sym::cfg_panic, cfg_fn!(cfg_panic)),
];

/// Find a gated cfg determined by the `pred`icate which is given the cfg's name.
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_hir/src/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ language_item_table! {
// is required to define it somewhere. Additionally, there are restrictions on crates that use
// a weak lang item, but do not have it defined.
Panic, sym::panic, panic_fn, Target::Fn;
PanicStr, sym::panic_str, panic_str, Target::Fn;
PanicBoundsCheck, sym::panic_bounds_check, panic_bounds_check_fn, Target::Fn;
PanicInfo, sym::panic_info, panic_info, Target::Struct;
PanicLocation, sym::panic_location, panic_location, Target::Struct;
Expand Down
72 changes: 6 additions & 66 deletions compiler/rustc_macros/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,11 @@ impl<T: Parse> Parse for List<T> {
}

/// A named group containing queries.
///
/// For now, the name is not used any more, but the capability remains interesting for future
/// developments of the query system.
struct Group {
#[allow(unused)]
name: Ident,
queries: List<Query>,
}
Expand Down Expand Up @@ -417,12 +421,9 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
let mut query_stream = quote! {};
let mut query_description_stream = quote! {};
let mut dep_node_def_stream = quote! {};
let mut dep_node_force_stream = quote! {};
let mut try_load_from_on_disk_cache_stream = quote! {};
let mut cached_queries = quote! {};

for group in groups.0 {
let mut group_stream = quote! {};
for mut query in group.queries.0 {
let modifiers = process_modifiers(&mut query);
let name = &query.name;
Expand All @@ -437,22 +438,6 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
cached_queries.extend(quote! {
#name,
});

try_load_from_on_disk_cache_stream.extend(quote! {
::rustc_middle::dep_graph::DepKind::#name => {
if <#arg as DepNodeParams<TyCtxt<'_>>>::can_reconstruct_query_key() {
debug_assert!($tcx.dep_graph
.node_color($dep_node)
.map(|c| c.is_green())
.unwrap_or(false));

let key = <#arg as DepNodeParams<TyCtxt<'_>>>::recover($tcx, $dep_node).unwrap();
if queries::#name::cache_on_disk($tcx, &key, None) {
let _ = $tcx.#name(key);
}
}
}
});
}

let mut attributes = Vec::new();
Expand Down Expand Up @@ -485,47 +470,20 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
let attribute_stream = quote! {#(#attributes),*};
let doc_comments = query.doc_comments.iter();
// Add the query to the group
group_stream.extend(quote! {
query_stream.extend(quote! {
#(#doc_comments)*
[#attribute_stream] fn #name: #name(#arg) #result,
[#attribute_stream] fn #name(#arg) #result,
});

// Create a dep node for the query
dep_node_def_stream.extend(quote! {
[#attribute_stream] #name(#arg),
});

// Add a match arm to force the query given the dep node
dep_node_force_stream.extend(quote! {
::rustc_middle::dep_graph::DepKind::#name => {
if <#arg as DepNodeParams<TyCtxt<'_>>>::can_reconstruct_query_key() {
if let Some(key) = <#arg as DepNodeParams<TyCtxt<'_>>>::recover($tcx, $dep_node) {
force_query::<crate::ty::query::queries::#name<'_>, _>(
$tcx,
key,
DUMMY_SP,
*$dep_node
);
return true;
}
}
}
});

add_query_description_impl(&query, modifiers, &mut query_description_stream);
}
let name = &group.name;
query_stream.extend(quote! {
#name { #group_stream },
});
}

dep_node_force_stream.extend(quote! {
::rustc_middle::dep_graph::DepKind::Null => {
bug!("Cannot force dep node: {:?}", $dep_node)
}
});

TokenStream::from(quote! {
macro_rules! rustc_query_append {
([$($macro:tt)*][$($other:tt)*]) => {
Expand All @@ -546,30 +504,12 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
);
}
}
macro_rules! rustc_dep_node_force {
([$dep_node:expr, $tcx:expr] $($other:tt)*) => {
match $dep_node.kind {
$($other)*

#dep_node_force_stream
}
}
}
macro_rules! rustc_cached_queries {
($($macro:tt)*) => {
$($macro)*(#cached_queries);
}
}

#query_description_stream

macro_rules! rustc_dep_node_try_load_from_on_disk_cache {
($dep_node:expr, $tcx:expr) => {
match $dep_node.kind {
#try_load_from_on_disk_cache_stream
_ => (),
}
}
}
})
}
8 changes: 4 additions & 4 deletions compiler/rustc_middle/src/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2036,13 +2036,13 @@ direct_interners! {

macro_rules! slice_interners {
($($field:ident: $method:ident($ty:ty)),+ $(,)?) => (
$(impl<'tcx> TyCtxt<'tcx> {
pub fn $method(self, v: &[$ty]) -> &'tcx List<$ty> {
impl<'tcx> TyCtxt<'tcx> {
$(pub fn $method(self, v: &[$ty]) -> &'tcx List<$ty> {
self.interners.$field.intern_ref(v, || {
Interned(List::from_arena(&*self.arena, v))
}).0
}
})+
})+
}
);
}

Expand Down
70 changes: 57 additions & 13 deletions compiler/rustc_middle/src/ty/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ use crate::ty::util::AlwaysRequiresDrop;
use crate::ty::{self, AdtSizedConstraint, CrateInherentImpls, ParamEnvAnd, Ty, TyCtxt};
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
use rustc_data_structures::profiling::ProfileCategory::*;
use rustc_data_structures::stable_hasher::StableVec;
use rustc_data_structures::svh::Svh;
use rustc_data_structures::sync::Lrc;
Expand Down Expand Up @@ -169,26 +168,71 @@ pub fn force_from_dep_node<'tcx>(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> bool
return false;
}

rustc_dep_node_force!([dep_node, tcx]
// These are inputs that are expected to be pre-allocated and that
// should therefore always be red or green already.
DepKind::CrateMetadata |
macro_rules! force_from_dep_node {
($($(#[$attr:meta])* [$($modifiers:tt)*] $name:ident($K:ty),)*) => {
match dep_node.kind {
// These are inputs that are expected to be pre-allocated and that
// should therefore always be red or green already.
DepKind::CrateMetadata |

// These are anonymous nodes.
DepKind::TraitSelect |
// These are anonymous nodes.
DepKind::TraitSelect |

// We don't have enough information to reconstruct the query key of
// these.
DepKind::CompileCodegenUnit => {
bug!("force_from_dep_node: encountered {:?}", dep_node)
// We don't have enough information to reconstruct the query key of
// these.
DepKind::CompileCodegenUnit |

// Forcing this makes no sense.
DepKind::Null => {
bug!("force_from_dep_node: encountered {:?}", dep_node)
}

$(DepKind::$name => {
debug_assert!(<$K as DepNodeParams<TyCtxt<'_>>>::can_reconstruct_query_key());

if let Some(key) = <$K as DepNodeParams<TyCtxt<'_>>>::recover(tcx, dep_node) {
force_query::<queries::$name<'_>, _>(
tcx,
key,
DUMMY_SP,
*dep_node
);
return true;
}
})*
}
}
);
}

rustc_dep_node_append! { [force_from_dep_node!][] }

false
}

pub(crate) fn try_load_from_on_disk_cache<'tcx>(tcx: TyCtxt<'tcx>, dep_node: &DepNode) {
rustc_dep_node_try_load_from_on_disk_cache!(dep_node, tcx)
macro_rules! try_load_from_on_disk_cache {
($($name:ident,)*) => {
match dep_node.kind {
$(DepKind::$name => {
if <query_keys::$name<'tcx> as DepNodeParams<TyCtxt<'_>>>::can_reconstruct_query_key() {
debug_assert!(tcx.dep_graph
.node_color(dep_node)
.map(|c| c.is_green())
.unwrap_or(false));

let key = <query_keys::$name<'tcx> as DepNodeParams<TyCtxt<'_>>>::recover(tcx, dep_node).unwrap();
if queries::$name::cache_on_disk(tcx, &key, None) {
let _ = tcx.$name(key);
}
}
})*

_ => (),
}
}
}

rustc_cached_queries!(try_load_from_on_disk_cache!);
}

mod sealed {
Expand Down
20 changes: 4 additions & 16 deletions compiler/rustc_middle/src/ty/query/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,33 +242,22 @@ macro_rules! hash_result {
};
}

macro_rules! define_queries {
(<$tcx:tt> $($category:tt {
$($(#[$attr:meta])* [$($modifiers:tt)*] fn $name:ident: $node:ident($($K:tt)*) -> $V:ty,)*
},)*) => {
define_queries_inner! { <$tcx>
$($( $(#[$attr])* category<$category> [$($modifiers)*] fn $name: $node($($K)*) -> $V,)*)*
}
}
}

macro_rules! query_helper_param_ty {
(DefId) => { impl IntoQueryParam<DefId> };
($K:ty) => { $K };
}

macro_rules! define_queries_inner {
macro_rules! define_queries {
(<$tcx:tt>
$($(#[$attr:meta])* category<$category:tt>
[$($modifiers:tt)*] fn $name:ident: $node:ident($($K:tt)*) -> $V:ty,)*) => {
$($(#[$attr:meta])*
[$($modifiers:tt)*] fn $name:ident($($K:tt)*) -> $V:ty,)*) => {

use std::mem;
use crate::{
rustc_data_structures::stable_hasher::HashStable,
rustc_data_structures::stable_hasher::StableHasher,
ich::StableHashingContext
};
use rustc_data_structures::profiling::ProfileCategory;

define_queries_struct! {
tcx: $tcx,
Expand Down Expand Up @@ -362,13 +351,12 @@ macro_rules! define_queries_inner {
as QueryStorage
>::Stored;
const NAME: &'static str = stringify!($name);
const CATEGORY: ProfileCategory = $category;
}

impl<$tcx> QueryAccessors<TyCtxt<$tcx>> for queries::$name<$tcx> {
const ANON: bool = is_anon!([$($modifiers)*]);
const EVAL_ALWAYS: bool = is_eval_always!([$($modifiers)*]);
const DEP_KIND: dep_graph::DepKind = dep_graph::DepKind::$node;
const DEP_KIND: dep_graph::DepKind = dep_graph::DepKind::$name;

type Cache = query_storage!([$($modifiers)*][$($K)*, $V]);

Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_middle/src/ty/query/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ pub fn print_stats(tcx: TyCtxt<'_>) {
}

macro_rules! print_stats {
(<$tcx:tt> $($category:tt {
$($(#[$attr:meta])* [$($modifiers:tt)*] fn $name:ident: $node:ident($K:ty) -> $V:ty,)*
},)*) => {
(<$tcx:tt>
$($(#[$attr:meta])* [$($modifiers:tt)*] fn $name:ident($K:ty) -> $V:ty,)*
) => {
fn query_stats(tcx: TyCtxt<'_>) -> Vec<QueryStats> {
let mut queries = Vec::new();

$($(
$(
queries.push(stats::<
crate::dep_graph::DepKind,
<TyCtxt<'_> as QueryContext>::Query,
Expand All @@ -135,7 +135,7 @@ macro_rules! print_stats {
stringify!($name),
&tcx.queries.$name,
));
)*)*
)*

queries
}
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_mir/src/const_eval/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ impl<'mir, 'tcx> InterpCx<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>> {
) -> InterpResult<'tcx> {
let def_id = instance.def_id();
if Some(def_id) == self.tcx.lang_items().panic_fn()
|| Some(def_id) == self.tcx.lang_items().panic_str()
|| Some(def_id) == self.tcx.lang_items().begin_panic_fn()
{
// &'static str
// &str
assert!(args.len() == 1);

let msg_place = self.deref_operand(args[0])?;
Expand Down
Loading