Auto merge of #152810 - JonathanBrouwer:rollup-3OFTrE3, r=<try>
Rollup of 18 pull requests try-job: x86_64-msvc-1 try-job: i686-msvc-1 try-job: x86_64-mingw-1 try-job: test-various try-job: armhf-gnu try-job: aarch64-apple try-job: x86_64-gnu-llvm-20-3 try-job: dist-various-2
This commit is contained in:
commit
7bb7280a66
80 changed files with 1739 additions and 340 deletions
|
|
@ -33,7 +33,7 @@ rustc_index::newtype_index! {
|
||||||
/// `b` is `FieldIdx(1)` in `VariantIdx(0)`,
|
/// `b` is `FieldIdx(1)` in `VariantIdx(0)`,
|
||||||
/// `d` is `FieldIdx(1)` in `VariantIdx(1)`, and
|
/// `d` is `FieldIdx(1)` in `VariantIdx(1)`, and
|
||||||
/// `f` is `FieldIdx(1)` in `VariantIdx(0)`.
|
/// `f` is `FieldIdx(1)` in `VariantIdx(0)`.
|
||||||
#[derive(HashStable_Generic)]
|
#[stable_hash_generic]
|
||||||
#[encodable]
|
#[encodable]
|
||||||
#[orderable]
|
#[orderable]
|
||||||
pub struct FieldIdx {}
|
pub struct FieldIdx {}
|
||||||
|
|
@ -57,7 +57,7 @@ rustc_index::newtype_index! {
|
||||||
///
|
///
|
||||||
/// `struct`s, `tuples`, and `unions`s are considered to have a single variant
|
/// `struct`s, `tuples`, and `unions`s are considered to have a single variant
|
||||||
/// with variant index zero, aka [`FIRST_VARIANT`].
|
/// with variant index zero, aka [`FIRST_VARIANT`].
|
||||||
#[derive(HashStable_Generic)]
|
#[stable_hash_generic]
|
||||||
#[encodable]
|
#[encodable]
|
||||||
#[orderable]
|
#[orderable]
|
||||||
pub struct VariantIdx {
|
pub struct VariantIdx {
|
||||||
|
|
|
||||||
|
|
@ -522,6 +522,13 @@ impl<'a, 'sess> MetaItemListParserContext<'a, 'sess> {
|
||||||
return self.parser.dcx().create_err(err);
|
return self.parser.dcx().create_err(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let ShouldEmit::ErrorsAndLints { recovery: Recovery::Forbidden } = self.should_emit {
|
||||||
|
// Do not attempt to suggest anything in `Recovery::Forbidden` mode.
|
||||||
|
// Malformed diagnostic-attr arguments that start with an `if` expression can lead to
|
||||||
|
// an ICE (https://github.com/rust-lang/rust/issues/152744), because callers may cancel the `InvalidMetaItem` error.
|
||||||
|
return self.parser.dcx().create_err(err);
|
||||||
|
}
|
||||||
|
|
||||||
// Suggest quoting idents, e.g. in `#[cfg(key = value)]`. We don't use `Token::ident` and
|
// Suggest quoting idents, e.g. in `#[cfg(key = value)]`. We don't use `Token::ident` and
|
||||||
// don't `uninterpolate` the token to avoid suggesting anything butchered or questionable
|
// don't `uninterpolate` the token to avoid suggesting anything butchered or questionable
|
||||||
// when macro metavariables are involved.
|
// when macro metavariables are involved.
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ fn default_struct_substructure(
|
||||||
cx: &ExtCtxt<'_>,
|
cx: &ExtCtxt<'_>,
|
||||||
trait_span: Span,
|
trait_span: Span,
|
||||||
substr: &Substructure<'_>,
|
substr: &Substructure<'_>,
|
||||||
summary: &StaticFields,
|
summary: &StaticFields<'_>,
|
||||||
) -> BlockOrExpr {
|
) -> BlockOrExpr {
|
||||||
let expr = match summary {
|
let expr = match summary {
|
||||||
Unnamed(_, IsTuple::No) => cx.expr_ident(trait_span, substr.type_ident),
|
Unnamed(_, IsTuple::No) => cx.expr_ident(trait_span, substr.type_ident),
|
||||||
|
|
@ -78,16 +78,16 @@ fn default_struct_substructure(
|
||||||
Named(fields) => {
|
Named(fields) => {
|
||||||
let default_fields = fields
|
let default_fields = fields
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(ident, span, default_val)| {
|
.map(|&(ident, span, default_val)| {
|
||||||
let value = match default_val {
|
let value = match default_val {
|
||||||
// We use `Default::default()`.
|
// We use `Default::default()`.
|
||||||
None => default_call(cx, *span),
|
None => default_call(cx, span),
|
||||||
// We use the field default const expression.
|
// We use the field default const expression.
|
||||||
Some(val) => {
|
Some(val) => {
|
||||||
cx.expr(val.value.span, ast::ExprKind::ConstBlock(val.clone()))
|
cx.expr(val.value.span, ast::ExprKind::ConstBlock(val.clone()))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
cx.field_imm(*span, *ident, value)
|
cx.field_imm(span, ident, value)
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
cx.expr_struct_ident(trait_span, substr.type_ident, default_fields)
|
cx.expr_struct_ident(trait_span, substr.type_ident, default_fields)
|
||||||
|
|
|
||||||
|
|
@ -303,11 +303,11 @@ pub(crate) enum IsTuple {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Fields for a static method
|
/// Fields for a static method
|
||||||
pub(crate) enum StaticFields {
|
pub(crate) enum StaticFields<'a> {
|
||||||
/// Tuple and unit structs/enum variants like this.
|
/// Tuple and unit structs/enum variants like this.
|
||||||
Unnamed(Vec<Span>, IsTuple),
|
Unnamed(Vec<Span>, IsTuple),
|
||||||
/// Normal structs/struct variants.
|
/// Normal structs/struct variants.
|
||||||
Named(Vec<(Ident, Span, Option<AnonConst>)>),
|
Named(Vec<(Ident, Span, Option<&'a AnonConst>)>),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A summary of the possible sets of fields.
|
/// A summary of the possible sets of fields.
|
||||||
|
|
@ -331,7 +331,7 @@ pub(crate) enum SubstructureFields<'a> {
|
||||||
EnumDiscr(FieldInfo, Option<Box<Expr>>),
|
EnumDiscr(FieldInfo, Option<Box<Expr>>),
|
||||||
|
|
||||||
/// A static method where `Self` is a struct.
|
/// A static method where `Self` is a struct.
|
||||||
StaticStruct(&'a ast::VariantData, StaticFields),
|
StaticStruct(&'a ast::VariantData, StaticFields<'a>),
|
||||||
|
|
||||||
/// A static method where `Self` is an enum.
|
/// A static method where `Self` is an enum.
|
||||||
StaticEnum(&'a ast::EnumDef),
|
StaticEnum(&'a ast::EnumDef),
|
||||||
|
|
@ -596,7 +596,7 @@ impl<'a> TraitDef<'a> {
|
||||||
cx: &ExtCtxt<'_>,
|
cx: &ExtCtxt<'_>,
|
||||||
type_ident: Ident,
|
type_ident: Ident,
|
||||||
generics: &Generics,
|
generics: &Generics,
|
||||||
field_tys: Vec<Box<ast::Ty>>,
|
field_tys: Vec<&ast::Ty>,
|
||||||
methods: Vec<Box<ast::AssocItem>>,
|
methods: Vec<Box<ast::AssocItem>>,
|
||||||
is_packed: bool,
|
is_packed: bool,
|
||||||
) -> Box<ast::Item> {
|
) -> Box<ast::Item> {
|
||||||
|
|
@ -870,8 +870,7 @@ impl<'a> TraitDef<'a> {
|
||||||
from_scratch: bool,
|
from_scratch: bool,
|
||||||
is_packed: bool,
|
is_packed: bool,
|
||||||
) -> Box<ast::Item> {
|
) -> Box<ast::Item> {
|
||||||
let field_tys: Vec<Box<ast::Ty>> =
|
let field_tys = Vec::from_iter(struct_def.fields().iter().map(|field| &*field.ty));
|
||||||
struct_def.fields().iter().map(|field| field.ty.clone()).collect();
|
|
||||||
|
|
||||||
let methods = self
|
let methods = self
|
||||||
.methods
|
.methods
|
||||||
|
|
@ -923,11 +922,13 @@ impl<'a> TraitDef<'a> {
|
||||||
generics: &Generics,
|
generics: &Generics,
|
||||||
from_scratch: bool,
|
from_scratch: bool,
|
||||||
) -> Box<ast::Item> {
|
) -> Box<ast::Item> {
|
||||||
let mut field_tys = Vec::new();
|
let field_tys = Vec::from_iter(
|
||||||
|
enum_def
|
||||||
for variant in &enum_def.variants {
|
.variants
|
||||||
field_tys.extend(variant.data.fields().iter().map(|field| field.ty.clone()));
|
.iter()
|
||||||
}
|
.flat_map(|variant| variant.data.fields())
|
||||||
|
.map(|field| &*field.ty),
|
||||||
|
);
|
||||||
|
|
||||||
let methods = self
|
let methods = self
|
||||||
.methods
|
.methods
|
||||||
|
|
@ -1160,8 +1161,8 @@ impl<'a> MethodDef<'a> {
|
||||||
fn expand_static_struct_method_body(
|
fn expand_static_struct_method_body(
|
||||||
&self,
|
&self,
|
||||||
cx: &ExtCtxt<'_>,
|
cx: &ExtCtxt<'_>,
|
||||||
trait_: &TraitDef<'_>,
|
trait_: &TraitDef<'a>,
|
||||||
struct_def: &VariantData,
|
struct_def: &'a VariantData,
|
||||||
type_ident: Ident,
|
type_ident: Ident,
|
||||||
nonselflike_args: &[Box<Expr>],
|
nonselflike_args: &[Box<Expr>],
|
||||||
) -> BlockOrExpr {
|
) -> BlockOrExpr {
|
||||||
|
|
@ -1480,13 +1481,13 @@ impl<'a> MethodDef<'a> {
|
||||||
|
|
||||||
// general helper methods.
|
// general helper methods.
|
||||||
impl<'a> TraitDef<'a> {
|
impl<'a> TraitDef<'a> {
|
||||||
fn summarise_struct(&self, cx: &ExtCtxt<'_>, struct_def: &VariantData) -> StaticFields {
|
fn summarise_struct(&self, cx: &ExtCtxt<'_>, struct_def: &'a VariantData) -> StaticFields<'a> {
|
||||||
let mut named_idents = Vec::new();
|
let mut named_idents = Vec::new();
|
||||||
let mut just_spans = Vec::new();
|
let mut just_spans = Vec::new();
|
||||||
for field in struct_def.fields() {
|
for field in struct_def.fields() {
|
||||||
let sp = field.span.with_ctxt(self.span.ctxt());
|
let sp = field.span.with_ctxt(self.span.ctxt());
|
||||||
match field.ident {
|
match field.ident {
|
||||||
Some(ident) => named_idents.push((ident, sp, field.default.clone())),
|
Some(ident) => named_idents.push((ident, sp, field.default.as_ref())),
|
||||||
_ => just_spans.push(sp),
|
_ => just_spans.push(sp),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
259
compiler/rustc_codegen_cranelift/.github/scripts/free-disk-space.sh
vendored
Executable file
259
compiler/rustc_codegen_cranelift/.github/scripts/free-disk-space.sh
vendored
Executable file
|
|
@ -0,0 +1,259 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Ported from rust-lang/rust commit d29e4783dff30f9526eeba3929ebfe86c00c9dad in src/ci/scripts/free-disk-space-linux.sh
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Script inspired by https://github.com/jlumbroso/free-disk-space
|
||||||
|
isX86() {
|
||||||
|
local arch
|
||||||
|
arch=$(uname -m)
|
||||||
|
if [ "$arch" = "x86_64" ]; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# In aws codebuild, the variable RUNNER_ENVIRONMENT is "self-hosted".
|
||||||
|
isGitHubRunner() {
|
||||||
|
# `:-` means "use the value of RUNNER_ENVIRONMENT if it exists, otherwise use an empty string".
|
||||||
|
if [[ "${RUNNER_ENVIRONMENT:-}" == "github-hosted" ]]; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# print a line of the specified character
|
||||||
|
printSeparationLine() {
|
||||||
|
for ((i = 0; i < 80; i++)); do
|
||||||
|
printf "%s" "$1"
|
||||||
|
done
|
||||||
|
printf "\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
# REF: https://stackoverflow.com/a/450821/408734
|
||||||
|
getAvailableSpace() {
|
||||||
|
df -a | awk 'NR > 1 {avail+=$4} END {print avail}'
|
||||||
|
}
|
||||||
|
|
||||||
|
# REF: https://unix.stackexchange.com/a/44087/60849
|
||||||
|
formatByteCount() {
|
||||||
|
numfmt --to=iec-i --suffix=B --padding=7 "${1}000"
|
||||||
|
}
|
||||||
|
|
||||||
|
# macro to output saved space
|
||||||
|
printSavedSpace() {
|
||||||
|
# Disk space before the operation
|
||||||
|
local before=${1}
|
||||||
|
local title=${2:-}
|
||||||
|
|
||||||
|
local after
|
||||||
|
after=$(getAvailableSpace)
|
||||||
|
local saved=$((after - before))
|
||||||
|
|
||||||
|
if [ "$saved" -lt 0 ]; then
|
||||||
|
echo "::warning::Saved space is negative: $saved. Using '0' as saved space."
|
||||||
|
saved=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
printSeparationLine "*"
|
||||||
|
if [ -n "${title}" ]; then
|
||||||
|
echo "=> ${title}: Saved $(formatByteCount "$saved")"
|
||||||
|
else
|
||||||
|
echo "=> Saved $(formatByteCount "$saved")"
|
||||||
|
fi
|
||||||
|
printSeparationLine "*"
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
# macro to print output of df with caption
|
||||||
|
printDF() {
|
||||||
|
local caption=${1}
|
||||||
|
|
||||||
|
printSeparationLine "="
|
||||||
|
echo "${caption}"
|
||||||
|
echo ""
|
||||||
|
echo "$ df -h"
|
||||||
|
echo ""
|
||||||
|
df -h
|
||||||
|
printSeparationLine "="
|
||||||
|
}
|
||||||
|
|
||||||
|
removeUnusedFilesAndDirs() {
|
||||||
|
local to_remove=(
|
||||||
|
"/usr/share/java"
|
||||||
|
)
|
||||||
|
|
||||||
|
if isGitHubRunner; then
|
||||||
|
to_remove+=(
|
||||||
|
"/usr/local/aws-sam-cli"
|
||||||
|
"/usr/local/doc/cmake"
|
||||||
|
"/usr/local/julia"*
|
||||||
|
"/usr/local/lib/android"
|
||||||
|
"/usr/local/share/chromedriver-"*
|
||||||
|
"/usr/local/share/chromium"
|
||||||
|
"/usr/local/share/cmake-"*
|
||||||
|
"/usr/local/share/edge_driver"
|
||||||
|
"/usr/local/share/emacs"
|
||||||
|
"/usr/local/share/gecko_driver"
|
||||||
|
"/usr/local/share/icons"
|
||||||
|
"/usr/local/share/powershell"
|
||||||
|
"/usr/local/share/vcpkg"
|
||||||
|
"/usr/local/share/vim"
|
||||||
|
"/usr/share/apache-maven-"*
|
||||||
|
"/usr/share/gradle-"*
|
||||||
|
"/usr/share/kotlinc"
|
||||||
|
"/usr/share/miniconda"
|
||||||
|
"/usr/share/php"
|
||||||
|
"/usr/share/ri"
|
||||||
|
"/usr/share/swift"
|
||||||
|
|
||||||
|
# binaries
|
||||||
|
"/usr/local/bin/azcopy"
|
||||||
|
"/usr/local/bin/bicep"
|
||||||
|
"/usr/local/bin/ccmake"
|
||||||
|
"/usr/local/bin/cmake-"*
|
||||||
|
"/usr/local/bin/cmake"
|
||||||
|
"/usr/local/bin/cpack"
|
||||||
|
"/usr/local/bin/ctest"
|
||||||
|
"/usr/local/bin/helm"
|
||||||
|
"/usr/local/bin/kind"
|
||||||
|
"/usr/local/bin/kustomize"
|
||||||
|
"/usr/local/bin/minikube"
|
||||||
|
"/usr/local/bin/packer"
|
||||||
|
"/usr/local/bin/phpunit"
|
||||||
|
"/usr/local/bin/pulumi-"*
|
||||||
|
"/usr/local/bin/pulumi"
|
||||||
|
"/usr/local/bin/stack"
|
||||||
|
|
||||||
|
# Haskell runtime
|
||||||
|
"/usr/local/.ghcup"
|
||||||
|
|
||||||
|
# Azure
|
||||||
|
"/opt/az"
|
||||||
|
"/usr/share/az_"*
|
||||||
|
)
|
||||||
|
|
||||||
|
if [ -n "${AGENT_TOOLSDIRECTORY:-}" ]; then
|
||||||
|
# Environment variable set by GitHub Actions
|
||||||
|
to_remove+=(
|
||||||
|
"${AGENT_TOOLSDIRECTORY}"
|
||||||
|
)
|
||||||
|
else
|
||||||
|
echo "::warning::AGENT_TOOLSDIRECTORY is not set. Skipping removal."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Remove folders and files present in AWS CodeBuild
|
||||||
|
to_remove+=(
|
||||||
|
# binaries
|
||||||
|
"/usr/local/bin/ecs-cli"
|
||||||
|
"/usr/local/bin/eksctl"
|
||||||
|
"/usr/local/bin/kubectl"
|
||||||
|
|
||||||
|
"${HOME}/.gradle"
|
||||||
|
"${HOME}/.dotnet"
|
||||||
|
"${HOME}/.goenv"
|
||||||
|
"${HOME}/.phpenv"
|
||||||
|
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
for element in "${to_remove[@]}"; do
|
||||||
|
if [ ! -e "$element" ]; then
|
||||||
|
# The file or directory doesn't exist.
|
||||||
|
# Maybe it was removed in a newer version of the runner or it's not present in a
|
||||||
|
# specific architecture (e.g. ARM).
|
||||||
|
echo "::warning::Directory or file $element does not exist, skipping."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Remove all files and directories at once to save time.
|
||||||
|
sudo rm -rf "${to_remove[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
execAndMeasureSpaceChange() {
|
||||||
|
local operation=${1} # Function to execute
|
||||||
|
local title=${2}
|
||||||
|
|
||||||
|
local before
|
||||||
|
before=$(getAvailableSpace)
|
||||||
|
$operation
|
||||||
|
|
||||||
|
printSavedSpace "$before" "$title"
|
||||||
|
}
|
||||||
|
|
||||||
|
# REF: https://github.com/apache/flink/blob/master/tools/azure-pipelines/free_disk_space.sh
|
||||||
|
cleanPackages() {
|
||||||
|
local packages=(
|
||||||
|
'^aspnetcore-.*'
|
||||||
|
'^dotnet-.*'
|
||||||
|
'^llvm-.*'
|
||||||
|
'^mongodb-.*'
|
||||||
|
'firefox'
|
||||||
|
'libgl1-mesa-dri'
|
||||||
|
'mono-devel'
|
||||||
|
'php.*'
|
||||||
|
)
|
||||||
|
|
||||||
|
if isGitHubRunner; then
|
||||||
|
packages+=(
|
||||||
|
azure-cli
|
||||||
|
)
|
||||||
|
|
||||||
|
if isX86; then
|
||||||
|
packages+=(
|
||||||
|
'google-chrome-stable'
|
||||||
|
'google-cloud-cli'
|
||||||
|
'google-cloud-sdk'
|
||||||
|
'powershell'
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
packages+=(
|
||||||
|
'google-chrome-stable'
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
WAIT_DPKG_LOCK="-o DPkg::Lock::Timeout=60"
|
||||||
|
sudo apt-get ${WAIT_DPKG_LOCK} -qq remove -y --fix-missing "${packages[@]}"
|
||||||
|
|
||||||
|
sudo apt-get ${WAIT_DPKG_LOCK} autoremove -y \
|
||||||
|
|| echo "::warning::The command [sudo apt-get autoremove -y] failed"
|
||||||
|
sudo apt-get ${WAIT_DPKG_LOCK} clean \
|
||||||
|
|| echo "::warning::The command [sudo apt-get clean] failed"
|
||||||
|
}
|
||||||
|
|
||||||
|
# They aren't present in ubuntu 24 runners.
|
||||||
|
cleanDocker() {
|
||||||
|
echo "=> Removing the following docker images:"
|
||||||
|
sudo docker image ls
|
||||||
|
echo "=> Removing docker images..."
|
||||||
|
sudo docker image prune --all --force || true
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remove Swap storage
|
||||||
|
cleanSwap() {
|
||||||
|
sudo swapoff -a || true
|
||||||
|
sudo rm -rf /mnt/swapfile || true
|
||||||
|
free -h
|
||||||
|
}
|
||||||
|
|
||||||
|
# Display initial disk space stats
|
||||||
|
AVAILABLE_INITIAL=$(getAvailableSpace)
|
||||||
|
|
||||||
|
printDF "BEFORE CLEAN-UP:"
|
||||||
|
echo ""
|
||||||
|
execAndMeasureSpaceChange cleanPackages "Unused packages"
|
||||||
|
execAndMeasureSpaceChange cleanDocker "Docker images"
|
||||||
|
execAndMeasureSpaceChange cleanSwap "Swap storage"
|
||||||
|
execAndMeasureSpaceChange removeUnusedFilesAndDirs "Unused files and directories"
|
||||||
|
|
||||||
|
# Output saved space statistic
|
||||||
|
echo ""
|
||||||
|
printDF "AFTER CLEAN-UP:"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
printSavedSpace "$AVAILABLE_INITIAL" "Total saved"
|
||||||
|
|
@ -49,6 +49,12 @@ jobs:
|
||||||
if: matrix.os == 'ubuntu-latest'
|
if: matrix.os == 'ubuntu-latest'
|
||||||
run: cat /proc/cpuinfo
|
run: cat /proc/cpuinfo
|
||||||
|
|
||||||
|
- name: Free disk space
|
||||||
|
if: runner.os == 'Linux'
|
||||||
|
env:
|
||||||
|
RUNNER_ENVIRONMENT: github-hosted
|
||||||
|
run: .github/scripts/free-disk-space.sh
|
||||||
|
|
||||||
- name: Cache cargo target dir
|
- name: Cache cargo target dir
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,6 @@ jobs:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- run: |
|
- run: |
|
||||||
sed -i 's/components.*/components = []/' rust-toolchain.toml
|
sed -i 's/components.*/components = []/' rust-toolchain.toml
|
||||||
- uses: rustsec/audit-check@v1.4.1
|
- uses: rustsec/audit-check@v2.0.0
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bumpalo"
|
name = "bumpalo"
|
||||||
version = "3.19.0"
|
version = "3.19.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
|
checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"allocator-api2",
|
"allocator-api2",
|
||||||
]
|
]
|
||||||
|
|
@ -43,42 +43,42 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-assembler-x64"
|
name = "cranelift-assembler-x64"
|
||||||
version = "0.127.0"
|
version = "0.128.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8bd963a645179fa33834ba61fa63353998543b07f877e208da9eb47d4a70d1e7"
|
checksum = "0377b13bf002a0774fcccac4f1102a10f04893d24060cf4b7350c87e4cbb647c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cranelift-assembler-x64-meta",
|
"cranelift-assembler-x64-meta",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-assembler-x64-meta"
|
name = "cranelift-assembler-x64-meta"
|
||||||
version = "0.127.0"
|
version = "0.128.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3f6d5739c9dc6b5553ca758d78d87d127dd19f397f776efecf817b8ba8d0bb01"
|
checksum = "cfa027979140d023b25bf7509fb7ede3a54c3d3871fb5ead4673c4b633f671a2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cranelift-srcgen",
|
"cranelift-srcgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-bforest"
|
name = "cranelift-bforest"
|
||||||
version = "0.127.0"
|
version = "0.128.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ff402c11bb1c9652b67a3e885e84b1b8d00c13472c8fd85211e06a41a63c3e03"
|
checksum = "618e4da87d9179a70b3c2f664451ca8898987aa6eb9f487d16988588b5d8cc40"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cranelift-entity",
|
"cranelift-entity",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-bitset"
|
name = "cranelift-bitset"
|
||||||
version = "0.127.0"
|
version = "0.128.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "769a0d88c2f5539e9c5536a93a7bf164b0dc68d91e3d00723e5b4ffc1440afdc"
|
checksum = "db53764b5dad233b37b8f5dc54d3caa9900c54579195e00f17ea21f03f71aaa7"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-codegen"
|
name = "cranelift-codegen"
|
||||||
version = "0.127.0"
|
version = "0.128.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d4351f721fb3b26add1c180f0a75c7474bab2f903c8b777c6ca65238ded59a78"
|
checksum = "4ae927f1d8c0abddaa863acd201471d56e7fc6c3925104f4861ed4dc3e28b421"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bumpalo",
|
"bumpalo",
|
||||||
"cranelift-assembler-x64",
|
"cranelift-assembler-x64",
|
||||||
|
|
@ -102,9 +102,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-codegen-meta"
|
name = "cranelift-codegen-meta"
|
||||||
version = "0.127.0"
|
version = "0.128.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "61f86c0ba5b96713643f4dd0de0df12844de9c7bb137d6829b174b706939aa74"
|
checksum = "d3fcf1e3e6757834bd2584f4cbff023fcc198e9279dcb5d684b4bb27a9b19f54"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cranelift-assembler-x64-meta",
|
"cranelift-assembler-x64-meta",
|
||||||
"cranelift-codegen-shared",
|
"cranelift-codegen-shared",
|
||||||
|
|
@ -114,33 +114,33 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-codegen-shared"
|
name = "cranelift-codegen-shared"
|
||||||
version = "0.127.0"
|
version = "0.128.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f08605eee8d51fd976a970bd5b16c9529b51b624f8af68f80649ffb172eb85a4"
|
checksum = "205dcb9e6ccf9d368b7466be675ff6ee54a63e36da6fe20e72d45169cf6fd254"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-control"
|
name = "cranelift-control"
|
||||||
version = "0.127.0"
|
version = "0.128.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "623aab0a09e40f0cf0b5d35eb7832bae4c4f13e3768228e051a6c1a60e88ef5f"
|
checksum = "108eca9fcfe86026054f931eceaf57b722c1b97464bf8265323a9b5877238817"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arbitrary",
|
"arbitrary",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-entity"
|
name = "cranelift-entity"
|
||||||
version = "0.127.0"
|
version = "0.128.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ea0f066e07e3bcbe38884cc5c94c32c7a90267d69df80f187d9dfe421adaa7c4"
|
checksum = "a0d96496910065d3165f84ff8e1e393916f4c086f88ac8e1b407678bc78735aa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cranelift-bitset",
|
"cranelift-bitset",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-frontend"
|
name = "cranelift-frontend"
|
||||||
version = "0.127.0"
|
version = "0.128.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "40865b02a0e52ca8e580ad64feef530cb1d05f6bb4972b4eef05e3eaeae81701"
|
checksum = "e303983ad7e23c850f24d9c41fc3cb346e1b930f066d3966545e4c98dac5c9fb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cranelift-codegen",
|
"cranelift-codegen",
|
||||||
"log",
|
"log",
|
||||||
|
|
@ -150,15 +150,15 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-isle"
|
name = "cranelift-isle"
|
||||||
version = "0.127.0"
|
version = "0.128.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "104b3c117ae513e9af1d90679842101193a5ccb96ac9f997966d85ea25be2852"
|
checksum = "24b0cf8d867d891245836cac7abafb0a5b0ea040a019d720702b3b8bcba40bfa"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-jit"
|
name = "cranelift-jit"
|
||||||
version = "0.127.0"
|
version = "0.128.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3aa5f855cfb8e4253ed2d0dfc1a0b6ebe4912e67aa8b7ee14026ff55ca17f1fe"
|
checksum = "dcf1e35da6eca2448395f483eb172ce71dd7842f7dc96f44bb8923beafe43c6d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"cranelift-codegen",
|
"cranelift-codegen",
|
||||||
|
|
@ -176,9 +176,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-module"
|
name = "cranelift-module"
|
||||||
version = "0.127.0"
|
version = "0.128.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b1d01806b191b59f4fc4680293dd5f554caf2de5b62f95eff5beef7acb46c29c"
|
checksum = "792ba2a54100e34f8a36e3e329a5207cafd1f0918a031d34695db73c163fdcc7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"cranelift-codegen",
|
"cranelift-codegen",
|
||||||
|
|
@ -187,9 +187,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-native"
|
name = "cranelift-native"
|
||||||
version = "0.127.0"
|
version = "0.128.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e5c54e0a358bc05b48f2032e1c320e7f468da068604f2869b77052eab68eb0fe"
|
checksum = "e24b641e315443e27807b69c440fe766737d7e718c68beb665a2d69259c77bf3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cranelift-codegen",
|
"cranelift-codegen",
|
||||||
"libc",
|
"libc",
|
||||||
|
|
@ -198,9 +198,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-object"
|
name = "cranelift-object"
|
||||||
version = "0.127.0"
|
version = "0.128.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3d17e0216be5daabab616647c1918e06dae0708474ba5f7b7762ac24ea5eb126"
|
checksum = "ecba1f219a201cf946150538e631defd620c5051b62c52ecb89a0004bab263d4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"cranelift-codegen",
|
"cranelift-codegen",
|
||||||
|
|
@ -213,9 +213,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-srcgen"
|
name = "cranelift-srcgen"
|
||||||
version = "0.127.0"
|
version = "0.128.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cc6f4b039f453b66c75e9f7886e5a2af96276e151f44dc19b24b58f9a0c98009"
|
checksum = "a4e378a54e7168a689486d67ee1f818b7e5356e54ae51a1d7a53f4f13f7f8b7a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crc32fast"
|
name = "crc32fast"
|
||||||
|
|
@ -257,9 +257,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.15.4"
|
version = "0.15.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5"
|
checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"foldhash",
|
"foldhash",
|
||||||
]
|
]
|
||||||
|
|
@ -282,9 +282,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.178"
|
version = "0.2.180"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091"
|
checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libloading"
|
name = "libloading"
|
||||||
|
|
@ -298,9 +298,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libm"
|
name = "libm"
|
||||||
version = "0.2.15"
|
version = "0.2.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de"
|
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
|
|
@ -337,27 +337,27 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.103"
|
version = "1.0.106"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8"
|
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.42"
|
version = "1.0.44"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f"
|
checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regalloc2"
|
name = "regalloc2"
|
||||||
version = "0.13.3"
|
version = "0.13.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4e249c660440317032a71ddac302f25f1d5dff387667bcc3978d1f77aa31ac34"
|
checksum = "08effbc1fa53aaebff69521a5c05640523fab037b34a4a2c109506bc938246fa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"allocator-api2",
|
"allocator-api2",
|
||||||
"bumpalo",
|
"bumpalo",
|
||||||
|
|
@ -446,9 +446,9 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.111"
|
version = "2.0.114"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87"
|
checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
@ -457,9 +457,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "target-lexicon"
|
name = "target-lexicon"
|
||||||
version = "0.13.3"
|
version = "0.13.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "df7f62577c25e07834649fc3b39fafdc597c0a3527dc1c60129201ccfcbaa50c"
|
checksum = "b1dd07eb858a2067e2f3c7155d54e929265c264e6f37efe3ee7a8d1b5a1dd0ba"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
|
|
@ -469,9 +469,9 @@ checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasmtime-internal-jit-icache-coherence"
|
name = "wasmtime-internal-jit-icache-coherence"
|
||||||
version = "40.0.0"
|
version = "41.0.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0858b470463f3e7c73acd6049046049e64be17b98901c2db5047450cf83df1fe"
|
checksum = "bada5ca1cc47df7d14100e2254e187c2486b426df813cea2dd2553a7469f7674"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
|
|
@ -481,9 +481,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasmtime-internal-math"
|
name = "wasmtime-internal-math"
|
||||||
version = "40.0.0"
|
version = "41.0.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "222e1a590ece4e898f20af1e541b61d2cb803f2557e7eaff23e6c1db5434454a"
|
checksum = "cf6f615d528eda9adc6eefb062135f831b5215c348f4c3ec3e143690c730605b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libm",
|
"libm",
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,12 @@ crate-type = ["dylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# These have to be in sync with each other
|
# These have to be in sync with each other
|
||||||
cranelift-codegen = { version = "0.127.0", default-features = false, features = ["std", "timing", "unwind", "all-native-arch"] }
|
cranelift-codegen = { version = "0.128.3", default-features = false, features = ["std", "timing", "unwind", "all-native-arch"] }
|
||||||
cranelift-frontend = { version = "0.127.0" }
|
cranelift-frontend = { version = "0.128.3" }
|
||||||
cranelift-module = { version = "0.127.0" }
|
cranelift-module = { version = "0.128.3" }
|
||||||
cranelift-native = { version = "0.127.0" }
|
cranelift-native = { version = "0.128.3" }
|
||||||
cranelift-jit = { version = "0.127.0", optional = true }
|
cranelift-jit = { version = "0.128.3", optional = true }
|
||||||
cranelift-object = { version = "0.127.0" }
|
cranelift-object = { version = "0.128.3" }
|
||||||
target-lexicon = "0.13"
|
target-lexicon = "0.13"
|
||||||
gimli = { version = "0.32", default-features = false, features = ["write"] }
|
gimli = { version = "0.32", default-features = false, features = ["write"] }
|
||||||
object = { version = "0.37.3", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
|
object = { version = "0.37.3", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
|
||||||
|
|
@ -24,12 +24,12 @@ smallvec = "1.8.1"
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
# Uncomment to use an unreleased version of cranelift
|
# Uncomment to use an unreleased version of cranelift
|
||||||
#cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-40.0.0" }
|
#cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-41.0.0" }
|
||||||
#cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-40.0.0" }
|
#cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-41.0.0" }
|
||||||
#cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-40.0.0" }
|
#cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-41.0.0" }
|
||||||
#cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-40.0.0" }
|
#cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-41.0.0" }
|
||||||
#cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-40.0.0" }
|
#cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-41.0.0" }
|
||||||
#cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-40.0.0" }
|
#cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-41.0.0" }
|
||||||
|
|
||||||
# Uncomment to use local checkout of cranelift
|
# Uncomment to use local checkout of cranelift
|
||||||
#cranelift-codegen = { path = "../wasmtime/cranelift/codegen" }
|
#cranelift-codegen = { path = "../wasmtime/cranelift/codegen" }
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,8 @@ pub(crate) fn build_backend(
|
||||||
|
|
||||||
cmd.arg("--release");
|
cmd.arg("--release");
|
||||||
|
|
||||||
|
cmd.arg("-Zno-embed-metadata");
|
||||||
|
|
||||||
eprintln!("[BUILD] rustc_codegen_cranelift");
|
eprintln!("[BUILD] rustc_codegen_cranelift");
|
||||||
crate::utils::spawn_and_wait(cmd);
|
crate::utils::spawn_and_wait(cmd);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -235,17 +235,14 @@ fn build_clif_sysroot_for_triple(
|
||||||
|
|
||||||
if let Some(prefix) = env::var_os("CG_CLIF_STDLIB_REMAP_PATH_PREFIX") {
|
if let Some(prefix) = env::var_os("CG_CLIF_STDLIB_REMAP_PATH_PREFIX") {
|
||||||
rustflags.push("--remap-path-prefix".to_owned());
|
rustflags.push("--remap-path-prefix".to_owned());
|
||||||
rustflags.push(format!(
|
rustflags.push(format!("library/={}/library", prefix.to_str().unwrap()));
|
||||||
"{}={}",
|
|
||||||
STDLIB_SRC.to_path(dirs).to_str().unwrap(),
|
|
||||||
prefix.to_str().unwrap()
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
compiler.rustflags.extend(rustflags);
|
compiler.rustflags.extend(rustflags);
|
||||||
let mut build_cmd = STANDARD_LIBRARY.build(&compiler, dirs);
|
let mut build_cmd = STANDARD_LIBRARY.build(&compiler, dirs);
|
||||||
build_cmd.arg("--release");
|
build_cmd.arg("--release");
|
||||||
build_cmd.arg("--features").arg("backtrace panic-unwind");
|
build_cmd.arg("--features").arg("backtrace panic-unwind");
|
||||||
build_cmd.arg(format!("-Zroot-dir={}", STDLIB_SRC.to_path(dirs).display()));
|
build_cmd.arg(format!("-Zroot-dir={}", STDLIB_SRC.to_path(dirs).display()));
|
||||||
|
build_cmd.arg("-Zno-embed-metadata");
|
||||||
build_cmd.env("CARGO_PROFILE_RELEASE_DEBUG", "true");
|
build_cmd.env("CARGO_PROFILE_RELEASE_DEBUG", "true");
|
||||||
build_cmd.env("__CARGO_DEFAULT_LIB_METADATA", "cg_clif");
|
build_cmd.env("__CARGO_DEFAULT_LIB_METADATA", "cg_clif");
|
||||||
if compiler.triple.contains("apple") {
|
if compiler.triple.contains("apple") {
|
||||||
|
|
@ -260,7 +257,7 @@ fn build_clif_sysroot_for_triple(
|
||||||
for entry in fs::read_dir(build_dir.join("deps")).unwrap() {
|
for entry in fs::read_dir(build_dir.join("deps")).unwrap() {
|
||||||
let entry = entry.unwrap();
|
let entry = entry.unwrap();
|
||||||
if let Some(ext) = entry.path().extension() {
|
if let Some(ext) = entry.path().extension() {
|
||||||
if ext == "rmeta" || ext == "d" || ext == "dSYM" || ext == "clif" {
|
if ext == "d" || ext == "dSYM" || ext == "clif" {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ aot.mini_core_hello_world
|
||||||
|
|
||||||
testsuite.base_sysroot
|
testsuite.base_sysroot
|
||||||
aot.arbitrary_self_types_pointers_and_wrappers
|
aot.arbitrary_self_types_pointers_and_wrappers
|
||||||
jit.std_example
|
#jit.std_example # FIXME(#1619) broken for some reason
|
||||||
aot.std_example
|
aot.std_example
|
||||||
aot.dst_field_align
|
aot.dst_field_align
|
||||||
aot.subslice-patterns-const-eval
|
aot.subslice-patterns-const-eval
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
From 116abc64add4d617104993a7a3011f20bcf31ef2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: bjorn3 <17426603+bjorn3@users.noreply.github.com>
|
||||||
|
Date: Mon, 26 Jan 2026 16:20:58 +0000
|
||||||
|
Subject: [PATCH] Ensure va_end doesn't get emitted unless VaList is actually
|
||||||
|
used
|
||||||
|
|
||||||
|
---
|
||||||
|
library/core/src/ffi/va_list.rs | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/library/core/src/ffi/va_list.rs b/library/core/src/ffi/va_list.rs
|
||||||
|
index d0f1553..75129af 100644
|
||||||
|
--- a/library/core/src/ffi/va_list.rs
|
||||||
|
+++ b/library/core/src/ffi/va_list.rs
|
||||||
|
@@ -217,6 +217,7 @@ impl Clone for VaList<'_> {
|
||||||
|
|
||||||
|
#[rustc_const_unstable(feature = "const_c_variadic", issue = "151787")]
|
||||||
|
impl<'f> const Drop for VaList<'f> {
|
||||||
|
+ #[inline]
|
||||||
|
fn drop(&mut self) {
|
||||||
|
// SAFETY: this variable argument list is being dropped, so won't be read from again.
|
||||||
|
unsafe { va_end(self) }
|
||||||
|
--
|
||||||
|
2.43.0
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "nightly-2025-12-23"
|
channel = "nightly-2026-02-18"
|
||||||
components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt"]
|
components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt"]
|
||||||
profile = "minimal"
|
profile = "minimal"
|
||||||
|
|
|
||||||
57
compiler/rustc_codegen_cranelift/scripts/jit-helpers.py
Normal file
57
compiler/rustc_codegen_cranelift/scripts/jit-helpers.py
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
import gdb
|
||||||
|
|
||||||
|
|
||||||
|
def jitmap_raw():
|
||||||
|
pid = gdb.selected_inferior().pid
|
||||||
|
jitmap_file = open("/tmp/perf-%d.map" % (pid,), "r")
|
||||||
|
jitmap = jitmap_file.read()
|
||||||
|
jitmap_file.close()
|
||||||
|
return jitmap
|
||||||
|
|
||||||
|
|
||||||
|
def jit_functions():
|
||||||
|
jitmap = jitmap_raw()
|
||||||
|
|
||||||
|
functions = []
|
||||||
|
for line in jitmap.strip().split("\n"):
|
||||||
|
[addr, size, name] = line.split(" ")
|
||||||
|
functions.append((int(addr, 16), int(size, 16), name))
|
||||||
|
|
||||||
|
return functions
|
||||||
|
|
||||||
|
|
||||||
|
class JitDecorator(gdb.FrameDecorator.FrameDecorator):
|
||||||
|
def __init__(self, fobj, name):
|
||||||
|
super(JitDecorator, self).__init__(fobj)
|
||||||
|
self.name = name
|
||||||
|
|
||||||
|
def function(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
|
class JitFilter:
|
||||||
|
"""
|
||||||
|
A backtrace filter which reads perf map files produced by cranelift-jit.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.name = "JitFilter"
|
||||||
|
self.enabled = True
|
||||||
|
self.priority = 0
|
||||||
|
|
||||||
|
gdb.current_progspace().frame_filters[self.name] = self
|
||||||
|
|
||||||
|
# FIXME add an actual unwinder or somehow register JITed .eh_frame with gdb to avoid relying on
|
||||||
|
# gdb unwinder heuristics.
|
||||||
|
def filter(self, frame_iter):
|
||||||
|
for frame in frame_iter:
|
||||||
|
frame_addr = frame.inferior_frame().pc()
|
||||||
|
for addr, size, name in jit_functions():
|
||||||
|
if frame_addr >= addr and frame_addr < addr + size:
|
||||||
|
yield JitDecorator(frame, name)
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
yield frame
|
||||||
|
|
||||||
|
|
||||||
|
JitFilter()
|
||||||
|
|
@ -49,25 +49,45 @@ std-features = ["panic-unwind"]
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat <<EOF | git apply -
|
cat <<EOF | git apply -
|
||||||
|
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
|
||||||
|
index 2e16f2cf27..3ac3df99a8 100644
|
||||||
|
--- a/src/bootstrap/bootstrap.py
|
||||||
|
+++ b/src/bootstrap/bootstrap.py
|
||||||
|
@@ -1147,6 +1147,8 @@ class RustBuild(object):
|
||||||
|
args += ["-Zwarnings"]
|
||||||
|
env["CARGO_BUILD_WARNINGS"] = "deny"
|
||||||
|
|
||||||
|
+ env["RUSTFLAGS"] += " -Zbinary-dep-depinfo"
|
||||||
|
+
|
||||||
|
# Add RUSTFLAGS_BOOTSTRAP to RUSTFLAGS for bootstrap compilation.
|
||||||
|
# Note that RUSTFLAGS_BOOTSTRAP should always be added to the end of
|
||||||
|
# RUSTFLAGS, since that causes RUSTFLAGS_BOOTSTRAP to override RUSTFLAGS.
|
||||||
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
|
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
|
||||||
index a656927b1f6..44fc5546fac 100644
|
index a656927b1f6..44fc5546fac 100644
|
||||||
--- a/src/bootstrap/src/core/config/config.rs
|
--- a/src/bootstrap/src/core/config/config.rs
|
||||||
+++ b/src/bootstrap/src/core/config/config.rs
|
+++ b/src/bootstrap/src/core/config/config.rs
|
||||||
@@ -2249,14 +2249,6 @@ pub fn parse_download_ci_llvm<'a>(
|
@@ -2249,7 +2249,7 @@ pub fn parse_download_ci_llvm<'a>(
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- #[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
- if b && dwn_ctx.is_running_on_ci && CiEnv::is_rust_lang_managed_ci_job() {
|
- if b && dwn_ctx.is_running_on_ci && CiEnv::is_rust_lang_managed_ci_job() {
|
||||||
- // On rust-lang CI, we must always rebuild LLVM if there were any modifications to it
|
+ if false && dwn_ctx.is_running_on_ci && CiEnv::is_rust_lang_managed_ci_job() {
|
||||||
- panic!(
|
// On rust-lang CI, we must always rebuild LLVM if there were any modifications to it
|
||||||
- "\`llvm.download-ci-llvm\` cannot be set to \`true\` on CI. Use \`if-unchanged\` instead."
|
panic!(
|
||||||
- );
|
"\`llvm.download-ci-llvm\` cannot be set to \`true\` on CI. Use \`if-unchanged\` instead."
|
||||||
- }
|
diff --git a/src/build_helper/src/git.rs b/src/build_helper/src/git.rs
|
||||||
-
|
index 330fb465de..a4593ed96f 100644
|
||||||
// If download-ci-llvm=true we also want to check that CI llvm is available
|
--- a/src/build_helper/src/git.rs
|
||||||
b && llvm::is_ci_llvm_available_for_target(&dwn_ctx.host_target, asserts)
|
+++ b/src/build_helper/src/git.rs
|
||||||
}
|
@@ -218,7 +218,7 @@ pub fn get_closest_upstream_commit(
|
||||||
|
config: &GitConfig<'_>,
|
||||||
|
env: CiEnv,
|
||||||
|
) -> Result<Option<String>, String> {
|
||||||
|
- let base = match env {
|
||||||
|
+ let base = match CiEnv::None {
|
||||||
|
CiEnv::None => "HEAD",
|
||||||
|
CiEnv::GitHubActions => {
|
||||||
|
// On CI, we should always have a non-upstream merge commit at the tip,
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
popd
|
popd
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,6 @@ pushd rust
|
||||||
|
|
||||||
command -v rg >/dev/null 2>&1 || cargo install ripgrep
|
command -v rg >/dev/null 2>&1 || cargo install ripgrep
|
||||||
|
|
||||||
rm -r tests/ui/{lto/,linkage*} || true
|
|
||||||
for test in $(rg --files-with-matches "lto" tests/{codegen-units,ui,incremental}); do
|
|
||||||
rm $test
|
|
||||||
done
|
|
||||||
|
|
||||||
# should-fail tests don't work when compiletest is compiled with panic=abort
|
# should-fail tests don't work when compiletest is compiled with panic=abort
|
||||||
for test in $(rg --files-with-matches "//@ should-fail" tests/{codegen-units,ui,incremental}); do
|
for test in $(rg --files-with-matches "//@ should-fail" tests/{codegen-units,ui,incremental}); do
|
||||||
rm $test
|
rm $test
|
||||||
|
|
@ -38,6 +33,7 @@ rm tests/ui/simd/intrinsic/generic-arithmetic-pass.rs # unimplemented simd_funne
|
||||||
rm -r tests/ui/scalable-vectors # scalable vectors are unsupported
|
rm -r tests/ui/scalable-vectors # scalable vectors are unsupported
|
||||||
|
|
||||||
# exotic linkages
|
# exotic linkages
|
||||||
|
rm -r tests/ui/linkage*
|
||||||
rm tests/incremental/hashes/function_interfaces.rs
|
rm tests/incremental/hashes/function_interfaces.rs
|
||||||
rm tests/incremental/hashes/statics.rs
|
rm tests/incremental/hashes/statics.rs
|
||||||
rm -r tests/run-make/naked-symbol-visibility
|
rm -r tests/run-make/naked-symbol-visibility
|
||||||
|
|
@ -45,11 +41,13 @@ rm -r tests/run-make/naked-symbol-visibility
|
||||||
# variadic arguments
|
# variadic arguments
|
||||||
rm tests/ui/abi/mir/mir_codegen_calls_variadic.rs # requires float varargs
|
rm tests/ui/abi/mir/mir_codegen_calls_variadic.rs # requires float varargs
|
||||||
rm tests/ui/c-variadic/naked.rs # same
|
rm tests/ui/c-variadic/naked.rs # same
|
||||||
|
rm tests/ui/consts/const-eval/c-variadic.rs # same
|
||||||
rm tests/ui/abi/variadic-ffi.rs # requires callee side vararg support
|
rm tests/ui/abi/variadic-ffi.rs # requires callee side vararg support
|
||||||
rm -r tests/run-make/c-link-to-rust-va-list-fn # requires callee side vararg support
|
rm -r tests/run-make/c-link-to-rust-va-list-fn # requires callee side vararg support
|
||||||
rm tests/ui/c-variadic/valid.rs # same
|
rm tests/ui/c-variadic/valid.rs # same
|
||||||
rm tests/ui/c-variadic/trait-method.rs # same
|
rm tests/ui/c-variadic/trait-method.rs # same
|
||||||
rm tests/ui/c-variadic/inherent-method.rs # same
|
rm tests/ui/c-variadic/inherent-method.rs # same
|
||||||
|
rm tests/ui/c-variadic/copy.rs # same
|
||||||
rm tests/ui/sanitizer/kcfi-c-variadic.rs # same
|
rm tests/ui/sanitizer/kcfi-c-variadic.rs # same
|
||||||
rm tests/ui/c-variadic/same-program-multiple-abis-x86_64.rs # variadics for calling conventions other than C unsupported
|
rm tests/ui/c-variadic/same-program-multiple-abis-x86_64.rs # variadics for calling conventions other than C unsupported
|
||||||
rm tests/ui/delegation/fn-header.rs
|
rm tests/ui/delegation/fn-header.rs
|
||||||
|
|
@ -79,6 +77,10 @@ rm -r tests/ui/eii # EII not yet implemented
|
||||||
rm -r tests/run-make/forced-unwind-terminate-pof # forced unwinding doesn't take precedence
|
rm -r tests/run-make/forced-unwind-terminate-pof # forced unwinding doesn't take precedence
|
||||||
|
|
||||||
# requires LTO
|
# requires LTO
|
||||||
|
rm -r tests/ui/lto
|
||||||
|
for test in $(rg --files-with-matches "lto" tests/{codegen-units,ui,incremental}); do
|
||||||
|
rm $test
|
||||||
|
done
|
||||||
rm -r tests/run-make/cdylib
|
rm -r tests/run-make/cdylib
|
||||||
rm -r tests/run-make/codegen-options-parsing
|
rm -r tests/run-make/codegen-options-parsing
|
||||||
rm -r tests/run-make/lto-*
|
rm -r tests/run-make/lto-*
|
||||||
|
|
@ -126,6 +128,14 @@ rm -r tests/run-make/notify-all-emit-artifacts
|
||||||
rm -r tests/run-make/reset-codegen-1
|
rm -r tests/run-make/reset-codegen-1
|
||||||
rm -r tests/run-make/inline-always-many-cgu
|
rm -r tests/run-make/inline-always-many-cgu
|
||||||
rm -r tests/run-make/intrinsic-unreachable
|
rm -r tests/run-make/intrinsic-unreachable
|
||||||
|
rm -r tests/run-make/artifact-incr-cache
|
||||||
|
rm -r tests/run-make/artifact-incr-cache-no-obj
|
||||||
|
rm -r tests/run-make/emit
|
||||||
|
rm -r tests/run-make/llvm-outputs
|
||||||
|
rm -r tests/run-make/panic-impl-transitive
|
||||||
|
rm -r tests/ui/debuginfo/debuginfo-emit-llvm-ir-and-split-debuginfo.rs
|
||||||
|
rm -r tests/ui/statics/issue-91050-1.rs
|
||||||
|
rm -r tests/ui/statics/issue-91050-2.rs
|
||||||
|
|
||||||
# giving different but possibly correct results
|
# giving different but possibly correct results
|
||||||
# =============================================
|
# =============================================
|
||||||
|
|
@ -134,6 +144,7 @@ rm tests/ui/mir/mir_raw_fat_ptr.rs # same
|
||||||
rm tests/ui/consts/issue-33537.rs # same
|
rm tests/ui/consts/issue-33537.rs # same
|
||||||
rm tests/ui/consts/const-mut-refs-crate.rs # same
|
rm tests/ui/consts/const-mut-refs-crate.rs # same
|
||||||
rm tests/ui/abi/large-byval-align.rs # exceeds implementation limit of Cranelift
|
rm tests/ui/abi/large-byval-align.rs # exceeds implementation limit of Cranelift
|
||||||
|
rm -r tests/run-make/short-ice # ICE backtrace begin/end marker mismatch
|
||||||
|
|
||||||
# doesn't work due to the way the rustc test suite is invoked.
|
# doesn't work due to the way the rustc test suite is invoked.
|
||||||
# should work when using ./x.py test the way it is intended
|
# should work when using ./x.py test the way it is intended
|
||||||
|
|
@ -147,20 +158,15 @@ rm -r tests/run-make-cargo/panic-immediate-abort-codegen # same
|
||||||
rm -r tests/run-make/missing-unstable-trait-bound # This disables support for unstable features, but running cg_clif needs some unstable features
|
rm -r tests/run-make/missing-unstable-trait-bound # This disables support for unstable features, but running cg_clif needs some unstable features
|
||||||
rm -r tests/run-make/const-trait-stable-toolchain # same
|
rm -r tests/run-make/const-trait-stable-toolchain # same
|
||||||
rm -r tests/run-make/print-request-help-stable-unstable # same
|
rm -r tests/run-make/print-request-help-stable-unstable # same
|
||||||
|
rm -r tests/run-make/issue-149402-suggest-unresolve # same
|
||||||
rm -r tests/run-make/incr-add-rust-src-component
|
rm -r tests/run-make/incr-add-rust-src-component
|
||||||
rm tests/ui/errors/remap-path-prefix-sysroot.rs # different sysroot source path
|
rm tests/ui/errors/remap-path-prefix-sysroot.rs # different sysroot source path
|
||||||
rm -r tests/run-make/export/extern-opt # something about rustc version mismatches
|
rm -r tests/run-make/export/extern-opt # something about rustc version mismatches
|
||||||
rm -r tests/run-make/export # same
|
rm -r tests/run-make/export # same
|
||||||
rm -r tests/ui/compiletest-self-test/compile-flags-incremental.rs # needs compiletest compiled with panic=unwind
|
rm -r tests/ui/compiletest-self-test/compile-flags-incremental.rs # needs compiletest compiled with panic=unwind
|
||||||
rm tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs # something going wrong with stdlib source remapping
|
rm -r tests/ui/extern/extern-types-field-offset.rs # expects /rustc/<hash> rather than /rustc/FAKE_PREFIX
|
||||||
rm tests/ui/consts/miri_unleashed/drop.rs # same
|
rm -r tests/ui/process/println-with-broken-pipe.rs # same
|
||||||
rm tests/ui/error-emitter/multiline-removal-suggestion.rs # same
|
rm tests/codegen-units/item-collection/opaque-return-impls.rs # extra mono item. possibly due to other configuration
|
||||||
rm tests/ui/lint/lint-const-item-mutation.rs # same
|
|
||||||
rm tests/ui/lint/use-redundant/use-redundant-issue-71450.rs # same
|
|
||||||
rm tests/ui/lint/use-redundant/use-redundant-prelude-rust-2021.rs # same
|
|
||||||
rm tests/ui/specialization/const_trait_impl.rs # same
|
|
||||||
rm tests/ui/thir-print/offset_of.rs # same
|
|
||||||
rm tests/ui/traits/const-traits/const_closure-const_trait_impl-ice-113381.rs # same
|
|
||||||
|
|
||||||
# genuine bugs
|
# genuine bugs
|
||||||
# ============
|
# ============
|
||||||
|
|
@ -170,11 +176,7 @@ rm -r tests/run-make/panic-abort-eh_frame # .eh_frame emitted with panic=abort
|
||||||
# bugs in the test suite
|
# bugs in the test suite
|
||||||
# ======================
|
# ======================
|
||||||
rm tests/ui/process/nofile-limit.rs # TODO some AArch64 linking issue
|
rm tests/ui/process/nofile-limit.rs # TODO some AArch64 linking issue
|
||||||
rm tests/ui/backtrace/synchronized-panic-handler.rs # missing needs-unwind annotation
|
|
||||||
rm tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rs # same
|
|
||||||
rm tests/ui/async-await/async-drop/async-drop-initial.rs # same (rust-lang/rust#140493)
|
|
||||||
rm -r tests/ui/codegen/equal-pointers-unequal # make incorrect assumptions about the location of stack variables
|
rm -r tests/ui/codegen/equal-pointers-unequal # make incorrect assumptions about the location of stack variables
|
||||||
rm -r tests/run-make-cargo/rustdoc-scrape-examples-paths # FIXME(rust-lang/rust#145580) incr comp bug
|
|
||||||
rm -r tests/incremental/extern_static/issue-49153.rs # assumes reference to undefined static gets optimized away
|
rm -r tests/incremental/extern_static/issue-49153.rs # assumes reference to undefined static gets optimized away
|
||||||
|
|
||||||
rm tests/ui/intrinsics/panic-uninitialized-zeroed.rs # really slow with unoptimized libstd
|
rm tests/ui/intrinsics/panic-uninitialized-zeroed.rs # really slow with unoptimized libstd
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,7 @@ pub(crate) fn conv_to_call_conv(
|
||||||
default_call_conv: CallConv,
|
default_call_conv: CallConv,
|
||||||
) -> CallConv {
|
) -> CallConv {
|
||||||
match c {
|
match c {
|
||||||
CanonAbi::Rust | CanonAbi::C => default_call_conv,
|
CanonAbi::Rust | CanonAbi::RustCold | CanonAbi::C => default_call_conv,
|
||||||
CanonAbi::RustCold => CallConv::Cold,
|
|
||||||
|
|
||||||
// Cranelift doesn't currently have anything for this.
|
// Cranelift doesn't currently have anything for this.
|
||||||
CanonAbi::RustPreserveNone => default_call_conv,
|
CanonAbi::RustPreserveNone => default_call_conv,
|
||||||
|
|
|
||||||
|
|
@ -527,7 +527,8 @@ impl<'a> Linker for GccLinker<'a> {
|
||||||
) {
|
) {
|
||||||
match output_kind {
|
match output_kind {
|
||||||
LinkOutputKind::DynamicNoPicExe => {
|
LinkOutputKind::DynamicNoPicExe => {
|
||||||
if !self.is_ld && self.is_gnu {
|
// noop on windows w/ gcc, warning w/ clang
|
||||||
|
if !self.is_ld && self.is_gnu && !self.sess.target.is_like_windows {
|
||||||
self.cc_arg("-no-pie");
|
self.cc_arg("-no-pie");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@ mod adt;
|
||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
use rustc_abi::{FieldIdx, VariantIdx};
|
use rustc_abi::{ExternAbi, FieldIdx, VariantIdx};
|
||||||
use rustc_ast::Mutability;
|
use rustc_ast::Mutability;
|
||||||
use rustc_hir::LangItem;
|
use rustc_hir::LangItem;
|
||||||
use rustc_middle::span_bug;
|
use rustc_middle::span_bug;
|
||||||
use rustc_middle::ty::layout::TyAndLayout;
|
use rustc_middle::ty::layout::TyAndLayout;
|
||||||
use rustc_middle::ty::{self, Const, ScalarInt, Ty};
|
use rustc_middle::ty::{self, Const, FnHeader, FnSigTys, ScalarInt, Ty, TyCtxt};
|
||||||
use rustc_span::{Symbol, sym};
|
use rustc_span::{Symbol, sym};
|
||||||
|
|
||||||
use crate::const_eval::CompileTimeMachine;
|
use crate::const_eval::CompileTimeMachine;
|
||||||
|
|
@ -188,10 +188,21 @@ impl<'tcx> InterpCx<'tcx, CompileTimeMachine<'tcx>> {
|
||||||
self.write_dyn_trait_type_info(dyn_place, *predicates, *region)?;
|
self.write_dyn_trait_type_info(dyn_place, *predicates, *region)?;
|
||||||
variant
|
variant
|
||||||
}
|
}
|
||||||
|
ty::FnPtr(sig, fn_header) => {
|
||||||
|
let (variant, variant_place) =
|
||||||
|
self.downcast(&field_dest, sym::FnPtr)?;
|
||||||
|
let fn_ptr_place =
|
||||||
|
self.project_field(&variant_place, FieldIdx::ZERO)?;
|
||||||
|
|
||||||
|
// FIXME: handle lifetime bounds
|
||||||
|
let sig = sig.skip_binder();
|
||||||
|
|
||||||
|
self.write_fn_ptr_type_info(fn_ptr_place, &sig, fn_header)?;
|
||||||
|
variant
|
||||||
|
}
|
||||||
ty::Foreign(_)
|
ty::Foreign(_)
|
||||||
| ty::Pat(_, _)
|
| ty::Pat(_, _)
|
||||||
| ty::FnDef(..)
|
| ty::FnDef(..)
|
||||||
| ty::FnPtr(..)
|
|
||||||
| ty::UnsafeBinder(..)
|
| ty::UnsafeBinder(..)
|
||||||
| ty::Closure(..)
|
| ty::Closure(..)
|
||||||
| ty::CoroutineClosure(..)
|
| ty::CoroutineClosure(..)
|
||||||
|
|
@ -402,6 +413,65 @@ impl<'tcx> InterpCx<'tcx, CompileTimeMachine<'tcx>> {
|
||||||
interp_ok(())
|
interp_ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn write_fn_ptr_type_info(
|
||||||
|
&mut self,
|
||||||
|
place: impl Writeable<'tcx, CtfeProvenance>,
|
||||||
|
sig: &FnSigTys<TyCtxt<'tcx>>,
|
||||||
|
fn_header: &FnHeader<TyCtxt<'tcx>>,
|
||||||
|
) -> InterpResult<'tcx> {
|
||||||
|
let FnHeader { safety, c_variadic, abi } = fn_header;
|
||||||
|
|
||||||
|
for (field_idx, field) in
|
||||||
|
place.layout().ty.ty_adt_def().unwrap().non_enum_variant().fields.iter_enumerated()
|
||||||
|
{
|
||||||
|
let field_place = self.project_field(&place, field_idx)?;
|
||||||
|
|
||||||
|
match field.name {
|
||||||
|
sym::unsafety => {
|
||||||
|
self.write_scalar(Scalar::from_bool(safety.is_unsafe()), &field_place)?;
|
||||||
|
}
|
||||||
|
sym::abi => match abi {
|
||||||
|
ExternAbi::C { .. } => {
|
||||||
|
let (rust_variant, _rust_place) =
|
||||||
|
self.downcast(&field_place, sym::ExternC)?;
|
||||||
|
self.write_discriminant(rust_variant, &field_place)?;
|
||||||
|
}
|
||||||
|
ExternAbi::Rust => {
|
||||||
|
let (rust_variant, _rust_place) =
|
||||||
|
self.downcast(&field_place, sym::ExternRust)?;
|
||||||
|
self.write_discriminant(rust_variant, &field_place)?;
|
||||||
|
}
|
||||||
|
other_abi => {
|
||||||
|
let (variant, variant_place) = self.downcast(&field_place, sym::Named)?;
|
||||||
|
let str_place = self.allocate_str_dedup(other_abi.as_str())?;
|
||||||
|
let str_ref = self.mplace_to_ref(&str_place)?;
|
||||||
|
let payload = self.project_field(&variant_place, FieldIdx::ZERO)?;
|
||||||
|
self.write_immediate(*str_ref, &payload)?;
|
||||||
|
self.write_discriminant(variant, &field_place)?;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sym::inputs => {
|
||||||
|
let inputs = sig.inputs();
|
||||||
|
self.allocate_fill_and_write_slice_ptr(
|
||||||
|
field_place,
|
||||||
|
inputs.len() as _,
|
||||||
|
|this, i, place| this.write_type_id(inputs[i as usize], &place),
|
||||||
|
)?;
|
||||||
|
}
|
||||||
|
sym::output => {
|
||||||
|
let output = sig.output();
|
||||||
|
self.write_type_id(output, &field_place)?;
|
||||||
|
}
|
||||||
|
sym::variadic => {
|
||||||
|
self.write_scalar(Scalar::from_bool(*c_variadic), &field_place)?;
|
||||||
|
}
|
||||||
|
other => span_bug!(self.tcx.def_span(field.did), "unimplemented field {other}"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interp_ok(())
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn write_pointer_type_info(
|
pub(crate) fn write_pointer_type_info(
|
||||||
&mut self,
|
&mut self,
|
||||||
place: impl Writeable<'tcx, CtfeProvenance>,
|
place: impl Writeable<'tcx, CtfeProvenance>,
|
||||||
|
|
|
||||||
|
|
@ -647,8 +647,9 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValidityVisitor<'rt, 'tcx, M> {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// This is not CTFE, so it's Miri with recursive checking.
|
// This is not CTFE, so it's Miri with recursive checking.
|
||||||
// FIXME: should we also `UnsafeCell` behind shared references? Currently that is not
|
// FIXME: should we skip `UnsafeCell` behind shared references? Currently that is
|
||||||
// needed since validation reads bypass Stacked Borrows and data race checks.
|
// not needed since validation reads bypass Stacked Borrows and data race checks,
|
||||||
|
// but is that really coherent?
|
||||||
}
|
}
|
||||||
let path = &self.path;
|
let path = &self.path;
|
||||||
ref_tracking.track(place, || {
|
ref_tracking.track(place, || {
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@
|
||||||
#![feature(min_specialization)]
|
#![feature(min_specialization)]
|
||||||
#![feature(negative_impls)]
|
#![feature(negative_impls)]
|
||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
|
#![feature(pattern_type_macro)]
|
||||||
|
#![feature(pattern_types)]
|
||||||
#![feature(ptr_alignment_type)]
|
#![feature(ptr_alignment_type)]
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
#![feature(sized_hierarchy)]
|
#![feature(sized_hierarchy)]
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ rustc_index::newtype_index! {
|
||||||
/// integers starting at zero, so a mapping that maps all or most nodes within
|
/// integers starting at zero, so a mapping that maps all or most nodes within
|
||||||
/// an "item-like" to something else can be implemented by a `Vec` instead of a
|
/// an "item-like" to something else can be implemented by a `Vec` instead of a
|
||||||
/// tree or hash map.
|
/// tree or hash map.
|
||||||
#[derive(HashStable_Generic)]
|
#[stable_hash_generic]
|
||||||
#[encodable]
|
#[encodable]
|
||||||
#[orderable]
|
#[orderable]
|
||||||
pub struct ItemLocalId {}
|
pub struct ItemLocalId {}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,17 @@ mod newtype;
|
||||||
/// optimizations. The default max value is 0xFFFF_FF00.
|
/// optimizations. The default max value is 0xFFFF_FF00.
|
||||||
/// - `#[gate_rustc_only]`: makes parts of the generated code nightly-only.
|
/// - `#[gate_rustc_only]`: makes parts of the generated code nightly-only.
|
||||||
#[proc_macro]
|
#[proc_macro]
|
||||||
#[cfg_attr(feature = "nightly", allow_internal_unstable(step_trait, rustc_attrs, trusted_step))]
|
#[cfg_attr(
|
||||||
|
feature = "nightly",
|
||||||
|
allow_internal_unstable(
|
||||||
|
step_trait,
|
||||||
|
rustc_attrs,
|
||||||
|
trusted_step,
|
||||||
|
pattern_types,
|
||||||
|
pattern_type_macro,
|
||||||
|
structural_match,
|
||||||
|
)
|
||||||
|
)]
|
||||||
pub fn newtype_index(input: TokenStream) -> TokenStream {
|
pub fn newtype_index(input: TokenStream) -> TokenStream {
|
||||||
newtype::newtype(input)
|
newtype::newtype(input)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,14 @@ impl Parse for Newtype {
|
||||||
braced!(body in input);
|
braced!(body in input);
|
||||||
|
|
||||||
// Any additional `#[derive]` macro paths to apply
|
// Any additional `#[derive]` macro paths to apply
|
||||||
let mut derive_paths: Vec<Path> = Vec::new();
|
|
||||||
let mut debug_format: Option<Lit> = None;
|
let mut debug_format: Option<Lit> = None;
|
||||||
let mut max = None;
|
let mut max = None;
|
||||||
let mut consts = Vec::new();
|
let mut consts = Vec::new();
|
||||||
let mut encodable = false;
|
let mut encodable = false;
|
||||||
let mut ord = false;
|
let mut ord = false;
|
||||||
|
let mut stable_hash = false;
|
||||||
|
let mut stable_hash_generic = false;
|
||||||
|
let mut stable_hash_no_context = false;
|
||||||
let mut gate_rustc_only = quote! {};
|
let mut gate_rustc_only = quote! {};
|
||||||
let mut gate_rustc_only_cfg = quote! { all() };
|
let mut gate_rustc_only_cfg = quote! { all() };
|
||||||
|
|
||||||
|
|
@ -42,6 +44,18 @@ impl Parse for Newtype {
|
||||||
ord = true;
|
ord = true;
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
"stable_hash" => {
|
||||||
|
stable_hash = true;
|
||||||
|
false
|
||||||
|
}
|
||||||
|
"stable_hash_generic" => {
|
||||||
|
stable_hash_generic = true;
|
||||||
|
false
|
||||||
|
}
|
||||||
|
"stable_hash_no_context" => {
|
||||||
|
stable_hash_no_context = true;
|
||||||
|
false
|
||||||
|
}
|
||||||
"max" => {
|
"max" => {
|
||||||
let Meta::NameValue(MetaNameValue { value: Expr::Lit(lit), .. }) = &attr.meta
|
let Meta::NameValue(MetaNameValue { value: Expr::Lit(lit), .. }) = &attr.meta
|
||||||
else {
|
else {
|
||||||
|
|
@ -111,12 +125,6 @@ impl Parse for Newtype {
|
||||||
} else {
|
} else {
|
||||||
quote! {}
|
quote! {}
|
||||||
};
|
};
|
||||||
|
|
||||||
if ord {
|
|
||||||
derive_paths.push(parse_quote!(Ord));
|
|
||||||
derive_paths.push(parse_quote!(PartialOrd));
|
|
||||||
}
|
|
||||||
|
|
||||||
let step = if ord {
|
let step = if ord {
|
||||||
quote! {
|
quote! {
|
||||||
#gate_rustc_only
|
#gate_rustc_only
|
||||||
|
|
@ -139,6 +147,38 @@ impl Parse for Newtype {
|
||||||
Self::index(start).checked_sub(u).map(Self::from_usize)
|
Self::index(start).checked_sub(u).map(Self::from_usize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl ::std::cmp::Ord for #name {
|
||||||
|
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
|
||||||
|
self.as_u32().cmp(&other.as_u32())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl ::std::cmp::PartialOrd for #name {
|
||||||
|
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
||||||
|
self.as_u32().partial_cmp(&other.as_u32())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
quote! {}
|
||||||
|
};
|
||||||
|
|
||||||
|
let hash_stable = if stable_hash {
|
||||||
|
quote! {
|
||||||
|
#gate_rustc_only
|
||||||
|
impl<'__ctx> ::rustc_data_structures::stable_hasher::HashStable<::rustc_middle::ich::StableHashingContext<'__ctx>> for #name {
|
||||||
|
fn hash_stable(&self, hcx: &mut ::rustc_middle::ich::StableHashingContext<'__ctx>, hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher) {
|
||||||
|
self.as_u32().hash_stable(hcx, hasher)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if stable_hash_generic || stable_hash_no_context {
|
||||||
|
quote! {
|
||||||
|
#gate_rustc_only
|
||||||
|
impl<CTX> ::rustc_data_structures::stable_hasher::HashStable<CTX> for #name {
|
||||||
|
fn hash_stable(&self, hcx: &mut CTX, hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher) {
|
||||||
|
self.as_u32().hash_stable(hcx, hasher)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
quote! {}
|
quote! {}
|
||||||
|
|
@ -154,11 +194,13 @@ impl Parse for Newtype {
|
||||||
|
|
||||||
Ok(Self(quote! {
|
Ok(Self(quote! {
|
||||||
#(#attrs)*
|
#(#attrs)*
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, #(#derive_paths),*)]
|
#[derive(Clone, Copy)]
|
||||||
#[cfg_attr(#gate_rustc_only_cfg, rustc_layout_scalar_valid_range_end(#max))]
|
|
||||||
#[cfg_attr(#gate_rustc_only_cfg, rustc_pass_by_value)]
|
#[cfg_attr(#gate_rustc_only_cfg, rustc_pass_by_value)]
|
||||||
#vis struct #name {
|
#vis struct #name {
|
||||||
|
#[cfg(not(#gate_rustc_only_cfg))]
|
||||||
private_use_as_methods_instead: u32,
|
private_use_as_methods_instead: u32,
|
||||||
|
#[cfg(#gate_rustc_only_cfg)]
|
||||||
|
private_use_as_methods_instead: pattern_type!(u32 is 0..=#max),
|
||||||
}
|
}
|
||||||
|
|
||||||
#(#consts)*
|
#(#consts)*
|
||||||
|
|
@ -226,7 +268,7 @@ impl Parse for Newtype {
|
||||||
/// Prefer using `from_u32`.
|
/// Prefer using `from_u32`.
|
||||||
#[inline]
|
#[inline]
|
||||||
#vis const unsafe fn from_u32_unchecked(value: u32) -> Self {
|
#vis const unsafe fn from_u32_unchecked(value: u32) -> Self {
|
||||||
Self { private_use_as_methods_instead: value }
|
Self { private_use_as_methods_instead: unsafe { std::mem::transmute(value) } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extracts the value of this index as a `usize`.
|
/// Extracts the value of this index as a `usize`.
|
||||||
|
|
@ -238,7 +280,7 @@ impl Parse for Newtype {
|
||||||
/// Extracts the value of this index as a `u32`.
|
/// Extracts the value of this index as a `u32`.
|
||||||
#[inline]
|
#[inline]
|
||||||
#vis const fn as_u32(self) -> u32 {
|
#vis const fn as_u32(self) -> u32 {
|
||||||
self.private_use_as_methods_instead
|
unsafe { std::mem::transmute(self.private_use_as_methods_instead) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extracts the value of this index as a `usize`.
|
/// Extracts the value of this index as a `usize`.
|
||||||
|
|
@ -278,6 +320,8 @@ impl Parse for Newtype {
|
||||||
|
|
||||||
#step
|
#step
|
||||||
|
|
||||||
|
#hash_stable
|
||||||
|
|
||||||
impl From<#name> for u32 {
|
impl From<#name> for u32 {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from(v: #name) -> u32 {
|
fn from(v: #name) -> u32 {
|
||||||
|
|
@ -306,6 +350,23 @@ impl Parse for Newtype {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ::std::cmp::Eq for #name {}
|
||||||
|
|
||||||
|
impl ::std::cmp::PartialEq for #name {
|
||||||
|
fn eq(&self, other: &Self) -> bool {
|
||||||
|
self.as_u32().eq(&other.as_u32())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#gate_rustc_only
|
||||||
|
impl ::std::marker::StructuralPartialEq for #name {}
|
||||||
|
|
||||||
|
impl ::std::hash::Hash for #name {
|
||||||
|
fn hash<H: ::std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.as_u32().hash(state)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#encodable_impls
|
#encodable_impls
|
||||||
#debug_impl
|
#debug_impl
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ use rustc_attr_parsing::{AttributeParser, Early, ShouldEmit};
|
||||||
use rustc_codegen_ssa::traits::CodegenBackend;
|
use rustc_codegen_ssa::traits::CodegenBackend;
|
||||||
use rustc_codegen_ssa::{CodegenResults, CrateInfo};
|
use rustc_codegen_ssa::{CodegenResults, CrateInfo};
|
||||||
use rustc_data_structures::indexmap::IndexMap;
|
use rustc_data_structures::indexmap::IndexMap;
|
||||||
use rustc_data_structures::jobserver::Proxy;
|
|
||||||
use rustc_data_structures::steal::Steal;
|
use rustc_data_structures::steal::Steal;
|
||||||
use rustc_data_structures::sync::{AppendOnlyIndexVec, FreezeLock, WorkerLocal, par_fns};
|
use rustc_data_structures::sync::{AppendOnlyIndexVec, FreezeLock, WorkerLocal, par_fns};
|
||||||
use rustc_data_structures::thousands;
|
use rustc_data_structures::thousands;
|
||||||
|
|
@ -28,7 +27,7 @@ use rustc_lint::{BufferedEarlyLint, EarlyCheckNode, LintStore, unerased_lint_sto
|
||||||
use rustc_metadata::EncodedMetadata;
|
use rustc_metadata::EncodedMetadata;
|
||||||
use rustc_metadata::creader::CStore;
|
use rustc_metadata::creader::CStore;
|
||||||
use rustc_middle::arena::Arena;
|
use rustc_middle::arena::Arena;
|
||||||
use rustc_middle::ty::{self, CurrentGcx, GlobalCtxt, RegisteredTools, TyCtxt};
|
use rustc_middle::ty::{self, RegisteredTools, TyCtxt};
|
||||||
use rustc_middle::util::Providers;
|
use rustc_middle::util::Providers;
|
||||||
use rustc_parse::lexer::StripTokens;
|
use rustc_parse::lexer::StripTokens;
|
||||||
use rustc_parse::{new_parser_from_file, new_parser_from_source_str, unwrap_or_emit_fatal};
|
use rustc_parse::{new_parser_from_file, new_parser_from_source_str, unwrap_or_emit_fatal};
|
||||||
|
|
@ -969,68 +968,45 @@ pub fn create_and_enter_global_ctxt<T, F: for<'tcx> FnOnce(TyCtxt<'tcx>) -> T>(
|
||||||
let arena = WorkerLocal::new(|_| Arena::default());
|
let arena = WorkerLocal::new(|_| Arena::default());
|
||||||
let hir_arena = WorkerLocal::new(|_| rustc_hir::Arena::default());
|
let hir_arena = WorkerLocal::new(|_| rustc_hir::Arena::default());
|
||||||
|
|
||||||
// This closure is necessary to force rustc to perform the correct lifetime
|
TyCtxt::create_global_ctxt(
|
||||||
// subtyping for GlobalCtxt::enter to be allowed.
|
|
||||||
let inner: Box<
|
|
||||||
dyn for<'tcx> FnOnce(
|
|
||||||
&'tcx Session,
|
|
||||||
CurrentGcx,
|
|
||||||
Arc<Proxy>,
|
|
||||||
&'tcx OnceLock<GlobalCtxt<'tcx>>,
|
|
||||||
&'tcx WorkerLocal<Arena<'tcx>>,
|
|
||||||
&'tcx WorkerLocal<rustc_hir::Arena<'tcx>>,
|
|
||||||
F,
|
|
||||||
) -> T,
|
|
||||||
> = Box::new(move |sess, current_gcx, jobserver_proxy, gcx_cell, arena, hir_arena, f| {
|
|
||||||
TyCtxt::create_global_ctxt(
|
|
||||||
gcx_cell,
|
|
||||||
sess,
|
|
||||||
crate_types,
|
|
||||||
stable_crate_id,
|
|
||||||
arena,
|
|
||||||
hir_arena,
|
|
||||||
untracked,
|
|
||||||
dep_graph,
|
|
||||||
rustc_query_impl::make_dep_kind_vtables(arena),
|
|
||||||
rustc_query_impl::query_system(
|
|
||||||
providers.queries,
|
|
||||||
providers.extern_queries,
|
|
||||||
query_result_on_disk_cache,
|
|
||||||
incremental,
|
|
||||||
),
|
|
||||||
providers.hooks,
|
|
||||||
current_gcx,
|
|
||||||
jobserver_proxy,
|
|
||||||
|tcx| {
|
|
||||||
let feed = tcx.create_crate_num(stable_crate_id).unwrap();
|
|
||||||
assert_eq!(feed.key(), LOCAL_CRATE);
|
|
||||||
feed.crate_name(crate_name);
|
|
||||||
|
|
||||||
let feed = tcx.feed_unit_query();
|
|
||||||
feed.features_query(tcx.arena.alloc(rustc_expand::config::features(
|
|
||||||
tcx.sess,
|
|
||||||
&pre_configured_attrs,
|
|
||||||
crate_name,
|
|
||||||
)));
|
|
||||||
feed.crate_for_resolver(tcx.arena.alloc(Steal::new((krate, pre_configured_attrs))));
|
|
||||||
feed.output_filenames(Arc::new(outputs));
|
|
||||||
|
|
||||||
let res = f(tcx);
|
|
||||||
// FIXME maybe run finish even when a fatal error occurred? or at least tcx.alloc_self_profile_query_strings()?
|
|
||||||
tcx.finish();
|
|
||||||
res
|
|
||||||
},
|
|
||||||
)
|
|
||||||
});
|
|
||||||
|
|
||||||
inner(
|
|
||||||
&compiler.sess,
|
|
||||||
compiler.current_gcx.clone(),
|
|
||||||
Arc::clone(&compiler.jobserver_proxy),
|
|
||||||
&gcx_cell,
|
&gcx_cell,
|
||||||
|
&compiler.sess,
|
||||||
|
crate_types,
|
||||||
|
stable_crate_id,
|
||||||
&arena,
|
&arena,
|
||||||
&hir_arena,
|
&hir_arena,
|
||||||
f,
|
untracked,
|
||||||
|
dep_graph,
|
||||||
|
rustc_query_impl::make_dep_kind_vtables(&arena),
|
||||||
|
rustc_query_impl::query_system(
|
||||||
|
providers.queries,
|
||||||
|
providers.extern_queries,
|
||||||
|
query_result_on_disk_cache,
|
||||||
|
incremental,
|
||||||
|
),
|
||||||
|
providers.hooks,
|
||||||
|
compiler.current_gcx.clone(),
|
||||||
|
Arc::clone(&compiler.jobserver_proxy),
|
||||||
|
|tcx| {
|
||||||
|
let feed = tcx.create_crate_num(stable_crate_id).unwrap();
|
||||||
|
assert_eq!(feed.key(), LOCAL_CRATE);
|
||||||
|
feed.crate_name(crate_name);
|
||||||
|
|
||||||
|
let feed = tcx.feed_unit_query();
|
||||||
|
feed.features_query(tcx.arena.alloc(rustc_expand::config::features(
|
||||||
|
tcx.sess,
|
||||||
|
&pre_configured_attrs,
|
||||||
|
crate_name,
|
||||||
|
)));
|
||||||
|
feed.crate_for_resolver(tcx.arena.alloc(Steal::new((krate, pre_configured_attrs))));
|
||||||
|
feed.output_filenames(Arc::new(outputs));
|
||||||
|
|
||||||
|
let res = f(tcx);
|
||||||
|
// FIXME maybe run finish even when a fatal error occurred? or at least
|
||||||
|
// tcx.alloc_self_profile_query_strings()?
|
||||||
|
tcx.finish();
|
||||||
|
res
|
||||||
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ rustc_index::newtype_index! {
|
||||||
///
|
///
|
||||||
/// * The subscope with `first_statement_index == 1` is scope of `c`,
|
/// * The subscope with `first_statement_index == 1` is scope of `c`,
|
||||||
/// and thus does not include EXPR_2, but covers the `...`.
|
/// and thus does not include EXPR_2, but covers the `...`.
|
||||||
#[derive(HashStable)]
|
#[stable_hash]
|
||||||
#[encodable]
|
#[encodable]
|
||||||
#[orderable]
|
#[orderable]
|
||||||
pub struct FirstStatementIndex {}
|
pub struct FirstStatementIndex {}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ use rustc_span::Span;
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
/// Used by [`CoverageKind::BlockMarker`] to mark blocks during THIR-to-MIR
|
/// Used by [`CoverageKind::BlockMarker`] to mark blocks during THIR-to-MIR
|
||||||
/// lowering, so that those blocks can be identified later.
|
/// lowering, so that those blocks can be identified later.
|
||||||
#[derive(HashStable)]
|
#[stable_hash]
|
||||||
#[encodable]
|
#[encodable]
|
||||||
#[debug_format = "BlockMarkerId({})"]
|
#[debug_format = "BlockMarkerId({})"]
|
||||||
pub struct BlockMarkerId {}
|
pub struct BlockMarkerId {}
|
||||||
|
|
@ -26,7 +26,7 @@ rustc_index::newtype_index! {
|
||||||
///
|
///
|
||||||
/// Note that LLVM handles counter IDs as `uint32_t`, so there is no need
|
/// Note that LLVM handles counter IDs as `uint32_t`, so there is no need
|
||||||
/// to use a larger representation on the Rust side.
|
/// to use a larger representation on the Rust side.
|
||||||
#[derive(HashStable)]
|
#[stable_hash]
|
||||||
#[encodable]
|
#[encodable]
|
||||||
#[orderable]
|
#[orderable]
|
||||||
#[debug_format = "CounterId({})"]
|
#[debug_format = "CounterId({})"]
|
||||||
|
|
@ -43,7 +43,7 @@ rustc_index::newtype_index! {
|
||||||
///
|
///
|
||||||
/// Note that LLVM handles expression IDs as `uint32_t`, so there is no need
|
/// Note that LLVM handles expression IDs as `uint32_t`, so there is no need
|
||||||
/// to use a larger representation on the Rust side.
|
/// to use a larger representation on the Rust side.
|
||||||
#[derive(HashStable)]
|
#[stable_hash]
|
||||||
#[encodable]
|
#[encodable]
|
||||||
#[orderable]
|
#[orderable]
|
||||||
#[debug_format = "ExpressionId({})"]
|
#[debug_format = "ExpressionId({})"]
|
||||||
|
|
@ -203,7 +203,7 @@ rustc_index::newtype_index! {
|
||||||
///
|
///
|
||||||
/// After that pass is complete, the coverage graph no longer exists, so a
|
/// After that pass is complete, the coverage graph no longer exists, so a
|
||||||
/// BCB is effectively an opaque ID.
|
/// BCB is effectively an opaque ID.
|
||||||
#[derive(HashStable)]
|
#[stable_hash]
|
||||||
#[encodable]
|
#[encodable]
|
||||||
#[orderable]
|
#[orderable]
|
||||||
#[debug_format = "bcb{}"]
|
#[debug_format = "bcb{}"]
|
||||||
|
|
|
||||||
|
|
@ -840,7 +840,7 @@ impl SourceInfo {
|
||||||
// Variables and temps
|
// Variables and temps
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
#[derive(HashStable)]
|
#[stable_hash]
|
||||||
#[encodable]
|
#[encodable]
|
||||||
#[orderable]
|
#[orderable]
|
||||||
#[debug_format = "_{}"]
|
#[debug_format = "_{}"]
|
||||||
|
|
@ -1283,7 +1283,7 @@ rustc_index::newtype_index! {
|
||||||
/// https://rustc-dev-guide.rust-lang.org/appendix/background.html#what-is-a-dataflow-analysis
|
/// https://rustc-dev-guide.rust-lang.org/appendix/background.html#what-is-a-dataflow-analysis
|
||||||
/// [`CriticalCallEdges`]: ../../rustc_mir_transform/add_call_guards/enum.AddCallGuards.html#variant.CriticalCallEdges
|
/// [`CriticalCallEdges`]: ../../rustc_mir_transform/add_call_guards/enum.AddCallGuards.html#variant.CriticalCallEdges
|
||||||
/// [guide-mir]: https://rustc-dev-guide.rust-lang.org/mir/
|
/// [guide-mir]: https://rustc-dev-guide.rust-lang.org/mir/
|
||||||
#[derive(HashStable)]
|
#[stable_hash]
|
||||||
#[encodable]
|
#[encodable]
|
||||||
#[orderable]
|
#[orderable]
|
||||||
#[debug_format = "bb{}"]
|
#[debug_format = "bb{}"]
|
||||||
|
|
@ -1417,7 +1417,7 @@ impl<'tcx> BasicBlockData<'tcx> {
|
||||||
// Scopes
|
// Scopes
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
#[derive(HashStable)]
|
#[stable_hash]
|
||||||
#[encodable]
|
#[encodable]
|
||||||
#[debug_format = "scope[{}]"]
|
#[debug_format = "scope[{}]"]
|
||||||
pub struct SourceScope {
|
pub struct SourceScope {
|
||||||
|
|
@ -1556,7 +1556,7 @@ pub struct UserTypeProjection {
|
||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
#[derive(HashStable)]
|
#[stable_hash]
|
||||||
#[encodable]
|
#[encodable]
|
||||||
#[orderable]
|
#[orderable]
|
||||||
#[debug_format = "promoted[{}]"]
|
#[debug_format = "promoted[{}]"]
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ use super::{ConstValue, SourceInfo};
|
||||||
use crate::ty::{self, CoroutineArgsExt, Ty};
|
use crate::ty::{self, CoroutineArgsExt, Ty};
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
#[derive(HashStable)]
|
#[stable_hash]
|
||||||
#[encodable]
|
#[encodable]
|
||||||
#[debug_format = "_s{}"]
|
#[debug_format = "_s{}"]
|
||||||
pub struct CoroutineSavedLocal {}
|
pub struct CoroutineSavedLocal {}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ macro_rules! thir_with_elements {
|
||||||
) => {
|
) => {
|
||||||
$(
|
$(
|
||||||
newtype_index! {
|
newtype_index! {
|
||||||
#[derive(HashStable)]
|
#[stable_hash]
|
||||||
#[debug_format = $format]
|
#[debug_format = $format]
|
||||||
pub struct $id {}
|
pub struct $id {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -716,7 +716,7 @@ impl<'a> LocalSetInContextMut<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
#[derive(HashStable)]
|
#[stable_hash]
|
||||||
#[encodable]
|
#[encodable]
|
||||||
#[debug_format = "UserType({})"]
|
#[debug_format = "UserType({})"]
|
||||||
pub struct UserTypeAnnotationIndex {
|
pub struct UserTypeAnnotationIndex {
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ struct TOFinder<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
#[derive(Ord, PartialOrd)]
|
#[orderable]
|
||||||
#[debug_format = "_c{}"]
|
#[debug_format = "_c{}"]
|
||||||
struct ConditionIndex {}
|
struct ConditionIndex {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ impl From<usize> for StaticNodeIdx {
|
||||||
}
|
}
|
||||||
|
|
||||||
newtype_index! {
|
newtype_index! {
|
||||||
#[derive(Ord, PartialOrd)]
|
#[orderable]
|
||||||
struct StaticSccIdx {}
|
struct StaticSccIdx {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -934,7 +934,11 @@ impl<'input> Parser<'input> {
|
||||||
0,
|
0,
|
||||||
ParseError {
|
ParseError {
|
||||||
description: "field access isn't supported".to_string(),
|
description: "field access isn't supported".to_string(),
|
||||||
note: None,
|
note: Some(
|
||||||
|
"consider moving this expression to a local variable and then \
|
||||||
|
using the local here instead"
|
||||||
|
.to_owned(),
|
||||||
|
),
|
||||||
label: "not supported".to_string(),
|
label: "not supported".to_string(),
|
||||||
span: arg.position_span.start..field.position_span.end,
|
span: arg.position_span.start..field.position_span.end,
|
||||||
secondary_label: None,
|
secondary_label: None,
|
||||||
|
|
@ -947,7 +951,11 @@ impl<'input> Parser<'input> {
|
||||||
0,
|
0,
|
||||||
ParseError {
|
ParseError {
|
||||||
description: "tuple index access isn't supported".to_string(),
|
description: "tuple index access isn't supported".to_string(),
|
||||||
note: None,
|
note: Some(
|
||||||
|
"consider moving this expression to a local variable and then \
|
||||||
|
using the local here instead"
|
||||||
|
.to_owned(),
|
||||||
|
),
|
||||||
label: "not supported".to_string(),
|
label: "not supported".to_string(),
|
||||||
span: arg.position_span.start..field.position_span.end,
|
span: arg.position_span.start..field.position_span.end,
|
||||||
secondary_label: None,
|
secondary_label: None,
|
||||||
|
|
|
||||||
|
|
@ -242,6 +242,8 @@ symbols! {
|
||||||
Equal,
|
Equal,
|
||||||
Err,
|
Err,
|
||||||
Error,
|
Error,
|
||||||
|
ExternC,
|
||||||
|
ExternRust,
|
||||||
File,
|
File,
|
||||||
FileType,
|
FileType,
|
||||||
Float,
|
Float,
|
||||||
|
|
@ -250,6 +252,7 @@ symbols! {
|
||||||
Fn,
|
Fn,
|
||||||
FnMut,
|
FnMut,
|
||||||
FnOnce,
|
FnOnce,
|
||||||
|
FnPtr,
|
||||||
Formatter,
|
Formatter,
|
||||||
Forward,
|
Forward,
|
||||||
From,
|
From,
|
||||||
|
|
@ -303,6 +306,7 @@ symbols! {
|
||||||
Mutex,
|
Mutex,
|
||||||
MutexGuard,
|
MutexGuard,
|
||||||
N,
|
N,
|
||||||
|
Named,
|
||||||
NonNull,
|
NonNull,
|
||||||
NonZero,
|
NonZero,
|
||||||
None,
|
None,
|
||||||
|
|
@ -1290,6 +1294,7 @@ symbols! {
|
||||||
inline_const,
|
inline_const,
|
||||||
inline_const_pat,
|
inline_const_pat,
|
||||||
inout,
|
inout,
|
||||||
|
inputs,
|
||||||
instant_now,
|
instant_now,
|
||||||
instruction_set,
|
instruction_set,
|
||||||
integer_: "integer", // underscore to avoid clashing with the function `sym::integer` below
|
integer_: "integer", // underscore to avoid clashing with the function `sym::integer` below
|
||||||
|
|
@ -1660,6 +1665,7 @@ symbols! {
|
||||||
os_string_as_os_str,
|
os_string_as_os_str,
|
||||||
other,
|
other,
|
||||||
out,
|
out,
|
||||||
|
output,
|
||||||
overflow_checks,
|
overflow_checks,
|
||||||
overlapping_marker_traits,
|
overlapping_marker_traits,
|
||||||
owned_box,
|
owned_box,
|
||||||
|
|
@ -2439,6 +2445,7 @@ symbols! {
|
||||||
unsafe_no_drop_flag,
|
unsafe_no_drop_flag,
|
||||||
unsafe_pinned,
|
unsafe_pinned,
|
||||||
unsafe_unpin,
|
unsafe_unpin,
|
||||||
|
unsafety,
|
||||||
unsize,
|
unsize,
|
||||||
unsized_const_param_ty,
|
unsized_const_param_ty,
|
||||||
unsized_const_params,
|
unsized_const_params,
|
||||||
|
|
@ -2483,6 +2490,7 @@ symbols! {
|
||||||
value,
|
value,
|
||||||
values,
|
values,
|
||||||
var,
|
var,
|
||||||
|
variadic,
|
||||||
variant_count,
|
variant_count,
|
||||||
variants,
|
variants,
|
||||||
vec,
|
vec,
|
||||||
|
|
|
||||||
|
|
@ -614,7 +614,7 @@ impl InlineAsmRegClass {
|
||||||
allow_experimental_reg: bool,
|
allow_experimental_reg: bool,
|
||||||
) -> &'static [(InlineAsmType, Option<Symbol>)] {
|
) -> &'static [(InlineAsmType, Option<Symbol>)] {
|
||||||
match self {
|
match self {
|
||||||
Self::X86(r) => r.supported_types(arch),
|
Self::X86(r) => r.supported_types(arch, allow_experimental_reg),
|
||||||
Self::Arm(r) => r.supported_types(arch),
|
Self::Arm(r) => r.supported_types(arch),
|
||||||
Self::AArch64(r) => r.supported_types(arch),
|
Self::AArch64(r) => r.supported_types(arch),
|
||||||
Self::RiscV(r) => r.supported_types(arch),
|
Self::RiscV(r) => r.supported_types(arch),
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,7 @@ impl X86InlineAsmRegClass {
|
||||||
pub fn supported_types(
|
pub fn supported_types(
|
||||||
self,
|
self,
|
||||||
arch: InlineAsmArch,
|
arch: InlineAsmArch,
|
||||||
|
allow_experimental_reg: bool,
|
||||||
) -> &'static [(InlineAsmType, Option<Symbol>)] {
|
) -> &'static [(InlineAsmType, Option<Symbol>)] {
|
||||||
match self {
|
match self {
|
||||||
Self::reg | Self::reg_abcd => {
|
Self::reg | Self::reg_abcd => {
|
||||||
|
|
@ -115,21 +116,52 @@ impl X86InlineAsmRegClass {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Self::reg_byte => types! { _: I8; },
|
Self::reg_byte => types! { _: I8; },
|
||||||
Self::xmm_reg => types! {
|
Self::xmm_reg => {
|
||||||
sse: I32, I64, F16, F32, F64, F128,
|
if allow_experimental_reg {
|
||||||
VecI8(16), VecI16(8), VecI32(4), VecI64(2), VecF16(8), VecF32(4), VecF64(2);
|
types! {
|
||||||
},
|
sse: I32, I64, I128, F16, F32, F64, F128,
|
||||||
Self::ymm_reg => types! {
|
VecI8(16), VecI16(8), VecI32(4), VecI64(2), VecF16(8), VecF32(4), VecF64(2);
|
||||||
avx: I32, I64, F16, F32, F64, F128,
|
}
|
||||||
VecI8(16), VecI16(8), VecI32(4), VecI64(2), VecF16(8), VecF32(4), VecF64(2),
|
} else {
|
||||||
VecI8(32), VecI16(16), VecI32(8), VecI64(4), VecF16(16), VecF32(8), VecF64(4);
|
types! {
|
||||||
},
|
sse: I32, I64, F16, F32, F64, F128,
|
||||||
Self::zmm_reg => types! {
|
VecI8(16), VecI16(8), VecI32(4), VecI64(2), VecF16(8), VecF32(4), VecF64(2);
|
||||||
avx512f: I32, I64, F16, F32, F64, F128,
|
}
|
||||||
VecI8(16), VecI16(8), VecI32(4), VecI64(2), VecF16(8), VecF32(4), VecF64(2),
|
}
|
||||||
VecI8(32), VecI16(16), VecI32(8), VecI64(4), VecF16(16), VecF32(8), VecF64(4),
|
}
|
||||||
VecI8(64), VecI16(32), VecI32(16), VecI64(8), VecF16(32), VecF32(16), VecF64(8);
|
Self::ymm_reg => {
|
||||||
},
|
if allow_experimental_reg {
|
||||||
|
types! {
|
||||||
|
avx: I32, I64, I128, F16, F32, F64, F128,
|
||||||
|
VecI8(16), VecI16(8), VecI32(4), VecI64(2), VecF16(8), VecF32(4), VecF64(2),
|
||||||
|
VecI8(32), VecI16(16), VecI32(8), VecI64(4), VecF16(16), VecF32(8), VecF64(4);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
types! {
|
||||||
|
avx: I32, I64, F16, F32, F64, F128,
|
||||||
|
VecI8(16), VecI16(8), VecI32(4), VecI64(2), VecF16(8), VecF32(4), VecF64(2),
|
||||||
|
VecI8(32), VecI16(16), VecI32(8), VecI64(4), VecF16(16), VecF32(8), VecF64(4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Self::zmm_reg => {
|
||||||
|
if allow_experimental_reg {
|
||||||
|
types! {
|
||||||
|
avx512f: I32, I64, I128, F16, F32, F64, F128,
|
||||||
|
VecI8(16), VecI16(8), VecI32(4), VecI64(2), VecF16(8), VecF32(4), VecF64(2),
|
||||||
|
VecI8(32), VecI16(16), VecI32(8), VecI64(4), VecF16(16), VecF32(8), VecF64(4),
|
||||||
|
VecI8(64), VecI16(32), VecI32(16), VecI64(8), VecF16(32), VecF32(16), VecF64(8);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
types! {
|
||||||
|
avx512f: I32, I64, F16, F32, F64, F128,
|
||||||
|
VecI8(16), VecI16(8), VecI32(4), VecI64(2), VecF16(8), VecF32(4), VecF64(2),
|
||||||
|
VecI8(32), VecI16(16), VecI32(8), VecI64(4), VecF16(16), VecF32(8), VecF64(4),
|
||||||
|
VecI8(64), VecI16(32), VecI32(16), VecI64(8), VecF16(32), VecF32(16), VecF64(8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Self::kreg => types! {
|
Self::kreg => types! {
|
||||||
avx512f: I8, I16;
|
avx512f: I8, I16;
|
||||||
avx512bw: I32, I64;
|
avx512bw: I32, I64;
|
||||||
|
|
|
||||||
|
|
@ -299,6 +299,12 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
||||||
let trait_def_id = alias.trait_def_id(tcx);
|
let trait_def_id = alias.trait_def_id(tcx);
|
||||||
let rebased_args = alias.args.rebase_onto(tcx, trait_def_id, impl_substs);
|
let rebased_args = alias.args.rebase_onto(tcx, trait_def_id, impl_substs);
|
||||||
|
|
||||||
|
// The impl is erroneous missing a definition for the associated type.
|
||||||
|
// Skipping it since calling `TyCtxt::type_of` on its assoc ty will trigger an ICE.
|
||||||
|
if !leaf_def.item.defaultness(tcx).has_value() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
let impl_item_def_id = leaf_def.item.def_id;
|
let impl_item_def_id = leaf_def.item.def_id;
|
||||||
if !tcx.check_args_compatible(impl_item_def_id, rebased_args) {
|
if !tcx.check_args_compatible(impl_item_def_id, rebased_args) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -254,9 +254,16 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
||||||
LangItem::TransmuteTrait,
|
LangItem::TransmuteTrait,
|
||||||
) {
|
) {
|
||||||
// Recompute the safe transmute reason and use that for the error reporting
|
// Recompute the safe transmute reason and use that for the error reporting
|
||||||
|
let (report_obligation, report_pred) =
|
||||||
|
self.select_transmute_obligation_for_reporting(
|
||||||
|
&obligation,
|
||||||
|
main_trait_predicate,
|
||||||
|
root_obligation,
|
||||||
|
);
|
||||||
|
|
||||||
match self.get_safe_transmute_error_and_reason(
|
match self.get_safe_transmute_error_and_reason(
|
||||||
obligation.clone(),
|
report_obligation,
|
||||||
main_trait_predicate,
|
report_pred,
|
||||||
span,
|
span,
|
||||||
) {
|
) {
|
||||||
GetSafeTransmuteErrorAndReason::Silent => {
|
GetSafeTransmuteErrorAndReason::Silent => {
|
||||||
|
|
@ -2825,6 +2832,51 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn select_transmute_obligation_for_reporting(
|
||||||
|
&self,
|
||||||
|
obligation: &PredicateObligation<'tcx>,
|
||||||
|
trait_predicate: ty::PolyTraitPredicate<'tcx>,
|
||||||
|
root_obligation: &PredicateObligation<'tcx>,
|
||||||
|
) -> (PredicateObligation<'tcx>, ty::PolyTraitPredicate<'tcx>) {
|
||||||
|
let ocx = ObligationCtxt::new(self);
|
||||||
|
let normalized_predicate = self.tcx.erase_and_anonymize_regions(
|
||||||
|
self.tcx.instantiate_bound_regions_with_erased(trait_predicate),
|
||||||
|
);
|
||||||
|
let trait_ref = normalized_predicate.trait_ref;
|
||||||
|
|
||||||
|
let Ok(assume) = ocx.structurally_normalize_const(
|
||||||
|
&obligation.cause,
|
||||||
|
obligation.param_env,
|
||||||
|
trait_ref.args.const_at(2),
|
||||||
|
) else {
|
||||||
|
return (obligation.clone(), trait_predicate);
|
||||||
|
};
|
||||||
|
|
||||||
|
let Some(assume) = rustc_transmute::Assume::from_const(self.tcx, assume) else {
|
||||||
|
return (obligation.clone(), trait_predicate);
|
||||||
|
};
|
||||||
|
|
||||||
|
let is_normalized_yes = matches!(
|
||||||
|
rustc_transmute::TransmuteTypeEnv::new(self.tcx).is_transmutable(
|
||||||
|
trait_ref.args.type_at(1),
|
||||||
|
trait_ref.args.type_at(0),
|
||||||
|
assume,
|
||||||
|
),
|
||||||
|
rustc_transmute::Answer::Yes,
|
||||||
|
);
|
||||||
|
|
||||||
|
// If the normalized check unexpectedly passes, fall back to root obligation for reporting.
|
||||||
|
if is_normalized_yes
|
||||||
|
&& let ty::PredicateKind::Clause(ty::ClauseKind::Trait(root_pred)) =
|
||||||
|
root_obligation.predicate.kind().skip_binder()
|
||||||
|
&& root_pred.def_id() == trait_predicate.def_id()
|
||||||
|
{
|
||||||
|
return (root_obligation.clone(), root_obligation.predicate.kind().rebind(root_pred));
|
||||||
|
}
|
||||||
|
|
||||||
|
(obligation.clone(), trait_predicate)
|
||||||
|
}
|
||||||
|
|
||||||
fn get_safe_transmute_error_and_reason(
|
fn get_safe_transmute_error_and_reason(
|
||||||
&self,
|
&self,
|
||||||
obligation: PredicateObligation<'tcx>,
|
obligation: PredicateObligation<'tcx>,
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ rustc_index::newtype_index! {
|
||||||
/// is the outer fn.
|
/// is the outer fn.
|
||||||
///
|
///
|
||||||
/// [dbi]: https://en.wikipedia.org/wiki/De_Bruijn_index
|
/// [dbi]: https://en.wikipedia.org/wiki/De_Bruijn_index
|
||||||
#[cfg_attr(feature = "nightly", derive(HashStable_NoContext))]
|
#[stable_hash_no_context]
|
||||||
#[encodable]
|
#[encodable]
|
||||||
#[orderable]
|
#[orderable]
|
||||||
#[debug_format = "DebruijnIndex({})"]
|
#[debug_format = "DebruijnIndex({})"]
|
||||||
|
|
@ -332,7 +332,7 @@ rustc_index::newtype_index! {
|
||||||
/// declared, but a type name in a non-zero universe is a placeholder
|
/// declared, but a type name in a non-zero universe is a placeholder
|
||||||
/// type -- an idealized representative of "types in general" that we
|
/// type -- an idealized representative of "types in general" that we
|
||||||
/// use for checking generic functions.
|
/// use for checking generic functions.
|
||||||
#[cfg_attr(feature = "nightly", derive(HashStable_NoContext))]
|
#[stable_hash_no_context]
|
||||||
#[encodable]
|
#[encodable]
|
||||||
#[orderable]
|
#[orderable]
|
||||||
#[debug_format = "U{}"]
|
#[debug_format = "U{}"]
|
||||||
|
|
@ -387,7 +387,7 @@ impl Default for UniverseIndex {
|
||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
#[cfg_attr(feature = "nightly", derive(HashStable_NoContext))]
|
#[stable_hash_generic]
|
||||||
#[encodable]
|
#[encodable]
|
||||||
#[orderable]
|
#[orderable]
|
||||||
#[debug_format = "{}"]
|
#[debug_format = "{}"]
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use derive_where::derive_where;
|
||||||
#[cfg(feature = "nightly")]
|
#[cfg(feature = "nightly")]
|
||||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||||
#[cfg(feature = "nightly")]
|
#[cfg(feature = "nightly")]
|
||||||
use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable_NoContext};
|
use rustc_macros::{Decodable_NoContext, Encodable_NoContext};
|
||||||
use rustc_type_ir_macros::GenericTypeVisitable;
|
use rustc_type_ir_macros::GenericTypeVisitable;
|
||||||
|
|
||||||
use self::RegionKind::*;
|
use self::RegionKind::*;
|
||||||
|
|
@ -16,7 +16,7 @@ rustc_index::newtype_index! {
|
||||||
#[orderable]
|
#[orderable]
|
||||||
#[debug_format = "'?{}"]
|
#[debug_format = "'?{}"]
|
||||||
#[gate_rustc_only]
|
#[gate_rustc_only]
|
||||||
#[cfg_attr(feature = "nightly", derive(HashStable_NoContext))]
|
#[stable_hash_no_context]
|
||||||
pub struct RegionVid {}
|
pub struct RegionVid {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -445,7 +445,7 @@ macro_rules! matches {
|
||||||
/// [raw-identifier syntax][ris]: `r#try`.
|
/// [raw-identifier syntax][ris]: `r#try`.
|
||||||
///
|
///
|
||||||
/// [propagating-errors]: https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-the--operator
|
/// [propagating-errors]: https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-the--operator
|
||||||
/// [ris]: https://doc.rust-lang.org/nightly/rust-by-example/compatibility/raw_identifiers.html
|
/// [ris]: ../rust-by-example/compatibility/raw_identifiers.html
|
||||||
///
|
///
|
||||||
/// `try!` matches the given [`Result`]. In case of the `Ok` variant, the
|
/// `try!` matches the given [`Result`]. In case of the `Ok` variant, the
|
||||||
/// expression has the value of the wrapped value.
|
/// expression has the value of the wrapped value.
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,8 @@ pub enum TypeKind {
|
||||||
Reference(Reference),
|
Reference(Reference),
|
||||||
/// Pointers.
|
/// Pointers.
|
||||||
Pointer(Pointer),
|
Pointer(Pointer),
|
||||||
|
/// Function pointers.
|
||||||
|
FnPtr(FnPtr),
|
||||||
/// FIXME(#146922): add all the common types
|
/// FIXME(#146922): add all the common types
|
||||||
Other,
|
Other,
|
||||||
}
|
}
|
||||||
|
|
@ -305,3 +307,39 @@ pub struct Pointer {
|
||||||
/// Whether this pointer is mutable or not.
|
/// Whether this pointer is mutable or not.
|
||||||
pub mutable: bool,
|
pub mutable: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
#[unstable(feature = "type_info", issue = "146922")]
|
||||||
|
/// Function pointer, e.g. fn(u8),
|
||||||
|
pub struct FnPtr {
|
||||||
|
/// Unsafety, true is unsafe
|
||||||
|
pub unsafety: bool,
|
||||||
|
|
||||||
|
/// Abi, e.g. extern "C"
|
||||||
|
pub abi: Abi,
|
||||||
|
|
||||||
|
/// Function inputs
|
||||||
|
pub inputs: &'static [TypeId],
|
||||||
|
|
||||||
|
/// Function return type, default is TypeId::of::<()>
|
||||||
|
pub output: TypeId,
|
||||||
|
|
||||||
|
/// Vardiadic function, e.g. extern "C" fn add(n: usize, mut args: ...);
|
||||||
|
pub variadic: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Default)]
|
||||||
|
#[non_exhaustive]
|
||||||
|
#[unstable(feature = "type_info", issue = "146922")]
|
||||||
|
/// Abi of [FnPtr]
|
||||||
|
pub enum Abi {
|
||||||
|
/// Named abi, e.g. extern "custom", "stdcall" etc.
|
||||||
|
Named(&'static str),
|
||||||
|
|
||||||
|
/// Default
|
||||||
|
#[default]
|
||||||
|
ExternRust,
|
||||||
|
|
||||||
|
/// C-calling convention
|
||||||
|
ExternC,
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
mod fn_ptr;
|
||||||
mod type_info;
|
mod type_info;
|
||||||
|
|
||||||
use core::mem::*;
|
use core::mem::*;
|
||||||
|
|
|
||||||
169
library/coretests/tests/mem/fn_ptr.rs
Normal file
169
library/coretests/tests/mem/fn_ptr.rs
Normal file
|
|
@ -0,0 +1,169 @@
|
||||||
|
use std::any::TypeId;
|
||||||
|
use std::mem::type_info::{Abi, FnPtr, Type, TypeKind};
|
||||||
|
|
||||||
|
const STRING_TY: TypeId = const { TypeId::of::<String>() };
|
||||||
|
const U8_TY: TypeId = const { TypeId::of::<u8>() };
|
||||||
|
const _U8_REF_TY: TypeId = const { TypeId::of::<&u8>() };
|
||||||
|
const UNIT_TY: TypeId = const { TypeId::of::<()>() };
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_fn_ptrs() {
|
||||||
|
let TypeKind::FnPtr(FnPtr {
|
||||||
|
unsafety: false,
|
||||||
|
abi: Abi::ExternRust,
|
||||||
|
inputs: &[],
|
||||||
|
output,
|
||||||
|
variadic: false,
|
||||||
|
}) = (const { Type::of::<fn()>().kind })
|
||||||
|
else {
|
||||||
|
panic!();
|
||||||
|
};
|
||||||
|
assert_eq!(output, UNIT_TY);
|
||||||
|
}
|
||||||
|
#[test]
|
||||||
|
fn test_ref() {
|
||||||
|
const {
|
||||||
|
// references are tricky because the lifetimes give the references different type ids
|
||||||
|
// so we check the pointees instead
|
||||||
|
let TypeKind::FnPtr(FnPtr {
|
||||||
|
unsafety: false,
|
||||||
|
abi: Abi::ExternRust,
|
||||||
|
inputs: &[ty1, ty2],
|
||||||
|
output,
|
||||||
|
variadic: false,
|
||||||
|
}) = (const { Type::of::<fn(&u8, &u8)>().kind })
|
||||||
|
else {
|
||||||
|
panic!();
|
||||||
|
};
|
||||||
|
if output != UNIT_TY {
|
||||||
|
panic!();
|
||||||
|
}
|
||||||
|
let TypeKind::Reference(reference) = ty1.info().kind else {
|
||||||
|
panic!();
|
||||||
|
};
|
||||||
|
if reference.pointee != U8_TY {
|
||||||
|
panic!();
|
||||||
|
}
|
||||||
|
let TypeKind::Reference(reference) = ty2.info().kind else {
|
||||||
|
panic!();
|
||||||
|
};
|
||||||
|
if reference.pointee != U8_TY {
|
||||||
|
panic!();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_unsafe() {
|
||||||
|
let TypeKind::FnPtr(FnPtr {
|
||||||
|
unsafety: true,
|
||||||
|
abi: Abi::ExternRust,
|
||||||
|
inputs: &[],
|
||||||
|
output,
|
||||||
|
variadic: false,
|
||||||
|
}) = (const { Type::of::<unsafe fn()>().kind })
|
||||||
|
else {
|
||||||
|
panic!();
|
||||||
|
};
|
||||||
|
assert_eq!(output, UNIT_TY);
|
||||||
|
}
|
||||||
|
#[test]
|
||||||
|
fn test_abi() {
|
||||||
|
let TypeKind::FnPtr(FnPtr {
|
||||||
|
unsafety: false,
|
||||||
|
abi: Abi::ExternRust,
|
||||||
|
inputs: &[],
|
||||||
|
output,
|
||||||
|
variadic: false,
|
||||||
|
}) = (const { Type::of::<extern "Rust" fn()>().kind })
|
||||||
|
else {
|
||||||
|
panic!();
|
||||||
|
};
|
||||||
|
assert_eq!(output, UNIT_TY);
|
||||||
|
|
||||||
|
let TypeKind::FnPtr(FnPtr {
|
||||||
|
unsafety: false,
|
||||||
|
abi: Abi::ExternC,
|
||||||
|
inputs: &[],
|
||||||
|
output,
|
||||||
|
variadic: false,
|
||||||
|
}) = (const { Type::of::<extern "C" fn()>().kind })
|
||||||
|
else {
|
||||||
|
panic!();
|
||||||
|
};
|
||||||
|
assert_eq!(output, UNIT_TY);
|
||||||
|
|
||||||
|
let TypeKind::FnPtr(FnPtr {
|
||||||
|
unsafety: true,
|
||||||
|
abi: Abi::Named("system"),
|
||||||
|
inputs: &[],
|
||||||
|
output,
|
||||||
|
variadic: false,
|
||||||
|
}) = (const { Type::of::<unsafe extern "system" fn()>().kind })
|
||||||
|
else {
|
||||||
|
panic!();
|
||||||
|
};
|
||||||
|
assert_eq!(output, UNIT_TY);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_inputs() {
|
||||||
|
let TypeKind::FnPtr(FnPtr {
|
||||||
|
unsafety: false,
|
||||||
|
abi: Abi::ExternRust,
|
||||||
|
inputs: &[ty1, ty2],
|
||||||
|
output,
|
||||||
|
variadic: false,
|
||||||
|
}) = (const { Type::of::<fn(String, u8)>().kind })
|
||||||
|
else {
|
||||||
|
panic!();
|
||||||
|
};
|
||||||
|
assert_eq!(output, UNIT_TY);
|
||||||
|
assert_eq!(ty1, STRING_TY);
|
||||||
|
assert_eq!(ty2, U8_TY);
|
||||||
|
|
||||||
|
let TypeKind::FnPtr(FnPtr {
|
||||||
|
unsafety: false,
|
||||||
|
abi: Abi::ExternRust,
|
||||||
|
inputs: &[ty1, ty2],
|
||||||
|
output,
|
||||||
|
variadic: false,
|
||||||
|
}) = (const { Type::of::<fn(val: String, p2: u8)>().kind })
|
||||||
|
else {
|
||||||
|
panic!();
|
||||||
|
};
|
||||||
|
assert_eq!(output, UNIT_TY);
|
||||||
|
assert_eq!(ty1, STRING_TY);
|
||||||
|
assert_eq!(ty2, U8_TY);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_output() {
|
||||||
|
let TypeKind::FnPtr(FnPtr {
|
||||||
|
unsafety: false,
|
||||||
|
abi: Abi::ExternRust,
|
||||||
|
inputs: &[],
|
||||||
|
output,
|
||||||
|
variadic: false,
|
||||||
|
}) = (const { Type::of::<fn() -> u8>().kind })
|
||||||
|
else {
|
||||||
|
panic!();
|
||||||
|
};
|
||||||
|
assert_eq!(output, U8_TY);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_variadic() {
|
||||||
|
let TypeKind::FnPtr(FnPtr {
|
||||||
|
unsafety: false,
|
||||||
|
abi: Abi::ExternC,
|
||||||
|
inputs: [ty1],
|
||||||
|
output,
|
||||||
|
variadic: true,
|
||||||
|
}) = &(const { Type::of::<extern "C" fn(u8, ...)>().kind })
|
||||||
|
else {
|
||||||
|
panic!();
|
||||||
|
};
|
||||||
|
assert_eq!(output, &UNIT_TY);
|
||||||
|
assert_eq!(*ty1, U8_TY);
|
||||||
|
}
|
||||||
|
|
@ -71,7 +71,7 @@ fn main() {
|
||||||
|
|
||||||
// check_version warnings are not printed during setup, or during CI
|
// check_version warnings are not printed during setup, or during CI
|
||||||
let changelog_suggestion = if matches!(config.cmd, Subcommand::Setup { .. })
|
let changelog_suggestion = if matches!(config.cmd, Subcommand::Setup { .. })
|
||||||
|| config.is_running_on_ci
|
|| config.is_running_on_ci()
|
||||||
|| config.dry_run()
|
|| config.dry_run()
|
||||||
{
|
{
|
||||||
None
|
None
|
||||||
|
|
|
||||||
|
|
@ -3084,7 +3084,7 @@ impl Step for Gcc {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
if builder.config.is_running_on_ci {
|
if builder.config.is_running_on_ci() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
builder.config.gcc_ci_mode,
|
builder.config.gcc_ci_mode,
|
||||||
GccCiMode::BuildLocally,
|
GccCiMode::BuildLocally,
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ fn update_rustfmt_version(build: &Builder<'_>) {
|
||||||
fn get_modified_rs_files(build: &Builder<'_>) -> Result<Option<Vec<String>>, String> {
|
fn get_modified_rs_files(build: &Builder<'_>) -> Result<Option<Vec<String>>, String> {
|
||||||
// In CI `get_git_modified_files` returns something different to normal environment.
|
// In CI `get_git_modified_files` returns something different to normal environment.
|
||||||
// This shouldn't be called in CI anyway.
|
// This shouldn't be called in CI anyway.
|
||||||
assert!(!build.config.is_running_on_ci);
|
assert!(!build.config.is_running_on_ci());
|
||||||
|
|
||||||
if !verify_rustfmt_version(build) {
|
if !verify_rustfmt_version(build) {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
|
|
@ -142,7 +142,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
|
||||||
// `--all` is specified or we are in CI. We check all files in CI to avoid bugs in
|
// `--all` is specified or we are in CI. We check all files in CI to avoid bugs in
|
||||||
// `get_modified_rs_files` letting regressions slip through; we also care about CI time less
|
// `get_modified_rs_files` letting regressions slip through; we also care about CI time less
|
||||||
// since this is still very fast compared to building the compiler.
|
// since this is still very fast compared to building the compiler.
|
||||||
let all = all || build.config.is_running_on_ci;
|
let all = all || build.config.is_running_on_ci();
|
||||||
|
|
||||||
let mut builder = ignore::types::TypesBuilder::new();
|
let mut builder = ignore::types::TypesBuilder::new();
|
||||||
builder.add_defaults();
|
builder.add_defaults();
|
||||||
|
|
|
||||||
|
|
@ -3500,7 +3500,7 @@ impl Step for BootstrapPy {
|
||||||
// Bootstrap tests might not be perfectly self-contained and can depend
|
// Bootstrap tests might not be perfectly self-contained and can depend
|
||||||
// on the environment, so only run them by default in CI, not locally.
|
// on the environment, so only run them by default in CI, not locally.
|
||||||
// See `test::Bootstrap::should_run`.
|
// See `test::Bootstrap::should_run`.
|
||||||
builder.config.is_running_on_ci
|
builder.config.is_running_on_ci()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_run(run: RunConfig<'_>) {
|
fn make_run(run: RunConfig<'_>) {
|
||||||
|
|
@ -3539,7 +3539,7 @@ impl Step for Bootstrap {
|
||||||
// Bootstrap tests might not be perfectly self-contained and can depend on the external
|
// Bootstrap tests might not be perfectly self-contained and can depend on the external
|
||||||
// environment, submodules that are checked out, etc.
|
// environment, submodules that are checked out, etc.
|
||||||
// Therefore we only run them by default on CI.
|
// Therefore we only run them by default on CI.
|
||||||
builder.config.is_running_on_ci
|
builder.config.is_running_on_ci()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Tests the build system itself.
|
/// Tests the build system itself.
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@ use std::env;
|
||||||
use std::ffi::{OsStr, OsString};
|
use std::ffi::{OsStr, OsString};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use build_helper::ci::CiEnv;
|
|
||||||
|
|
||||||
use super::{Builder, Kind};
|
use super::{Builder, Kind};
|
||||||
use crate::core::build_steps::test;
|
use crate::core::build_steps::test;
|
||||||
use crate::core::build_steps::tool::SourceType;
|
use crate::core::build_steps::tool::SourceType;
|
||||||
|
|
@ -1330,7 +1328,7 @@ impl Builder<'_> {
|
||||||
// Try to use a sysroot-relative bindir, in case it was configured absolutely.
|
// Try to use a sysroot-relative bindir, in case it was configured absolutely.
|
||||||
cargo.env("RUSTC_INSTALL_BINDIR", self.config.bindir_relative());
|
cargo.env("RUSTC_INSTALL_BINDIR", self.config.bindir_relative());
|
||||||
|
|
||||||
if CiEnv::is_ci() {
|
if self.config.is_running_on_ci() {
|
||||||
// Tell cargo to use colored output for nicer logs in CI, even
|
// Tell cargo to use colored output for nicer logs in CI, even
|
||||||
// though CI isn't printing to a terminal.
|
// though CI isn't printing to a terminal.
|
||||||
// Also set an explicit `TERM=xterm` so that cargo doesn't warn
|
// Also set an explicit `TERM=xterm` so that cargo doesn't warn
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ pub const RUSTC_IF_UNCHANGED_ALLOWED_PATHS: &[&str] = &[
|
||||||
/// filled out from the decoded forms of the structs below. For documentation
|
/// filled out from the decoded forms of the structs below. For documentation
|
||||||
/// on each field, see the corresponding fields in
|
/// on each field, see the corresponding fields in
|
||||||
/// `bootstrap.example.toml`.
|
/// `bootstrap.example.toml`.
|
||||||
#[derive(Default, Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub change_id: Option<ChangeId>,
|
pub change_id: Option<ChangeId>,
|
||||||
pub bypass_bootstrap_lock: bool,
|
pub bypass_bootstrap_lock: bool,
|
||||||
|
|
@ -318,7 +318,7 @@ pub struct Config {
|
||||||
|
|
||||||
/// Default value for `--extra-checks`
|
/// Default value for `--extra-checks`
|
||||||
pub tidy_extra_checks: Option<String>,
|
pub tidy_extra_checks: Option<String>,
|
||||||
pub is_running_on_ci: bool,
|
pub ci_env: CiEnv,
|
||||||
|
|
||||||
/// Cache for determining path modifications
|
/// Cache for determining path modifications
|
||||||
pub path_modification_cache: Arc<Mutex<HashMap<Vec<&'static str>, PathFreshness>>>,
|
pub path_modification_cache: Arc<Mutex<HashMap<Vec<&'static str>, PathFreshness>>>,
|
||||||
|
|
@ -728,7 +728,11 @@ impl Config {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let is_running_on_ci = flags_ci.unwrap_or(CiEnv::is_ci());
|
let ci_env = match flags_ci {
|
||||||
|
Some(true) => CiEnv::GitHubActions,
|
||||||
|
Some(false) => CiEnv::None,
|
||||||
|
None => CiEnv::current(),
|
||||||
|
};
|
||||||
let dwn_ctx = DownloadContext {
|
let dwn_ctx = DownloadContext {
|
||||||
path_modification_cache: path_modification_cache.clone(),
|
path_modification_cache: path_modification_cache.clone(),
|
||||||
src: &src,
|
src: &src,
|
||||||
|
|
@ -739,7 +743,7 @@ impl Config {
|
||||||
stage0_metadata: &stage0_metadata,
|
stage0_metadata: &stage0_metadata,
|
||||||
llvm_assertions,
|
llvm_assertions,
|
||||||
bootstrap_cache_path: &build_bootstrap_cache_path,
|
bootstrap_cache_path: &build_bootstrap_cache_path,
|
||||||
is_running_on_ci,
|
ci_env,
|
||||||
};
|
};
|
||||||
|
|
||||||
let initial_rustc = build_rustc.unwrap_or_else(|| {
|
let initial_rustc = build_rustc.unwrap_or_else(|| {
|
||||||
|
|
@ -1168,7 +1172,7 @@ impl Config {
|
||||||
|
|
||||||
// CI should always run stage 2 builds, unless it specifically states otherwise
|
// CI should always run stage 2 builds, unless it specifically states otherwise
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
if flags_stage.is_none() && is_running_on_ci {
|
if flags_stage.is_none() && ci_env.is_running_in_ci() {
|
||||||
match flags_cmd {
|
match flags_cmd {
|
||||||
Subcommand::Test { .. }
|
Subcommand::Test { .. }
|
||||||
| Subcommand::Miri { .. }
|
| Subcommand::Miri { .. }
|
||||||
|
|
@ -1295,6 +1299,7 @@ impl Config {
|
||||||
ccache,
|
ccache,
|
||||||
change_id: toml.change_id.inner,
|
change_id: toml.change_id.inner,
|
||||||
channel,
|
channel,
|
||||||
|
ci_env,
|
||||||
clippy_info,
|
clippy_info,
|
||||||
cmd: flags_cmd,
|
cmd: flags_cmd,
|
||||||
codegen_tests: rust_codegen_tests.unwrap_or(true),
|
codegen_tests: rust_codegen_tests.unwrap_or(true),
|
||||||
|
|
@ -1345,7 +1350,6 @@ impl Config {
|
||||||
initial_rustc,
|
initial_rustc,
|
||||||
initial_rustfmt,
|
initial_rustfmt,
|
||||||
initial_sysroot,
|
initial_sysroot,
|
||||||
is_running_on_ci,
|
|
||||||
jemalloc: rust_jemalloc.unwrap_or(false),
|
jemalloc: rust_jemalloc.unwrap_or(false),
|
||||||
jobs: Some(threads_from_config(flags_jobs.or(build_jobs).unwrap_or(0))),
|
jobs: Some(threads_from_config(flags_jobs.or(build_jobs).unwrap_or(0))),
|
||||||
json_output: flags_json_output,
|
json_output: flags_json_output,
|
||||||
|
|
@ -1500,6 +1504,10 @@ impl Config {
|
||||||
self.exec_ctx.dry_run()
|
self.exec_ctx.dry_run()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_running_on_ci(&self) -> bool {
|
||||||
|
self.ci_env.is_running_in_ci()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn is_explicit_stage(&self) -> bool {
|
pub fn is_explicit_stage(&self) -> bool {
|
||||||
self.explicit_stage_from_cli || self.explicit_stage_from_config
|
self.explicit_stage_from_cli || self.explicit_stage_from_config
|
||||||
}
|
}
|
||||||
|
|
@ -1666,7 +1674,7 @@ impl Config {
|
||||||
if !self.llvm_from_ci {
|
if !self.llvm_from_ci {
|
||||||
// This happens when LLVM submodule is updated in CI, we should disable ci-rustc without an error
|
// This happens when LLVM submodule is updated in CI, we should disable ci-rustc without an error
|
||||||
// to not break CI. For non-CI environments, we should return an error.
|
// to not break CI. For non-CI environments, we should return an error.
|
||||||
if self.is_running_on_ci {
|
if self.is_running_on_ci() {
|
||||||
println!("WARNING: LLVM submodule has changes, `download-rustc` will be disabled.");
|
println!("WARNING: LLVM submodule has changes, `download-rustc` will be disabled.");
|
||||||
return None;
|
return None;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1788,8 +1796,7 @@ impl Config {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.entry(paths.to_vec())
|
.entry(paths.to_vec())
|
||||||
.or_insert_with(|| {
|
.or_insert_with(|| {
|
||||||
check_path_modifications(&self.src, &self.git_config(), paths, CiEnv::current())
|
check_path_modifications(&self.src, &self.git_config(), paths, self.ci_env).unwrap()
|
||||||
.unwrap()
|
|
||||||
})
|
})
|
||||||
.clone()
|
.clone()
|
||||||
}
|
}
|
||||||
|
|
@ -2223,7 +2230,7 @@ pub fn download_ci_rustc_commit<'a>(
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
if dwn_ctx.is_running_on_ci {
|
if dwn_ctx.is_running_on_ci() {
|
||||||
eprintln!("CI rustc commit matches with HEAD and we are in CI.");
|
eprintln!("CI rustc commit matches with HEAD and we are in CI.");
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"`rustc.download-ci` functionality will be skipped as artifacts are not available."
|
"`rustc.download-ci` functionality will be skipped as artifacts are not available."
|
||||||
|
|
@ -2267,7 +2274,7 @@ pub fn check_path_modifications_<'a>(
|
||||||
dwn_ctx.src,
|
dwn_ctx.src,
|
||||||
&git_config(dwn_ctx.stage0_metadata),
|
&git_config(dwn_ctx.stage0_metadata),
|
||||||
paths,
|
paths,
|
||||||
CiEnv::current(),
|
dwn_ctx.ci_env,
|
||||||
)
|
)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
})
|
})
|
||||||
|
|
@ -2322,7 +2329,7 @@ pub fn parse_download_ci_llvm<'a>(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
if b && dwn_ctx.is_running_on_ci && CiEnv::is_rust_lang_managed_ci_job() {
|
if b && dwn_ctx.is_running_on_ci() && CiEnv::is_rust_lang_managed_ci_job() {
|
||||||
// On rust-lang CI, we must always rebuild LLVM if there were any modifications to it
|
// On rust-lang CI, we must always rebuild LLVM if there were any modifications to it
|
||||||
panic!(
|
panic!(
|
||||||
"`llvm.download-ci-llvm` cannot be set to `true` on CI. Use `if-unchanged` instead."
|
"`llvm.download-ci-llvm` cannot be set to `true` on CI. Use `if-unchanged` instead."
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ fn download_ci_llvm() {
|
||||||
.config("check")
|
.config("check")
|
||||||
.with_default_toml_config("llvm.download-ci-llvm = \"if-unchanged\"")
|
.with_default_toml_config("llvm.download-ci-llvm = \"if-unchanged\"")
|
||||||
.create_config();
|
.create_config();
|
||||||
if if_unchanged_config.llvm_from_ci && if_unchanged_config.is_running_on_ci {
|
if if_unchanged_config.llvm_from_ci && if_unchanged_config.is_running_on_ci() {
|
||||||
let has_changes = if_unchanged_config.has_changes_from_upstream(LLVM_INVALIDATION_PATHS);
|
let has_changes = if_unchanged_config.has_changes_from_upstream(LLVM_INVALIDATION_PATHS);
|
||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
|
|
@ -491,13 +491,14 @@ fn test_exclude() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_ci_flag() {
|
fn test_ci_flag() {
|
||||||
let config = TestCtx::new().config("check").arg("--ci").arg("false").create_config();
|
let config = TestCtx::new().config("check").arg("--ci").arg("false").create_config();
|
||||||
assert!(!config.is_running_on_ci);
|
assert!(!config.is_running_on_ci());
|
||||||
|
|
||||||
let config = TestCtx::new().config("check").arg("--ci").arg("true").create_config();
|
let config = TestCtx::new().config("check").arg("--ci").arg("true").create_config();
|
||||||
assert!(config.is_running_on_ci);
|
assert!(config.is_running_on_ci());
|
||||||
|
|
||||||
|
// If --ci flag is not added, is_running_on_ci() relies on if it is run on actual CI or not.
|
||||||
let config = TestCtx::new().config("check").create_config();
|
let config = TestCtx::new().config("check").create_config();
|
||||||
assert_eq!(config.is_running_on_ci, CiEnv::is_ci());
|
assert_eq!(config.is_running_on_ci(), CiEnv::is_ci());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ use std::io::{BufRead, BufReader, BufWriter, ErrorKind, Write};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::{Arc, Mutex, OnceLock};
|
use std::sync::{Arc, Mutex, OnceLock};
|
||||||
|
|
||||||
|
use build_helper::ci::CiEnv;
|
||||||
use build_helper::git::PathFreshness;
|
use build_helper::git::PathFreshness;
|
||||||
use xz2::bufread::XzDecoder;
|
use xz2::bufread::XzDecoder;
|
||||||
|
|
||||||
|
|
@ -411,7 +412,13 @@ pub(crate) struct DownloadContext<'a> {
|
||||||
pub stage0_metadata: &'a build_helper::stage0_parser::Stage0,
|
pub stage0_metadata: &'a build_helper::stage0_parser::Stage0,
|
||||||
pub llvm_assertions: bool,
|
pub llvm_assertions: bool,
|
||||||
pub bootstrap_cache_path: &'a Option<PathBuf>,
|
pub bootstrap_cache_path: &'a Option<PathBuf>,
|
||||||
pub is_running_on_ci: bool,
|
pub ci_env: CiEnv,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> DownloadContext<'a> {
|
||||||
|
pub fn is_running_on_ci(&self) -> bool {
|
||||||
|
self.ci_env.is_running_in_ci()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> AsRef<DownloadContext<'a>> for DownloadContext<'a> {
|
impl<'a> AsRef<DownloadContext<'a>> for DownloadContext<'a> {
|
||||||
|
|
@ -432,7 +439,7 @@ impl<'a> From<&'a Config> for DownloadContext<'a> {
|
||||||
stage0_metadata: &value.stage0_metadata,
|
stage0_metadata: &value.stage0_metadata,
|
||||||
llvm_assertions: value.llvm_assertions,
|
llvm_assertions: value.llvm_assertions,
|
||||||
bootstrap_cache_path: &value.bootstrap_cache_path,
|
bootstrap_cache_path: &value.bootstrap_cache_path,
|
||||||
is_running_on_ci: value.is_running_on_ci,
|
ci_env: value.ci_env,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -981,7 +988,7 @@ fn download_file<'a>(
|
||||||
match url.split_once("://").map(|(proto, _)| proto) {
|
match url.split_once("://").map(|(proto, _)| proto) {
|
||||||
Some("http") | Some("https") => download_http_with_retries(
|
Some("http") | Some("https") => download_http_with_retries(
|
||||||
dwn_ctx.host_target,
|
dwn_ctx.host_target,
|
||||||
dwn_ctx.is_running_on_ci,
|
dwn_ctx.is_running_on_ci(),
|
||||||
dwn_ctx.exec_ctx,
|
dwn_ctx.exec_ctx,
|
||||||
&tempfile,
|
&tempfile,
|
||||||
url,
|
url,
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,7 @@ fn default_compiler(
|
||||||
let root = if let Some(path) = build.wasi_sdk_path.as_ref() {
|
let root = if let Some(path) = build.wasi_sdk_path.as_ref() {
|
||||||
path
|
path
|
||||||
} else {
|
} else {
|
||||||
if build.config.is_running_on_ci {
|
if build.config.is_running_on_ci() {
|
||||||
panic!("ERROR: WASI_SDK_PATH must be configured for a -wasi target on CI");
|
panic!("ERROR: WASI_SDK_PATH must be configured for a -wasi target on CI");
|
||||||
}
|
}
|
||||||
println!("WARNING: WASI_SDK_PATH not set, using default cc/cxx compiler");
|
println!("WARNING: WASI_SDK_PATH not set, using default cc/cxx compiler");
|
||||||
|
|
|
||||||
|
|
@ -222,7 +222,7 @@ impl BuildMetrics {
|
||||||
format_version: CURRENT_FORMAT_VERSION,
|
format_version: CURRENT_FORMAT_VERSION,
|
||||||
system_stats,
|
system_stats,
|
||||||
invocations,
|
invocations,
|
||||||
ci_metadata: get_ci_metadata(CiEnv::current()),
|
ci_metadata: get_ci_metadata(build.config.ci_env),
|
||||||
};
|
};
|
||||||
|
|
||||||
t!(std::fs::create_dir_all(dest.parent().unwrap()));
|
t!(std::fs::create_dir_all(dest.parent().unwrap()));
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ impl<'a> Renderer<'a> {
|
||||||
|
|
||||||
if self.builder.config.verbose_tests {
|
if self.builder.config.verbose_tests {
|
||||||
self.render_test_outcome_verbose(outcome, test);
|
self.render_test_outcome_verbose(outcome, test);
|
||||||
} else if self.builder.config.is_running_on_ci {
|
} else if self.builder.config.is_running_on_ci() {
|
||||||
self.render_test_outcome_ci(outcome, test);
|
self.render_test_outcome_ci(outcome, test);
|
||||||
} else {
|
} else {
|
||||||
self.render_test_outcome_terse(outcome, test);
|
self.render_test_outcome_terse(outcome, test);
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ If cross-compiling, make sure your C compiler is included in `$PATH`, then add i
|
||||||
`bootstrap.toml`:
|
`bootstrap.toml`:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[target.aarch64-unknown-linux-musl]
|
[target.aarch64-unknown-linux-gnu]
|
||||||
cc = "aarch64-linux-gnu-gcc"
|
cc = "aarch64-linux-gnu-gcc"
|
||||||
cxx = "aarch64-linux-gnu-g++"
|
cxx = "aarch64-linux-gnu-g++"
|
||||||
ar = "aarch64-linux-gnu-ar"
|
ar = "aarch64-linux-gnu-ar"
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,9 @@ This tracks support for additional registers in architectures where inline assem
|
||||||
| Architecture | Register class | Target feature | Allowed types |
|
| Architecture | Register class | Target feature | Allowed types |
|
||||||
| ------------ | -------------- | -------------- | ------------- |
|
| ------------ | -------------- | -------------- | ------------- |
|
||||||
| s390x | `vreg` | `vector` | `i32`, `f32`, `i64`, `f64`, `i128`, `f128`, `i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4`, `f64x2` |
|
| s390x | `vreg` | `vector` | `i32`, `f32`, `i64`, `f64`, `i128`, `f128`, `i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4`, `f64x2` |
|
||||||
|
| x86 | `xmm_reg` | `sse` | `i128` |
|
||||||
|
| x86 | `ymm_reg` | `avx` | `i128` |
|
||||||
|
| x86 | `zmm_reg` | `avx512f` | `i128` |
|
||||||
|
|
||||||
## Register aliases
|
## Register aliases
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2384,15 +2384,22 @@ impl<'test> TestCx<'test> {
|
||||||
_ => {}
|
_ => {}
|
||||||
};
|
};
|
||||||
|
|
||||||
let stderr = if self.force_color_svg() {
|
let stderr;
|
||||||
anstyle_svg::Term::new().render_svg(&proc_res.stderr)
|
let normalized_stderr;
|
||||||
} else if explicit_format {
|
|
||||||
proc_res.stderr.clone()
|
if self.force_color_svg() {
|
||||||
} else {
|
let normalized = self.normalize_output(&proc_res.stderr, &self.props.normalize_stderr);
|
||||||
json::extract_rendered(&proc_res.stderr)
|
stderr = anstyle_svg::Term::new().render_svg(&normalized);
|
||||||
};
|
normalized_stderr = stderr.clone();
|
||||||
|
} else {
|
||||||
|
stderr = if explicit_format {
|
||||||
|
proc_res.stderr.clone()
|
||||||
|
} else {
|
||||||
|
json::extract_rendered(&proc_res.stderr)
|
||||||
|
};
|
||||||
|
normalized_stderr = self.normalize_output(&stderr, &self.props.normalize_stderr);
|
||||||
|
}
|
||||||
|
|
||||||
let normalized_stderr = self.normalize_output(&stderr, &self.props.normalize_stderr);
|
|
||||||
let mut errors = 0;
|
let mut errors = 0;
|
||||||
match output_kind {
|
match output_kind {
|
||||||
TestOutput::Compile => {
|
TestOutput::Compile => {
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,10 @@ pub trait MetaSized: PointeeSized {}
|
||||||
)]
|
)]
|
||||||
pub trait Sized: MetaSized {}
|
pub trait Sized: MetaSized {}
|
||||||
|
|
||||||
|
#[lang = "destruct"]
|
||||||
|
#[rustc_on_unimplemented(message = "can't drop `{Self}`", append_const_msg)]
|
||||||
|
pub trait Destruct: PointeeSized {}
|
||||||
|
|
||||||
#[lang = "legacy_receiver"]
|
#[lang = "legacy_receiver"]
|
||||||
pub trait LegacyReceiver {}
|
pub trait LegacyReceiver {}
|
||||||
impl<T: PointeeSized> LegacyReceiver for &T {}
|
impl<T: PointeeSized> LegacyReceiver for &T {}
|
||||||
|
|
|
||||||
19
tests/mir-opt/alignment_checks.rs
Normal file
19
tests/mir-opt/alignment_checks.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
//@ compile-flags: -Copt-level=1 -Zmir-opt-level=2 -Zub-checks
|
||||||
|
//@ only-64bit
|
||||||
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||||
|
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
// The diff shows exactly what is generated by the pass;
|
||||||
|
// then we check the final `-O1` output for people who want to run them
|
||||||
|
// without the codegen being too terrible.
|
||||||
|
|
||||||
|
// EMIT_MIR alignment_checks.sized_ptr.CheckAlignment.diff
|
||||||
|
pub unsafe fn sized_ptr(ptr: *const u32) -> u32 {
|
||||||
|
// CHECK-LABEL: fn sized_ptr(_1: *const u32)
|
||||||
|
// CHECK: _2 = copy _1 as usize (Transmute);
|
||||||
|
// CHECK: _3 = BitAnd(copy _2, const 3_usize);
|
||||||
|
// CHECK: _4 = Eq(copy _3, const 0_usize);
|
||||||
|
// CHECK: assert(copy _4,
|
||||||
|
*ptr
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
- // MIR for `sized_ptr` before CheckAlignment
|
||||||
|
+ // MIR for `sized_ptr` after CheckAlignment
|
||||||
|
|
||||||
|
fn sized_ptr(_1: *const u32) -> u32 {
|
||||||
|
debug ptr => _1;
|
||||||
|
let mut _0: u32;
|
||||||
|
+ let mut _2: *const ();
|
||||||
|
+ let mut _3: usize;
|
||||||
|
+ let mut _4: usize;
|
||||||
|
+ let mut _5: usize;
|
||||||
|
+ let mut _6: bool;
|
||||||
|
|
||||||
|
bb0: {
|
||||||
|
+ _2 = copy _1 as *const () (PtrToPtr);
|
||||||
|
+ _3 = copy _2 as usize (Transmute);
|
||||||
|
+ _4 = Sub(const <u32 as std::mem::SizedTypeProperties>::ALIGN, const 1_usize);
|
||||||
|
+ _5 = BitAnd(copy _3, copy _4);
|
||||||
|
+ _6 = Eq(copy _5, const 0_usize);
|
||||||
|
+ assert(copy _6, "misaligned pointer dereference: address must be a multiple of {} but is {}", const <u32 as std::mem::SizedTypeProperties>::ALIGN, copy _3) -> [success: bb1, unwind unreachable];
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ bb1: {
|
||||||
|
_0 = copy (*_1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
- // MIR for `sized_ptr` before CheckAlignment
|
||||||
|
+ // MIR for `sized_ptr` after CheckAlignment
|
||||||
|
|
||||||
|
fn sized_ptr(_1: *const u32) -> u32 {
|
||||||
|
debug ptr => _1;
|
||||||
|
let mut _0: u32;
|
||||||
|
+ let mut _2: *const ();
|
||||||
|
+ let mut _3: usize;
|
||||||
|
+ let mut _4: usize;
|
||||||
|
+ let mut _5: usize;
|
||||||
|
+ let mut _6: bool;
|
||||||
|
|
||||||
|
bb0: {
|
||||||
|
+ _2 = copy _1 as *const () (PtrToPtr);
|
||||||
|
+ _3 = copy _2 as usize (Transmute);
|
||||||
|
+ _4 = Sub(const <u32 as std::mem::SizedTypeProperties>::ALIGN, const 1_usize);
|
||||||
|
+ _5 = BitAnd(copy _3, copy _4);
|
||||||
|
+ _6 = Eq(copy _5, const 0_usize);
|
||||||
|
+ assert(copy _6, "misaligned pointer dereference: address must be a multiple of {} but is {}", const <u32 as std::mem::SizedTypeProperties>::ALIGN, copy _3) -> [success: bb1, unwind unreachable];
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ bb1: {
|
||||||
|
_0 = copy (*_1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -27,9 +27,9 @@ use std::io::Write;
|
||||||
use std::ops::ControlFlow;
|
use std::ops::ControlFlow;
|
||||||
|
|
||||||
use rustc_public::crate_def::CrateDef;
|
use rustc_public::crate_def::CrateDef;
|
||||||
use rustc_public::mir::Body;
|
|
||||||
use rustc_public::mir::alloc::GlobalAlloc;
|
use rustc_public::mir::alloc::GlobalAlloc;
|
||||||
use rustc_public::mir::mono::{Instance, StaticDef};
|
use rustc_public::mir::mono::{Instance, StaticDef};
|
||||||
|
use rustc_public::mir::{Body, Operand, Rvalue, StatementKind};
|
||||||
use rustc_public::ty::{Allocation, ConstantKind};
|
use rustc_public::ty::{Allocation, ConstantKind};
|
||||||
use rustc_public::{CrateItem, CrateItems, ItemKind};
|
use rustc_public::{CrateItem, CrateItems, ItemKind};
|
||||||
|
|
||||||
|
|
@ -106,7 +106,7 @@ fn check_other_consts(item: CrateItem) {
|
||||||
// Instance body will force constant evaluation.
|
// Instance body will force constant evaluation.
|
||||||
let body = Instance::try_from(item).unwrap().body().unwrap();
|
let body = Instance::try_from(item).unwrap().body().unwrap();
|
||||||
let assigns = collect_consts(&body);
|
let assigns = collect_consts(&body);
|
||||||
assert_eq!(assigns.len(), 10);
|
assert_eq!(assigns.len(), 11);
|
||||||
let mut char_id = None;
|
let mut char_id = None;
|
||||||
let mut bool_id = None;
|
let mut bool_id = None;
|
||||||
for (name, alloc) in assigns {
|
for (name, alloc) in assigns {
|
||||||
|
|
@ -167,17 +167,44 @@ fn check_other_consts(item: CrateItem) {
|
||||||
assert_ne!(bool_id, char_id);
|
assert_ne!(bool_id, char_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Collects all the constant assignments.
|
/// Collects all constant allocations from `fn other_consts()`. The returned map
|
||||||
|
/// maps variable names to their corresponding constant allocation.
|
||||||
pub fn collect_consts(body: &Body) -> HashMap<String, &Allocation> {
|
pub fn collect_consts(body: &Body) -> HashMap<String, &Allocation> {
|
||||||
body.var_debug_info
|
let local_to_const_alloc = body
|
||||||
|
.blocks
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|info| {
|
.flat_map(|block| block.statements.iter())
|
||||||
info.constant().map(|const_op| {
|
.filter_map(|statement| {
|
||||||
let ConstantKind::Allocated(alloc) = const_op.const_.kind() else { unreachable!() };
|
let StatementKind::Assign(place, Rvalue::Use(Operand::Constant(const_op))) =
|
||||||
(info.name.clone(), alloc)
|
&statement.kind
|
||||||
})
|
else {
|
||||||
|
return None;
|
||||||
|
};
|
||||||
|
let ConstantKind::Allocated(alloc) = const_op.const_.kind() else { return None };
|
||||||
|
Some((place.local, alloc))
|
||||||
})
|
})
|
||||||
.collect::<HashMap<_, _>>()
|
.collect::<HashMap<_, _>>();
|
||||||
|
|
||||||
|
let mut allocations = HashMap::new();
|
||||||
|
for info in &body.var_debug_info {
|
||||||
|
// MIR optimzations sometimes gets rid of assignments. Look up the
|
||||||
|
// constant allocation directly in this case.
|
||||||
|
if let Some(const_op) = info.constant() {
|
||||||
|
let ConstantKind::Allocated(alloc) = const_op.const_.kind() else { unreachable!() };
|
||||||
|
allocations.insert(info.name.clone(), alloc);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If MIR optimzations didn't get rid of the assignment, then we can
|
||||||
|
// find the constant allocation as an rvalue of the corresponding
|
||||||
|
// assignment.
|
||||||
|
if let Some(local) = info.local() {
|
||||||
|
if let Some(alloc) = local_to_const_alloc.get(&local) {
|
||||||
|
allocations.insert(info.name.clone(), alloc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allocations
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check the allocation data for `LEN`.
|
/// Check the allocation data for `LEN`.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
error: invalid register class `foo`: unknown register class
|
error: invalid register class `foo`: unknown register class
|
||||||
--> $DIR/bad-reg.rs:12:20
|
--> $DIR/bad-reg.rs:20:20
|
||||||
|
|
|
|
||||||
LL | asm!("{}", in(foo) foo);
|
LL | asm!("{}", in(foo) foo);
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
|
|
@ -7,13 +7,13 @@ LL | asm!("{}", in(foo) foo);
|
||||||
= note: the following register classes are supported on this target: `reg`, `reg_abcd`, `reg_byte`, `xmm_reg`, `ymm_reg`, `zmm_reg`, `kreg`, `kreg0`, `mmx_reg`, `x87_reg`, `tmm_reg`
|
= note: the following register classes are supported on this target: `reg`, `reg_abcd`, `reg_byte`, `xmm_reg`, `ymm_reg`, `zmm_reg`, `kreg`, `kreg0`, `mmx_reg`, `x87_reg`, `tmm_reg`
|
||||||
|
|
||||||
error: invalid register `foo`: unknown register
|
error: invalid register `foo`: unknown register
|
||||||
--> $DIR/bad-reg.rs:14:18
|
--> $DIR/bad-reg.rs:22:18
|
||||||
|
|
|
|
||||||
LL | asm!("", in("foo") foo);
|
LL | asm!("", in("foo") foo);
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: invalid asm template modifier for this register class
|
error: invalid asm template modifier for this register class
|
||||||
--> $DIR/bad-reg.rs:16:15
|
--> $DIR/bad-reg.rs:24:15
|
||||||
|
|
|
|
||||||
LL | asm!("{:z}", in(reg) foo);
|
LL | asm!("{:z}", in(reg) foo);
|
||||||
| ^^^^ ----------- argument
|
| ^^^^ ----------- argument
|
||||||
|
|
@ -23,7 +23,7 @@ LL | asm!("{:z}", in(reg) foo);
|
||||||
= note: the `reg` register class supports the following template modifiers: `l`, `x`, `e`, `r`
|
= note: the `reg` register class supports the following template modifiers: `l`, `x`, `e`, `r`
|
||||||
|
|
||||||
error: invalid asm template modifier for this register class
|
error: invalid asm template modifier for this register class
|
||||||
--> $DIR/bad-reg.rs:18:15
|
--> $DIR/bad-reg.rs:26:15
|
||||||
|
|
|
|
||||||
LL | asm!("{:r}", in(xmm_reg) foo);
|
LL | asm!("{:r}", in(xmm_reg) foo);
|
||||||
| ^^^^ --------------- argument
|
| ^^^^ --------------- argument
|
||||||
|
|
@ -33,7 +33,7 @@ LL | asm!("{:r}", in(xmm_reg) foo);
|
||||||
= note: the `xmm_reg` register class supports the following template modifiers: `x`, `y`, `z`
|
= note: the `xmm_reg` register class supports the following template modifiers: `x`, `y`, `z`
|
||||||
|
|
||||||
error: asm template modifiers are not allowed for `const` arguments
|
error: asm template modifiers are not allowed for `const` arguments
|
||||||
--> $DIR/bad-reg.rs:20:15
|
--> $DIR/bad-reg.rs:28:15
|
||||||
|
|
|
|
||||||
LL | asm!("{:a}", const 0);
|
LL | asm!("{:a}", const 0);
|
||||||
| ^^^^ ------- argument
|
| ^^^^ ------- argument
|
||||||
|
|
@ -41,7 +41,7 @@ LL | asm!("{:a}", const 0);
|
||||||
| template modifier
|
| template modifier
|
||||||
|
|
||||||
error: asm template modifiers are not allowed for `sym` arguments
|
error: asm template modifiers are not allowed for `sym` arguments
|
||||||
--> $DIR/bad-reg.rs:22:15
|
--> $DIR/bad-reg.rs:30:15
|
||||||
|
|
|
|
||||||
LL | asm!("{:a}", sym main);
|
LL | asm!("{:a}", sym main);
|
||||||
| ^^^^ -------- argument
|
| ^^^^ -------- argument
|
||||||
|
|
@ -49,67 +49,67 @@ LL | asm!("{:a}", sym main);
|
||||||
| template modifier
|
| template modifier
|
||||||
|
|
||||||
error: invalid register `ebp`: the frame pointer cannot be used as an operand for inline asm
|
error: invalid register `ebp`: the frame pointer cannot be used as an operand for inline asm
|
||||||
--> $DIR/bad-reg.rs:24:18
|
--> $DIR/bad-reg.rs:32:18
|
||||||
|
|
|
|
||||||
LL | asm!("", in("ebp") foo);
|
LL | asm!("", in("ebp") foo);
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: invalid register `rsp`: the stack pointer cannot be used as an operand for inline asm
|
error: invalid register `rsp`: the stack pointer cannot be used as an operand for inline asm
|
||||||
--> $DIR/bad-reg.rs:26:18
|
--> $DIR/bad-reg.rs:34:18
|
||||||
|
|
|
|
||||||
LL | asm!("", in("rsp") foo);
|
LL | asm!("", in("rsp") foo);
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: invalid register `ip`: the instruction pointer cannot be used as an operand for inline asm
|
error: invalid register `ip`: the instruction pointer cannot be used as an operand for inline asm
|
||||||
--> $DIR/bad-reg.rs:28:18
|
--> $DIR/bad-reg.rs:36:18
|
||||||
|
|
|
|
||||||
LL | asm!("", in("ip") foo);
|
LL | asm!("", in("ip") foo);
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
error: register class `x87_reg` can only be used as a clobber, not as an input or output
|
error: register class `x87_reg` can only be used as a clobber, not as an input or output
|
||||||
--> $DIR/bad-reg.rs:31:18
|
--> $DIR/bad-reg.rs:39:18
|
||||||
|
|
|
|
||||||
LL | asm!("", in("st(2)") foo);
|
LL | asm!("", in("st(2)") foo);
|
||||||
| ^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: register class `mmx_reg` can only be used as a clobber, not as an input or output
|
error: register class `mmx_reg` can only be used as a clobber, not as an input or output
|
||||||
--> $DIR/bad-reg.rs:34:18
|
--> $DIR/bad-reg.rs:42:18
|
||||||
|
|
|
|
||||||
LL | asm!("", in("mm0") foo);
|
LL | asm!("", in("mm0") foo);
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: register class `kreg0` can only be used as a clobber, not as an input or output
|
error: register class `kreg0` can only be used as a clobber, not as an input or output
|
||||||
--> $DIR/bad-reg.rs:37:18
|
--> $DIR/bad-reg.rs:45:18
|
||||||
|
|
|
|
||||||
LL | asm!("", in("k0") foo);
|
LL | asm!("", in("k0") foo);
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
error: register class `x87_reg` can only be used as a clobber, not as an input or output
|
error: register class `x87_reg` can only be used as a clobber, not as an input or output
|
||||||
--> $DIR/bad-reg.rs:42:20
|
--> $DIR/bad-reg.rs:50:20
|
||||||
|
|
|
|
||||||
LL | asm!("{}", in(x87_reg) foo);
|
LL | asm!("{}", in(x87_reg) foo);
|
||||||
| ^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: register class `mmx_reg` can only be used as a clobber, not as an input or output
|
error: register class `mmx_reg` can only be used as a clobber, not as an input or output
|
||||||
--> $DIR/bad-reg.rs:45:20
|
--> $DIR/bad-reg.rs:53:20
|
||||||
|
|
|
|
||||||
LL | asm!("{}", in(mmx_reg) foo);
|
LL | asm!("{}", in(mmx_reg) foo);
|
||||||
| ^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: register class `x87_reg` can only be used as a clobber, not as an input or output
|
error: register class `x87_reg` can only be used as a clobber, not as an input or output
|
||||||
--> $DIR/bad-reg.rs:48:20
|
--> $DIR/bad-reg.rs:56:20
|
||||||
|
|
|
|
||||||
LL | asm!("{}", out(x87_reg) _);
|
LL | asm!("{}", out(x87_reg) _);
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: register class `mmx_reg` can only be used as a clobber, not as an input or output
|
error: register class `mmx_reg` can only be used as a clobber, not as an input or output
|
||||||
--> $DIR/bad-reg.rs:50:20
|
--> $DIR/bad-reg.rs:58:20
|
||||||
|
|
|
|
||||||
LL | asm!("{}", out(mmx_reg) _);
|
LL | asm!("{}", out(mmx_reg) _);
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: register `al` conflicts with register `eax`
|
error: register `al` conflicts with register `eax`
|
||||||
--> $DIR/bad-reg.rs:56:33
|
--> $DIR/bad-reg.rs:64:33
|
||||||
|
|
|
|
||||||
LL | asm!("", in("eax") foo, in("al") bar);
|
LL | asm!("", in("eax") foo, in("al") bar);
|
||||||
| ------------- ^^^^^^^^^^^^ register `al`
|
| ------------- ^^^^^^^^^^^^ register `al`
|
||||||
|
|
@ -117,7 +117,7 @@ LL | asm!("", in("eax") foo, in("al") bar);
|
||||||
| register `eax`
|
| register `eax`
|
||||||
|
|
||||||
error: register `rax` conflicts with register `rax`
|
error: register `rax` conflicts with register `rax`
|
||||||
--> $DIR/bad-reg.rs:59:33
|
--> $DIR/bad-reg.rs:67:33
|
||||||
|
|
|
|
||||||
LL | asm!("", in("rax") foo, out("rax") bar);
|
LL | asm!("", in("rax") foo, out("rax") bar);
|
||||||
| ------------- ^^^^^^^^^^^^^^ register `rax`
|
| ------------- ^^^^^^^^^^^^^^ register `rax`
|
||||||
|
|
@ -125,13 +125,13 @@ LL | asm!("", in("rax") foo, out("rax") bar);
|
||||||
| register `rax`
|
| register `rax`
|
||||||
|
|
|
|
||||||
help: use `lateout` instead of `out` to avoid conflict
|
help: use `lateout` instead of `out` to avoid conflict
|
||||||
--> $DIR/bad-reg.rs:59:18
|
--> $DIR/bad-reg.rs:67:18
|
||||||
|
|
|
|
||||||
LL | asm!("", in("rax") foo, out("rax") bar);
|
LL | asm!("", in("rax") foo, out("rax") bar);
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: register `ymm0` conflicts with register `xmm0`
|
error: register `ymm0` conflicts with register `xmm0`
|
||||||
--> $DIR/bad-reg.rs:64:34
|
--> $DIR/bad-reg.rs:72:34
|
||||||
|
|
|
|
||||||
LL | asm!("", in("xmm0") foo, in("ymm0") bar);
|
LL | asm!("", in("xmm0") foo, in("ymm0") bar);
|
||||||
| -------------- ^^^^^^^^^^^^^^ register `ymm0`
|
| -------------- ^^^^^^^^^^^^^^ register `ymm0`
|
||||||
|
|
@ -139,7 +139,7 @@ LL | asm!("", in("xmm0") foo, in("ymm0") bar);
|
||||||
| register `xmm0`
|
| register `xmm0`
|
||||||
|
|
||||||
error: register `ymm0` conflicts with register `xmm0`
|
error: register `ymm0` conflicts with register `xmm0`
|
||||||
--> $DIR/bad-reg.rs:66:34
|
--> $DIR/bad-reg.rs:74:34
|
||||||
|
|
|
|
||||||
LL | asm!("", in("xmm0") foo, out("ymm0") bar);
|
LL | asm!("", in("xmm0") foo, out("ymm0") bar);
|
||||||
| -------------- ^^^^^^^^^^^^^^^ register `ymm0`
|
| -------------- ^^^^^^^^^^^^^^^ register `ymm0`
|
||||||
|
|
@ -147,13 +147,13 @@ LL | asm!("", in("xmm0") foo, out("ymm0") bar);
|
||||||
| register `xmm0`
|
| register `xmm0`
|
||||||
|
|
|
|
||||||
help: use `lateout` instead of `out` to avoid conflict
|
help: use `lateout` instead of `out` to avoid conflict
|
||||||
--> $DIR/bad-reg.rs:66:18
|
--> $DIR/bad-reg.rs:74:18
|
||||||
|
|
|
|
||||||
LL | asm!("", in("xmm0") foo, out("ymm0") bar);
|
LL | asm!("", in("xmm0") foo, out("ymm0") bar);
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: type `i32` cannot be used with this register class
|
error: type `i32` cannot be used with this register class
|
||||||
--> $DIR/bad-reg.rs:31:30
|
--> $DIR/bad-reg.rs:39:30
|
||||||
|
|
|
|
||||||
LL | asm!("", in("st(2)") foo);
|
LL | asm!("", in("st(2)") foo);
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
@ -161,7 +161,7 @@ LL | asm!("", in("st(2)") foo);
|
||||||
= note: register class `x87_reg` supports these types:
|
= note: register class `x87_reg` supports these types:
|
||||||
|
|
||||||
error: type `i32` cannot be used with this register class
|
error: type `i32` cannot be used with this register class
|
||||||
--> $DIR/bad-reg.rs:34:28
|
--> $DIR/bad-reg.rs:42:28
|
||||||
|
|
|
|
||||||
LL | asm!("", in("mm0") foo);
|
LL | asm!("", in("mm0") foo);
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
@ -169,7 +169,7 @@ LL | asm!("", in("mm0") foo);
|
||||||
= note: register class `mmx_reg` supports these types:
|
= note: register class `mmx_reg` supports these types:
|
||||||
|
|
||||||
error: type `i32` cannot be used with this register class
|
error: type `i32` cannot be used with this register class
|
||||||
--> $DIR/bad-reg.rs:37:27
|
--> $DIR/bad-reg.rs:45:27
|
||||||
|
|
|
|
||||||
LL | asm!("", in("k0") foo);
|
LL | asm!("", in("k0") foo);
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
@ -177,7 +177,7 @@ LL | asm!("", in("k0") foo);
|
||||||
= note: register class `kreg0` supports these types:
|
= note: register class `kreg0` supports these types:
|
||||||
|
|
||||||
error: type `i32` cannot be used with this register class
|
error: type `i32` cannot be used with this register class
|
||||||
--> $DIR/bad-reg.rs:42:32
|
--> $DIR/bad-reg.rs:50:32
|
||||||
|
|
|
|
||||||
LL | asm!("{}", in(x87_reg) foo);
|
LL | asm!("{}", in(x87_reg) foo);
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
@ -185,7 +185,7 @@ LL | asm!("{}", in(x87_reg) foo);
|
||||||
= note: register class `x87_reg` supports these types:
|
= note: register class `x87_reg` supports these types:
|
||||||
|
|
||||||
error: type `i32` cannot be used with this register class
|
error: type `i32` cannot be used with this register class
|
||||||
--> $DIR/bad-reg.rs:45:32
|
--> $DIR/bad-reg.rs:53:32
|
||||||
|
|
|
|
||||||
LL | asm!("{}", in(mmx_reg) foo);
|
LL | asm!("{}", in(mmx_reg) foo);
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
@ -193,7 +193,7 @@ LL | asm!("{}", in(mmx_reg) foo);
|
||||||
= note: register class `mmx_reg` supports these types:
|
= note: register class `mmx_reg` supports these types:
|
||||||
|
|
||||||
error: type `i32` cannot be used with this register class
|
error: type `i32` cannot be used with this register class
|
||||||
--> $DIR/bad-reg.rs:56:42
|
--> $DIR/bad-reg.rs:64:42
|
||||||
|
|
|
|
||||||
LL | asm!("", in("eax") foo, in("al") bar);
|
LL | asm!("", in("eax") foo, in("al") bar);
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
@ -201,7 +201,7 @@ LL | asm!("", in("eax") foo, in("al") bar);
|
||||||
= note: register class `reg_byte` supports these types: i8
|
= note: register class `reg_byte` supports these types: i8
|
||||||
|
|
||||||
error: type `i32` cannot be used with this register class
|
error: type `i32` cannot be used with this register class
|
||||||
--> $DIR/bad-reg.rs:61:27
|
--> $DIR/bad-reg.rs:69:27
|
||||||
|
|
|
|
||||||
LL | asm!("", in("al") foo, lateout("al") bar);
|
LL | asm!("", in("al") foo, lateout("al") bar);
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
@ -209,7 +209,7 @@ LL | asm!("", in("al") foo, lateout("al") bar);
|
||||||
= note: register class `reg_byte` supports these types: i8
|
= note: register class `reg_byte` supports these types: i8
|
||||||
|
|
||||||
error: type `i32` cannot be used with this register class
|
error: type `i32` cannot be used with this register class
|
||||||
--> $DIR/bad-reg.rs:61:46
|
--> $DIR/bad-reg.rs:69:46
|
||||||
|
|
|
|
||||||
LL | asm!("", in("al") foo, lateout("al") bar);
|
LL | asm!("", in("al") foo, lateout("al") bar);
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
@ -1,7 +1,15 @@
|
||||||
|
//@ add-minicore
|
||||||
//@ only-x86_64
|
//@ only-x86_64
|
||||||
//@ compile-flags: -C target-feature=+avx2
|
//@ revisions: stable experimental_reg
|
||||||
|
//@ compile-flags: -C target-feature=+avx2,+avx512f
|
||||||
|
#![cfg_attr(experimental_reg, feature(asm_experimental_reg))]
|
||||||
|
|
||||||
use std::arch::asm;
|
#![crate_type = "lib"]
|
||||||
|
#![feature(no_core)]
|
||||||
|
#![no_core]
|
||||||
|
|
||||||
|
extern crate minicore;
|
||||||
|
use minicore::*;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut foo = 0;
|
let mut foo = 0;
|
||||||
|
|
@ -66,5 +74,23 @@ fn main() {
|
||||||
asm!("", in("xmm0") foo, out("ymm0") bar);
|
asm!("", in("xmm0") foo, out("ymm0") bar);
|
||||||
//~^ ERROR register `ymm0` conflicts with register `xmm0`
|
//~^ ERROR register `ymm0` conflicts with register `xmm0`
|
||||||
asm!("", in("xmm0") foo, lateout("ymm0") bar);
|
asm!("", in("xmm0") foo, lateout("ymm0") bar);
|
||||||
|
|
||||||
|
// Passing u128/i128 is currently experimental.
|
||||||
|
let mut xmmword = 0u128;
|
||||||
|
|
||||||
|
asm!("/* {:x} */", in(xmm_reg) xmmword); // requires asm_experimental_reg
|
||||||
|
//[stable]~^ ERROR type `u128` cannot be used with this register class in stable
|
||||||
|
asm!("/* {:x} */", out(xmm_reg) xmmword); // requires asm_experimental_reg
|
||||||
|
//[stable]~^ ERROR type `u128` cannot be used with this register class in stable
|
||||||
|
|
||||||
|
asm!("/* {:y} */", in(ymm_reg) xmmword); // requires asm_experimental_reg
|
||||||
|
//[stable]~^ ERROR type `u128` cannot be used with this register class in stable
|
||||||
|
asm!("/* {:y} */", out(ymm_reg) xmmword); // requires asm_experimental_reg
|
||||||
|
//[stable]~^ ERROR type `u128` cannot be used with this register class in stable
|
||||||
|
|
||||||
|
asm!("/* {:z} */", in(zmm_reg) xmmword); // requires asm_experimental_reg
|
||||||
|
//[stable]~^ ERROR type `u128` cannot be used with this register class in stable
|
||||||
|
asm!("/* {:z} */", out(zmm_reg) xmmword); // requires asm_experimental_reg
|
||||||
|
//[stable]~^ ERROR type `u128` cannot be used with this register class in stable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
281
tests/ui/asm/x86_64/bad-reg.stable.stderr
Normal file
281
tests/ui/asm/x86_64/bad-reg.stable.stderr
Normal file
|
|
@ -0,0 +1,281 @@
|
||||||
|
error: invalid register class `foo`: unknown register class
|
||||||
|
--> $DIR/bad-reg.rs:20:20
|
||||||
|
|
|
||||||
|
LL | asm!("{}", in(foo) foo);
|
||||||
|
| ^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: the following register classes are supported on this target: `reg`, `reg_abcd`, `reg_byte`, `xmm_reg`, `ymm_reg`, `zmm_reg`, `kreg`, `kreg0`, `mmx_reg`, `x87_reg`, `tmm_reg`
|
||||||
|
|
||||||
|
error: invalid register `foo`: unknown register
|
||||||
|
--> $DIR/bad-reg.rs:22:18
|
||||||
|
|
|
||||||
|
LL | asm!("", in("foo") foo);
|
||||||
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: invalid asm template modifier for this register class
|
||||||
|
--> $DIR/bad-reg.rs:24:15
|
||||||
|
|
|
||||||
|
LL | asm!("{:z}", in(reg) foo);
|
||||||
|
| ^^^^ ----------- argument
|
||||||
|
| |
|
||||||
|
| template modifier
|
||||||
|
|
|
||||||
|
= note: the `reg` register class supports the following template modifiers: `l`, `x`, `e`, `r`
|
||||||
|
|
||||||
|
error: invalid asm template modifier for this register class
|
||||||
|
--> $DIR/bad-reg.rs:26:15
|
||||||
|
|
|
||||||
|
LL | asm!("{:r}", in(xmm_reg) foo);
|
||||||
|
| ^^^^ --------------- argument
|
||||||
|
| |
|
||||||
|
| template modifier
|
||||||
|
|
|
||||||
|
= note: the `xmm_reg` register class supports the following template modifiers: `x`, `y`, `z`
|
||||||
|
|
||||||
|
error: asm template modifiers are not allowed for `const` arguments
|
||||||
|
--> $DIR/bad-reg.rs:28:15
|
||||||
|
|
|
||||||
|
LL | asm!("{:a}", const 0);
|
||||||
|
| ^^^^ ------- argument
|
||||||
|
| |
|
||||||
|
| template modifier
|
||||||
|
|
||||||
|
error: asm template modifiers are not allowed for `sym` arguments
|
||||||
|
--> $DIR/bad-reg.rs:30:15
|
||||||
|
|
|
||||||
|
LL | asm!("{:a}", sym main);
|
||||||
|
| ^^^^ -------- argument
|
||||||
|
| |
|
||||||
|
| template modifier
|
||||||
|
|
||||||
|
error: invalid register `ebp`: the frame pointer cannot be used as an operand for inline asm
|
||||||
|
--> $DIR/bad-reg.rs:32:18
|
||||||
|
|
|
||||||
|
LL | asm!("", in("ebp") foo);
|
||||||
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: invalid register `rsp`: the stack pointer cannot be used as an operand for inline asm
|
||||||
|
--> $DIR/bad-reg.rs:34:18
|
||||||
|
|
|
||||||
|
LL | asm!("", in("rsp") foo);
|
||||||
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: invalid register `ip`: the instruction pointer cannot be used as an operand for inline asm
|
||||||
|
--> $DIR/bad-reg.rs:36:18
|
||||||
|
|
|
||||||
|
LL | asm!("", in("ip") foo);
|
||||||
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: register class `x87_reg` can only be used as a clobber, not as an input or output
|
||||||
|
--> $DIR/bad-reg.rs:39:18
|
||||||
|
|
|
||||||
|
LL | asm!("", in("st(2)") foo);
|
||||||
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: register class `mmx_reg` can only be used as a clobber, not as an input or output
|
||||||
|
--> $DIR/bad-reg.rs:42:18
|
||||||
|
|
|
||||||
|
LL | asm!("", in("mm0") foo);
|
||||||
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: register class `kreg0` can only be used as a clobber, not as an input or output
|
||||||
|
--> $DIR/bad-reg.rs:45:18
|
||||||
|
|
|
||||||
|
LL | asm!("", in("k0") foo);
|
||||||
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: register class `x87_reg` can only be used as a clobber, not as an input or output
|
||||||
|
--> $DIR/bad-reg.rs:50:20
|
||||||
|
|
|
||||||
|
LL | asm!("{}", in(x87_reg) foo);
|
||||||
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: register class `mmx_reg` can only be used as a clobber, not as an input or output
|
||||||
|
--> $DIR/bad-reg.rs:53:20
|
||||||
|
|
|
||||||
|
LL | asm!("{}", in(mmx_reg) foo);
|
||||||
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: register class `x87_reg` can only be used as a clobber, not as an input or output
|
||||||
|
--> $DIR/bad-reg.rs:56:20
|
||||||
|
|
|
||||||
|
LL | asm!("{}", out(x87_reg) _);
|
||||||
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: register class `mmx_reg` can only be used as a clobber, not as an input or output
|
||||||
|
--> $DIR/bad-reg.rs:58:20
|
||||||
|
|
|
||||||
|
LL | asm!("{}", out(mmx_reg) _);
|
||||||
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: register `al` conflicts with register `eax`
|
||||||
|
--> $DIR/bad-reg.rs:64:33
|
||||||
|
|
|
||||||
|
LL | asm!("", in("eax") foo, in("al") bar);
|
||||||
|
| ------------- ^^^^^^^^^^^^ register `al`
|
||||||
|
| |
|
||||||
|
| register `eax`
|
||||||
|
|
||||||
|
error: register `rax` conflicts with register `rax`
|
||||||
|
--> $DIR/bad-reg.rs:67:33
|
||||||
|
|
|
||||||
|
LL | asm!("", in("rax") foo, out("rax") bar);
|
||||||
|
| ------------- ^^^^^^^^^^^^^^ register `rax`
|
||||||
|
| |
|
||||||
|
| register `rax`
|
||||||
|
|
|
||||||
|
help: use `lateout` instead of `out` to avoid conflict
|
||||||
|
--> $DIR/bad-reg.rs:67:18
|
||||||
|
|
|
||||||
|
LL | asm!("", in("rax") foo, out("rax") bar);
|
||||||
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: register `ymm0` conflicts with register `xmm0`
|
||||||
|
--> $DIR/bad-reg.rs:72:34
|
||||||
|
|
|
||||||
|
LL | asm!("", in("xmm0") foo, in("ymm0") bar);
|
||||||
|
| -------------- ^^^^^^^^^^^^^^ register `ymm0`
|
||||||
|
| |
|
||||||
|
| register `xmm0`
|
||||||
|
|
||||||
|
error: register `ymm0` conflicts with register `xmm0`
|
||||||
|
--> $DIR/bad-reg.rs:74:34
|
||||||
|
|
|
||||||
|
LL | asm!("", in("xmm0") foo, out("ymm0") bar);
|
||||||
|
| -------------- ^^^^^^^^^^^^^^^ register `ymm0`
|
||||||
|
| |
|
||||||
|
| register `xmm0`
|
||||||
|
|
|
||||||
|
help: use `lateout` instead of `out` to avoid conflict
|
||||||
|
--> $DIR/bad-reg.rs:74:18
|
||||||
|
|
|
||||||
|
LL | asm!("", in("xmm0") foo, out("ymm0") bar);
|
||||||
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: type `i32` cannot be used with this register class
|
||||||
|
--> $DIR/bad-reg.rs:39:30
|
||||||
|
|
|
||||||
|
LL | asm!("", in("st(2)") foo);
|
||||||
|
| ^^^
|
||||||
|
|
|
||||||
|
= note: register class `x87_reg` supports these types:
|
||||||
|
|
||||||
|
error: type `i32` cannot be used with this register class
|
||||||
|
--> $DIR/bad-reg.rs:42:28
|
||||||
|
|
|
||||||
|
LL | asm!("", in("mm0") foo);
|
||||||
|
| ^^^
|
||||||
|
|
|
||||||
|
= note: register class `mmx_reg` supports these types:
|
||||||
|
|
||||||
|
error: type `i32` cannot be used with this register class
|
||||||
|
--> $DIR/bad-reg.rs:45:27
|
||||||
|
|
|
||||||
|
LL | asm!("", in("k0") foo);
|
||||||
|
| ^^^
|
||||||
|
|
|
||||||
|
= note: register class `kreg0` supports these types:
|
||||||
|
|
||||||
|
error: type `i32` cannot be used with this register class
|
||||||
|
--> $DIR/bad-reg.rs:50:32
|
||||||
|
|
|
||||||
|
LL | asm!("{}", in(x87_reg) foo);
|
||||||
|
| ^^^
|
||||||
|
|
|
||||||
|
= note: register class `x87_reg` supports these types:
|
||||||
|
|
||||||
|
error: type `i32` cannot be used with this register class
|
||||||
|
--> $DIR/bad-reg.rs:53:32
|
||||||
|
|
|
||||||
|
LL | asm!("{}", in(mmx_reg) foo);
|
||||||
|
| ^^^
|
||||||
|
|
|
||||||
|
= note: register class `mmx_reg` supports these types:
|
||||||
|
|
||||||
|
error: type `i32` cannot be used with this register class
|
||||||
|
--> $DIR/bad-reg.rs:64:42
|
||||||
|
|
|
||||||
|
LL | asm!("", in("eax") foo, in("al") bar);
|
||||||
|
| ^^^
|
||||||
|
|
|
||||||
|
= note: register class `reg_byte` supports these types: i8
|
||||||
|
|
||||||
|
error: type `i32` cannot be used with this register class
|
||||||
|
--> $DIR/bad-reg.rs:69:27
|
||||||
|
|
|
||||||
|
LL | asm!("", in("al") foo, lateout("al") bar);
|
||||||
|
| ^^^
|
||||||
|
|
|
||||||
|
= note: register class `reg_byte` supports these types: i8
|
||||||
|
|
||||||
|
error: type `i32` cannot be used with this register class
|
||||||
|
--> $DIR/bad-reg.rs:69:46
|
||||||
|
|
|
||||||
|
LL | asm!("", in("al") foo, lateout("al") bar);
|
||||||
|
| ^^^
|
||||||
|
|
|
||||||
|
= note: register class `reg_byte` supports these types: i8
|
||||||
|
|
||||||
|
error[E0658]: type `u128` cannot be used with this register class in stable
|
||||||
|
--> $DIR/bad-reg.rs:81:40
|
||||||
|
|
|
||||||
|
LL | asm!("/* {:x} */", in(xmm_reg) xmmword); // requires asm_experimental_reg
|
||||||
|
| ^^^^^^^
|
||||||
|
|
|
||||||
|
= note: see issue #133416 <https://github.com/rust-lang/rust/issues/133416> for more information
|
||||||
|
= help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable
|
||||||
|
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||||
|
|
||||||
|
error[E0658]: type `u128` cannot be used with this register class in stable
|
||||||
|
--> $DIR/bad-reg.rs:83:41
|
||||||
|
|
|
||||||
|
LL | asm!("/* {:x} */", out(xmm_reg) xmmword); // requires asm_experimental_reg
|
||||||
|
| ^^^^^^^
|
||||||
|
|
|
||||||
|
= note: see issue #133416 <https://github.com/rust-lang/rust/issues/133416> for more information
|
||||||
|
= help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable
|
||||||
|
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||||
|
|
||||||
|
error[E0658]: type `u128` cannot be used with this register class in stable
|
||||||
|
--> $DIR/bad-reg.rs:86:40
|
||||||
|
|
|
||||||
|
LL | asm!("/* {:y} */", in(ymm_reg) xmmword); // requires asm_experimental_reg
|
||||||
|
| ^^^^^^^
|
||||||
|
|
|
||||||
|
= note: see issue #133416 <https://github.com/rust-lang/rust/issues/133416> for more information
|
||||||
|
= help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable
|
||||||
|
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||||
|
|
||||||
|
error[E0658]: type `u128` cannot be used with this register class in stable
|
||||||
|
--> $DIR/bad-reg.rs:88:41
|
||||||
|
|
|
||||||
|
LL | asm!("/* {:y} */", out(ymm_reg) xmmword); // requires asm_experimental_reg
|
||||||
|
| ^^^^^^^
|
||||||
|
|
|
||||||
|
= note: see issue #133416 <https://github.com/rust-lang/rust/issues/133416> for more information
|
||||||
|
= help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable
|
||||||
|
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||||
|
|
||||||
|
error[E0658]: type `u128` cannot be used with this register class in stable
|
||||||
|
--> $DIR/bad-reg.rs:91:40
|
||||||
|
|
|
||||||
|
LL | asm!("/* {:z} */", in(zmm_reg) xmmword); // requires asm_experimental_reg
|
||||||
|
| ^^^^^^^
|
||||||
|
|
|
||||||
|
= note: see issue #133416 <https://github.com/rust-lang/rust/issues/133416> for more information
|
||||||
|
= help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable
|
||||||
|
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||||
|
|
||||||
|
error[E0658]: type `u128` cannot be used with this register class in stable
|
||||||
|
--> $DIR/bad-reg.rs:93:41
|
||||||
|
|
|
||||||
|
LL | asm!("/* {:z} */", out(zmm_reg) xmmword); // requires asm_experimental_reg
|
||||||
|
| ^^^^^^^
|
||||||
|
|
|
||||||
|
= note: see issue #133416 <https://github.com/rust-lang/rust/issues/133416> for more information
|
||||||
|
= help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable
|
||||||
|
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||||
|
|
||||||
|
error: aborting due to 34 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0658`.
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
// A regression test for https://github.com/rust-lang/rust/issues/152663
|
||||||
|
// Previously triggered an ICE when checking whether the param-env
|
||||||
|
// shadows a global impl. The crash occurred due to calling
|
||||||
|
// `TyCtxt::type_of` on an erroneous associated type in a trait impl
|
||||||
|
// that had no corresponding value.
|
||||||
|
|
||||||
|
trait Iterable {
|
||||||
|
type Iter;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> Iterable for [T] {
|
||||||
|
//~^ ERROR: not all trait items implemented
|
||||||
|
fn iter() -> Self::Iter {}
|
||||||
|
//~^ ERROR: method `iter` is not a member of trait `Iterable`
|
||||||
|
//~| ERROR: mismatched types
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
error[E0407]: method `iter` is not a member of trait `Iterable`
|
||||||
|
--> $DIR/param-env-shadowing-suggestion-no-ice-on-missing-assoc-value.rs:13:5
|
||||||
|
|
|
||||||
|
LL | fn iter() -> Self::Iter {}
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `Iterable`
|
||||||
|
|
||||||
|
error[E0046]: not all trait items implemented, missing: `Iter`
|
||||||
|
--> $DIR/param-env-shadowing-suggestion-no-ice-on-missing-assoc-value.rs:11:1
|
||||||
|
|
|
||||||
|
LL | type Iter;
|
||||||
|
| --------- `Iter` from trait
|
||||||
|
...
|
||||||
|
LL | impl<T> Iterable for [T] {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ missing `Iter` in implementation
|
||||||
|
|
||||||
|
error[E0308]: mismatched types
|
||||||
|
--> $DIR/param-env-shadowing-suggestion-no-ice-on-missing-assoc-value.rs:13:18
|
||||||
|
|
|
||||||
|
LL | fn iter() -> Self::Iter {}
|
||||||
|
| ---- ^^^^^^^^^^ expected associated type, found `()`
|
||||||
|
| |
|
||||||
|
| implicitly returns `()` as its body has no tail or `return` expression
|
||||||
|
|
|
||||||
|
= note: expected associated type `<[T] as Iterable>::Iter`
|
||||||
|
found unit type `()`
|
||||||
|
= help: consider constraining the associated type `<[T] as Iterable>::Iter` to `()` or calling a method that returns `<[T] as Iterable>::Iter`
|
||||||
|
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
|
||||||
|
|
||||||
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
Some errors have detailed explanations: E0046, E0308, E0407.
|
||||||
|
For more information about an error, try `rustc --explain E0046`.
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
//@ check-pass
|
||||||
|
//@ reference: attributes.diagnostic.do_not_recommend.syntax
|
||||||
|
|
||||||
|
trait Foo {}
|
||||||
|
|
||||||
|
#[diagnostic::do_not_recommend(if not_accepted)]
|
||||||
|
//~^ WARNING `#[diagnostic::do_not_recommend]` does not expect any arguments
|
||||||
|
impl Foo for () {}
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
|
||||||
|
--> $DIR/malformed-diagnostic-attributes-if-expression.rs:6:1
|
||||||
|
|
|
||||||
|
LL | #[diagnostic::do_not_recommend(if not_accepted)]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: `#[warn(malformed_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default
|
||||||
|
|
||||||
|
warning: 1 warning emitted
|
||||||
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
// Checks that there is a suggestion for simple tuple index access expression (used where an
|
// Checks that there is a suggestion for simple tuple index access expression (used where an
|
||||||
// identifier is expected in a format arg) to use positional arg instead.
|
// identifier is expected in a format arg) to use positional arg instead, with a note to move
|
||||||
// Issue: <https://github.com/rust-lang/rust/issues/122535>.
|
// the expression into a local variable.
|
||||||
|
// Issue: <https://github.com/rust-lang/rust/issues/114108>.
|
||||||
//@ run-rustfix
|
//@ run-rustfix
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
// Checks that there is a suggestion for simple tuple index access expression (used where an
|
// Checks that there is a suggestion for simple tuple index access expression (used where an
|
||||||
// identifier is expected in a format arg) to use positional arg instead.
|
// identifier is expected in a format arg) to use positional arg instead, with a note to move
|
||||||
// Issue: <https://github.com/rust-lang/rust/issues/122535>.
|
// the expression into a local variable.
|
||||||
|
// Issue: <https://github.com/rust-lang/rust/issues/114108>.
|
||||||
//@ run-rustfix
|
//@ run-rustfix
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
error: invalid format string: tuple index access isn't supported
|
error: invalid format string: tuple index access isn't supported
|
||||||
--> $DIR/format-args-non-identifier-diagnostics.rs:8:16
|
--> $DIR/format-args-non-identifier-diagnostics.rs:9:16
|
||||||
|
|
|
|
||||||
LL | println!("{x.0}");
|
LL | println!("{x.0}");
|
||||||
| ^^^ not supported in format string
|
| ^^^ not supported in format string
|
||||||
|
|
|
|
||||||
|
= note: consider moving this expression to a local variable and then using the local here instead
|
||||||
help: consider using a positional formatting argument instead
|
help: consider using a positional formatting argument instead
|
||||||
|
|
|
|
||||||
LL - println!("{x.0}");
|
LL - println!("{x.0}");
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ fn main() {
|
||||||
let bar = 3;
|
let bar = 3;
|
||||||
let _ = format!("{0}", foo.field); //~ ERROR invalid format string: field access isn't supported
|
let _ = format!("{0}", foo.field); //~ ERROR invalid format string: field access isn't supported
|
||||||
let _ = format!("{1} {} {bar}", "aa", foo.field); //~ ERROR invalid format string: field access isn't supported
|
let _ = format!("{1} {} {bar}", "aa", foo.field); //~ ERROR invalid format string: field access isn't supported
|
||||||
|
let _ = format!("{0:value$} {bar}", foo.field, value = 1); //~ ERROR invalid format string: field access isn't supported
|
||||||
let _ = format!("{2} {} {1} {bar}", "aa", "bb", foo.field); //~ ERROR invalid format string: field access isn't supported
|
let _ = format!("{2} {} {1} {bar}", "aa", "bb", foo.field); //~ ERROR invalid format string: field access isn't supported
|
||||||
let _ = format!("{1} {} {baz}", "aa", foo.field, baz = 3); //~ ERROR invalid format string: field access isn't supported
|
let _ = format!("{1} {} {baz}", "aa", foo.field, baz = 3); //~ ERROR invalid format string: field access isn't supported
|
||||||
let _ = format!("{1:?} {} {baz}", "aa", foo.field, baz = 3); //~ ERROR invalid format string: field access isn't supported
|
let _ = format!("{1:?} {} {baz}", "aa", foo.field, baz = 3); //~ ERROR invalid format string: field access isn't supported
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ fn main() {
|
||||||
let bar = 3;
|
let bar = 3;
|
||||||
let _ = format!("{foo.field}"); //~ ERROR invalid format string: field access isn't supported
|
let _ = format!("{foo.field}"); //~ ERROR invalid format string: field access isn't supported
|
||||||
let _ = format!("{foo.field} {} {bar}", "aa"); //~ ERROR invalid format string: field access isn't supported
|
let _ = format!("{foo.field} {} {bar}", "aa"); //~ ERROR invalid format string: field access isn't supported
|
||||||
|
let _ = format!("{foo.field:value$} {bar}", value = 1); //~ ERROR invalid format string: field access isn't supported
|
||||||
let _ = format!("{foo.field} {} {1} {bar}", "aa", "bb"); //~ ERROR invalid format string: field access isn't supported
|
let _ = format!("{foo.field} {} {1} {bar}", "aa", "bb"); //~ ERROR invalid format string: field access isn't supported
|
||||||
let _ = format!("{foo.field} {} {baz}", "aa", baz = 3); //~ ERROR invalid format string: field access isn't supported
|
let _ = format!("{foo.field} {} {baz}", "aa", baz = 3); //~ ERROR invalid format string: field access isn't supported
|
||||||
let _ = format!("{foo.field:?} {} {baz}", "aa", baz = 3); //~ ERROR invalid format string: field access isn't supported
|
let _ = format!("{foo.field:?} {} {baz}", "aa", baz = 3); //~ ERROR invalid format string: field access isn't supported
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ error: invalid format string: field access isn't supported
|
||||||
LL | let _ = format!("{foo.field}");
|
LL | let _ = format!("{foo.field}");
|
||||||
| ^^^^^^^^^ not supported in format string
|
| ^^^^^^^^^ not supported in format string
|
||||||
|
|
|
|
||||||
|
= note: consider moving this expression to a local variable and then using the local here instead
|
||||||
help: consider using a positional formatting argument instead
|
help: consider using a positional formatting argument instead
|
||||||
|
|
|
|
||||||
LL - let _ = format!("{foo.field}");
|
LL - let _ = format!("{foo.field}");
|
||||||
|
|
@ -16,6 +17,7 @@ error: invalid format string: field access isn't supported
|
||||||
LL | let _ = format!("{foo.field} {} {bar}", "aa");
|
LL | let _ = format!("{foo.field} {} {bar}", "aa");
|
||||||
| ^^^^^^^^^ not supported in format string
|
| ^^^^^^^^^ not supported in format string
|
||||||
|
|
|
|
||||||
|
= note: consider moving this expression to a local variable and then using the local here instead
|
||||||
help: consider using a positional formatting argument instead
|
help: consider using a positional formatting argument instead
|
||||||
|
|
|
|
||||||
LL - let _ = format!("{foo.field} {} {bar}", "aa");
|
LL - let _ = format!("{foo.field} {} {bar}", "aa");
|
||||||
|
|
@ -25,9 +27,23 @@ LL + let _ = format!("{1} {} {bar}", "aa", foo.field);
|
||||||
error: invalid format string: field access isn't supported
|
error: invalid format string: field access isn't supported
|
||||||
--> $DIR/struct-field-as-captured-argument.rs:13:23
|
--> $DIR/struct-field-as-captured-argument.rs:13:23
|
||||||
|
|
|
|
||||||
|
LL | let _ = format!("{foo.field:value$} {bar}", value = 1);
|
||||||
|
| ^^^^^^^^^ not supported in format string
|
||||||
|
|
|
||||||
|
= note: consider moving this expression to a local variable and then using the local here instead
|
||||||
|
help: consider using a positional formatting argument instead
|
||||||
|
|
|
||||||
|
LL - let _ = format!("{foo.field:value$} {bar}", value = 1);
|
||||||
|
LL + let _ = format!("{0:value$} {bar}", foo.field, value = 1);
|
||||||
|
|
|
||||||
|
|
||||||
|
error: invalid format string: field access isn't supported
|
||||||
|
--> $DIR/struct-field-as-captured-argument.rs:14:23
|
||||||
|
|
|
||||||
LL | let _ = format!("{foo.field} {} {1} {bar}", "aa", "bb");
|
LL | let _ = format!("{foo.field} {} {1} {bar}", "aa", "bb");
|
||||||
| ^^^^^^^^^ not supported in format string
|
| ^^^^^^^^^ not supported in format string
|
||||||
|
|
|
|
||||||
|
= note: consider moving this expression to a local variable and then using the local here instead
|
||||||
help: consider using a positional formatting argument instead
|
help: consider using a positional formatting argument instead
|
||||||
|
|
|
|
||||||
LL - let _ = format!("{foo.field} {} {1} {bar}", "aa", "bb");
|
LL - let _ = format!("{foo.field} {} {1} {bar}", "aa", "bb");
|
||||||
|
|
@ -35,11 +51,12 @@ LL + let _ = format!("{2} {} {1} {bar}", "aa", "bb", foo.field);
|
||||||
|
|
|
|
||||||
|
|
||||||
error: invalid format string: field access isn't supported
|
error: invalid format string: field access isn't supported
|
||||||
--> $DIR/struct-field-as-captured-argument.rs:14:23
|
--> $DIR/struct-field-as-captured-argument.rs:15:23
|
||||||
|
|
|
|
||||||
LL | let _ = format!("{foo.field} {} {baz}", "aa", baz = 3);
|
LL | let _ = format!("{foo.field} {} {baz}", "aa", baz = 3);
|
||||||
| ^^^^^^^^^ not supported in format string
|
| ^^^^^^^^^ not supported in format string
|
||||||
|
|
|
|
||||||
|
= note: consider moving this expression to a local variable and then using the local here instead
|
||||||
help: consider using a positional formatting argument instead
|
help: consider using a positional formatting argument instead
|
||||||
|
|
|
|
||||||
LL - let _ = format!("{foo.field} {} {baz}", "aa", baz = 3);
|
LL - let _ = format!("{foo.field} {} {baz}", "aa", baz = 3);
|
||||||
|
|
@ -47,11 +64,12 @@ LL + let _ = format!("{1} {} {baz}", "aa", foo.field, baz = 3);
|
||||||
|
|
|
|
||||||
|
|
||||||
error: invalid format string: field access isn't supported
|
error: invalid format string: field access isn't supported
|
||||||
--> $DIR/struct-field-as-captured-argument.rs:15:23
|
--> $DIR/struct-field-as-captured-argument.rs:16:23
|
||||||
|
|
|
|
||||||
LL | let _ = format!("{foo.field:?} {} {baz}", "aa", baz = 3);
|
LL | let _ = format!("{foo.field:?} {} {baz}", "aa", baz = 3);
|
||||||
| ^^^^^^^^^ not supported in format string
|
| ^^^^^^^^^ not supported in format string
|
||||||
|
|
|
|
||||||
|
= note: consider moving this expression to a local variable and then using the local here instead
|
||||||
help: consider using a positional formatting argument instead
|
help: consider using a positional formatting argument instead
|
||||||
|
|
|
|
||||||
LL - let _ = format!("{foo.field:?} {} {baz}", "aa", baz = 3);
|
LL - let _ = format!("{foo.field:?} {} {baz}", "aa", baz = 3);
|
||||||
|
|
@ -59,11 +77,12 @@ LL + let _ = format!("{1:?} {} {baz}", "aa", foo.field, baz = 3);
|
||||||
|
|
|
|
||||||
|
|
||||||
error: invalid format string: field access isn't supported
|
error: invalid format string: field access isn't supported
|
||||||
--> $DIR/struct-field-as-captured-argument.rs:16:23
|
--> $DIR/struct-field-as-captured-argument.rs:17:23
|
||||||
|
|
|
|
||||||
LL | let _ = format!("{foo.field:#?} {} {baz}", "aa", baz = 3);
|
LL | let _ = format!("{foo.field:#?} {} {baz}", "aa", baz = 3);
|
||||||
| ^^^^^^^^^ not supported in format string
|
| ^^^^^^^^^ not supported in format string
|
||||||
|
|
|
|
||||||
|
= note: consider moving this expression to a local variable and then using the local here instead
|
||||||
help: consider using a positional formatting argument instead
|
help: consider using a positional formatting argument instead
|
||||||
|
|
|
|
||||||
LL - let _ = format!("{foo.field:#?} {} {baz}", "aa", baz = 3);
|
LL - let _ = format!("{foo.field:#?} {} {baz}", "aa", baz = 3);
|
||||||
|
|
@ -71,16 +90,17 @@ LL + let _ = format!("{1:#?} {} {baz}", "aa", foo.field, baz = 3);
|
||||||
|
|
|
|
||||||
|
|
||||||
error: invalid format string: field access isn't supported
|
error: invalid format string: field access isn't supported
|
||||||
--> $DIR/struct-field-as-captured-argument.rs:17:23
|
--> $DIR/struct-field-as-captured-argument.rs:18:23
|
||||||
|
|
|
|
||||||
LL | let _ = format!("{foo.field:.3} {} {baz}", "aa", baz = 3);
|
LL | let _ = format!("{foo.field:.3} {} {baz}", "aa", baz = 3);
|
||||||
| ^^^^^^^^^ not supported in format string
|
| ^^^^^^^^^ not supported in format string
|
||||||
|
|
|
|
||||||
|
= note: consider moving this expression to a local variable and then using the local here instead
|
||||||
help: consider using a positional formatting argument instead
|
help: consider using a positional formatting argument instead
|
||||||
|
|
|
|
||||||
LL - let _ = format!("{foo.field:.3} {} {baz}", "aa", baz = 3);
|
LL - let _ = format!("{foo.field:.3} {} {baz}", "aa", baz = 3);
|
||||||
LL + let _ = format!("{1:.3} {} {baz}", "aa", foo.field, baz = 3);
|
LL + let _ = format!("{1:.3} {} {baz}", "aa", foo.field, baz = 3);
|
||||||
|
|
|
|
||||||
|
|
||||||
error: aborting due to 7 previous errors
|
error: aborting due to 8 previous errors
|
||||||
|
|
||||||
|
|
|
||||||
31
tests/ui/transmutability/type-alias-normalization.rs
Normal file
31
tests/ui/transmutability/type-alias-normalization.rs
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
//! regression test for https://github.com/rust-lang/rust/issues/151462
|
||||||
|
//@compile-flags: -Znext-solver=globally
|
||||||
|
#![feature(lazy_type_alias, transmutability)]
|
||||||
|
#![allow(incomplete_features)]
|
||||||
|
mod assert {
|
||||||
|
use std::mem::{Assume, TransmuteFrom};
|
||||||
|
|
||||||
|
pub fn is_maybe_transmutable<Src, Dst>()
|
||||||
|
where
|
||||||
|
Src: TransmuteFrom<
|
||||||
|
Src,
|
||||||
|
{
|
||||||
|
Assume {
|
||||||
|
alignment: true,
|
||||||
|
lifetimes: true,
|
||||||
|
safety: true,
|
||||||
|
validity: true,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
>,
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test() {
|
||||||
|
type JustUnit = ();
|
||||||
|
assert::is_maybe_transmutable::<JustUnit, ()>();
|
||||||
|
//~^ ERROR `JustUnit` cannot be safely transmuted into `JustUnit`
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
29
tests/ui/transmutability/type-alias-normalization.stderr
Normal file
29
tests/ui/transmutability/type-alias-normalization.stderr
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
error[E0277]: `JustUnit` cannot be safely transmuted into `JustUnit`
|
||||||
|
--> $DIR/type-alias-normalization.rs:27:37
|
||||||
|
|
|
||||||
|
LL | assert::is_maybe_transmutable::<JustUnit, ()>();
|
||||||
|
| ^^^^^^^^ analyzing the transmutability of `JustUnit` is not yet supported
|
||||||
|
|
|
||||||
|
note: required by a bound in `is_maybe_transmutable`
|
||||||
|
--> $DIR/type-alias-normalization.rs:10:14
|
||||||
|
|
|
||||||
|
LL | pub fn is_maybe_transmutable<Src, Dst>()
|
||||||
|
| --------------------- required by a bound in this function
|
||||||
|
LL | where
|
||||||
|
LL | Src: TransmuteFrom<
|
||||||
|
| ______________^
|
||||||
|
LL | | Src,
|
||||||
|
LL | | {
|
||||||
|
LL | | Assume {
|
||||||
|
... |
|
||||||
|
LL | | },
|
||||||
|
LL | | >,
|
||||||
|
| |_________^ required by this bound in `is_maybe_transmutable`
|
||||||
|
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
|
||||||
|
|
|
||||||
|
LL | fn test() where (): TransmuteFrom<(), Assume { alignment: true, lifetimes: true, safety: true, validity: true }> {
|
||||||
|
| ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue