Skip to content

Commit 0e3c9bb

Browse files
committed
Auto merge of #48615 - Manishearth:rollup, r=Manishearth
Rollup of 10 pull requests - Successful merges: #48355, #48359, #48380, #48419, #48420, #48461, #48522, #48570, #48572, #48603 - Failed merges:
2 parents 0ff9872 + b2b9707 commit 0e3c9bb

File tree

41 files changed

+677
-148
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+677
-148
lines changed

src/doc/man/rustc.1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,16 @@ Print version info and exit.
125125
\fB\-v\fR, \fB\-\-verbose\fR
126126
Use verbose output.
127127
.TP
128+
\fB\-\-remap\-path\-prefix\fR \fIfrom\fR=\fIto\fR
129+
Remap source path prefixes in all output, including compiler diagnostics, debug information,
130+
macro expansions, etc. The \fIfrom\fR=\fIto\fR parameter is scanned from right to left, so \fIfrom\fR
131+
may contain '=', but \fIto\fR may not.
132+
133+
This is useful for normalizing build products, for example by removing the current directory out of
134+
pathnames emitted into the object files. The replacement is purely textual, with no consideration of
135+
the current system's pathname syntax. For example \fI\-\-remap\-path\-prefix foo=bar\fR will
136+
match \fBfoo/lib.rs\fR but not \fB./foo/lib.rs\fR.
137+
.TP
128138
\fB\-\-extern\fR \fINAME\fR=\fIPATH\fR
129139
Specify where an external rust library is located. These should match
130140
\fIextern\fR declarations in the crate's source code.

src/doc/unstable-book/src/compiler-flags/remap-path-prefix.md

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/libcore/iter/iterator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,8 +1062,8 @@ pub trait Iterator {
10621062
/// assert_eq!(merged, "alphabetagamma");
10631063
/// ```
10641064
///
1065-
/// You can also rewrite this in terms of [`flat_map()`] which is preferable
1066-
/// in this case since that conveys intent clearer:
1065+
/// You can also rewrite this in terms of [`flat_map()`], which is preferable
1066+
/// in this case since it conveys intent more clearly:
10671067
///
10681068
/// ```
10691069
/// let words = ["alpha", "beta", "gamma"];

src/libcore/panicking.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ pub fn panic_fmt(fmt: fmt::Arguments, file_line_col: &(&'static str, u32, u32))
6464
#[allow(improper_ctypes)]
6565
extern {
6666
#[lang = "panic_fmt"]
67-
#[unwind]
67+
#[cfg_attr(stage0, unwind)]
68+
#[cfg_attr(not(stage0), unwind(allowed))]
6869
fn panic_impl(fmt: fmt::Arguments, file: &'static str, line: u32, col: u32) -> !;
6970
}
7071
let (file, line, col) = *file_line_col;

src/libpanic_unwind/gcc.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,8 @@ unsafe fn find_eh_action(context: *mut uw::_Unwind_Context)
286286
// See docs in the `unwind` module.
287287
#[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))]
288288
#[lang = "eh_unwind_resume"]
289-
#[unwind]
289+
#[cfg_attr(stage0, unwind)]
290+
#[cfg_attr(not(stage0), unwind(allowed))]
290291
unsafe extern "C" fn rust_eh_unwind_resume(panic_ctx: *mut u8) -> ! {
291292
uw::_Unwind_Resume(panic_ctx as *mut uw::_Unwind_Exception);
292293
}

src/libpanic_unwind/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ pub unsafe extern "C" fn __rust_maybe_catch_panic(f: fn(*mut u8),
112112
// Entry point for raising an exception, just delegates to the platform-specific
113113
// implementation.
114114
#[no_mangle]
115-
#[unwind]
115+
#[cfg_attr(stage0, unwind)]
116+
#[cfg_attr(not(stage0), unwind(allowed))]
116117
pub unsafe extern "C" fn __rust_start_panic(data: usize, vtable: usize) -> u32 {
117118
imp::panic(mem::transmute(raw::TraitObject {
118119
data: data as *mut (),

src/libpanic_unwind/seh64_gnu.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ unsafe extern "C" fn rust_eh_personality(exceptionRecord: *mut c::EXCEPTION_RECO
108108
}
109109

110110
#[lang = "eh_unwind_resume"]
111-
#[unwind]
111+
#[cfg_attr(stage0, unwind)]
112+
#[cfg_attr(not(stage0), unwind(allowed))]
112113
unsafe extern "C" fn rust_eh_unwind_resume(panic_ctx: c::LPVOID) -> ! {
113114
let params = [panic_ctx as c::ULONG_PTR];
114115
c::RaiseException(RUST_PANIC,

src/libpanic_unwind/windows.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,21 @@ pub enum EXCEPTION_DISPOSITION {
7979
pub use self::EXCEPTION_DISPOSITION::*;
8080

8181
extern "system" {
82-
#[unwind]
82+
#[cfg_attr(stage0, unwind)]
83+
#[cfg_attr(not(stage0), unwind(allowed))]
8384
pub fn RaiseException(dwExceptionCode: DWORD,
8485
dwExceptionFlags: DWORD,
8586
nNumberOfArguments: DWORD,
8687
lpArguments: *const ULONG_PTR);
87-
#[unwind]
88+
#[cfg_attr(stage0, unwind)]
89+
#[cfg_attr(not(stage0), unwind(allowed))]
8890
pub fn RtlUnwindEx(TargetFrame: LPVOID,
8991
TargetIp: LPVOID,
9092
ExceptionRecord: *const EXCEPTION_RECORD,
9193
ReturnValue: LPVOID,
9294
OriginalContext: *const CONTEXT,
9395
HistoryTable: *const UNWIND_HISTORY_TABLE);
94-
#[unwind]
96+
#[cfg_attr(stage0, unwind)]
97+
#[cfg_attr(not(stage0), unwind(allowed))]
9598
pub fn _CxxThrowException(pExceptionObject: *mut c_void, pThrowInfo: *mut u8);
9699
}

src/libproc_macro/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ impl SourceFile {
316316
/// If the code span associated with this `SourceFile` was generated by an external macro, this
317317
/// may not be an actual path on the filesystem. Use [`is_real`] to check.
318318
///
319-
/// Also note that even if `is_real` returns `true`, if `-Z remap-path-prefix-*` was passed on
319+
/// Also note that even if `is_real` returns `true`, if `--remap-path-prefix` was passed on
320320
/// the command line, the path as given may not actually be valid.
321321
///
322322
/// [`is_real`]: #method.is_real

src/librustc/hir/lowering.rs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ use hir::HirVec;
4646
use hir::map::{Definitions, DefKey, DefPathData};
4747
use hir::def_id::{DefIndex, DefId, CRATE_DEF_INDEX, DefIndexAddressSpace};
4848
use hir::def::{Def, PathResolution};
49-
use lint::builtin::PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES;
49+
use lint::builtin::{self, PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES};
5050
use middle::cstore::CrateStore;
5151
use rustc_data_structures::indexed_vec::IndexVec;
5252
use session::Session;
@@ -912,7 +912,11 @@ impl<'a> LoweringContext<'a> {
912912
TyKind::Path(ref qself, ref path) => {
913913
let id = self.lower_node_id(t.id);
914914
let qpath = self.lower_qpath(t.id, qself, path, ParamMode::Explicit, itctx);
915-
return self.ty_path(id, t.span, qpath);
915+
let ty = self.ty_path(id, t.span, qpath);
916+
if let hir::TyTraitObject(..) = ty.node {
917+
self.maybe_lint_bare_trait(t.span, t.id, qself.is_none() && path.is_global());
918+
}
919+
return ty;
916920
}
917921
TyKind::ImplicitSelf => {
918922
hir::TyPath(hir::QPath::Resolved(None, P(hir::Path {
@@ -931,7 +935,7 @@ impl<'a> LoweringContext<'a> {
931935
let expr = self.lower_body(None, |this| this.lower_expr(expr));
932936
hir::TyTypeof(expr)
933937
}
934-
TyKind::TraitObject(ref bounds, ..) => {
938+
TyKind::TraitObject(ref bounds, kind) => {
935939
let mut lifetime_bound = None;
936940
let bounds = bounds.iter().filter_map(|bound| {
937941
match *bound {
@@ -950,6 +954,9 @@ impl<'a> LoweringContext<'a> {
950954
let lifetime_bound = lifetime_bound.unwrap_or_else(|| {
951955
self.elided_lifetime(t.span)
952956
});
957+
if kind != TraitObjectSyntax::Dyn {
958+
self.maybe_lint_bare_trait(t.span, t.id, false);
959+
}
953960
hir::TyTraitObject(bounds, lifetime_bound)
954961
}
955962
TyKind::ImplTrait(ref bounds) => {
@@ -3685,7 +3692,6 @@ impl<'a> LoweringContext<'a> {
36853692
// The original ID is taken by the `PolyTraitRef`,
36863693
// so the `Ty` itself needs a different one.
36873694
id = self.next_id();
3688-
36893695
hir::TyTraitObject(hir_vec![principal], self.elided_lifetime(span))
36903696
} else {
36913697
hir::TyPath(hir::QPath::Resolved(None, path))
@@ -3703,6 +3709,16 @@ impl<'a> LoweringContext<'a> {
37033709
name: hir::LifetimeName::Implicit,
37043710
}
37053711
}
3712+
3713+
fn maybe_lint_bare_trait(&self, span: Span, id: NodeId, is_global: bool) {
3714+
if self.sess.features.borrow().dyn_trait {
3715+
self.sess.buffer_lint_with_diagnostic(
3716+
builtin::BARE_TRAIT_OBJECT, id, span,
3717+
"trait objects without an explicit `dyn` are deprecated",
3718+
builtin::BuiltinLintDiagnostics::BareTraitObject(span, is_global)
3719+
)
3720+
}
3721+
}
37063722
}
37073723

37083724
fn body_ids(bodies: &BTreeMap<hir::BodyId, hir::Body>) -> Vec<hir::BodyId> {

0 commit comments

Comments
 (0)