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 8 pull requests #59271

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3477939
[CI] Update binutils for powerpc64 and powerpc64le
cuviper Mar 7, 2019
c843fe7
Wrap a long configure line
cuviper Mar 7, 2019
b9d12ed
Be more discerning on when to attempt suggesting a comma in a macro i…
estebank Mar 11, 2019
27abd52
Fix operator precedence
estebank Mar 13, 2019
4e5692d
test that wildcard type `_` is not duplicated by `type Foo<X> = (X, X…
pnkfelix Jan 18, 2019
a7bd36c
Add peer_addr function to UdpSocket
LinusU Mar 11, 2019
bf473e3
Mark UdpSocket peer_addr unstable w/ tracking issue
LinusU Mar 12, 2019
24e3fa0
Document UdpSocket peer_addr NotConnected error
LinusU Mar 12, 2019
7f7cfae
Add test for UdpSocket peer_addr
LinusU Mar 12, 2019
7e73cd4
Fix test names regarding ip version
LinusU Mar 12, 2019
214110b
Add UdpSocket peer_addr implementation for L4Re
LinusU Mar 16, 2019
81d5fb5
Add UdpSocket peer_addr implementation for Wasm
LinusU Mar 16, 2019
b392c5e
use the identifier span for missing struct field
euclio Mar 16, 2019
498bead
Tweak spans for E0599
estebank Mar 10, 2019
713f96d
Swap const evaluation lint spans to point at problem in primary span
estebank Mar 11, 2019
690bc57
Swap primary/secondary spans for E0458
estebank Mar 11, 2019
18d727f
Tweak unsupported negative trait bounds message
estebank Mar 11, 2019
bb15af1
Tweak unnecessary import suggestion
estebank Mar 11, 2019
b616cca
Hide obvious suggestion from cli output
estebank Mar 11, 2019
743d019
Deduplicate const eval error spans for better output
estebank Mar 11, 2019
b53ca90
Mark duplicate import removal suggestion tool only
estebank Mar 11, 2019
d1656f1
Fix rebase
estebank Mar 17, 2019
6430318
Use a valid name for graphviz graphs
matthewjasper Mar 17, 2019
98b2672
update mailmap for Bastian Kauschke
lcnr Mar 17, 2019
9200f05
Rollup merge of #57729 - pnkfelix:issue-55748-pat-types-are-constrain…
sanxiyn Mar 18, 2019
d46ba07
Rollup merge of #58986 - cuviper:ppc64-binutils, r=alexcrichton
sanxiyn Mar 18, 2019
02c2e84
Rollup merge of #59084 - estebank:diagnostic-spans, r=davidtwco
sanxiyn Mar 18, 2019
fbdaf3e
Rollup merge of #59106 - LinusU:udp-peer-addr, r=kennytm
sanxiyn Mar 18, 2019
f62585f
Rollup merge of #59116 - estebank:comma-sugg, r=petrochenkov
sanxiyn Mar 18, 2019
859c9a5
Rollup merge of #59240 - euclio:struct-field-span, r=oli-obk
sanxiyn Mar 18, 2019
00fb9d9
Rollup merge of #59251 - matthewjasper:fix-graphviz, r=petrochenkov
sanxiyn Mar 18, 2019
9dd8cb2
Rollup merge of #59252 - lcnr:mailmap, r=Centril
sanxiyn Mar 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
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Ariel Ben-Yehuda <arielb1@mail.tau.ac.il> Ariel Ben-Yehuda <ariel.byd@gmail.com>
Ariel Ben-Yehuda <arielb1@mail.tau.ac.il> arielb1 <arielb1@mail.tau.ac.il>
Austin Seipp <mad.one@gmail.com> <as@hacks.yi.org>
Aydin Kim <ladinjin@hanmail.net> aydin.kim <aydin.kim@samsung.com>
Bastian Kauschke <bastian_kauschke@hotmail.de>
Barosl Lee <vcs@barosl.com> Barosl LEE <github@barosl.com>
Ben Alpert <ben@benalpert.com> <spicyjalapeno@gmail.com>
Ben Sago <ogham@users.noreply.github.com> Ben S <ogham@bsago.me>
Expand Down
20 changes: 20 additions & 0 deletions src/ci/docker/dist-powerpc64-linux/build-powerpc64-toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,29 @@ set -ex

source shared.sh

BINUTILS=2.32
TARGET=powerpc64-unknown-linux-gnu
PREFIX=/x-tools/$TARGET
SYSROOT=$PREFIX/$TARGET/sysroot

mkdir build
cd build
cp ../powerpc64-linux-gnu.config .config
hide_output ct-ng build
cd ..
rm -rf build

chmod -R u+w $PREFIX

# Next, download and build newer binutils.
mkdir binutils-$TARGET
pushd binutils-$TARGET
curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.bz2 | tar xjf -
mkdir binutils-build
cd binutils-build
hide_output ../binutils-$BINUTILS/configure --target=$TARGET \
--prefix=$PREFIX --with-sysroot=$SYSROOT
hide_output make -j10
hide_output make install
popd
rm -rf binutils-$TARGET
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -ex

source shared.sh

BINUTILS=2.25.1
BINUTILS=2.32
GCC=5.3.0
TARGET=powerpc64le-linux-gnu
SYSROOT=/usr/local/$TARGET/sysroot
Expand Down
13 changes: 13 additions & 0 deletions src/librustc/mir/interpret/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ impl<'a, 'gcx, 'tcx> ConstEvalErr<'tcx> {
tcx: TyCtxtAt<'a, 'gcx, 'tcx>,
message: &str,
lint_root: hir::HirId,
span: Option<Span>,
) -> ErrorHandled {
let lint = self.struct_generic(
tcx,
Expand All @@ -108,6 +109,18 @@ impl<'a, 'gcx, 'tcx> ConstEvalErr<'tcx> {
);
match lint {
Ok(mut lint) => {
if let Some(span) = span {
let primary_spans = lint.span.primary_spans().to_vec();
// point at the actual error as the primary span
lint.replace_span_with(span);
// point to the `const` statement as a secondary span
// they don't have any label
for sp in primary_spans {
if sp != span {
lint.span_label(sp, "");
}
}
}
lint.emit();
ErrorHandled::Reported
},
Expand Down
12 changes: 11 additions & 1 deletion src/librustc_driver/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -633,10 +633,20 @@ fn print_flowgraph<'a, 'tcx, W: Write>(variants: Vec<borrowck_dot::Variant>,
let body = tcx.hir().body(body_id);
let cfg = cfg::CFG::new(tcx, &body);
let labelled_edges = mode != PpFlowGraphMode::UnlabelledEdges;
let hir_id = code.id();
// We have to disassemble the hir_id because name must be ASCII
// alphanumeric. This does not appear in the rendered graph, so it does not
// have to be user friendly.
let name = format!(
"hir_id_{}_{}_{}",
hir_id.owner.address_space().index(),
hir_id.owner.as_array_index(),
hir_id.local_id.index(),
);
let lcfg = LabelledCFG {
tcx,
cfg: &cfg,
name: format!("node_{}", code.id()),
name,
labelled_edges,
};

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_errors/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ impl Diagnostic {
}],
}],
msg: msg.to_owned(),
style: SuggestionStyle::HideCodeInline,
style: SuggestionStyle::HideCodeAlways,
applicability,
});
self
Expand Down
5 changes: 3 additions & 2 deletions src/librustc_metadata/native_libs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for Collector<'a, 'tcx> {
"dylib" => cstore::NativeUnknown,
"framework" => cstore::NativeFramework,
k => {
struct_span_err!(self.tcx.sess, m.span, E0458,
struct_span_err!(self.tcx.sess, item.span(), E0458,
"unknown kind: `{}`", k)
.span_label(item.span(), "unknown kind").emit();
.span_label(item.span(), "unknown kind")
.span_label(m.span, "").emit();
cstore::NativeUnknown
}
};
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_mir/borrow_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
let mut flow_inits = FlowAtLocation::new(do_dataflow(
tcx,
mir,
id,
def_id,
&attributes,
&dead_unwinds,
MaybeInitializedPlaces::new(tcx, mir, &mdpe),
Expand Down Expand Up @@ -191,7 +191,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
let flow_borrows = FlowAtLocation::new(do_dataflow(
tcx,
mir,
id,
def_id,
&attributes,
&dead_unwinds,
Borrows::new(tcx, mir, regioncx.clone(), &borrow_set),
Expand All @@ -200,7 +200,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
let flow_uninits = FlowAtLocation::new(do_dataflow(
tcx,
mir,
id,
def_id,
&attributes,
&dead_unwinds,
MaybeUninitializedPlaces::new(tcx, mir, &mdpe),
Expand All @@ -209,7 +209,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
let flow_ever_inits = FlowAtLocation::new(do_dataflow(
tcx,
mir,
id,
def_id,
&attributes,
&dead_unwinds,
EverInitializedPlaces::new(tcx, mir, &mdpe),
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_mir/const_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,7 @@ pub fn const_eval_raw_provider<'a, 'tcx>(
tcx.at(tcx.def_span(def_id)),
"any use of this value will cause an error",
hir_id,
Some(err.span),
)
},
// promoting runtime code is only allowed to error if it references broken constants
Expand All @@ -684,6 +685,7 @@ pub fn const_eval_raw_provider<'a, 'tcx>(
tcx.at(span),
"reaching this expression at runtime will panic or abort",
tcx.hir().as_local_hir_id(def_id).unwrap(),
Some(err.span),
)
}
// anything else (array lengths, enum initializers, constant patterns) are reported
Expand Down
17 changes: 9 additions & 8 deletions src/librustc_mir/dataflow/graphviz.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
//! Hook into libgraphviz for rendering dataflow graphs for MIR.

use rustc::hir::HirId;
use rustc::hir::def_id::DefId;
use rustc::mir::{BasicBlock, Mir};

use std::fs;
use std::io;
use std::marker::PhantomData;
use std::path::Path;

use crate::util::graphviz_safe_def_name;

use super::{BitDenotation, DataflowState};
use super::DataflowBuilder;
use super::DebugFormatted;

pub trait MirWithFlowState<'tcx> {
type BD: BitDenotation<'tcx>;
fn hir_id(&self) -> HirId;
fn def_id(&self) -> DefId;
fn mir(&self) -> &Mir<'tcx>;
fn flow_state(&self) -> &DataflowState<'tcx, Self::BD>;
}
Expand All @@ -23,7 +25,7 @@ impl<'a, 'tcx, BD> MirWithFlowState<'tcx> for DataflowBuilder<'a, 'tcx, BD>
where BD: BitDenotation<'tcx>
{
type BD = BD;
fn hir_id(&self) -> HirId { self.hir_id }
fn def_id(&self) -> DefId { self.def_id }
fn mir(&self) -> &Mir<'tcx> { self.flow_state.mir() }
fn flow_state(&self) -> &DataflowState<'tcx, Self::BD> { &self.flow_state.flow_state }
}
Expand All @@ -47,8 +49,8 @@ pub(crate) fn print_borrowck_graph_to<'a, 'tcx, BD, P>(
let g = Graph { mbcx, phantom: PhantomData, render_idx };
let mut v = Vec::new();
dot::render(&g, &mut v)?;
debug!("print_borrowck_graph_to path: {} hir_id: {}",
path.display(), mbcx.hir_id);
debug!("print_borrowck_graph_to path: {} def_id: {:?}",
path.display(), mbcx.def_id);
fs::write(path, v)
}

Expand All @@ -69,9 +71,8 @@ impl<'a, 'tcx, MWF, P> dot::Labeller<'a> for Graph<'a, 'tcx, MWF, P>
type Node = Node;
type Edge = Edge;
fn graph_id(&self) -> dot::Id<'_> {
dot::Id::new(format!("graph_for_node_{}",
self.mbcx.hir_id()))
.unwrap()
let name = graphviz_safe_def_name(self.mbcx.def_id());
dot::Id::new(format!("graph_for_def_id_{}", name)).unwrap()
}

fn node_id(&self, n: &Node) -> dot::Id<'_> {
Expand Down
12 changes: 6 additions & 6 deletions src/librustc_mir/dataflow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use rustc_data_structures::bit_set::{BitSet, BitSetOperator, HybridBitSet};
use rustc_data_structures::indexed_vec::Idx;
use rustc_data_structures::work_queue::WorkQueue;

use rustc::hir::HirId;
use rustc::hir::def_id::DefId;
use rustc::ty::{self, TyCtxt};
use rustc::mir::{self, Mir, BasicBlock, BasicBlockData, Location, Statement, Terminator};
use rustc::mir::traversal;
Expand Down Expand Up @@ -39,7 +39,7 @@ pub(crate) struct DataflowBuilder<'a, 'tcx: 'a, BD>
where
BD: BitDenotation<'tcx>
{
hir_id: HirId,
def_id: DefId,
flow_state: DataflowAnalysis<'a, 'tcx, BD>,
print_preflow_to: Option<String>,
print_postflow_to: Option<String>,
Expand Down Expand Up @@ -117,7 +117,7 @@ pub struct MoveDataParamEnv<'gcx, 'tcx> {

pub(crate) fn do_dataflow<'a, 'gcx, 'tcx, BD, P>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
mir: &'a Mir<'tcx>,
hir_id: HirId,
def_id: DefId,
attributes: &[ast::Attribute],
dead_unwinds: &BitSet<BasicBlock>,
bd: BD,
Expand All @@ -127,14 +127,14 @@ pub(crate) fn do_dataflow<'a, 'gcx, 'tcx, BD, P>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
P: Fn(&BD, BD::Idx) -> DebugFormatted
{
let flow_state = DataflowAnalysis::new(mir, dead_unwinds, bd);
flow_state.run(tcx, hir_id, attributes, p)
flow_state.run(tcx, def_id, attributes, p)
}

impl<'a, 'gcx: 'tcx, 'tcx: 'a, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitDenotation<'tcx>
{
pub(crate) fn run<P>(self,
tcx: TyCtxt<'a, 'gcx, 'tcx>,
hir_id: HirId,
def_id: DefId,
attributes: &[ast::Attribute],
p: P) -> DataflowResults<'tcx, BD>
where P: Fn(&BD, BD::Idx) -> DebugFormatted
Expand All @@ -159,7 +159,7 @@ impl<'a, 'gcx: 'tcx, 'tcx: 'a, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitD
name_found(tcx.sess, attributes, "borrowck_graphviz_postflow");

let mut mbcx = DataflowBuilder {
hir_id,
def_id,
print_preflow_to, print_postflow_to, flow_state: self,
};

Expand Down
1 change: 1 addition & 0 deletions src/librustc_mir/transform/const_prop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> {
self.ecx.tcx,
"this expression will panic at runtime",
lint_root,
None,
);
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/librustc_mir/transform/elaborate_drops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl MirPass for ElaborateDrops {
{
debug!("elaborate_drops({:?} @ {:?})", src, mir.span);

let id = tcx.hir().as_local_hir_id(src.def_id()).unwrap();
let def_id = src.def_id();
let param_env = tcx.param_env(src.def_id()).with_reveal_all();
let move_data = match MoveData::gather_moves(mir, tcx) {
Ok(move_data) => move_data,
Expand All @@ -50,13 +50,13 @@ impl MirPass for ElaborateDrops {
move_data,
param_env,
};
let dead_unwinds = find_dead_unwinds(tcx, mir, id, &env);
let dead_unwinds = find_dead_unwinds(tcx, mir, def_id, &env);
let flow_inits =
do_dataflow(tcx, mir, id, &[], &dead_unwinds,
do_dataflow(tcx, mir, def_id, &[], &dead_unwinds,
MaybeInitializedPlaces::new(tcx, mir, &env),
|bd, p| DebugFormatted::new(&bd.move_data().move_paths[p]));
let flow_uninits =
do_dataflow(tcx, mir, id, &[], &dead_unwinds,
do_dataflow(tcx, mir, def_id, &[], &dead_unwinds,
MaybeUninitializedPlaces::new(tcx, mir, &env),
|bd, p| DebugFormatted::new(&bd.move_data().move_paths[p]));

Expand All @@ -80,7 +80,7 @@ impl MirPass for ElaborateDrops {
fn find_dead_unwinds<'a, 'tcx>(
tcx: TyCtxt<'a, 'tcx, 'tcx>,
mir: &Mir<'tcx>,
id: hir::HirId,
def_id: hir::def_id::DefId,
env: &MoveDataParamEnv<'tcx, 'tcx>)
-> BitSet<BasicBlock>
{
Expand All @@ -89,7 +89,7 @@ fn find_dead_unwinds<'a, 'tcx>(
// reach cleanup blocks, which can't have unwind edges themselves.
let mut dead_unwinds = BitSet::new_empty(mir.basic_blocks().len());
let flow_inits =
do_dataflow(tcx, mir, id, &[], &dead_unwinds,
do_dataflow(tcx, mir, def_id, &[], &dead_unwinds,
MaybeInitializedPlaces::new(tcx, mir, &env),
|bd, p| DebugFormatted::new(&bd.move_data().move_paths[p]));
for (bb, bb_data) in mir.basic_blocks().iter_enumerated() {
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_mir/transform/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,13 @@ fn locals_live_across_suspend_points(
FxHashMap<BasicBlock, liveness::LiveVarSet>,
) {
let dead_unwinds = BitSet::new_empty(mir.basic_blocks().len());
let hir_id = tcx.hir().as_local_hir_id(source.def_id()).unwrap();
let def_id = source.def_id();

// Calculate when MIR locals have live storage. This gives us an upper bound of their
// lifetimes.
let storage_live_analysis = MaybeStorageLive::new(mir);
let storage_live =
do_dataflow(tcx, mir, hir_id, &[], &dead_unwinds, storage_live_analysis,
do_dataflow(tcx, mir, def_id, &[], &dead_unwinds, storage_live_analysis,
|bd, p| DebugFormatted::new(&bd.mir().local_decls[p]));

// Find the MIR locals which do not use StorageLive/StorageDead statements.
Expand All @@ -403,7 +403,7 @@ fn locals_live_across_suspend_points(
let borrowed_locals = if !movable {
let analysis = HaveBeenBorrowedLocals::new(mir);
let result =
do_dataflow(tcx, mir, hir_id, &[], &dead_unwinds, analysis,
do_dataflow(tcx, mir, def_id, &[], &dead_unwinds, analysis,
|bd, p| DebugFormatted::new(&bd.mir().local_decls[p]));
Some((analysis, result))
} else {
Expand Down
Loading