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

Avoid "blacklist" #74150

Merged
merged 1 commit into from
Jul 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/librustc_error_codes/error_codes/E0570.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The requested ABI is unsupported by the current target.

The rust compiler maintains for each target a blacklist of ABIs unsupported on
The rust compiler maintains for each target a list of unsupported ABIs on
that target. If an ABI is present in such a list this usually means that the
target / ABI combination is currently unsupported by llvm.

Expand Down
36 changes: 18 additions & 18 deletions src/librustc_resolve/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ impl<'a> Resolver<'a> {
}

let check_usable = |this: &mut Self, binding: &'a NameBinding<'a>| {
if let Some(blacklisted_binding) = this.blacklisted_binding {
if ptr::eq(binding, blacklisted_binding) {
if let Some(unusable_binding) = this.unusable_binding {
if ptr::eq(binding, unusable_binding) {
return Err((Determined, Weak::No));
}
}
Expand All @@ -278,12 +278,12 @@ impl<'a> Resolver<'a> {
return resolution
.binding
.and_then(|binding| {
// If the primary binding is blacklisted, search further and return the shadowed
// glob binding if it exists. What we really want here is having two separate
// scopes in a module - one for non-globs and one for globs, but until that's done
// use this hack to avoid inconsistent resolution ICEs during import validation.
if let Some(blacklisted_binding) = self.blacklisted_binding {
if ptr::eq(binding, blacklisted_binding) {
// If the primary binding is unusable, search further and return the shadowed glob
// binding if it exists. What we really want here is having two separate scopes in
// a module - one for non-globs and one for globs, but until that's done use this
// hack to avoid inconsistent resolution ICEs during import validation.
if let Some(unusable_binding) = self.unusable_binding {
if ptr::eq(binding, unusable_binding) {
return resolution.shadowed_glob;
}
}
Expand Down Expand Up @@ -875,9 +875,9 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
/// consolidate multiple unresolved import errors into a single diagnostic.
fn finalize_import(&mut self, import: &'b Import<'b>) -> Option<UnresolvedImportError> {
let orig_vis = import.vis.replace(ty::Visibility::Invisible);
let orig_blacklisted_binding = match &import.kind {
let orig_unusable_binding = match &import.kind {
ImportKind::Single { target_bindings, .. } => {
Some(mem::replace(&mut self.r.blacklisted_binding, target_bindings[TypeNS].get()))
Some(mem::replace(&mut self.r.unusable_binding, target_bindings[TypeNS].get()))
}
_ => None,
};
Expand All @@ -891,8 +891,8 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
import.crate_lint(),
);
let no_ambiguity = self.r.ambiguity_errors.len() == prev_ambiguity_errors_len;
if let Some(orig_blacklisted_binding) = orig_blacklisted_binding {
self.r.blacklisted_binding = orig_blacklisted_binding;
if let Some(orig_unusable_binding) = orig_unusable_binding {
self.r.unusable_binding = orig_unusable_binding;
}
import.vis.set(orig_vis);
if let PathResult::Failed { .. } | PathResult::NonModule(..) = path_res {
Expand Down Expand Up @@ -1013,8 +1013,8 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
self.r.per_ns(|this, ns| {
if !type_ns_only || ns == TypeNS {
let orig_vis = import.vis.replace(ty::Visibility::Invisible);
let orig_blacklisted_binding =
mem::replace(&mut this.blacklisted_binding, target_bindings[ns].get());
let orig_unusable_binding =
mem::replace(&mut this.unusable_binding, target_bindings[ns].get());
let orig_last_import_segment = mem::replace(&mut this.last_import_segment, true);
let binding = this.resolve_ident_in_module(
module,
Expand All @@ -1025,7 +1025,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
import.span,
);
this.last_import_segment = orig_last_import_segment;
this.blacklisted_binding = orig_blacklisted_binding;
this.unusable_binding = orig_unusable_binding;
import.vis.set(orig_vis);

match binding {
Expand Down Expand Up @@ -1291,8 +1291,8 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
return;
}

let orig_blacklisted_binding =
mem::replace(&mut this.blacklisted_binding, target_bindings[ns].get());
let orig_unusable_binding =
mem::replace(&mut this.unusable_binding, target_bindings[ns].get());

match this.early_resolve_ident_in_lexical_scope(
target,
Expand All @@ -1311,7 +1311,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
Err(_) => is_redundant[ns] = Some(false),
}

this.blacklisted_binding = orig_blacklisted_binding;
this.unusable_binding = orig_unusable_binding;
}
});

Expand Down
6 changes: 3 additions & 3 deletions src/librustc_resolve/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -842,14 +842,14 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
report_error(self, ns);
}
Some(LexicalScopeBinding::Item(binding)) => {
let orig_blacklisted_binding =
replace(&mut self.r.blacklisted_binding, Some(binding));
let orig_unusable_binding =
replace(&mut self.r.unusable_binding, Some(binding));
if let Some(LexicalScopeBinding::Res(..)) = self
.resolve_ident_in_lexical_scope(ident, ns, None, use_tree.prefix.span)
{
report_error(self, ns);
}
self.r.blacklisted_binding = orig_blacklisted_binding;
self.r.unusable_binding = orig_unusable_binding;
}
None => {}
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ pub struct Resolver<'a> {
last_import_segment: bool,
/// This binding should be ignored during in-module resolution, so that we don't get
/// "self-confirming" import resolutions during import validation.
blacklisted_binding: Option<&'a NameBinding<'a>>,
unusable_binding: Option<&'a NameBinding<'a>>,

/// The idents for the primitive types.
primitive_type_table: PrimitiveTypeTable,
Expand Down Expand Up @@ -1266,7 +1266,7 @@ impl<'a> Resolver<'a> {
indeterminate_imports: Vec::new(),

last_import_segment: false,
blacklisted_binding: None,
unusable_binding: None,

primitive_type_table: PrimitiveTypeTable::new(),

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/aarch64_apple_ios.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn target() -> TargetResult {
features: "+neon,+fp-armv8,+apple-a7".to_string(),
eliminate_frame_pointer: false,
max_atomic_width: Some(128),
abi_blacklist: super::arm_base::abi_blacklist(),
unsupported_abis: super::arm_base::unsupported_abis(),
forces_embed_bitcode: true,
// Taken from a clang build on Xcode 11.4.1.
// These arguments are not actually invoked - they just have
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/aarch64_apple_tvos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn target() -> TargetResult {
features: "+neon,+fp-armv8,+apple-a7".to_string(),
eliminate_frame_pointer: false,
max_atomic_width: Some(128),
abi_blacklist: super::arm_base::abi_blacklist(),
unsupported_abis: super::arm_base::unsupported_abis(),
forces_embed_bitcode: true,
..base
},
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/aarch64_fuchsia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ pub fn target() -> TargetResult {
target_env: String::new(),
target_vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
options: TargetOptions { abi_blacklist: super::arm_base::abi_blacklist(), ..base },
options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base },
})
}
2 changes: 1 addition & 1 deletion src/librustc_target/spec/aarch64_linux_android.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ pub fn target() -> TargetResult {
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { abi_blacklist: super::arm_base::abi_blacklist(), ..base },
options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base },
})
}
2 changes: 1 addition & 1 deletion src/librustc_target/spec/aarch64_unknown_cloudabi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::spec::{LinkerFlavor, Target, TargetResult};
pub fn target() -> TargetResult {
let mut base = super::cloudabi_base::opts();
base.max_atomic_width = Some(128);
base.abi_blacklist = super::arm_base::abi_blacklist();
base.unsupported_abis = super::arm_base::unsupported_abis();
base.linker = Some("aarch64-unknown-cloudabi-cc".to_string());

Ok(Target {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/aarch64_unknown_freebsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ pub fn target() -> TargetResult {
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { abi_blacklist: super::arm_base::abi_blacklist(), ..base },
options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base },
})
}
2 changes: 1 addition & 1 deletion src/librustc_target/spec/aarch64_unknown_hermit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::spec::{LinkerFlavor, Target, TargetResult};
pub fn target() -> TargetResult {
let mut base = super::hermit_base::opts();
base.max_atomic_width = Some(128);
base.abi_blacklist = super::arm_base::abi_blacklist();
base.unsupported_abis = super::arm_base::unsupported_abis();
base.linker = Some("aarch64-hermit-gcc".to_string());

Ok(Target {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/aarch64_unknown_linux_gnu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions {
abi_blacklist: super::arm_base::abi_blacklist(),
unsupported_abis: super::arm_base::unsupported_abis(),
target_mcount: "\u{1}_mcount".to_string(),
..base
},
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/aarch64_unknown_linux_musl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions {
abi_blacklist: super::arm_base::abi_blacklist(),
unsupported_abis: super::arm_base::unsupported_abis(),
target_mcount: "\u{1}_mcount".to_string(),
..base
},
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/aarch64_unknown_netbsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
pub fn target() -> TargetResult {
let mut base = super::netbsd_base::opts();
base.max_atomic_width = Some(128);
base.abi_blacklist = super::arm_base::abi_blacklist();
base.unsupported_abis = super::arm_base::unsupported_abis();

Ok(Target {
llvm_target: "aarch64-unknown-netbsd".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/aarch64_unknown_none.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn target() -> Result<Target, String> {
linker_is_gnu: true,
max_atomic_width: Some(128),
panic_strategy: PanicStrategy::Abort,
abi_blacklist: super::arm_base::abi_blacklist(),
unsupported_abis: super::arm_base::unsupported_abis(),
..Default::default()
};
Ok(Target {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/aarch64_unknown_none_softfloat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn target() -> Result<Target, String> {
linker_is_gnu: true,
max_atomic_width: Some(128),
panic_strategy: PanicStrategy::Abort,
abi_blacklist: super::arm_base::abi_blacklist(),
unsupported_abis: super::arm_base::unsupported_abis(),
..Default::default()
};
Ok(Target {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/aarch64_unknown_openbsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::spec::{LinkerFlavor, Target, TargetResult};
pub fn target() -> TargetResult {
let mut base = super::openbsd_base::opts();
base.max_atomic_width = Some(128);
base.abi_blacklist = super::arm_base::abi_blacklist();
base.unsupported_abis = super::arm_base::unsupported_abis();

Ok(Target {
llvm_target: "aarch64-unknown-openbsd".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/aarch64_wrs_vxworks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ pub fn target() -> TargetResult {
target_env: "gnu".to_string(),
target_vendor: "wrs".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { abi_blacklist: super::arm_base::abi_blacklist(), ..base },
options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base },
})
}
2 changes: 1 addition & 1 deletion src/librustc_target/spec/arm_base.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::spec::abi::Abi;

// All the calling conventions trigger an assertion(Unsupported calling convention) in llvm on arm
pub fn abi_blacklist() -> Vec<Abi> {
pub fn unsupported_abis() -> Vec<Abi> {
vec![Abi::Stdcall, Abi::Fastcall, Abi::Vectorcall, Abi::Thiscall, Abi::Win64, Abi::SysV64]
}
2 changes: 1 addition & 1 deletion src/librustc_target/spec/arm_linux_androideabi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ pub fn target() -> TargetResult {
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { abi_blacklist: super::arm_base::abi_blacklist(), ..base },
options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base },
})
}
2 changes: 1 addition & 1 deletion src/librustc_target/spec/arm_unknown_linux_gnueabi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn target() -> TargetResult {

options: TargetOptions {
features: "+strict-align,+v6".to_string(),
abi_blacklist: super::arm_base::abi_blacklist(),
unsupported_abis: super::arm_base::unsupported_abis(),
target_mcount: "\u{1}__gnu_mcount_nc".to_string(),
..base
},
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/arm_unknown_linux_gnueabihf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn target() -> TargetResult {

options: TargetOptions {
features: "+strict-align,+v6,+vfp2,-d32".to_string(),
abi_blacklist: super::arm_base::abi_blacklist(),
unsupported_abis: super::arm_base::unsupported_abis(),
target_mcount: "\u{1}__gnu_mcount_nc".to_string(),
..base
},
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/arm_unknown_linux_musleabi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions {
abi_blacklist: super::arm_base::abi_blacklist(),
unsupported_abis: super::arm_base::unsupported_abis(),
target_mcount: "\u{1}mcount".to_string(),
..base
},
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/arm_unknown_linux_musleabihf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions {
abi_blacklist: super::arm_base::abi_blacklist(),
unsupported_abis: super::arm_base::unsupported_abis(),
target_mcount: "\u{1}mcount".to_string(),
..base
},
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/armebv7r_none_eabi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn target() -> TargetResult {
relocation_model: RelocModel::Static,
panic_strategy: PanicStrategy::Abort,
max_atomic_width: Some(32),
abi_blacklist: super::arm_base::abi_blacklist(),
unsupported_abis: super::arm_base::unsupported_abis(),
emit_debug_gdb_scripts: false,
..Default::default()
},
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/armebv7r_none_eabihf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub fn target() -> TargetResult {
panic_strategy: PanicStrategy::Abort,
features: "+vfp3,-d32,-fp16".to_string(),
max_atomic_width: Some(32),
abi_blacklist: super::arm_base::abi_blacklist(),
unsupported_abis: super::arm_base::unsupported_abis(),
emit_debug_gdb_scripts: false,
..Default::default()
},
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/armv4t_unknown_linux_gnueabi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn target() -> TargetResult {
features: "+soft-float,+strict-align".to_string(),
// Atomic operations provided by compiler-builtins
max_atomic_width: Some(32),
abi_blacklist: super::arm_base::abi_blacklist(),
unsupported_abis: super::arm_base::unsupported_abis(),
target_mcount: "\u{1}__gnu_mcount_nc".to_string(),
..base
},
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/armv5te_unknown_linux_gnueabi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn target() -> TargetResult {
features: "+soft-float,+strict-align".to_string(),
// Atomic operations provided by compiler-builtins
max_atomic_width: Some(32),
abi_blacklist: super::arm_base::abi_blacklist(),
unsupported_abis: super::arm_base::unsupported_abis(),
target_mcount: "\u{1}__gnu_mcount_nc".to_string(),
..base
},
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/armv5te_unknown_linux_musleabi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub fn target() -> TargetResult {
features: "+soft-float,+strict-align".to_string(),
// Atomic operations provided by compiler-builtins
max_atomic_width: Some(32),
abi_blacklist: super::arm_base::abi_blacklist(),
unsupported_abis: super::arm_base::unsupported_abis(),
target_mcount: "\u{1}mcount".to_string(),
..base
},
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/armv6_unknown_freebsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn target() -> TargetResult {
options: TargetOptions {
features: "+v6,+vfp2,-d32".to_string(),
max_atomic_width: Some(64),
abi_blacklist: super::arm_base::abi_blacklist(),
unsupported_abis: super::arm_base::unsupported_abis(),
target_mcount: "\u{1}__gnu_mcount_nc".to_string(),
..base
},
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/armv6_unknown_netbsd_eabihf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn target() -> TargetResult {

options: TargetOptions {
features: "+v6,+vfp2,-d32".to_string(),
abi_blacklist: super::arm_base::abi_blacklist(),
unsupported_abis: super::arm_base::unsupported_abis(),
target_mcount: "__mcount".to_string(),
..base
},
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/armv7_apple_ios.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn target() -> TargetResult {
options: TargetOptions {
features: "+v7,+vfp3,+neon".to_string(),
max_atomic_width: Some(64),
abi_blacklist: super::arm_base::abi_blacklist(),
unsupported_abis: super::arm_base::unsupported_abis(),
..base
},
})
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/armv7_linux_androideabi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ pub fn target() -> TargetResult {
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { abi_blacklist: super::arm_base::abi_blacklist(), ..base },
options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base },
})
}
2 changes: 1 addition & 1 deletion src/librustc_target/spec/armv7_unknown_cloudabi_eabihf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub fn target() -> TargetResult {
base.cpu = "cortex-a8".to_string();
base.max_atomic_width = Some(64);
base.features = "+v7,+vfp3,+neon".to_string();
base.abi_blacklist = super::arm_base::abi_blacklist();
base.unsupported_abis = super::arm_base::unsupported_abis();
base.linker = Some("armv7-unknown-cloudabi-eabihf-cc".to_string());

Ok(Target {
Expand Down
Loading