Skip to content

Commit a34a9b8

Browse files
committed
Revert to f9a3086
1 parent 8ad7bc3 commit a34a9b8

File tree

95 files changed

+273
-2340
lines changed

Some content is hidden

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

95 files changed

+273
-2340
lines changed

src/doc/unstable-book/src/compiler-flags/sanitizer.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ of bugs:
2626
* Double-free, invalid free
2727
* Memory leaks
2828

29-
The memory leak detection is enabled by default on Linux, and can be enabled
30-
with runtime flag `ASAN_OPTIONS=detect_leaks=1` on macOS.
31-
3229
AddressSanitizer is supported on the following targets:
3330

3431
* `x86_64-apple-darwin`
@@ -199,6 +196,10 @@ fn main() {
199196
200197
```shell
201198
$ export \
199+
CC=clang \
200+
CXX=clang++ \
201+
CFLAGS='-fsanitize=memory -fsanitize-memory-track-origins' \
202+
CXXFLAGS='-fsanitize=memory -fsanitize-memory-track-origins' \
202203
RUSTFLAGS='-Zsanitizer=memory -Zsanitizer-memory-track-origins' \
203204
RUSTDOCFLAGS='-Zsanitizer=memory -Zsanitizer-memory-track-origins'
204205
$ cargo clean

src/libcore/num/f32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ pub mod consts {
242242
/// The full circle constant (τ)
243243
///
244244
/// Equal to 2π.
245-
#[stable(feature = "tau_constant", since = "1.47.0")]
245+
#[unstable(feature = "tau_constant", issue = "66770")]
246246
pub const TAU: f32 = 6.28318530717958647692528676655900577_f32;
247247

248248
/// π/2

src/libcore/num/f64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ pub mod consts {
242242
/// The full circle constant (τ)
243243
///
244244
/// Equal to 2π.
245-
#[stable(feature = "tau_constant", since = "1.47.0")]
245+
#[unstable(feature = "tau_constant", issue = "66770")]
246246
pub const TAU: f64 = 6.28318530717958647692528676655900577_f64;
247247

248248
/// π/2

src/libcore/ops/range.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use crate::hash::Hash;
3939
/// [`Iterator`]: ../iter/trait.IntoIterator.html
4040
/// [slicing index]: ../slice/trait.SliceIndex.html
4141
#[doc(alias = "..")]
42-
#[derive(Copy, Clone, Default, PartialEq, Eq, Hash)]
42+
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
4343
#[stable(feature = "rust1", since = "1.0.0")]
4444
pub struct RangeFull;
4545

@@ -71,7 +71,7 @@ impl fmt::Debug for RangeFull {
7171
/// assert_eq!(arr[1..=3], [ 1,2,3 ]);
7272
/// ```
7373
#[doc(alias = "..")]
74-
#[derive(Clone, Default, PartialEq, Eq, Hash)] // not Copy -- see #27186
74+
#[derive(Clone, PartialEq, Eq, Hash)] // not Copy -- see #27186
7575
#[stable(feature = "rust1", since = "1.0.0")]
7676
pub struct Range<Idx> {
7777
/// The lower bound of the range (inclusive).

src/librustc_codegen_llvm/callee.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use log::debug;
1313
use rustc_codegen_ssa::traits::*;
1414

1515
use rustc_middle::ty::layout::{FnAbiExt, HasTyCtxt};
16-
use rustc_middle::ty::{self, Instance, TypeFoldable};
16+
use rustc_middle::ty::{Instance, TypeFoldable};
1717

1818
/// Codegens a reference to a fn/method item, monomorphizing and
1919
/// inlining as it goes.
@@ -29,18 +29,14 @@ pub fn get_fn(cx: &CodegenCx<'ll, 'tcx>, instance: Instance<'tcx>) -> &'ll Value
2929

3030
assert!(!instance.substs.needs_infer());
3131
assert!(!instance.substs.has_escaping_bound_vars());
32+
assert!(!instance.substs.has_param_types_or_consts());
3233

3334
if let Some(&llfn) = cx.instances.borrow().get(&instance) {
3435
return llfn;
3536
}
3637

3738
let sym = tcx.symbol_name(instance).name;
38-
debug!(
39-
"get_fn({:?}: {:?}) => {}",
40-
instance,
41-
instance.ty(cx.tcx(), ty::ParamEnv::reveal_all()),
42-
sym
43-
);
39+
debug!("get_fn({:?}: {:?}) => {}", instance, instance.monomorphic_ty(cx.tcx()), sym);
4440

4541
let fn_abi = FnAbi::of_instance(cx, instance, &[]);
4642

src/librustc_codegen_llvm/consts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ impl CodegenCx<'ll, 'tcx> {
203203
def_id
204204
);
205205

206-
let ty = instance.ty(self.tcx, ty::ParamEnv::reveal_all());
206+
let ty = instance.monomorphic_ty(self.tcx);
207207
let sym = self.tcx.symbol_name(instance).name;
208208

209209
debug!("get_static: sym={} instance={:?}", sym, instance);
@@ -361,7 +361,7 @@ impl StaticMethods for CodegenCx<'ll, 'tcx> {
361361
};
362362

363363
let instance = Instance::mono(self.tcx, def_id);
364-
let ty = instance.ty(self.tcx, ty::ParamEnv::reveal_all());
364+
let ty = instance.monomorphic_ty(self.tcx);
365365
let llty = self.layout_of(ty).llvm_type(self);
366366
let g = if val_llty == llty {
367367
g

src/librustc_codegen_llvm/debuginfo/metadata.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,6 @@ pub fn type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>, usage_site_span: Sp
700700
prepare_tuple_metadata(cx, t, &tys, unique_type_id, usage_site_span, NO_SCOPE_METADATA)
701701
.finalize(cx)
702702
}
703-
// Type parameters from polymorphized functions.
704-
ty::Param(_) => MetadataCreationResult::new(param_type_metadata(cx, t), false),
705703
_ => bug!("debuginfo: unexpected type in type_metadata: {:?}", t),
706704
};
707705

@@ -957,20 +955,6 @@ fn pointer_type_metadata(
957955
}
958956
}
959957

960-
fn param_type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll DIType {
961-
debug!("param_type_metadata: {:?}", t);
962-
let name = format!("{:?}", t);
963-
return unsafe {
964-
llvm::LLVMRustDIBuilderCreateBasicType(
965-
DIB(cx),
966-
name.as_ptr().cast(),
967-
name.len(),
968-
Size::ZERO.bits(),
969-
DW_ATE_unsigned,
970-
)
971-
};
972-
}
973-
974958
pub fn compile_unit_metadata(
975959
tcx: TyCtxt<'_>,
976960
codegen_unit_name: &str,
@@ -2481,7 +2465,7 @@ pub fn create_global_var_metadata(cx: &CodegenCx<'ll, '_>, def_id: DefId, global
24812465
};
24822466

24832467
let is_local_to_unit = is_node_local_to_unit(cx, def_id);
2484-
let variable_type = Instance::mono(cx.tcx, def_id).ty(cx.tcx, ty::ParamEnv::reveal_all());
2468+
let variable_type = Instance::mono(cx.tcx, def_id).monomorphic_ty(cx.tcx);
24852469
let type_metadata = type_metadata(cx, variable_type, span);
24862470
let var_name = tcx.item_name(def_id).as_str();
24872471
let linkage_name = mangled_name_of_instance(cx, Instance::mono(tcx, def_id)).name;

src/librustc_codegen_llvm/debuginfo/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use rustc_index::vec::IndexVec;
2626
use rustc_middle::mir;
2727
use rustc_middle::ty::layout::HasTyCtxt;
2828
use rustc_middle::ty::subst::{GenericArgKind, SubstsRef};
29-
use rustc_middle::ty::{self, Instance, ParamEnv, Ty, TypeFoldable};
29+
use rustc_middle::ty::{self, Instance, ParamEnv, Ty};
3030
use rustc_session::config::{self, DebugInfo};
3131
use rustc_span::symbol::Symbol;
3232
use rustc_span::{self, BytePos, Span};
@@ -470,9 +470,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
470470
match impl_self_ty.kind {
471471
ty::Adt(def, ..) if !def.is_box() => {
472472
// Again, only create type information if full debuginfo is enabled
473-
if cx.sess().opts.debuginfo == DebugInfo::Full
474-
&& !impl_self_ty.needs_subst()
475-
{
473+
if cx.sess().opts.debuginfo == DebugInfo::Full {
476474
Some(type_metadata(cx, impl_self_ty, rustc_span::DUMMY_SP))
477475
} else {
478476
Some(namespace::item_namespace(cx, def.did))

src/librustc_codegen_llvm/intrinsic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> {
160160
caller_instance: ty::Instance<'tcx>,
161161
) {
162162
let tcx = self.tcx;
163-
let callee_ty = instance.ty(tcx, ty::ParamEnv::reveal_all());
163+
let callee_ty = instance.monomorphic_ty(tcx);
164164

165165
let (def_id, substs) = match callee_ty.kind {
166166
ty::FnDef(def_id, substs) => (def_id, substs),

src/librustc_codegen_llvm/mono_item.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_hir::def_id::{DefId, LOCAL_CRATE};
1010
pub use rustc_middle::mir::mono::MonoItem;
1111
use rustc_middle::mir::mono::{Linkage, Visibility};
1212
use rustc_middle::ty::layout::FnAbiExt;
13-
use rustc_middle::ty::{self, Instance, TypeFoldable};
13+
use rustc_middle::ty::{Instance, TypeFoldable};
1414
use rustc_target::abi::LayoutOf;
1515

1616
impl PreDefineMethods<'tcx> for CodegenCx<'ll, 'tcx> {
@@ -22,7 +22,7 @@ impl PreDefineMethods<'tcx> for CodegenCx<'ll, 'tcx> {
2222
symbol_name: &str,
2323
) {
2424
let instance = Instance::mono(self.tcx, def_id);
25-
let ty = instance.ty(self.tcx, ty::ParamEnv::reveal_all());
25+
let ty = instance.monomorphic_ty(self.tcx);
2626
let llty = self.layout_of(ty).llvm_type(self);
2727

2828
let g = self.define_global(symbol_name, llty).unwrap_or_else(|| {
@@ -47,7 +47,7 @@ impl PreDefineMethods<'tcx> for CodegenCx<'ll, 'tcx> {
4747
visibility: Visibility,
4848
symbol_name: &str,
4949
) {
50-
assert!(!instance.substs.needs_infer());
50+
assert!(!instance.substs.needs_infer() && !instance.substs.has_param_types_or_consts());
5151

5252
let fn_abi = FnAbi::of_instance(self, instance, &[]);
5353
let lldecl = self.declare_fn(symbol_name, &fn_abi);

src/librustc_codegen_ssa/debuginfo/type_names.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,17 +205,14 @@ pub fn push_debuginfo_type_name<'tcx>(
205205
tcx.def_key(def_id).disambiguated_data.disambiguator
206206
));
207207
}
208-
// Type parameters from polymorphized functions.
209-
ty::Param(_) => {
210-
output.push_str(&format!("{:?}", t));
211-
}
212208
ty::Error(_)
213209
| ty::Infer(_)
214210
| ty::Placeholder(..)
215211
| ty::Projection(..)
216212
| ty::Bound(..)
217213
| ty::Opaque(..)
218-
| ty::GeneratorWitness(..) => {
214+
| ty::GeneratorWitness(..)
215+
| ty::Param(_) => {
219216
bug!(
220217
"debuginfo: Trying to create type name for \
221218
unexpected type: {:?}",

src/librustc_codegen_ssa/meth.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ pub fn get_vtable<'tcx, Cx: CodegenMethods<'tcx>>(
9494
def_id,
9595
substs,
9696
)
97-
.unwrap()
98-
.polymorphize(cx.tcx()),
97+
.unwrap(),
9998
)
10099
})
101100
});

src/librustc_codegen_ssa/mir/analyze.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ impl<Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
124124
let base_ty = self.fx.monomorphize(&base_ty);
125125

126126
// ZSTs don't require any actual memory access.
127-
let elem_ty = base_ty.projection_ty(cx.tcx(), self.fx.monomorphize(&elem)).ty;
127+
let elem_ty = base_ty.projection_ty(cx.tcx(), elem).ty;
128+
let elem_ty = self.fx.monomorphize(&elem_ty);
128129
let span = self.fx.mir.local_decls[place_ref.local].source_info.span;
129130
if cx.spanned_layout_of(elem_ty, span).is_zst() {
130131
return;

src/librustc_codegen_ssa/mir/block.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
543543
Some(
544544
ty::Instance::resolve(bx.tcx(), ty::ParamEnv::reveal_all(), def_id, substs)
545545
.unwrap()
546-
.unwrap()
547-
.polymorphize(bx.tcx()),
546+
.unwrap(),
548547
),
549548
None,
550549
),

src/librustc_codegen_ssa/mir/rvalue.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,17 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
190190
if bx.cx().tcx().has_attr(def_id, sym::rustc_args_required_const) {
191191
bug!("reifying a fn ptr that requires const arguments");
192192
}
193-
let instance = ty::Instance::resolve_for_fn_ptr(
194-
bx.tcx(),
195-
ty::ParamEnv::reveal_all(),
196-
def_id,
197-
substs,
193+
OperandValue::Immediate(
194+
bx.get_fn_addr(
195+
ty::Instance::resolve_for_fn_ptr(
196+
bx.tcx(),
197+
ty::ParamEnv::reveal_all(),
198+
def_id,
199+
substs,
200+
)
201+
.unwrap(),
202+
),
198203
)
199-
.unwrap()
200-
.polymorphize(bx.cx().tcx());
201-
OperandValue::Immediate(bx.get_fn_addr(instance))
202204
}
203205
_ => bug!("{} cannot be reified to a fn ptr", operand.layout.ty),
204206
}
@@ -211,8 +213,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
211213
def_id,
212214
substs,
213215
ty::ClosureKind::FnOnce,
214-
)
215-
.polymorphize(bx.cx().tcx());
216+
);
216217
OperandValue::Immediate(bx.cx().get_fn_addr(instance))
217218
}
218219
_ => bug!("{} cannot be cast to a fn ptr", operand.layout.ty),

src/librustc_data_structures/stable_hasher.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -469,15 +469,6 @@ impl<R: vec::Idx, C: vec::Idx, CTX> HashStable<CTX> for bit_set::BitMatrix<R, C>
469469
}
470470
}
471471

