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 #61943

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
45bb409
Only show methods that appear in the impl block for types in the Impl…
ebarnard Jun 3, 2019
5fa8b52
move stray run-pass const tests into const/ folder
RalfJung Jun 9, 2019
ea1bec3
Turn down the myriad-closures test
alexcrichton Jun 14, 2019
007aaba
Remove unnecessary lift calls
Zoxc Jun 14, 2019
56e30e1
Tweak transparent enums and unions diagnostic spans
estebank Jun 11, 2019
f06b761
review comments: move diagnostic code out of happy path
estebank Jun 12, 2019
961ba8f
syntax: Factor out common fields from `SyntaxExtension` variants
petrochenkov Jun 16, 2019
679000c
allow_internal_unstable: Avoid some more allocations
petrochenkov Jun 16, 2019
085a8d0
syntax: Remove `DummyResolver`
petrochenkov Jun 17, 2019
68e1141
resolve: Avoid creating fresh syntax extensions for all non-macro att…
petrochenkov Jun 17, 2019
8ec502e
syntax: Introduce `default`/`with_unstable` constructors for `ExpnInfo`
petrochenkov Jun 17, 2019
2de2278
syntax: Move `default_transparency` into `ExpnInfo`
petrochenkov Jun 17, 2019
1ff3bce
hygiene: Avoid some unnecessary `ExpnInfo` clones
petrochenkov Jun 17, 2019
e152554
resolve/expand: Move expansion info setting to a single earlier point
petrochenkov Jun 18, 2019
0f9dc6c
Make MaybeUninit #[repr(transparent)]
mjbshaw Jun 12, 2019
dedf2ed
rustc_typeck: correctly compute `Substs` for `Res::SelfCtor`.
eddyb Jun 16, 2019
831ddf7
ci: Add a script for generating CPU usage graphs
alexcrichton Jun 14, 2019
d8eea92
create an issue for miri even in status test-fail
RalfJung Jun 18, 2019
830d15d
Rollup merge of #61505 - ebarnard:doc-shrink, r=GuillaumeGomez
Centril Jun 18, 2019
26880f6
Rollup merge of #61701 - RalfJung:const-tests, r=cramertj
Centril Jun 18, 2019
43ebb35
Rollup merge of #61748 - estebank:transparent-span, r=Centril
Centril Jun 18, 2019
32254ac
Rollup merge of #61802 - mjbshaw:maybe-uninit-transparent, r=cramertj
Centril Jun 18, 2019
4301ebd
Rollup merge of #61839 - alexcrichton:pr-and-master-builds, r=pietroa…
Centril Jun 18, 2019
78f9399
Rollup merge of #61842 - Zoxc:trim-lift, r=eddyb
Centril Jun 18, 2019
ebf9696
Rollup merge of #61843 - alexcrichton:disable-myriad-closures, r=piet…
Centril Jun 18, 2019
f755231
Rollup merge of #61896 - eddyb:correct-self-ctor, r=petrochenkov
Centril Jun 18, 2019
0bb197c
Rollup merge of #61898 - petrochenkov:sekind, r=eddyb
Centril Jun 18, 2019
0b8da29
Rollup merge of #61938 - RalfJung:miri-toolstate, r=kennytm
Centril Jun 18, 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
19 changes: 2 additions & 17 deletions src/ci/cpu-usage-over-time.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,8 @@
# the second column is always zero.
#
# Once you've downloaded a file there's various ways to plot it and visualize
# it. For command line usage you can use a script like so:
#
# set timefmt '%Y-%m-%dT%H:%M:%S'
# set xdata time
# set ylabel "Idle CPU %"
# set xlabel "Time"
# set datafile sep ','
# set term png
# set output "printme.png"
# set grid
# builder = "i686-apple"
# plot "cpu-".builder.".csv" using 1:2 with lines title builder
#
# Executed as `gnuplot < ./foo.plot` it will generate a graph called
# `printme.png` which you can then open up. If you know how to improve this
# script or the viewing process that would be much appreciated :) (or even if
# you know how to automate it!)
# it. For command line usage you use the `src/etc/cpu-usage-over-time-plot.sh`
# script in this repository.

import datetime
import sys
Expand Down
2 changes: 1 addition & 1 deletion src/doc/unstable-book/src/language-features/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ The advantages over a simple `fn(&str) -> u32` are:
In addition to procedural macros, you can define new
[`derive`](../../reference/attributes/derive.md)-like attributes and other kinds
of extensions. See `Registry::register_syntax_extension` and the
`SyntaxExtension` enum. For a more involved macro example, see
`SyntaxExtension` struct. For a more involved macro example, see
[`regex_macros`](https://github.com/rust-lang/regex/blob/master/regex_macros/src/lib.rs).


Expand Down
49 changes: 49 additions & 0 deletions src/etc/cpu-usage-over-time-plot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

# A small script to help visualizing CPU usage over time data collected on CI
# using `gnuplot`.
#
# This script is expected to be called with two arguments. The first is the full
# commit SHA of the build you're interested in, and the second is the name of
# the builder. For example:
#
# ./src/etc/cpu-usage-over-time-plot.sh e699ea096fcc2fc9ce8e8bcf884e11496a31cc9f i686-mingw-1
#
# That will generate `$builder.png` in the current directory which you can open
# up to see a hopefully pretty graph.
#
# Improvements to this script are greatly appreciated!

set -ex

bucket=rust-lang-ci-evalazure
commit=$1
builder=$2

curl -O https://$bucket.s3.amazonaws.com/rustc-builds/$commit/cpu-$builder.csv

gnuplot <<-EOF
reset
set timefmt '%Y-%m-%dT%H:%M:%S'
set xdata time
set ylabel "CPU Usage %"
set xlabel "Time"
set datafile sep ','
set term png size 3000,1000
set output "$builder.png"
set grid

f(x) = mean_y
fit f(x) 'cpu-$builder.csv' using 1:(100-\$2) via mean_y

set label 1 gprintf("Average = %g%%", mean_y) center font ",18"
set label 1 at graph 0.50, 0.25
set xtics rotate by 45 offset -2,-2.4 300
set ytics 10
set boxwidth 0.5

plot \\
mean_y with lines linetype 1 linecolor rgb "#ff0000" title "average", \\
"cpu-$builder.csv" using 1:(100-\$2) with points pointtype 7 pointsize 0.4 title "$builder", \\
"" using 1:(100-\$2) smooth bezier linewidth 3 title "bezier"
EOF
1 change: 1 addition & 0 deletions src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
#![feature(staged_api)]
#![feature(std_internals)]
#![feature(stmt_expr_attributes)]
#![cfg_attr(not(bootstrap), feature(transparent_unions))]
#![feature(unboxed_closures)]
#![feature(unsized_locals)]
#![feature(untagged_unions)]
Expand Down
16 changes: 15 additions & 1 deletion src/libcore/mem/maybe_uninit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ use crate::mem::ManuallyDrop;
///
/// # Layout
///
/// `MaybeUninit<T>` is guaranteed to have the same size and alignment as `T`:
/// `MaybeUninit<T>` is guaranteed to have the same size, alignment, and ABI as `T`:
///
/// ```rust
/// use std::mem::{MaybeUninit, size_of, align_of};
Expand All @@ -191,9 +191,23 @@ use crate::mem::ManuallyDrop;
/// assert_eq!(size_of::<Option<bool>>(), 1);
/// assert_eq!(size_of::<Option<MaybeUninit<bool>>>(), 2);
/// ```
///
/// If `T` is FFI-safe, then so is `MaybeUninit<T>`.
///
/// While `MaybeUninit` is `#[repr(transparent)]` (indicating it guarantees the same size,
/// alignment, and ABI as `T`), this does *not* change any of the previous caveats. `Option<T>` and
/// `Option<MaybeUninit<T>>` may still have different sizes, and types containing a field of type
/// `T` may be laid out (and sized) differently than if that field were `MaybeUninit<T>`.
/// `MaybeUninit` is a union type, and `#[repr(transparent)]` on unions is unstable (see [the
/// tracking issue](https://github.com/rust-lang/rust/issues/60405)). Over time, the exact
/// guarantees of `#[repr(transparent)]` on unions may evolve, and `MaybeUninit` may or may not
/// remain `#[repr(transparent)]`. That said, `MaybeUninit<T>` will *always* guarantee that it has
/// the same size, alignment, and ABI as `T`; it's just that the way `MaybeUninit` implements that
/// guarantee may evolve.
#[allow(missing_debug_implementations)]
#[stable(feature = "maybe_uninit", since = "1.36.0")]
#[derive(Copy)]
#[cfg_attr(not(bootstrap), repr(transparent))]
pub union MaybeUninit<T> {
uninit: (),
value: ManuallyDrop<T>,
Expand Down
27 changes: 14 additions & 13 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ use syntax::errors;
use syntax::ext::hygiene::{Mark, SyntaxContext};
use syntax::print::pprust;
use syntax::ptr::P;
use syntax::source_map::{self, respan, CompilerDesugaringKind, Spanned};
use syntax::source_map::{self, respan, ExpnInfo, CompilerDesugaringKind, Spanned};
use syntax::source_map::CompilerDesugaringKind::IfTemporary;
use syntax::std_inject;
use syntax::symbol::{kw, sym, Symbol};
use syntax::tokenstream::{TokenStream, TokenTree};
use syntax::parse::token::{self, Token};
use syntax::visit::{self, Visitor};
use syntax_pos::{DUMMY_SP, edition, Span};
use syntax_pos::{DUMMY_SP, Span};

const HIR_ID_COUNTER_LOCKED: u32 = 0xFFFFFFFF;

Expand Down Expand Up @@ -142,6 +142,9 @@ pub struct LoweringContext<'a> {
current_hir_id_owner: Vec<(DefIndex, u32)>,
item_local_id_counters: NodeMap<u32>,
node_id_to_hir_id: IndexVec<NodeId, hir::HirId>,

allow_try_trait: Option<Lrc<[Symbol]>>,
allow_gen_future: Option<Lrc<[Symbol]>>,
}

pub trait Resolver {
Expand Down Expand Up @@ -267,6 +270,8 @@ pub fn lower_crate(
lifetimes_to_define: Vec::new(),
is_collecting_in_band_lifetimes: false,
in_scope_lifetimes: Vec::new(),
allow_try_trait: Some([sym::try_trait][..].into()),
allow_gen_future: Some([sym::gen_future][..].into()),
}.lower_crate(krate)
}

Expand Down Expand Up @@ -848,14 +853,10 @@ impl<'a> LoweringContext<'a> {
allow_internal_unstable: Option<Lrc<[Symbol]>>,
) -> Span {
let mark = Mark::fresh(Mark::root());
mark.set_expn_info(source_map::ExpnInfo {
call_site: span,
mark.set_expn_info(ExpnInfo {
def_site: Some(span),
format: source_map::CompilerDesugaring(reason),
allow_internal_unstable,
allow_internal_unsafe: false,
local_inner_macros: false,
edition: edition::Edition::from_session(),
..ExpnInfo::default(source_map::CompilerDesugaring(reason), span, self.sess.edition())
});
span.with_ctxt(SyntaxContext::empty().apply_mark(mark))
}
Expand Down Expand Up @@ -1156,7 +1157,7 @@ impl<'a> LoweringContext<'a> {
let unstable_span = self.mark_span_with_reason(
CompilerDesugaringKind::Async,
span,
Some(vec![sym::gen_future].into()),
self.allow_gen_future.clone(),
);
let gen_future = self.expr_std_path(
unstable_span, &[sym::future, sym::from_generator], None, ThinVec::new());
Expand Down Expand Up @@ -4382,7 +4383,7 @@ impl<'a> LoweringContext<'a> {
let unstable_span = this.mark_span_with_reason(
CompilerDesugaringKind::TryBlock,
body.span,
Some(vec![sym::try_trait].into()),
this.allow_try_trait.clone(),
);
let mut block = this.lower_block(body, true).into_inner();
let tail = block.expr.take().map_or_else(
Expand Down Expand Up @@ -4968,13 +4969,13 @@ impl<'a> LoweringContext<'a> {
let unstable_span = self.mark_span_with_reason(
CompilerDesugaringKind::QuestionMark,
e.span,
Some(vec![sym::try_trait].into()),
self.allow_try_trait.clone(),
);
let try_span = self.sess.source_map().end_point(e.span);
let try_span = self.mark_span_with_reason(
CompilerDesugaringKind::QuestionMark,
try_span,
Some(vec![sym::try_trait].into()),
self.allow_try_trait.clone(),
);

// `Try::into_result(<expr>)`
Expand Down Expand Up @@ -5776,7 +5777,7 @@ impl<'a> LoweringContext<'a> {
let gen_future_span = self.mark_span_with_reason(
CompilerDesugaringKind::Await,
await_span,
Some(vec![sym::gen_future].into()),
self.allow_gen_future.clone(),
);

// let mut pinned = <expr>;
Expand Down
9 changes: 8 additions & 1 deletion src/librustc/ich/impls_syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,17 @@ impl_stable_hash_for!(enum ::syntax::ast::MetaItemKind {
NameValue(lit)
});

impl_stable_hash_for!(enum ::syntax_pos::hygiene::Transparency {
Transparent,
SemiTransparent,
Opaque,
});

impl_stable_hash_for!(struct ::syntax_pos::hygiene::ExpnInfo {
call_site,
def_site,
format,
def_site,
default_transparency,
allow_internal_unstable,
allow_internal_unsafe,
local_inner_macros,
Expand Down
30 changes: 8 additions & 22 deletions src/librustc/infer/canonical/canonicalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::mir::interpret::ConstValue;
use std::sync::atomic::Ordering;
use crate::ty::fold::{TypeFoldable, TypeFolder};
use crate::ty::subst::Kind;
use crate::ty::{self, BoundVar, InferConst, Lift, List, Ty, TyCtxt, TypeFlags};
use crate::ty::{self, BoundVar, InferConst, List, Ty, TyCtxt, TypeFlags};
use crate::ty::flags::FlagComputation;

use rustc_data_structures::fx::FxHashMap;
Expand Down Expand Up @@ -43,7 +43,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
query_state: &mut OriginalQueryValues<'tcx>,
) -> Canonicalized<'tcx, V>
where
V: TypeFoldable<'tcx> + Lift<'tcx>,
V: TypeFoldable<'tcx>,
{
self.tcx
.sess
Expand Down Expand Up @@ -87,7 +87,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
/// [c]: https://rust-lang.github.io/rustc-guide/traits/canonicalization.html#canonicalizing-the-query-result
pub fn canonicalize_response<V>(&self, value: &V) -> Canonicalized<'tcx, V>
where
V: TypeFoldable<'tcx> + Lift<'tcx>,
V: TypeFoldable<'tcx>,
{
let mut query_state = OriginalQueryValues::default();
Canonicalizer::canonicalize(
Expand All @@ -101,7 +101,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {

pub fn canonicalize_user_type_annotation<V>(&self, value: &V) -> Canonicalized<'tcx, V>
where
V: TypeFoldable<'tcx> + Lift<'tcx>,
V: TypeFoldable<'tcx>,
{
let mut query_state = OriginalQueryValues::default();
Canonicalizer::canonicalize(
Expand Down Expand Up @@ -132,7 +132,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
query_state: &mut OriginalQueryValues<'tcx>,
) -> Canonicalized<'tcx, V>
where
V: TypeFoldable<'tcx> + Lift<'tcx>,
V: TypeFoldable<'tcx>,
{
self.tcx
.sess
Expand Down Expand Up @@ -506,7 +506,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
query_state: &mut OriginalQueryValues<'tcx>,
) -> Canonicalized<'tcx, V>
where
V: TypeFoldable<'tcx> + Lift<'tcx>,
V: TypeFoldable<'tcx>,
{
let needs_canonical_flags = if canonicalize_region_mode.any() {
TypeFlags::KEEP_IN_LOCAL_TCX |
Expand All @@ -520,20 +520,12 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
TypeFlags::HAS_CT_PLACEHOLDER
};

let gcx = tcx.global_tcx();

// Fast path: nothing that needs to be canonicalized.
if !value.has_type_flags(needs_canonical_flags) {
let out_value = gcx.lift(value).unwrap_or_else(|| {
bug!(
"failed to lift `{:?}` (nothing to canonicalize)",
value
)
});
let canon_value = Canonical {
max_universe: ty::UniverseIndex::ROOT,
variables: List::empty(),
value: out_value,
value: value.clone(),
};
return canon_value;
}
Expand All @@ -553,13 +545,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
// Once we have canonicalized `out_value`, it should not
// contain anything that ties it to this inference context
// anymore, so it should live in the global arena.
let out_value = gcx.lift(&out_value).unwrap_or_else(|| {
bug!(
"failed to lift `{:?}`, canonicalized from `{:?}`",
out_value,
value
)
});
debug_assert!(!out_value.has_type_flags(TypeFlags::KEEP_IN_LOCAL_TCX));

let canonical_variables = tcx.intern_canonical_var_infos(&canonicalizer.variables);

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/infer/canonical/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ pub struct QueryResponse<'tcx, R> {
pub value: R,
}

pub type Canonicalized<'tcx, V> = Canonical<'tcx, <V as Lift<'tcx>>::Lifted>;
pub type Canonicalized<'tcx, V> = Canonical<'tcx, V>;

pub type CanonicalizedQueryResponse<'tcx, T> =
&'tcx Canonical<'tcx, QueryResponse<'tcx, <T as Lift<'tcx>>::Lifted>>;
&'tcx Canonical<'tcx, QueryResponse<'tcx, T>>;

/// Indicates whether or not we were able to prove the query to be
/// true.
Expand Down
16 changes: 8 additions & 8 deletions src/librustc/infer/canonical/query_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use crate::traits::TraitEngine;
use crate::traits::{Obligation, ObligationCause, PredicateObligation};
use crate::ty::fold::TypeFoldable;
use crate::ty::subst::{Kind, UnpackedKind};
use crate::ty::{self, BoundVar, InferConst, Lift, Ty, TyCtxt};
use crate::ty::{self, BoundVar, InferConst, Ty, TyCtxt};
use crate::util::captures::Captures;

impl<'tcx> InferCtxtBuilder<'tcx> {
Expand All @@ -53,8 +53,8 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
) -> Fallible<CanonicalizedQueryResponse<'tcx, R>>
where
K: TypeFoldable<'tcx>,
R: Debug + Lift<'tcx> + TypeFoldable<'tcx>,
Canonical<'tcx, <QueryResponse<'tcx, R> as Lift<'tcx>>::Lifted>: ArenaAllocatable,
R: Debug + TypeFoldable<'tcx>,
Canonical<'tcx, QueryResponse<'tcx, R>>: ArenaAllocatable,
{
self.enter_with_canonical(
DUMMY_SP,
Expand Down Expand Up @@ -99,8 +99,8 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
fulfill_cx: &mut dyn TraitEngine<'tcx>,
) -> Fallible<CanonicalizedQueryResponse<'tcx, T>>
where
T: Debug + Lift<'tcx> + TypeFoldable<'tcx>,
Canonical<'tcx, <QueryResponse<'tcx, T> as Lift<'tcx>>::Lifted>: ArenaAllocatable,
T: Debug + TypeFoldable<'tcx>,
Canonical<'tcx, QueryResponse<'tcx, T>>: ArenaAllocatable,
{
let query_response = self.make_query_response(inference_vars, answer, fulfill_cx)?;
let canonical_result = self.canonicalize_response(&query_response);
Expand All @@ -126,9 +126,9 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
&self,
inference_vars: CanonicalVarValues<'tcx>,
answer: T,
) -> Canonical<'tcx, QueryResponse<'tcx, <T as Lift<'tcx>>::Lifted>>
) -> Canonical<'tcx, QueryResponse<'tcx, T>>
where
T: Debug + Lift<'tcx> + TypeFoldable<'tcx>,
T: Debug + TypeFoldable<'tcx>,
{
self.canonicalize_response(&QueryResponse {
var_values: inference_vars,
Expand All @@ -147,7 +147,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
fulfill_cx: &mut dyn TraitEngine<'tcx>,
) -> Result<QueryResponse<'tcx, T>, NoSolution>
where
T: Debug + TypeFoldable<'tcx> + Lift<'tcx>,
T: Debug + TypeFoldable<'tcx>,
{
let tcx = self.tcx;

Expand Down
Loading