Auto merge of #121627 - GuillaumeGomez:rollup-udp3m0k, r=GuillaumeGomez
Rollup of 5 pull requests Successful merges: - #120656 (Allow tests to specify a `//@ filecheck-flags:` header) - #120840 (Split Diagnostics for Uncommon Codepoints: Add Individual Identifier Types) - #121554 (Don't unnecessarily change `SIGPIPE` disposition in `unix_sigpipe` tests) - #121590 (Correctly handle if rustdoc JS script hash changed) - #121620 (Fix more #121208 fallout (round 3)) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
ee933f6795
@ -1331,7 +1331,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.tcx.dcx().span_bug(
|
self.tcx.dcx().span_delayed_bug(
|
||||||
lifetime_ref.ident.span,
|
lifetime_ref.ident.span,
|
||||||
format!("Could not resolve {:?} in scope {:#?}", lifetime_ref, self.scope,),
|
format!("Could not resolve {:?} in scope {:#?}", lifetime_ref, self.scope,),
|
||||||
);
|
);
|
||||||
|
@ -804,10 +804,11 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
|
|||||||
let trait_ref = principal.with_self_ty(self.tcx, self_ty);
|
let trait_ref = principal.with_self_ty(self.tcx, self_ty);
|
||||||
self.elaborate_bounds(iter::once(trait_ref), |this, new_trait_ref, item| {
|
self.elaborate_bounds(iter::once(trait_ref), |this, new_trait_ref, item| {
|
||||||
if new_trait_ref.has_non_region_bound_vars() {
|
if new_trait_ref.has_non_region_bound_vars() {
|
||||||
this.dcx().span_bug(
|
this.dcx().span_delayed_bug(
|
||||||
this.span,
|
this.span,
|
||||||
"tried to select method from HRTB with non-lifetime bound vars",
|
"tried to select method from HRTB with non-lifetime bound vars",
|
||||||
);
|
);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let new_trait_ref = this.instantiate_bound_regions_with_erased(new_trait_ref);
|
let new_trait_ref = this.instantiate_bound_regions_with_erased(new_trait_ref);
|
||||||
|
@ -244,9 +244,28 @@ lint_hidden_unicode_codepoints = unicode codepoint changing visible direction of
|
|||||||
lint_identifier_non_ascii_char = identifier contains non-ASCII characters
|
lint_identifier_non_ascii_char = identifier contains non-ASCII characters
|
||||||
|
|
||||||
lint_identifier_uncommon_codepoints = identifier contains {$codepoints_len ->
|
lint_identifier_uncommon_codepoints = identifier contains {$codepoints_len ->
|
||||||
[one] an uncommon Unicode codepoint
|
[one] { $identifier_type ->
|
||||||
*[other] uncommon Unicode codepoints
|
[Exclusion] a character from an archaic script
|
||||||
|
[Technical] a character that is for non-linguistic, specialized usage
|
||||||
|
[Limited_Use] a character from a script in limited use
|
||||||
|
[Not_NFKC] a non normalized (NFKC) character
|
||||||
|
*[other] an uncommon character
|
||||||
|
}
|
||||||
|
*[other] { $identifier_type ->
|
||||||
|
[Exclusion] {$codepoints_len} characters from archaic scripts
|
||||||
|
[Technical] {$codepoints_len} characters that are for non-linguistic, specialized usage
|
||||||
|
[Limited_Use] {$codepoints_len} characters from scripts in limited use
|
||||||
|
[Not_NFKC] {$codepoints_len} non normalized (NFKC) characters
|
||||||
|
*[other] uncommon characters
|
||||||
|
}
|
||||||
}: {$codepoints}
|
}: {$codepoints}
|
||||||
|
.note = {$codepoints_len ->
|
||||||
|
[one] this character is
|
||||||
|
*[other] these characters are
|
||||||
|
} included in the{$identifier_type ->
|
||||||
|
[Restricted] {""}
|
||||||
|
*[other] {" "}{$identifier_type}
|
||||||
|
} Unicode general security profile
|
||||||
|
|
||||||
lint_ignored_unless_crate_specified = {$level}({$name}) is ignored unless specified at crate level
|
lint_ignored_unless_crate_specified = {$level}({$name}) is ignored unless specified at crate level
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#![feature(array_windows)]
|
#![feature(array_windows)]
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
#![feature(control_flow_enum)]
|
#![feature(control_flow_enum)]
|
||||||
|
#![feature(extract_if)]
|
||||||
#![feature(generic_nonzero)]
|
#![feature(generic_nonzero)]
|
||||||
#![feature(if_let_guard)]
|
#![feature(if_let_guard)]
|
||||||
#![feature(iter_order_by)]
|
#![feature(iter_order_by)]
|
||||||
|
@ -1129,9 +1129,11 @@ pub struct IdentifierNonAsciiChar;
|
|||||||
|
|
||||||
#[derive(LintDiagnostic)]
|
#[derive(LintDiagnostic)]
|
||||||
#[diag(lint_identifier_uncommon_codepoints)]
|
#[diag(lint_identifier_uncommon_codepoints)]
|
||||||
|
#[note]
|
||||||
pub struct IdentifierUncommonCodepoints {
|
pub struct IdentifierUncommonCodepoints {
|
||||||
pub codepoints: Vec<char>,
|
pub codepoints: Vec<char>,
|
||||||
pub codepoints_len: usize,
|
pub codepoints_len: usize,
|
||||||
|
pub identifier_type: &'static str,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(LintDiagnostic)]
|
#[derive(LintDiagnostic)]
|
||||||
|
@ -7,6 +7,7 @@ use rustc_ast as ast;
|
|||||||
use rustc_data_structures::fx::FxIndexMap;
|
use rustc_data_structures::fx::FxIndexMap;
|
||||||
use rustc_data_structures::unord::UnordMap;
|
use rustc_data_structures::unord::UnordMap;
|
||||||
use rustc_span::symbol::Symbol;
|
use rustc_span::symbol::Symbol;
|
||||||
|
use unicode_security::general_security_profile::IdentifierType;
|
||||||
|
|
||||||
declare_lint! {
|
declare_lint! {
|
||||||
/// The `non_ascii_idents` lint detects non-ASCII identifiers.
|
/// The `non_ascii_idents` lint detects non-ASCII identifiers.
|
||||||
@ -189,18 +190,48 @@ impl EarlyLintPass for NonAsciiIdents {
|
|||||||
if check_uncommon_codepoints
|
if check_uncommon_codepoints
|
||||||
&& !symbol_str.chars().all(GeneralSecurityProfile::identifier_allowed)
|
&& !symbol_str.chars().all(GeneralSecurityProfile::identifier_allowed)
|
||||||
{
|
{
|
||||||
let codepoints: Vec<_> = symbol_str
|
let mut chars: Vec<_> = symbol_str
|
||||||
.chars()
|
.chars()
|
||||||
.filter(|c| !GeneralSecurityProfile::identifier_allowed(*c))
|
.map(|c| (c, GeneralSecurityProfile::identifier_type(c)))
|
||||||
.collect();
|
.collect();
|
||||||
let codepoints_len = codepoints.len();
|
|
||||||
|
|
||||||
|
for (id_ty, id_ty_descr) in [
|
||||||
|
(IdentifierType::Exclusion, "Exclusion"),
|
||||||
|
(IdentifierType::Technical, "Technical"),
|
||||||
|
(IdentifierType::Limited_Use, "Limited_Use"),
|
||||||
|
(IdentifierType::Not_NFKC, "Not_NFKC"),
|
||||||
|
] {
|
||||||
|
let codepoints: Vec<_> =
|
||||||
|
chars.extract_if(|(_, ty)| *ty == Some(id_ty)).collect();
|
||||||
|
if codepoints.is_empty() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
cx.emit_span_lint(
|
cx.emit_span_lint(
|
||||||
UNCOMMON_CODEPOINTS,
|
UNCOMMON_CODEPOINTS,
|
||||||
sp,
|
sp,
|
||||||
IdentifierUncommonCodepoints { codepoints, codepoints_len },
|
IdentifierUncommonCodepoints {
|
||||||
|
codepoints_len: codepoints.len(),
|
||||||
|
codepoints: codepoints.into_iter().map(|(c, _)| c).collect(),
|
||||||
|
identifier_type: id_ty_descr,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let remaining = chars
|
||||||
|
.extract_if(|(c, _)| !GeneralSecurityProfile::identifier_allowed(*c))
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
if !remaining.is_empty() {
|
||||||
|
cx.emit_span_lint(
|
||||||
|
UNCOMMON_CODEPOINTS,
|
||||||
|
sp,
|
||||||
|
IdentifierUncommonCodepoints {
|
||||||
|
codepoints_len: remaining.len(),
|
||||||
|
codepoints: remaining.into_iter().map(|(c, _)| c).collect(),
|
||||||
|
identifier_type: "Restricted",
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if has_non_ascii_idents && check_confusable_idents {
|
if has_non_ascii_idents && check_confusable_idents {
|
||||||
|
@ -185,9 +185,12 @@ function preLoadCss(cssUrl) {
|
|||||||
(function() {
|
(function() {
|
||||||
const isHelpPage = window.location.pathname.endsWith("/help.html");
|
const isHelpPage = window.location.pathname.endsWith("/help.html");
|
||||||
|
|
||||||
function loadScript(url) {
|
function loadScript(url, errorCallback) {
|
||||||
const script = document.createElement("script");
|
const script = document.createElement("script");
|
||||||
script.src = url;
|
script.src = url;
|
||||||
|
if (errorCallback !== undefined) {
|
||||||
|
script.onerror = errorCallback;
|
||||||
|
}
|
||||||
document.head.append(script);
|
document.head.append(script);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,11 +295,16 @@ function preLoadCss(cssUrl) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let searchLoaded = false;
|
let searchLoaded = false;
|
||||||
|
// If you're browsing the nightly docs, the page might need to be refreshed for the
|
||||||
|
// search to work because the hash of the JS scripts might have changed.
|
||||||
|
function sendSearchForm() {
|
||||||
|
document.getElementsByClassName("search-form")[0].submit();
|
||||||
|
}
|
||||||
function loadSearch() {
|
function loadSearch() {
|
||||||
if (!searchLoaded) {
|
if (!searchLoaded) {
|
||||||
searchLoaded = true;
|
searchLoaded = true;
|
||||||
loadScript(getVar("static-root-path") + getVar("search-js"));
|
loadScript(getVar("static-root-path") + getVar("search-js"), sendSearchForm);
|
||||||
loadScript(resourcePath("search-index", ".js"));
|
loadScript(resourcePath("search-index", ".js"), sendSearchForm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,6 +197,8 @@ pub struct TestProps {
|
|||||||
/// Extra flags to pass to `llvm-cov` when producing coverage reports.
|
/// Extra flags to pass to `llvm-cov` when producing coverage reports.
|
||||||
/// Only used by the "coverage-run" test mode.
|
/// Only used by the "coverage-run" test mode.
|
||||||
pub llvm_cov_flags: Vec<String>,
|
pub llvm_cov_flags: Vec<String>,
|
||||||
|
/// Extra flags to pass to LLVM's `filecheck` tool, in tests that use it.
|
||||||
|
pub filecheck_flags: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
mod directives {
|
mod directives {
|
||||||
@ -236,6 +238,7 @@ mod directives {
|
|||||||
pub const REMAP_SRC_BASE: &'static str = "remap-src-base";
|
pub const REMAP_SRC_BASE: &'static str = "remap-src-base";
|
||||||
pub const COMPARE_OUTPUT_LINES_BY_SUBSET: &'static str = "compare-output-lines-by-subset";
|
pub const COMPARE_OUTPUT_LINES_BY_SUBSET: &'static str = "compare-output-lines-by-subset";
|
||||||
pub const LLVM_COV_FLAGS: &'static str = "llvm-cov-flags";
|
pub const LLVM_COV_FLAGS: &'static str = "llvm-cov-flags";
|
||||||
|
pub const FILECHECK_FLAGS: &'static str = "filecheck-flags";
|
||||||
// This isn't a real directive, just one that is probably mistyped often
|
// This isn't a real directive, just one that is probably mistyped often
|
||||||
pub const INCORRECT_COMPILER_FLAGS: &'static str = "compiler-flags";
|
pub const INCORRECT_COMPILER_FLAGS: &'static str = "compiler-flags";
|
||||||
}
|
}
|
||||||
@ -286,6 +289,7 @@ impl TestProps {
|
|||||||
mir_unit_test: None,
|
mir_unit_test: None,
|
||||||
remap_src_base: false,
|
remap_src_base: false,
|
||||||
llvm_cov_flags: vec![],
|
llvm_cov_flags: vec![],
|
||||||
|
filecheck_flags: vec![],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,6 +546,10 @@ impl TestProps {
|
|||||||
if let Some(flags) = config.parse_name_value_directive(ln, LLVM_COV_FLAGS) {
|
if let Some(flags) = config.parse_name_value_directive(ln, LLVM_COV_FLAGS) {
|
||||||
self.llvm_cov_flags.extend(split_flags(&flags));
|
self.llvm_cov_flags.extend(split_flags(&flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(flags) = config.parse_name_value_directive(ln, FILECHECK_FLAGS) {
|
||||||
|
self.filecheck_flags.extend(split_flags(&flags));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -2909,25 +2909,32 @@ impl<'test> TestCx<'test> {
|
|||||||
fn verify_with_filecheck(&self, output: &Path) -> ProcRes {
|
fn verify_with_filecheck(&self, output: &Path) -> ProcRes {
|
||||||
let mut filecheck = Command::new(self.config.llvm_filecheck.as_ref().unwrap());
|
let mut filecheck = Command::new(self.config.llvm_filecheck.as_ref().unwrap());
|
||||||
filecheck.arg("--input-file").arg(output).arg(&self.testpaths.file);
|
filecheck.arg("--input-file").arg(output).arg(&self.testpaths.file);
|
||||||
// It would be more appropriate to make most of the arguments configurable through
|
|
||||||
// a comment-attribute similar to `compile-flags`. For example, --check-prefixes is a very
|
// FIXME: Consider making some of these prefix flags opt-in per test,
|
||||||
// useful flag.
|
// via `filecheck-flags` or by adding new header directives.
|
||||||
//
|
|
||||||
// For now, though…
|
// Because we use custom prefixes, we also have to register the default prefix.
|
||||||
let prefix_for_target =
|
filecheck.arg("--check-prefix=CHECK");
|
||||||
if self.config.target.contains("msvc") { "MSVC" } else { "NONMSVC" };
|
|
||||||
let prefixes = if let Some(rev) = self.revision {
|
// Some tests use the current revision name as a check prefix.
|
||||||
format!("CHECK,{},{}", prefix_for_target, rev)
|
if let Some(rev) = self.revision {
|
||||||
} else {
|
filecheck.arg("--check-prefix").arg(rev);
|
||||||
format!("CHECK,{}", prefix_for_target)
|
|
||||||
};
|
|
||||||
if self.config.llvm_version.unwrap_or(0) >= 130000 {
|
|
||||||
filecheck.args(&["--allow-unused-prefixes", "--check-prefixes", &prefixes]);
|
|
||||||
} else {
|
|
||||||
filecheck.args(&["--check-prefixes", &prefixes]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Some tests also expect either the MSVC or NONMSVC prefix to be defined.
|
||||||
|
let msvc_or_not = if self.config.target.contains("msvc") { "MSVC" } else { "NONMSVC" };
|
||||||
|
filecheck.arg("--check-prefix").arg(msvc_or_not);
|
||||||
|
|
||||||
|
// The filecheck tool normally fails if a prefix is defined but not used.
|
||||||
|
// However, we define several prefixes globally for all tests.
|
||||||
|
filecheck.arg("--allow-unused-prefixes");
|
||||||
|
|
||||||
// Provide more context on failures.
|
// Provide more context on failures.
|
||||||
filecheck.args(&["--dump-input-context", "100"]);
|
filecheck.args(&["--dump-input-context", "100"]);
|
||||||
|
|
||||||
|
// Add custom flags supplied by the `filecheck-flags:` test header.
|
||||||
|
filecheck.args(&self.props.filecheck_flags);
|
||||||
|
|
||||||
self.compose_and_run(filecheck, "", None, None)
|
self.compose_and_run(filecheck, "", None, None)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
120
tests/codegen/instrument-coverage/testprog.rs
Normal file
120
tests/codegen/instrument-coverage/testprog.rs
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
//@ edition: 2021
|
||||||
|
//@ needs-profiler-support
|
||||||
|
//@ compile-flags: -Cinstrument-coverage -Copt-level=0
|
||||||
|
//@ revisions: LINUX DARWIN WINDOWS
|
||||||
|
|
||||||
|
//@ [LINUX] only-linux
|
||||||
|
//@ [LINUX] filecheck-flags: -DINSTR_PROF_DATA=__llvm_prf_data
|
||||||
|
//@ [LINUX] filecheck-flags: -DINSTR_PROF_NAME=__llvm_prf_names
|
||||||
|
//@ [LINUX] filecheck-flags: -DINSTR_PROF_CNTS=__llvm_prf_cnts
|
||||||
|
//@ [LINUX] filecheck-flags: -DINSTR_PROF_COVMAP=__llvm_covmap
|
||||||
|
//@ [LINUX] filecheck-flags: -DINSTR_PROF_COVFUN=__llvm_covfun
|
||||||
|
//@ [LINUX] filecheck-flags: '-DCOMDAT_IF_SUPPORTED=, comdat'
|
||||||
|
|
||||||
|
//@ [DARWIN] only-macos
|
||||||
|
//@ [DARWIN] filecheck-flags: -DINSTR_PROF_DATA=__DATA,__llvm_prf_data,regular,live_support
|
||||||
|
//@ [DARWIN] filecheck-flags: -DINSTR_PROF_NAME=__DATA,__llvm_prf_names
|
||||||
|
//@ [DARWIN] filecheck-flags: -DINSTR_PROF_CNTS=__DATA,__llvm_prf_cnts
|
||||||
|
//@ [DARWIN] filecheck-flags: -DINSTR_PROF_COVMAP=__LLVM_COV,__llvm_covmap
|
||||||
|
//@ [DARWIN] filecheck-flags: -DINSTR_PROF_COVFUN=__LLVM_COV,__llvm_covfun
|
||||||
|
//@ [DARWIN] filecheck-flags: -DCOMDAT_IF_SUPPORTED=
|
||||||
|
|
||||||
|
//@ [WINDOWS] only-windows
|
||||||
|
//@ [WINDOWS] filecheck-flags: -DINSTR_PROF_DATA=.lprfd$M
|
||||||
|
//@ [WINDOWS] filecheck-flags: -DINSTR_PROF_NAME=.lprfn$M
|
||||||
|
//@ [WINDOWS] filecheck-flags: -DINSTR_PROF_CNTS=.lprfc$M
|
||||||
|
//@ [WINDOWS] filecheck-flags: -DINSTR_PROF_COVMAP=.lcovmap$M
|
||||||
|
//@ [WINDOWS] filecheck-flags: -DINSTR_PROF_COVFUN=.lcovfun$M
|
||||||
|
//@ [WINDOWS] filecheck-flags: '-DCOMDAT_IF_SUPPORTED=, comdat'
|
||||||
|
|
||||||
|
// ignore-tidy-linelength
|
||||||
|
|
||||||
|
pub fn will_be_called() -> &'static str {
|
||||||
|
let val = "called";
|
||||||
|
println!("{}", val);
|
||||||
|
val
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn will_not_be_called() -> bool {
|
||||||
|
println!("should not have been called");
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn print<T>(left: &str, value: T, right: &str)
|
||||||
|
where
|
||||||
|
T: std::fmt::Display,
|
||||||
|
{
|
||||||
|
println!("{}{}{}", left, value, right);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn wrap_with<F, T>(inner: T, should_wrap: bool, wrapper: F)
|
||||||
|
where
|
||||||
|
F: FnOnce(&T)
|
||||||
|
{
|
||||||
|
if should_wrap {
|
||||||
|
wrapper(&inner)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let less = 1;
|
||||||
|
let more = 100;
|
||||||
|
|
||||||
|
if less < more {
|
||||||
|
wrap_with(will_be_called(), less < more, |inner| print(" ***", inner, "*** "));
|
||||||
|
wrap_with(will_be_called(), more < less, |inner| print(" ***", inner, "*** "));
|
||||||
|
} else {
|
||||||
|
wrap_with(will_not_be_called(), true, |inner| print("wrapped result is: ", inner, ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for metadata, variables, declarations, and function definitions injected
|
||||||
|
// into LLVM IR when compiling with -Cinstrument-coverage.
|
||||||
|
|
||||||
|
// WINDOWS: $__llvm_profile_runtime_user = comdat any
|
||||||
|
|
||||||
|
// CHECK: @__llvm_coverage_mapping = private constant
|
||||||
|
// CHECK-SAME: section "[[INSTR_PROF_COVMAP]]", align 8
|
||||||
|
|
||||||
|
// CHECK: @__covrec_{{[A-F0-9]+}}u = linkonce_odr hidden constant
|
||||||
|
// CHECK-SAME: section "[[INSTR_PROF_COVFUN]]"[[COMDAT_IF_SUPPORTED]], align 8
|
||||||
|
|
||||||
|
// WINDOWS: @__llvm_profile_runtime = external{{.*}}global i32
|
||||||
|
|
||||||
|
// CHECK: @__profc__R{{[a-zA-Z0-9_]+}}testprog14will_be_called = {{private|internal}} global
|
||||||
|
// CHECK-SAME: section "[[INSTR_PROF_CNTS]]"{{.*}}, align 8
|
||||||
|
|
||||||
|
// CHECK: @__profd__R{{[a-zA-Z0-9_]+}}testprog14will_be_called = {{private|internal}} global
|
||||||
|
// CHECK-SAME: @__profc__R{{[a-zA-Z0-9_]+}}testprog14will_be_called
|
||||||
|
// CHECK-SAME: section "[[INSTR_PROF_DATA]]"{{.*}}, align 8
|
||||||
|
|
||||||
|
// CHECK: @__profc__R{{[a-zA-Z0-9_]+}}testprog4main = {{private|internal}} global
|
||||||
|
// CHECK-SAME: section "[[INSTR_PROF_CNTS]]"{{.*}}, align 8
|
||||||
|
|
||||||
|
// CHECK: @__profd__R{{[a-zA-Z0-9_]+}}testprog4main = {{private|internal}} global
|
||||||
|
// CHECK-SAME: @__profc__R{{[a-zA-Z0-9_]+}}testprog4main
|
||||||
|
// CHECK-SAME: section "[[INSTR_PROF_DATA]]"{{.*}}, align 8
|
||||||
|
|
||||||
|
// CHECK: @__llvm_prf_nm = private constant
|
||||||
|
// CHECK-SAME: section "[[INSTR_PROF_NAME]]", align 1
|
||||||
|
|
||||||
|
// CHECK: @llvm.used = appending global
|
||||||
|
// CHECK-SAME: @__llvm_coverage_mapping
|
||||||
|
// CHECK-SAME: @__llvm_prf_nm
|
||||||
|
// CHECK-SAME: section "llvm.metadata"
|
||||||
|
|
||||||
|
// CHECK: define internal { {{.*}} } @_R{{[a-zA-Z0-9_]+}}testprog14will_be_called() unnamed_addr #{{[0-9]+}} {
|
||||||
|
// CHECK-NEXT: start:
|
||||||
|
// CHECK-NOT: define internal
|
||||||
|
// CHECK: atomicrmw add ptr
|
||||||
|
// CHECK-SAME: @__profc__R{{[a-zA-Z0-9_]+}}testprog14will_be_called,
|
||||||
|
|
||||||
|
// CHECK: declare void @llvm.instrprof.increment(ptr, i64, i32, i32) #[[LLVM_INSTRPROF_INCREMENT_ATTR:[0-9]+]]
|
||||||
|
|
||||||
|
// WINDOWS: define linkonce_odr hidden i32 @__llvm_profile_runtime_user() #[[LLVM_PROFILE_RUNTIME_USER_ATTR:[0-9]+]] comdat {
|
||||||
|
// WINDOWS-NEXT: %1 = load i32, ptr @__llvm_profile_runtime
|
||||||
|
// WINDOWS-NEXT: ret i32 %1
|
||||||
|
// WINDOWS-NEXT: }
|
||||||
|
|
||||||
|
// CHECK: attributes #[[LLVM_INSTRPROF_INCREMENT_ATTR]] = { nounwind }
|
||||||
|
// WINDOWS: attributes #[[LLVM_PROFILE_RUNTIME_USER_ATTR]] = { noinline }
|
4
tests/codegen/meta-filecheck/check-prefix.rs
Normal file
4
tests/codegen/meta-filecheck/check-prefix.rs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
// Simple test that uses the default CHECK prefix and should always succeed.
|
||||||
|
|
||||||
|
// CHECK: main
|
||||||
|
fn main() {}
|
8
tests/codegen/meta-filecheck/filecheck-flags.rs
Normal file
8
tests/codegen/meta-filecheck/filecheck-flags.rs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// Arguments provided via `filecheck-flags` should be passed to `filecheck`.
|
||||||
|
|
||||||
|
//@ revisions: good bad
|
||||||
|
//@ [good] filecheck-flags: --check-prefix=CUSTOM
|
||||||
|
//@ [bad] should-fail
|
||||||
|
|
||||||
|
// CUSTOM: main
|
||||||
|
fn main() {}
|
7
tests/codegen/meta-filecheck/msvc-prefix-bad.rs
Normal file
7
tests/codegen/meta-filecheck/msvc-prefix-bad.rs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// This is exactly like `msvc-prefix-good.rs`, except that it should always fail.
|
||||||
|
|
||||||
|
//@ should-fail
|
||||||
|
|
||||||
|
// MSVC: text that should not match
|
||||||
|
// NONMSVC: text that should not match
|
||||||
|
fn main() {}
|
7
tests/codegen/meta-filecheck/msvc-prefix-good.rs
Normal file
7
tests/codegen/meta-filecheck/msvc-prefix-good.rs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// One of MSVC or NONMSVC should always be defined, so this test should pass.
|
||||||
|
|
||||||
|
// (one of these should always be present)
|
||||||
|
|
||||||
|
// MSVC: main
|
||||||
|
// NONMSVC: main
|
||||||
|
fn main() {}
|
5
tests/codegen/meta-filecheck/no-directives.rs
Normal file
5
tests/codegen/meta-filecheck/no-directives.rs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// A test that doesn't include any filecheck directives should fail.
|
||||||
|
|
||||||
|
//@ should-fail
|
||||||
|
|
||||||
|
fn main() {}
|
8
tests/codegen/meta-filecheck/revision-prefix.rs
Normal file
8
tests/codegen/meta-filecheck/revision-prefix.rs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// The current revision name is registered as a filecheck prefix.
|
||||||
|
|
||||||
|
//@ revisions: GOOD BAD
|
||||||
|
//@ [BAD] should-fail
|
||||||
|
|
||||||
|
// GOOD: main
|
||||||
|
// BAD: text that should not match
|
||||||
|
fn main() {}
|
@ -1,64 +0,0 @@
|
|||||||
# needs-profiler-support
|
|
||||||
|
|
||||||
# Rust coverage maps support LLVM Coverage Mapping Format versions 5 and 6,
|
|
||||||
# corresponding with LLVM versions 12 and 13, respectively.
|
|
||||||
# When upgrading LLVM versions, consider whether to enforce a minimum LLVM
|
|
||||||
# version during testing, with an additional directive at the top of this file
|
|
||||||
# that sets, for example: `min-llvm-version: 12.0`
|
|
||||||
|
|
||||||
include ../tools.mk
|
|
||||||
|
|
||||||
BASEDIR=../coverage-llvmir
|
|
||||||
|
|
||||||
ifeq ($(UNAME),Darwin)
|
|
||||||
INSTR_PROF_DATA_SUFFIX=,regular,live_support
|
|
||||||
DATA_SECTION_PREFIX=__DATA,
|
|
||||||
LLVM_COV_SECTION_PREFIX=__LLVM_COV,
|
|
||||||
COMDAT_IF_SUPPORTED=
|
|
||||||
else
|
|
||||||
INSTR_PROF_DATA_SUFFIX=
|
|
||||||
DATA_SECTION_PREFIX=
|
|
||||||
LLVM_COV_SECTION_PREFIX=
|
|
||||||
COMDAT_IF_SUPPORTED=, comdat
|
|
||||||
endif
|
|
||||||
|
|
||||||
DEFINE_INTERNAL=define internal
|
|
||||||
|
|
||||||
ifdef IS_WINDOWS
|
|
||||||
LLVM_FILECHECK_OPTIONS=\
|
|
||||||
-check-prefixes=CHECK,WINDOWS \
|
|
||||||
-DDEFINE_INTERNAL='$(DEFINE_INTERNAL)' \
|
|
||||||
-DCOMDAT_IF_SUPPORTED='$(COMDAT_IF_SUPPORTED)' \
|
|
||||||
-DINSTR_PROF_DATA='.lprfd$$M' \
|
|
||||||
-DINSTR_PROF_NAME='.lprfn$$M' \
|
|
||||||
-DINSTR_PROF_CNTS='.lprfc$$M' \
|
|
||||||
-DINSTR_PROF_VALS='.lprfv$$M' \
|
|
||||||
-DINSTR_PROF_VNODES='.lprfnd$$M' \
|
|
||||||
-DINSTR_PROF_COVMAP='.lcovmap$$M' \
|
|
||||||
-DINSTR_PROF_COVFUN='.lcovfun$$M' \
|
|
||||||
-DINSTR_PROF_ORDERFILE='.lorderfile$$M'
|
|
||||||
else
|
|
||||||
LLVM_FILECHECK_OPTIONS=\
|
|
||||||
-check-prefixes=CHECK \
|
|
||||||
-DDEFINE_INTERNAL='$(DEFINE_INTERNAL)' \
|
|
||||||
-DCOMDAT_IF_SUPPORTED='$(COMDAT_IF_SUPPORTED)' \
|
|
||||||
-DINSTR_PROF_DATA='$(DATA_SECTION_PREFIX)__llvm_prf_data$(INSTR_PROF_DATA_SUFFIX)' \
|
|
||||||
-DINSTR_PROF_NAME='$(DATA_SECTION_PREFIX)__llvm_prf_names' \
|
|
||||||
-DINSTR_PROF_CNTS='$(DATA_SECTION_PREFIX)__llvm_prf_cnts' \
|
|
||||||
-DINSTR_PROF_VALS='$(DATA_SECTION_PREFIX)__llvm_prf_vals' \
|
|
||||||
-DINSTR_PROF_VNODES='$(DATA_SECTION_PREFIX)__llvm_prf_vnds' \
|
|
||||||
-DINSTR_PROF_COVMAP='$(LLVM_COV_SECTION_PREFIX)__llvm_covmap' \
|
|
||||||
-DINSTR_PROF_COVFUN='$(LLVM_COV_SECTION_PREFIX)__llvm_covfun' \
|
|
||||||
-DINSTR_PROF_ORDERFILE='$(DATA_SECTION_PREFIX)__llvm_orderfile'
|
|
||||||
endif
|
|
||||||
|
|
||||||
all: test_llvm_ir
|
|
||||||
|
|
||||||
test_llvm_ir:
|
|
||||||
# Compile the test program with non-experimental coverage instrumentation, and generate LLVM IR
|
|
||||||
$(RUSTC) $(BASEDIR)/testprog.rs \
|
|
||||||
-Cinstrument-coverage \
|
|
||||||
--emit=llvm-ir
|
|
||||||
|
|
||||||
cat "$(TMPDIR)"/testprog.ll | \
|
|
||||||
"$(LLVM_FILECHECK)" $(BASEDIR)/filecheck.testprog.txt $(LLVM_FILECHECK_OPTIONS)
|
|
@ -1,50 +0,0 @@
|
|||||||
# Check for metadata, variables, declarations, and function definitions injected
|
|
||||||
# into LLVM IR when compiling with -Cinstrument-coverage.
|
|
||||||
|
|
||||||
WINDOWS: $__llvm_profile_runtime_user = comdat any
|
|
||||||
|
|
||||||
CHECK: @__llvm_coverage_mapping = private constant
|
|
||||||
CHECK-SAME: section "[[INSTR_PROF_COVMAP]]", align 8
|
|
||||||
|
|
||||||
CHECK: @__covrec_{{[A-F0-9]+}}u = linkonce_odr hidden constant
|
|
||||||
CHECK-SAME: section "[[INSTR_PROF_COVFUN]]"[[COMDAT_IF_SUPPORTED]], align 8
|
|
||||||
|
|
||||||
WINDOWS: @__llvm_profile_runtime = external{{.*}}global i32
|
|
||||||
|
|
||||||
CHECK: @__profc__R{{[a-zA-Z0-9_]+}}testprog14will_be_called = {{private|internal}} global
|
|
||||||
CHECK-SAME: section "[[INSTR_PROF_CNTS]]"{{.*}}, align 8
|
|
||||||
|
|
||||||
CHECK: @__profd__R{{[a-zA-Z0-9_]+}}testprog14will_be_called = {{private|internal}} global
|
|
||||||
CHECK-SAME: @__profc__R{{[a-zA-Z0-9_]+}}testprog14will_be_called
|
|
||||||
CHECK-SAME: section "[[INSTR_PROF_DATA]]"{{.*}}, align 8
|
|
||||||
|
|
||||||
CHECK: @__profc__R{{[a-zA-Z0-9_]+}}testprog4main = {{private|internal}} global
|
|
||||||
CHECK-SAME: section "[[INSTR_PROF_CNTS]]"{{.*}}, align 8
|
|
||||||
|
|
||||||
CHECK: @__profd__R{{[a-zA-Z0-9_]+}}testprog4main = {{private|internal}} global
|
|
||||||
CHECK-SAME: @__profc__R{{[a-zA-Z0-9_]+}}testprog4main
|
|
||||||
CHECK-SAME: section "[[INSTR_PROF_DATA]]"{{.*}}, align 8
|
|
||||||
|
|
||||||
CHECK: @__llvm_prf_nm = private constant
|
|
||||||
CHECK-SAME: section "[[INSTR_PROF_NAME]]", align 1
|
|
||||||
|
|
||||||
CHECK: @llvm.used = appending global
|
|
||||||
CHECK-SAME: @__llvm_coverage_mapping
|
|
||||||
CHECK-SAME: @__llvm_prf_nm
|
|
||||||
CHECK-SAME: section "llvm.metadata"
|
|
||||||
|
|
||||||
CHECK: [[DEFINE_INTERNAL]] { {{.*}} } @_R{{[a-zA-Z0-9_]+}}testprog14will_be_called() unnamed_addr #{{[0-9]+}} {
|
|
||||||
CHECK-NEXT: start:
|
|
||||||
CHECK-NOT: [[DEFINE_INTERNAL]]
|
|
||||||
CHECK: atomicrmw add ptr
|
|
||||||
CHECK-SAME: @__profc__R{{[a-zA-Z0-9_]+}}testprog14will_be_called,
|
|
||||||
|
|
||||||
CHECK: declare void @llvm.instrprof.increment(ptr, i64, i32, i32) #[[LLVM_INSTRPROF_INCREMENT_ATTR:[0-9]+]]
|
|
||||||
|
|
||||||
WINDOWS: define linkonce_odr hidden i32 @__llvm_profile_runtime_user() #[[LLVM_PROFILE_RUNTIME_USER_ATTR:[0-9]+]] comdat {
|
|
||||||
WINDOWS-NEXT: %1 = load i32, ptr @__llvm_profile_runtime
|
|
||||||
WINDOWS-NEXT: ret i32 %1
|
|
||||||
WINDOWS-NEXT: }
|
|
||||||
|
|
||||||
CHECK: attributes #[[LLVM_INSTRPROF_INCREMENT_ATTR]] = { nounwind }
|
|
||||||
WINDOWS: attributes #[[LLVM_PROFILE_RUNTIME_USER_ATTR]] = { noinline }
|
|
@ -1,38 +0,0 @@
|
|||||||
pub fn will_be_called() -> &'static str {
|
|
||||||
let val = "called";
|
|
||||||
println!("{}", val);
|
|
||||||
val
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn will_not_be_called() -> bool {
|
|
||||||
println!("should not have been called");
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn print<T>(left: &str, value: T, right: &str)
|
|
||||||
where
|
|
||||||
T: std::fmt::Display,
|
|
||||||
{
|
|
||||||
println!("{}{}{}", left, value, right);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn wrap_with<F, T>(inner: T, should_wrap: bool, wrapper: F)
|
|
||||||
where
|
|
||||||
F: FnOnce(&T)
|
|
||||||
{
|
|
||||||
if should_wrap {
|
|
||||||
wrapper(&inner)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let less = 1;
|
|
||||||
let more = 100;
|
|
||||||
|
|
||||||
if less < more {
|
|
||||||
wrap_with(will_be_called(), less < more, |inner| print(" ***", inner, "*** "));
|
|
||||||
wrap_with(will_be_called(), more < less, |inner| print(" ***", inner, "*** "));
|
|
||||||
} else {
|
|
||||||
wrap_with(will_not_be_called(), true, |inner| print("wrapped result is: ", inner, ""));
|
|
||||||
}
|
|
||||||
}
|
|
@ -17,17 +17,17 @@ pub fn assert_sigpipe_handler(expected_handler: SignalHandler) {
|
|||||||
target_os = "android",
|
target_os = "android",
|
||||||
)))]
|
)))]
|
||||||
{
|
{
|
||||||
let prev = unsafe { libc::signal(libc::SIGPIPE, libc::SIG_IGN) };
|
let actual = unsafe {
|
||||||
|
let mut actual: libc::sigaction = std::mem::zeroed();
|
||||||
|
libc::sigaction(libc::SIGPIPE, std::ptr::null(), &mut actual);
|
||||||
|
actual.sa_sigaction
|
||||||
|
};
|
||||||
|
|
||||||
let expected = match expected_handler {
|
let expected = match expected_handler {
|
||||||
SignalHandler::Ignore => libc::SIG_IGN,
|
SignalHandler::Ignore => libc::SIG_IGN,
|
||||||
SignalHandler::Default => libc::SIG_DFL,
|
SignalHandler::Default => libc::SIG_DFL,
|
||||||
};
|
};
|
||||||
assert_eq!(prev, expected, "expected sigpipe value matches actual value");
|
|
||||||
|
|
||||||
// Unlikely to matter, but restore the old value anyway
|
assert_eq!(actual, expected, "actual and expected SIGPIPE disposition differs");
|
||||||
unsafe {
|
|
||||||
libc::signal(libc::SIGPIPE, prev);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
20
tests/ui/higher-ranked/trait-bounds/span-bug-issue-121597.rs
Normal file
20
tests/ui/higher-ranked/trait-bounds/span-bug-issue-121597.rs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#![allow(incomplete_features)]
|
||||||
|
#![feature(non_lifetime_binders)]
|
||||||
|
|
||||||
|
trait Foo: for<T> Bar<T> {}
|
||||||
|
|
||||||
|
trait Bar<T: ?Sized> {
|
||||||
|
fn method(&self) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Type2;
|
||||||
|
fn needs_bar(_: *mut Type2) {}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let x: &dyn Foo = &();
|
||||||
|
//~^ ERROR the trait `Foo` cannot be made into an object
|
||||||
|
//~| ERROR the trait `Foo` cannot be made into an object
|
||||||
|
|
||||||
|
needs_bar(x);
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
error[E0038]: the trait `Foo` cannot be made into an object
|
||||||
|
--> $DIR/span-bug-issue-121597.rs:14:23
|
||||||
|
|
|
||||||
|
LL | let x: &dyn Foo = &();
|
||||||
|
| ^^^ `Foo` cannot be made into an object
|
||||||
|
|
|
||||||
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||||
|
--> $DIR/span-bug-issue-121597.rs:4:12
|
||||||
|
|
|
||||||
|
LL | trait Foo: for<T> Bar<T> {}
|
||||||
|
| --- ^^^^^^^^^^^^^ ...because where clause cannot reference non-lifetime `for<...>` variables
|
||||||
|
| |
|
||||||
|
| this trait cannot be made into an object...
|
||||||
|
= note: required for the cast from `&()` to `&dyn Foo`
|
||||||
|
|
||||||
|
error[E0038]: the trait `Foo` cannot be made into an object
|
||||||
|
--> $DIR/span-bug-issue-121597.rs:14:12
|
||||||
|
|
|
||||||
|
LL | let x: &dyn Foo = &();
|
||||||
|
| ^^^^^^^^ `Foo` cannot be made into an object
|
||||||
|
|
|
||||||
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||||
|
--> $DIR/span-bug-issue-121597.rs:4:12
|
||||||
|
|
|
||||||
|
LL | trait Foo: for<T> Bar<T> {}
|
||||||
|
| --- ^^^^^^^^^^^^^ ...because where clause cannot reference non-lifetime `for<...>` variables
|
||||||
|
| |
|
||||||
|
| this trait cannot be made into an object...
|
||||||
|
|
||||||
|
error[E0308]: mismatched types
|
||||||
|
--> $DIR/span-bug-issue-121597.rs:18:15
|
||||||
|
|
|
||||||
|
LL | needs_bar(x);
|
||||||
|
| --------- ^ types differ in mutability
|
||||||
|
| |
|
||||||
|
| arguments to this function are incorrect
|
||||||
|
|
|
||||||
|
= note: expected raw pointer `*mut Type2`
|
||||||
|
found reference `&dyn Foo`
|
||||||
|
note: function defined here
|
||||||
|
--> $DIR/span-bug-issue-121597.rs:11:4
|
||||||
|
|
|
||||||
|
LL | fn needs_bar(_: *mut Type2) {}
|
||||||
|
| ^^^^^^^^^ -------------
|
||||||
|
|
||||||
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
Some errors have detailed explanations: E0038, E0308.
|
||||||
|
For more information about an error, try `rustc --explain E0038`.
|
@ -4,7 +4,7 @@ fn invalid_emoji_usages() {
|
|||||||
let wireless🛜 = "basic emoji"; //~ ERROR: identifiers cannot contain emoji
|
let wireless🛜 = "basic emoji"; //~ ERROR: identifiers cannot contain emoji
|
||||||
// FIXME
|
// FIXME
|
||||||
let key1️⃣ = "keycap sequence"; //~ ERROR: unknown start of token
|
let key1️⃣ = "keycap sequence"; //~ ERROR: unknown start of token
|
||||||
//~^ WARN: identifier contains an uncommon Unicode codepoint
|
//~^ WARN: identifier contains an uncommon character: '\u{fe0f}'
|
||||||
let flag🇺🇳 = "flag sequence"; //~ ERROR: identifiers cannot contain emoji
|
let flag🇺🇳 = "flag sequence"; //~ ERROR: identifiers cannot contain emoji
|
||||||
let wales🏴 = "tag sequence"; //~ ERROR: identifiers cannot contain emoji
|
let wales🏴 = "tag sequence"; //~ ERROR: identifiers cannot contain emoji
|
||||||
let folded🙏🏿 = "modifier sequence"; //~ ERROR: identifiers cannot contain emoji
|
let folded🙏🏿 = "modifier sequence"; //~ ERROR: identifiers cannot contain emoji
|
||||||
|
@ -40,12 +40,13 @@ error: identifiers cannot contain emoji: `folded🙏🏿`
|
|||||||
LL | let folded🙏🏿 = "modifier sequence";
|
LL | let folded🙏🏿 = "modifier sequence";
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
warning: identifier contains an uncommon Unicode codepoint: '\u{fe0f}'
|
warning: identifier contains an uncommon character: '\u{fe0f}'
|
||||||
--> $DIR/lex-emoji-identifiers.rs:6:9
|
--> $DIR/lex-emoji-identifiers.rs:6:9
|
||||||
|
|
|
|
||||||
LL | let key1️⃣ = "keycap sequence";
|
LL | let key1️⃣ = "keycap sequence";
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
|
|
|
||||||
|
= note: this character is included in the Unicode general security profile
|
||||||
= note: `#[warn(uncommon_codepoints)]` on by default
|
= note: `#[warn(uncommon_codepoints)]` on by default
|
||||||
|
|
||||||
error: aborting due to 7 previous errors; 1 warning emitted
|
error: aborting due to 7 previous errors; 1 warning emitted
|
||||||
|
13
tests/ui/lifetimes/could-not-resolve-issue-121503.rs
Normal file
13
tests/ui/lifetimes/could-not-resolve-issue-121503.rs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
//@ edition:2018
|
||||||
|
|
||||||
|
#![feature(allocator_api)]
|
||||||
|
struct Struct;
|
||||||
|
impl Struct {
|
||||||
|
async fn box_ref_Struct(self: Box<Self, impl FnMut(&mut Self)>) -> &u32 {
|
||||||
|
//~^ ERROR the trait bound `impl FnMut(&mut Self): Allocator` is not satisfied
|
||||||
|
//~| ERROR Box<Struct, impl FnMut(&mut Self)>` cannot be used as the type of `self` without
|
||||||
|
&1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
28
tests/ui/lifetimes/could-not-resolve-issue-121503.stderr
Normal file
28
tests/ui/lifetimes/could-not-resolve-issue-121503.stderr
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
error[E0277]: the trait bound `impl FnMut(&mut Self): Allocator` is not satisfied
|
||||||
|
--> $DIR/could-not-resolve-issue-121503.rs:6:5
|
||||||
|
|
|
||||||
|
LL | async fn box_ref_Struct(self: Box<Self, impl FnMut(&mut Self)>) -> &u32 {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Allocator` is not implemented for `impl FnMut(&mut Self)`
|
||||||
|
|
|
||||||
|
note: required by a bound in `Box`
|
||||||
|
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
|
||||||
|
help: consider further restricting this bound
|
||||||
|
|
|
||||||
|
LL | async fn box_ref_Struct(self: Box<Self, impl FnMut(&mut Self) + std::alloc::Allocator>) -> &u32 {
|
||||||
|
| +++++++++++++++++++++++
|
||||||
|
|
||||||
|
error[E0658]: `Box<Struct, impl FnMut(&mut Self)>` cannot be used as the type of `self` without the `arbitrary_self_types` feature
|
||||||
|
--> $DIR/could-not-resolve-issue-121503.rs:6:35
|
||||||
|
|
|
||||||
|
LL | async fn box_ref_Struct(self: Box<Self, impl FnMut(&mut Self)>) -> &u32 {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information
|
||||||
|
= help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable
|
||||||
|
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||||
|
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
Some errors have detailed explanations: E0277, E0658.
|
||||||
|
For more information about an error, try `rustc --explain E0277`.
|
@ -1,12 +1,13 @@
|
|||||||
#![deny(uncommon_codepoints)]
|
#![deny(uncommon_codepoints)]
|
||||||
|
|
||||||
const µ: f64 = 0.000001; //~ ERROR identifier contains an uncommon Unicode codepoint
|
const µ: f64 = 0.000001; //~ identifier contains a non normalized (NFKC) character: 'µ'
|
||||||
//~| WARNING should have an upper case name
|
//~| WARNING should have an upper case name
|
||||||
|
|
||||||
fn dijkstra() {} //~ ERROR identifier contains an uncommon Unicode codepoint
|
fn dijkstra() {}
|
||||||
|
//~^ ERROR identifier contains a non normalized (NFKC) character: 'ij'
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let ㇻㇲㇳ = "rust"; //~ ERROR identifier contains uncommon Unicode codepoints
|
let ㇻㇲㇳ = "rust"; //~ ERROR identifier contains uncommon characters: 'ㇻ', 'ㇲ', and 'ㇳ'
|
||||||
|
|
||||||
// using the same identifier the second time won't trigger the lint.
|
// using the same identifier the second time won't trigger the lint.
|
||||||
println!("{}", ㇻㇲㇳ);
|
println!("{}", ㇻㇲㇳ);
|
||||||
|
@ -1,26 +1,31 @@
|
|||||||
error: identifier contains an uncommon Unicode codepoint: 'µ'
|
error: identifier contains a non normalized (NFKC) character: 'µ'
|
||||||
--> $DIR/lint-uncommon-codepoints.rs:3:7
|
--> $DIR/lint-uncommon-codepoints.rs:3:7
|
||||||
|
|
|
|
||||||
LL | const µ: f64 = 0.000001;
|
LL | const µ: f64 = 0.000001;
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
|
= note: this character is included in the Not_NFKC Unicode general security profile
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/lint-uncommon-codepoints.rs:1:9
|
--> $DIR/lint-uncommon-codepoints.rs:1:9
|
||||||
|
|
|
|
||||||
LL | #![deny(uncommon_codepoints)]
|
LL | #![deny(uncommon_codepoints)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: identifier contains an uncommon Unicode codepoint: 'ij'
|
error: identifier contains a non normalized (NFKC) character: 'ij'
|
||||||
--> $DIR/lint-uncommon-codepoints.rs:6:4
|
--> $DIR/lint-uncommon-codepoints.rs:6:4
|
||||||
|
|
|
|
||||||
LL | fn dijkstra() {}
|
LL | fn dijkstra() {}
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
|
||||||
|
= note: this character is included in the Not_NFKC Unicode general security profile
|
||||||
|
|
||||||
error: identifier contains uncommon Unicode codepoints: 'ㇻ', 'ㇲ', and 'ㇳ'
|
error: identifier contains uncommon characters: 'ㇻ', 'ㇲ', and 'ㇳ'
|
||||||
--> $DIR/lint-uncommon-codepoints.rs:9:9
|
--> $DIR/lint-uncommon-codepoints.rs:10:9
|
||||||
|
|
|
|
||||||
LL | let ㇻㇲㇳ = "rust";
|
LL | let ㇻㇲㇳ = "rust";
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
|
||||||
|
= note: these characters are included in the Unicode general security profile
|
||||||
|
|
||||||
warning: constant `µ` should have an upper case name
|
warning: constant `µ` should have an upper case name
|
||||||
--> $DIR/lint-uncommon-codepoints.rs:3:7
|
--> $DIR/lint-uncommon-codepoints.rs:3:7
|
||||||
|
Loading…
x
Reference in New Issue
Block a user