Skip to content

Rollup of 11 pull requests #60488

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

Closed
wants to merge 44 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
bee92b5
Make deprecation lint `ambiguous_associated_items` deny-by-default
petrochenkov Apr 12, 2019
be33738
Added arm-none-eabi target
Gilnaa Apr 20, 2019
d8cc8dc
Added armv7-none target instead of arm-none
Gilnaa Apr 23, 2019
bd42e12
Set armv7-none to use strict alignment
Gilnaa Apr 23, 2019
a912664
report fatal errors during doctest parsing
euclio Apr 23, 2019
c8baec9
Added non hf armv7a target
Gilnaa Apr 24, 2019
0e7e938
Do not suggest incorrect syntax on pattern borrow error
estebank Apr 30, 2019
742b48d
Be more specific in the suggestion filtering
estebank Apr 30, 2019
ff68673
add tests
estebank Apr 30, 2019
693eea5
review comments
estebank Apr 30, 2019
14ca950
Fix style
estebank Apr 30, 2019
6068478
Add if let test
estebank Apr 30, 2019
bf4d0ad
Rename to RUSTC_LOG
JohnTitor Apr 30, 2019
da46eea
Add error for existential types
JohnTitor Apr 30, 2019
bb3549f
Fix tests
JohnTitor Apr 30, 2019
f56d285
Use multispan
JohnTitor Apr 30, 2019
db7f265
Fix spans
JohnTitor Apr 30, 2019
748d978
Fix run-pass test
JohnTitor Apr 30, 2019
ed08c6a
review comments: change wording
estebank Apr 30, 2019
24fddb1
Resolve match arm ty when arms diverge
estebank May 1, 2019
6ef39e6
Avoid repeated interning of static strings.
nnethercote May 2, 2019
16fe8cc
Remove the `self.mir` field from `ConstPropagator`
wesleywiser Apr 29, 2019
cac07eb
Fix failing test
wesleywiser May 2, 2019
8b82f68
Make find_attr_val a little bit more precise
rasendubi Apr 29, 2019
b7f55ca
Assign group and parse since for Feature
rasendubi Apr 29, 2019
d5ba6d4
Ensure language features in group are sorted by since
rasendubi Apr 29, 2019
d54477e
Address review comments
rasendubi May 1, 2019
90d3fa2
Make tidy::version::Version a [u32; 3]
rasendubi May 1, 2019
3b4fe7e
Group and sort feature_gate.rs
rasendubi May 1, 2019
c120fd8
Rework Version::parse to avoid extra allocations
rasendubi May 1, 2019
4bcc828
Make in_feature_group a simple bool flag
rasendubi May 2, 2019
201f14b
Make tidy::version::Version copy
rasendubi May 2, 2019
d72f4de
Constrain all regions in the concrete type for an opaque type
matthewjasper May 1, 2019
7d7787d
Rollup merge of #59928 - petrochenkov:denyambass, r=varkor
Centril May 2, 2019
7f1ed70
Rollup merge of #60135 - Gilnaa:arm-none-eabi, r=nagisa
Centril May 2, 2019
3010b14
Rollup merge of #60220 - euclio:rustdoc-test-fatal-parsing-errors, r=…
Centril May 2, 2019
d38096a
Rollup merge of #60373 - rasendubi:lang-features-sort-since, r=Centril
Centril May 2, 2019
22bd72a
Rollup merge of #60393 - estebank:pat-sugg, r=oli-obk
Centril May 2, 2019
bc4a2ad
Rollup merge of #60401 - JohnTitor:rename-log, r=davidtwco
Centril May 2, 2019
6e7bcff
Rollup merge of #60409 - JohnTitor:error-for-existential-type, r=oli-obk
Centril May 2, 2019
57cfb40
Rollup merge of #60449 - matthewjasper:impl-trait-outlives, r=pnkfelix
Centril May 2, 2019
dff53a0
Rollup merge of #60455 - estebank:resolve-match-arm-ty, r=davidtwco
Centril May 2, 2019
d0057da
Rollup merge of #60457 - wesleywiser:const_prop_refactoring, r=oli-obk
Centril May 2, 2019
5ab3b6b
Rollup merge of #60467 - nnethercote:less-symbol-interning, r=davidtwco
Centril May 2, 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 Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3553,6 +3553,7 @@ dependencies = [
name = "tidy"
version = "0.1.0"
dependencies = [
"regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ fn configure_cmake(builder: &Builder<'_>,
}

if env::var_os("SCCACHE_ERROR_LOG").is_some() {
cfg.env("RUST_LOG", "sccache=warn");
cfg.env("RUSTC_LOG", "sccache=warn");
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/ci/docker/dist-various-1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,17 @@ ENV TARGETS=$TARGETS,armebv7r-none-eabi
ENV TARGETS=$TARGETS,armebv7r-none-eabihf
ENV TARGETS=$TARGETS,armv7r-none-eabi
ENV TARGETS=$TARGETS,armv7r-none-eabihf
ENV TARGETS=$TARGETS,armv7a-none-eabi
ENV TARGETS=$TARGETS,armv7a-none-eabihf
ENV TARGETS=$TARGETS,thumbv7neon-unknown-linux-gnueabihf

ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \
CC_mips_unknown_linux_musl=mips-openwrt-linux-gcc \
CC_sparc64_unknown_linux_gnu=sparc64-linux-gnu-gcc \
CC_x86_64_unknown_redox=x86_64-unknown-redox-gcc \
CC_armebv7r_none_eabi=arm-none-eabi-gcc \
CC_armv7a_none_eabi=arm-none-eabi-gcc \
CC_armv7a_none_eabihf=arm-none-eabi-gcc \
CC_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc \
AR_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-ar \
CXX_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-g++
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
for sp in prior_arms {
err.span_label(*sp, format!(
"this is found to be of type `{}`",
last_ty,
self.resolve_type_vars_if_possible(&last_ty),
));
}
} else if let Some(sp) = prior_arms.last() {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
/// potentially leaving "dangling type variables" behind.
/// In such cases, an assertion will fail when attempting to
/// register obligations, within a snapshot. Very useful, much
/// better than grovelling through megabytes of `RUST_LOG` output.
/// better than grovelling through megabytes of `RUSTC_LOG` output.
///
/// HOWEVER, in some cases the flag is unhelpful. In particular, we
/// sometimes create a "mini-fulfilment-cx" in which we enroll
Expand Down
141 changes: 84 additions & 57 deletions src/librustc/infer/opaque_types/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
use rustc_data_structures::fx::FxHashMap;
use syntax_pos::Span;

use crate::hir::def_id::DefId;
use crate::hir;
use crate::hir::Node;
use crate::infer::{self, InferCtxt, InferOk, TypeVariableOrigin};
use crate::infer::outlives::free_region_map::FreeRegionRelations;
use rustc_data_structures::fx::FxHashMap;
use crate::traits::{self, PredicateObligation};
use crate::ty::{self, Ty, TyCtxt, GenericParamDefKind};
use crate::ty::fold::{BottomUpFolder, TypeFoldable, TypeFolder};
use crate::ty::outlives::Component;
use crate::ty::fold::{BottomUpFolder, TypeFoldable, TypeFolder, TypeVisitor};
use crate::ty::subst::{Kind, InternalSubsts, SubstsRef, UnpackedKind};
use crate::util::nodemap::DefIdMap;

Expand Down Expand Up @@ -373,58 +374,11 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
let least_region = least_region.unwrap_or(self.tcx.lifetimes.re_static);
debug!("constrain_opaque_types: least_region={:?}", least_region);

// Require that the type `concrete_ty` outlives
// `least_region`, modulo any type parameters that appear
// in the type, which we ignore. This is because impl
// trait values are assumed to capture all the in-scope
// type parameters. This little loop here just invokes
// `outlives` repeatedly, draining all the nested
// obligations that result.
let mut types = vec![concrete_ty];
let bound_region = |r| self.sub_regions(infer::CallReturn(span), least_region, r);
while let Some(ty) = types.pop() {
let mut components = smallvec![];
self.tcx.push_outlives_components(ty, &mut components);
while let Some(component) = components.pop() {
match component {
Component::Region(r) => {
bound_region(r);
}

Component::Param(_) => {
// ignore type parameters like `T`, they are captured
// implicitly by the `impl Trait`
}

Component::UnresolvedInferenceVariable(_) => {
// we should get an error that more type
// annotations are needed in this case
self.tcx
.sess
.delay_span_bug(span, "unresolved inf var in opaque");
}

Component::Projection(ty::ProjectionTy {
substs,
item_def_id: _,
}) => {
for k in substs {
match k.unpack() {
UnpackedKind::Lifetime(lt) => bound_region(lt),
UnpackedKind::Type(ty) => types.push(ty),
UnpackedKind::Const(_) => {
// Const parameters don't impose constraints.
}
}
}
}

Component::EscapingProjection(more_components) => {
components.extend(more_components);
}
}
}
}
concrete_ty.visit_with(&mut OpaqueTypeOutlivesVisitor {
infcx: self,
least_region,
span,
});
}

/// Given the fully resolved, instantiated type for an opaque
Expand Down Expand Up @@ -502,6 +456,80 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
}
}

// Visitor that requires that (almost) all regions in the type visited outlive
// `least_region`. We cannot use `push_outlives_components` because regions in
// closure signatures are not included in their outlives components. We need to
// ensure all regions outlive the given bound so that we don't end up with,
// say, `ReScope` appearing in a return type and causing ICEs when other
// functions end up with region constraints involving regions from other
// functions.
//
// We also cannot use `for_each_free_region` because for closures it includes
// the regions parameters from the enclosing item.
//
// We ignore any type parameters because impl trait values are assumed to
// capture all the in-scope type parameters.
struct OpaqueTypeOutlivesVisitor<'a, 'gcx, 'tcx> {
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
least_region: ty::Region<'tcx>,
span: Span,
}

impl<'tcx> TypeVisitor<'tcx> for OpaqueTypeOutlivesVisitor<'_, '_, 'tcx>
{
fn visit_binder<T: TypeFoldable<'tcx>>(&mut self, t: &ty::Binder<T>) -> bool {
t.skip_binder().visit_with(self);
false // keep visiting
}

fn visit_region(&mut self, r: ty::Region<'tcx>) -> bool {
match *r {
// ignore bound regions, keep visiting
ty::ReLateBound(_, _) => false,
_ => {
self.infcx.sub_regions(infer::CallReturn(self.span), self.least_region, r);
false
}
}
}

fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
// We're only interested in types involving regions
if !ty.flags.intersects(ty::TypeFlags::HAS_FREE_REGIONS) {
return false; // keep visiting
}

match ty.sty {
ty::Closure(def_id, ref substs) => {
// Skip lifetime parameters of the enclosing item(s)

for upvar_ty in substs.upvar_tys(def_id, self.infcx.tcx) {
upvar_ty.visit_with(self);
}

substs.closure_sig_ty(def_id, self.infcx.tcx).visit_with(self);
}

ty::Generator(def_id, ref substs, _) => {
// Skip lifetime parameters of the enclosing item(s)
// Also skip the witness type, because that has no free regions.

for upvar_ty in substs.upvar_tys(def_id, self.infcx.tcx) {
upvar_ty.visit_with(self);
}

substs.return_ty(def_id, self.infcx.tcx).visit_with(self);
substs.yield_ty(def_id, self.infcx.tcx).visit_with(self);
}
_ => {
ty.super_visit_with(self);
}
}

false
}
}

struct ReverseMapper<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
tcx: TyCtxt<'cx, 'gcx, 'tcx>,

Expand Down Expand Up @@ -563,8 +591,7 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for ReverseMapper<'cx, 'gcx, 'tcx>
// ignore `'static`, as that can appear anywhere
ty::ReStatic |

// ignore `ReScope`, as that can appear anywhere
// See `src/test/run-pass/issue-49556.rs` for example.
// ignore `ReScope`, which may appear in impl Trait in bindings.
ty::ReScope(..) => return r,

_ => { }
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ declare_lint! {

declare_lint! {
pub AMBIGUOUS_ASSOCIATED_ITEMS,
Warn,
Deny,
"ambiguous associated items"
}

Expand Down
22 changes: 13 additions & 9 deletions src/librustc_codegen_llvm/debuginfo/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -784,26 +784,30 @@ pub fn file_metadata(cx: &CodegenCx<'ll, '_>,
file_name,
defining_crate);

let directory = if defining_crate == LOCAL_CRATE {
&cx.sess().working_dir.0
let file_name = &file_name.to_string();
let file_name_symbol = Symbol::intern(file_name);
if defining_crate == LOCAL_CRATE {
let directory = &cx.sess().working_dir.0.to_string_lossy();
file_metadata_raw(cx, file_name, Some(file_name_symbol),
directory, Some(Symbol::intern(directory)))
} else {
// If the path comes from an upstream crate we assume it has been made
// independent of the compiler's working directory one way or another.
Path::new("")
};

file_metadata_raw(cx, &file_name.to_string(), &directory.to_string_lossy())
file_metadata_raw(cx, file_name, Some(file_name_symbol), "", None)
}
}

pub fn unknown_file_metadata(cx: &CodegenCx<'ll, '_>) -> &'ll DIFile {
file_metadata_raw(cx, "<unknown>", "")
file_metadata_raw(cx, "<unknown>", None, "", None)
}

fn file_metadata_raw(cx: &CodegenCx<'ll, '_>,
file_name: &str,
directory: &str)
file_name_symbol: Option<Symbol>,
directory: &str,
directory_symbol: Option<Symbol>)
-> &'ll DIFile {
let key = (Symbol::intern(file_name), Symbol::intern(directory));
let key = (file_name_symbol, directory_symbol);

if let Some(file_metadata) = debug_context(cx).created_files.borrow().get(&key) {
return *file_metadata;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/debuginfo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub struct CrateDebugContext<'a, 'tcx> {
llcontext: &'a llvm::Context,
llmod: &'a llvm::Module,
builder: &'a mut DIBuilder<'a>,
created_files: RefCell<FxHashMap<(Symbol, Symbol), &'a DIFile>>,
created_files: RefCell<FxHashMap<(Option<Symbol>, Option<Symbol>), &'a DIFile>>,
created_enum_disr_types: RefCell<FxHashMap<(DefId, layout::Primitive), &'a DIType>>,

type_map: RefCell<TypeMap<'a, 'tcx>>,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ pub fn report_ices_to_stderr_if_any<F: FnOnce() -> R, R>(f: F) -> Result<R, Erro
/// This allows tools to enable rust logging without having to magically match rustc's
/// log crate version
pub fn init_rustc_env_logger() {
env_logger::init();
env_logger::init_from_env("RUSTC_LOG");
}

pub fn main() {
Expand Down
Loading