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 9 pull requests #78362

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
13a5067
Unignore test
Oct 13, 2020
0558e6e
bootstrap: fall back to auto-detected CXX
jonas-schievink Oct 14, 2020
77a7ccf
bootstrap: configure native toolchain for run-make
jonas-schievink Oct 14, 2020
e36de6b
Move issue-36710 test to run-make
jonas-schievink Oct 14, 2020
a671604
Ignore test on WASM
jonas-schievink Oct 14, 2020
d7c7649
ignore-thumb
jonas-schievink Oct 16, 2020
60594b1
Ignore on 32-bit targets
Oct 19, 2020
d80f127
Avoid panic_bounds_check in fmt::write.
m-ou-se Oct 19, 2020
ea24395
Add debug_asserts for the unsafe indexing in fmt::write.
m-ou-se Oct 20, 2020
356d5b5
Add test to check for fmt::write bloat.
m-ou-se Oct 20, 2020
52640f2
[mir-opt] Allow debuginfo to be generated for a constant or a Place
wesleywiser May 30, 2020
2202653
Miri engine validity check: simplify code with 'matches!'
RalfJung Oct 21, 2020
fcaf233
Miri engine interning: improve comments, and entirely skip ZST
RalfJung Oct 21, 2020
484d9eb
Move fmt-write-bloat test to run-make-fulldeps.
m-ou-se Oct 21, 2020
d0d0e78
Capture output from threads spawned in tests
tmandry Aug 5, 2020
db15596
Only load LOCAL_STREAMS if they are being used
SergioBenitez Oct 22, 2020
86df903
Tweak "use `.await`" suggestion
estebank Oct 21, 2020
a4ee3ca
Suggest semicolon removal on prior match arm
estebank Oct 22, 2020
671d7c4
Account for possible boxable `impl Future` in semicolon removal sugge…
estebank Oct 22, 2020
62ba365
Review comments: use newtype instead of `bool`
estebank Oct 22, 2020
3a0227b
Silence unnecessary `await foo?` knock-down error
estebank Oct 22, 2020
1829b4a
Add test case for different `impl Future`s
estebank Oct 22, 2020
c548511
Add more `.await` suggestions on E0308
estebank Oct 23, 2020
f5d7443
Suggest semicolon removal and boxing when appropriate
estebank Oct 23, 2020
1333206
ensure that statics are inhabited
RalfJung Oct 24, 2020
5d62492
fix typo
RalfJung Oct 24, 2020
7b4c397
Do not try to report on closures to avoid ICE
JohnTitor Oct 23, 2020
4ec396e
Test with NLL explicitly
JohnTitor Oct 25, 2020
e218380
Make some functions private that don't have to be public
jyn514 Oct 25, 2020
3bd5cc9
also test non-extern uninhabited statics
RalfJung Oct 25, 2020
6de07f8
Rollup merge of #73210 - wesleywiser:consts_in_debuginfo, r=oli-obk
Dylan-DPC Oct 25, 2020
66fed47
Rollup merge of #77901 - jonas-schievink:unignore-test-36710, r=Mark-…
Dylan-DPC Oct 25, 2020
5d07254
Rollup merge of #78122 - fusion-engineering-forks:fmt-write-bounds-ch…
Dylan-DPC Oct 25, 2020
423d164
Rollup merge of #78179 - RalfJung:miri-comments, r=oli-obk
Dylan-DPC Oct 25, 2020
a3bd184
Rollup merge of #78214 - estebank:match-semicolon, r=oli-obk
Dylan-DPC Oct 25, 2020
0c44b23
Rollup merge of #78227 - SergioBenitez:test-stdout-threading, r=m-ou-se
Dylan-DPC Oct 25, 2020
73c9339
Rollup merge of #78268 - JohnTitor:issue-78262, r=estebank
Dylan-DPC Oct 25, 2020
21cd03b
Rollup merge of #78324 - RalfJung:uninhabited-statics, r=oli-obk
Dylan-DPC Oct 25, 2020
9b485eb
Rollup merge of #78348 - jyn514:pub-crate, r=GuillaumeGomez
Dylan-DPC Oct 25, 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
5 changes: 3 additions & 2 deletions compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1416,10 +1416,11 @@ fn generator_layout_and_saved_local_names(

let state_arg = mir::Local::new(1);
for var in &body.var_debug_info {
if var.place.local != state_arg {
let place = if let mir::VarDebugInfoContents::Place(p) = var.value { p } else { continue };
if place.local != state_arg {
continue;
}
match var.place.projection[..] {
match place.projection[..] {
[
// Deref of the `Pin<&mut Self>` state argument.
mir::ProjectionElem::Field(..),
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_ssa/src/mir/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use super::FunctionCx;

impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
pub fn eval_mir_constant_to_operand(
&mut self,
&self,
bx: &mut Bx,
constant: &mir::Constant<'tcx>,
) -> Result<OperandRef<'tcx, Bx::Value>, ErrorHandled> {
Expand All @@ -21,7 +21,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
}

pub fn eval_mir_constant(
&mut self,
&self,
constant: &mir::Constant<'tcx>,
) -> Result<ConstValue<'tcx>, ErrorHandled> {
match self.monomorphize(&constant.literal).val {
Expand Down
100 changes: 67 additions & 33 deletions compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rustc_span::symbol::{kw, Symbol};
use rustc_span::{BytePos, Span};
use rustc_target::abi::{LayoutOf, Size};

use super::operand::OperandValue;
use super::operand::{OperandRef, OperandValue};
use super::place::PlaceRef;
use super::{FunctionCx, LocalRef};

Expand Down Expand Up @@ -111,6 +111,24 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
}
}

fn spill_operand_to_stack(
operand: &OperandRef<'tcx, Bx::Value>,
name: Option<String>,
bx: &mut Bx,
) -> PlaceRef<'tcx, Bx::Value> {
// "Spill" the value onto the stack, for debuginfo,
// without forcing non-debuginfo uses of the local
// to also load from the stack every single time.
// FIXME(#68817) use `llvm.dbg.value` instead,
// at least for the cases which LLVM handles correctly.
let spill_slot = PlaceRef::alloca(bx, operand.layout);
if let Some(name) = name {
bx.set_var_name(spill_slot.llval, &(name + ".dbg.spill"));
}
operand.val.store(bx, spill_slot);
spill_slot
}

/// Apply debuginfo and/or name, after creating the `alloca` for a local,
/// or initializing the local with an operand (whichever applies).
pub fn debug_introduce_local(&self, bx: &mut Bx, local: mir::Local) {
Expand Down Expand Up @@ -225,17 +243,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
return;
}

// "Spill" the value onto the stack, for debuginfo,
// without forcing non-debuginfo uses of the local
// to also load from the stack every single time.
// FIXME(#68817) use `llvm.dbg.value` instead,
// at least for the cases which LLVM handles correctly.
let spill_slot = PlaceRef::alloca(bx, operand.layout);
if let Some(name) = name {
bx.set_var_name(spill_slot.llval, &(name + ".dbg.spill"));
}
operand.val.store(bx, spill_slot);
spill_slot
Self::spill_operand_to_stack(operand, name, bx)
}

LocalRef::Place(place) => *place,
Expand Down Expand Up @@ -310,6 +318,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
/// Partition all `VarDebugInfo` in `self.mir`, by their base `Local`.
pub fn compute_per_local_var_debug_info(
&self,
bx: &mut Bx,
) -> Option<IndexVec<mir::Local, Vec<PerLocalVarDebugInfo<'tcx, Bx::DIVariable>>>> {
let full_debug_info = self.cx.sess().opts.debuginfo == DebugInfo::Full;

Expand All @@ -324,22 +333,30 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
} else {
(None, var.source_info.span)
};
let (var_ty, var_kind) = match var.value {
mir::VarDebugInfoContents::Place(place) => {
let var_ty = self.monomorphized_place_ty(place.as_ref());
let var_kind = if self.mir.local_kind(place.local) == mir::LocalKind::Arg
&& place.projection.is_empty()
&& var.source_info.scope == mir::OUTERMOST_SOURCE_SCOPE
{
let arg_index = place.local.index() - 1;

// FIXME(eddyb) shouldn't `ArgumentVariable` indices be
// offset in closures to account for the hidden environment?
// Also, is this `+ 1` needed at all?
VariableKind::ArgumentVariable(arg_index + 1)
} else {
VariableKind::LocalVariable
};
(var_ty, var_kind)
}
mir::VarDebugInfoContents::Const(c) => {
let ty = self.monomorphize(&c.literal.ty);
(ty, VariableKind::LocalVariable)
}
};
let dbg_var = scope.map(|scope| {
let place = var.place;
let var_ty = self.monomorphized_place_ty(place.as_ref());
let var_kind = if self.mir.local_kind(place.local) == mir::LocalKind::Arg
&& place.projection.is_empty()
&& var.source_info.scope == mir::OUTERMOST_SOURCE_SCOPE
{
let arg_index = place.local.index() - 1;

// FIXME(eddyb) shouldn't `ArgumentVariable` indices be
// offset in closures to account for the hidden environment?
// Also, is this `+ 1` needed at all?
VariableKind::ArgumentVariable(arg_index + 1)
} else {
VariableKind::LocalVariable
};
self.cx.create_dbg_var(
self.debug_context.as_ref().unwrap(),
var.name,
Expand All @@ -350,12 +367,29 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
)
});

per_local[var.place.local].push(PerLocalVarDebugInfo {
name: var.name,
source_info: var.source_info,
dbg_var,
projection: var.place.projection,
});
match var.value {
mir::VarDebugInfoContents::Place(place) => {
per_local[place.local].push(PerLocalVarDebugInfo {
name: var.name,
source_info: var.source_info,
dbg_var,
projection: place.projection,
});
}
mir::VarDebugInfoContents::Const(c) => {
if let (Some(scope), Some(dbg_var)) = (scope, dbg_var) {
if let Ok(operand) = self.eval_mir_constant_to_operand(bx, &c) {
let base = Self::spill_operand_to_stack(
&operand,
Some(var.name.to_string()),
bx,
);

bx.dbg_var_addr(dbg_var, scope, base.llval, Size::ZERO, &[], span);
}
}
}
}
}
Some(per_local)
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
caller_location: None,
};

fx.per_local_var_debug_info = fx.compute_per_local_var_debug_info();
fx.per_local_var_debug_info = fx.compute_per_local_var_debug_info(&mut bx);

for const_ in &mir.required_consts {
if let Err(err) = fx.eval_mir_constant(const_) {
Expand Down
Loading