472-
impl<T, CTX> HashStable<CTX> for bit_set::FiniteBitSet<T>
473-
where
474-
T: HashStable<CTX> + bit_set::FiniteBitSetTy,
475-
{
476-
fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) {
477-
self.0.hash_stable(hcx, hasher);
478-
}
479-
}
480-
481472
impl_stable_hash_via_hash!(::std::path::Path);
482473
impl_stable_hash_via_hash!(::std::path::PathBuf);
483474

src/librustc_error_codes/error_codes.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,6 @@ E0767: include_str!("./error_codes/E0767.md"),
453453
E0768: include_str!("./error_codes/E0768.md"),
454454
E0769: include_str!("./error_codes/E0769.md"),
455455
E0770: include_str!("./error_codes/E0770.md"),
456-
E0771: include_str!("./error_codes/E0771.md"),
457456
;
458457
// E0006, // merged with E0005
459458
// E0008, // cannot bind by-move into a pattern guard

src/librustc_error_codes/error_codes/E0771.md

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

src/librustc_feature/builtin_attrs.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
568568
),
569569
rustc_attr!(TEST, rustc_synthetic, AssumedUsed, template!(Word)),
570570
rustc_attr!(TEST, rustc_symbol_name, AssumedUsed, template!(Word)),
571-
rustc_attr!(TEST, rustc_polymorphize_error, AssumedUsed, template!(Word)),
572571
rustc_attr!(TEST, rustc_def_path, AssumedUsed, template!(Word)),
573572
rustc_attr!(TEST, rustc_mir, AssumedUsed, template!(List: "arg1, arg2, ...")),
574573
rustc_attr!(TEST, rustc_dump_program_clauses, AssumedUsed, template!(Word)),

0 commit comments

Comments
 (0)