Merge from rustc
31
.github/workflows/ci.yml
vendored
@ -88,82 +88,57 @@ jobs:
|
|||||||
run: "echo \"[CI_PR_NUMBER=$num]\""
|
run: "echo \"[CI_PR_NUMBER=$num]\""
|
||||||
env:
|
env:
|
||||||
num: "${{ github.event.number }}"
|
num: "${{ github.event.number }}"
|
||||||
if: "success() && !env.SKIP_JOB && github.event_name == 'pull_request'"
|
if: "success() && github.event_name == 'pull_request'"
|
||||||
- name: add extra environment variables
|
- name: add extra environment variables
|
||||||
run: src/ci/scripts/setup-environment.sh
|
run: src/ci/scripts/setup-environment.sh
|
||||||
env:
|
env:
|
||||||
EXTRA_VARIABLES: "${{ toJson(matrix.env) }}"
|
EXTRA_VARIABLES: "${{ toJson(matrix.env) }}"
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: decide whether to skip this job
|
|
||||||
run: src/ci/scripts/should-skip-this.sh
|
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: ensure the channel matches the target branch
|
- name: ensure the channel matches the target branch
|
||||||
run: src/ci/scripts/verify-channel.sh
|
run: src/ci/scripts/verify-channel.sh
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: collect CPU statistics
|
- name: collect CPU statistics
|
||||||
run: src/ci/scripts/collect-cpu-stats.sh
|
run: src/ci/scripts/collect-cpu-stats.sh
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: show the current environment
|
- name: show the current environment
|
||||||
run: src/ci/scripts/dump-environment.sh
|
run: src/ci/scripts/dump-environment.sh
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: install awscli
|
- name: install awscli
|
||||||
run: src/ci/scripts/install-awscli.sh
|
run: src/ci/scripts/install-awscli.sh
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: install sccache
|
- name: install sccache
|
||||||
run: src/ci/scripts/install-sccache.sh
|
run: src/ci/scripts/install-sccache.sh
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: select Xcode
|
- name: select Xcode
|
||||||
run: src/ci/scripts/select-xcode.sh
|
run: src/ci/scripts/select-xcode.sh
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: install clang
|
- name: install clang
|
||||||
run: src/ci/scripts/install-clang.sh
|
run: src/ci/scripts/install-clang.sh
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: install tidy
|
- name: install tidy
|
||||||
run: src/ci/scripts/install-tidy.sh
|
run: src/ci/scripts/install-tidy.sh
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: install WIX
|
- name: install WIX
|
||||||
run: src/ci/scripts/install-wix.sh
|
run: src/ci/scripts/install-wix.sh
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: disable git crlf conversion
|
- name: disable git crlf conversion
|
||||||
run: src/ci/scripts/disable-git-crlf-conversion.sh
|
run: src/ci/scripts/disable-git-crlf-conversion.sh
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: checkout submodules
|
- name: checkout submodules
|
||||||
run: src/ci/scripts/checkout-submodules.sh
|
run: src/ci/scripts/checkout-submodules.sh
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: install MSYS2
|
- name: install MSYS2
|
||||||
run: src/ci/scripts/install-msys2.sh
|
run: src/ci/scripts/install-msys2.sh
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: install MinGW
|
- name: install MinGW
|
||||||
run: src/ci/scripts/install-mingw.sh
|
run: src/ci/scripts/install-mingw.sh
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: install ninja
|
- name: install ninja
|
||||||
run: src/ci/scripts/install-ninja.sh
|
run: src/ci/scripts/install-ninja.sh
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: enable ipv6 on Docker
|
- name: enable ipv6 on Docker
|
||||||
run: src/ci/scripts/enable-docker-ipv6.sh
|
run: src/ci/scripts/enable-docker-ipv6.sh
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: disable git crlf conversion
|
- name: disable git crlf conversion
|
||||||
run: src/ci/scripts/disable-git-crlf-conversion.sh
|
run: src/ci/scripts/disable-git-crlf-conversion.sh
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: ensure line endings are correct
|
- name: ensure line endings are correct
|
||||||
run: src/ci/scripts/verify-line-endings.sh
|
run: src/ci/scripts/verify-line-endings.sh
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: ensure backported commits are in upstream branches
|
- name: ensure backported commits are in upstream branches
|
||||||
run: src/ci/scripts/verify-backported-commits.sh
|
run: src/ci/scripts/verify-backported-commits.sh
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: ensure the stable version number is correct
|
- name: ensure the stable version number is correct
|
||||||
run: src/ci/scripts/verify-stable-version-number.sh
|
run: src/ci/scripts/verify-stable-version-number.sh
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: run the build
|
- name: run the build
|
||||||
run: src/ci/scripts/run-build-from-ci.sh 2>&1
|
run: src/ci/scripts/run-build-from-ci.sh 2>&1
|
||||||
env:
|
env:
|
||||||
AWS_ACCESS_KEY_ID: "${{ env.CACHES_AWS_ACCESS_KEY_ID }}"
|
AWS_ACCESS_KEY_ID: "${{ env.CACHES_AWS_ACCESS_KEY_ID }}"
|
||||||
AWS_SECRET_ACCESS_KEY: "${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}"
|
AWS_SECRET_ACCESS_KEY: "${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}"
|
||||||
TOOLSTATE_REPO_ACCESS_TOKEN: "${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}"
|
TOOLSTATE_REPO_ACCESS_TOKEN: "${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}"
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: create github artifacts
|
- name: create github artifacts
|
||||||
run: src/ci/scripts/create-doc-artifacts.sh
|
run: src/ci/scripts/create-doc-artifacts.sh
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: upload artifacts to github
|
- name: upload artifacts to github
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@ -171,13 +146,12 @@ jobs:
|
|||||||
path: obj/artifacts/doc
|
path: obj/artifacts/doc
|
||||||
if-no-files-found: ignore
|
if-no-files-found: ignore
|
||||||
retention-days: 5
|
retention-days: 5
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
- name: upload artifacts to S3
|
- name: upload artifacts to S3
|
||||||
run: src/ci/scripts/upload-artifacts.sh
|
run: src/ci/scripts/upload-artifacts.sh
|
||||||
env:
|
env:
|
||||||
AWS_ACCESS_KEY_ID: "${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}"
|
AWS_ACCESS_KEY_ID: "${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}"
|
||||||
AWS_SECRET_ACCESS_KEY: "${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}"
|
AWS_SECRET_ACCESS_KEY: "${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}"
|
||||||
if: "success() && !env.SKIP_JOB && (github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1')"
|
if: "success() && (github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1')"
|
||||||
master:
|
master:
|
||||||
name: master
|
name: master
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -202,7 +176,6 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
TOOLSTATE_REPO_ACCESS_TOKEN: "${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}"
|
TOOLSTATE_REPO_ACCESS_TOKEN: "${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}"
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
try-success:
|
try-success:
|
||||||
needs:
|
needs:
|
||||||
- job
|
- job
|
||||||
|
@ -3345,6 +3345,7 @@ version = "0.0.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"object 0.34.0",
|
"object 0.34.0",
|
||||||
"regex",
|
"regex",
|
||||||
|
"similar",
|
||||||
"wasmparser",
|
"wasmparser",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -5140,6 +5141,12 @@ version = "1.3.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "similar"
|
||||||
|
version = "2.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fa42c91313f1d05da9b26f267f931cf178d4aba455b4c4622dd7355eb80c6640"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "siphasher"
|
name = "siphasher"
|
||||||
version = "0.3.11"
|
version = "0.3.11"
|
||||||
|
@ -2786,6 +2786,7 @@ pub enum AttrKind {
|
|||||||
#[derive(Clone, Encodable, Decodable, Debug)]
|
#[derive(Clone, Encodable, Decodable, Debug)]
|
||||||
pub struct NormalAttr {
|
pub struct NormalAttr {
|
||||||
pub item: AttrItem,
|
pub item: AttrItem,
|
||||||
|
// Tokens for the full attribute, e.g. `#[foo]`, `#![bar]`.
|
||||||
pub tokens: Option<LazyAttrTokenStream>,
|
pub tokens: Option<LazyAttrTokenStream>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2802,6 +2803,7 @@ impl NormalAttr {
|
|||||||
pub struct AttrItem {
|
pub struct AttrItem {
|
||||||
pub path: Path,
|
pub path: Path,
|
||||||
pub args: AttrArgs,
|
pub args: AttrArgs,
|
||||||
|
// Tokens for the meta item, e.g. just the `foo` within `#[foo]` or `#![foo]`.
|
||||||
pub tokens: Option<LazyAttrTokenStream>,
|
pub tokens: Option<LazyAttrTokenStream>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,7 +298,10 @@ impl MetaItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn value_str(&self) -> Option<Symbol> {
|
pub fn value_str(&self) -> Option<Symbol> {
|
||||||
self.kind.value_str()
|
match &self.kind {
|
||||||
|
MetaItemKind::NameValue(v) => v.kind.str(),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_tokens<'a, I>(tokens: &mut iter::Peekable<I>) -> Option<MetaItem>
|
fn from_tokens<'a, I>(tokens: &mut iter::Peekable<I>) -> Option<MetaItem>
|
||||||
@ -362,13 +365,6 @@ impl MetaItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl MetaItemKind {
|
impl MetaItemKind {
|
||||||
pub fn value_str(&self) -> Option<Symbol> {
|
|
||||||
match self {
|
|
||||||
MetaItemKind::NameValue(v) => v.kind.str(),
|
|
||||||
_ => None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn list_from_tokens(tokens: TokenStream) -> Option<ThinVec<NestedMetaItem>> {
|
fn list_from_tokens(tokens: TokenStream) -> Option<ThinVec<NestedMetaItem>> {
|
||||||
let mut tokens = tokens.trees().peekable();
|
let mut tokens = tokens.trees().peekable();
|
||||||
let mut result = ThinVec::new();
|
let mut result = ThinVec::new();
|
||||||
@ -468,8 +464,9 @@ impl NestedMetaItem {
|
|||||||
self.meta_item().and_then(|meta_item| meta_item.meta_item_list())
|
self.meta_item().and_then(|meta_item| meta_item.meta_item_list())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a name and single literal value tuple of the `MetaItem`.
|
/// If it's a singleton list of the form `foo(lit)`, returns the `foo` and
|
||||||
pub fn name_value_literal(&self) -> Option<(Symbol, &MetaItemLit)> {
|
/// the `lit`.
|
||||||
|
pub fn singleton_lit_list(&self) -> Option<(Symbol, &MetaItemLit)> {
|
||||||
self.meta_item().and_then(|meta_item| {
|
self.meta_item().and_then(|meta_item| {
|
||||||
meta_item.meta_item_list().and_then(|meta_item_list| {
|
meta_item.meta_item_list().and_then(|meta_item_list| {
|
||||||
if meta_item_list.len() == 1
|
if meta_item_list.len() == 1
|
||||||
|
@ -335,7 +335,7 @@ pub fn visit_clobber<T: DummyAstNode>(t: &mut T, f: impl FnOnce(T) -> T) {
|
|||||||
|
|
||||||
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn visit_vec<T, F>(elems: &mut Vec<T>, mut visit_elem: F)
|
fn visit_vec<T, F>(elems: &mut Vec<T>, mut visit_elem: F)
|
||||||
where
|
where
|
||||||
F: FnMut(&mut T),
|
F: FnMut(&mut T),
|
||||||
{
|
{
|
||||||
@ -346,7 +346,7 @@ where
|
|||||||
|
|
||||||
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn visit_thin_vec<T, F>(elems: &mut ThinVec<T>, mut visit_elem: F)
|
fn visit_thin_vec<T, F>(elems: &mut ThinVec<T>, mut visit_elem: F)
|
||||||
where
|
where
|
||||||
F: FnMut(&mut T),
|
F: FnMut(&mut T),
|
||||||
{
|
{
|
||||||
@ -357,7 +357,7 @@ where
|
|||||||
|
|
||||||
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn visit_opt<T, F>(opt: &mut Option<T>, mut visit_elem: F)
|
fn visit_opt<T, F>(opt: &mut Option<T>, mut visit_elem: F)
|
||||||
where
|
where
|
||||||
F: FnMut(&mut T),
|
F: FnMut(&mut T),
|
||||||
{
|
{
|
||||||
@ -367,36 +367,37 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
||||||
pub fn visit_attrs<T: MutVisitor>(attrs: &mut AttrVec, vis: &mut T) {
|
fn visit_attrs<T: MutVisitor>(attrs: &mut AttrVec, vis: &mut T) {
|
||||||
for attr in attrs.iter_mut() {
|
for attr in attrs.iter_mut() {
|
||||||
vis.visit_attribute(attr);
|
vis.visit_attribute(attr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
||||||
pub fn visit_exprs<T: MutVisitor>(exprs: &mut Vec<P<Expr>>, vis: &mut T) {
|
#[allow(unused)]
|
||||||
|
fn visit_exprs<T: MutVisitor>(exprs: &mut Vec<P<Expr>>, vis: &mut T) {
|
||||||
exprs.flat_map_in_place(|expr| vis.filter_map_expr(expr))
|
exprs.flat_map_in_place(|expr| vis.filter_map_expr(expr))
|
||||||
}
|
}
|
||||||
|
|
||||||
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
||||||
pub fn visit_thin_exprs<T: MutVisitor>(exprs: &mut ThinVec<P<Expr>>, vis: &mut T) {
|
fn visit_thin_exprs<T: MutVisitor>(exprs: &mut ThinVec<P<Expr>>, vis: &mut T) {
|
||||||
exprs.flat_map_in_place(|expr| vis.filter_map_expr(expr))
|
exprs.flat_map_in_place(|expr| vis.filter_map_expr(expr))
|
||||||
}
|
}
|
||||||
|
|
||||||
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
||||||
pub fn visit_bounds<T: MutVisitor>(bounds: &mut GenericBounds, vis: &mut T) {
|
fn visit_bounds<T: MutVisitor>(bounds: &mut GenericBounds, vis: &mut T) {
|
||||||
visit_vec(bounds, |bound| vis.visit_param_bound(bound));
|
visit_vec(bounds, |bound| vis.visit_param_bound(bound));
|
||||||
}
|
}
|
||||||
|
|
||||||
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
||||||
pub fn visit_fn_sig<T: MutVisitor>(FnSig { header, decl, span }: &mut FnSig, vis: &mut T) {
|
fn visit_fn_sig<T: MutVisitor>(FnSig { header, decl, span }: &mut FnSig, vis: &mut T) {
|
||||||
vis.visit_fn_header(header);
|
vis.visit_fn_header(header);
|
||||||
vis.visit_fn_decl(decl);
|
vis.visit_fn_decl(decl);
|
||||||
vis.visit_span(span);
|
vis.visit_span(span);
|
||||||
}
|
}
|
||||||
|
|
||||||
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
||||||
pub fn visit_attr_args<T: MutVisitor>(args: &mut AttrArgs, vis: &mut T) {
|
fn visit_attr_args<T: MutVisitor>(args: &mut AttrArgs, vis: &mut T) {
|
||||||
match args {
|
match args {
|
||||||
AttrArgs::Empty => {}
|
AttrArgs::Empty => {}
|
||||||
AttrArgs::Delimited(args) => visit_delim_args(args, vis),
|
AttrArgs::Delimited(args) => visit_delim_args(args, vis),
|
||||||
@ -411,7 +412,7 @@ pub fn visit_attr_args<T: MutVisitor>(args: &mut AttrArgs, vis: &mut T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
||||||
pub fn visit_delim_args<T: MutVisitor>(args: &mut DelimArgs, vis: &mut T) {
|
fn visit_delim_args<T: MutVisitor>(args: &mut DelimArgs, vis: &mut T) {
|
||||||
let DelimArgs { dspan, delim: _, tokens } = args;
|
let DelimArgs { dspan, delim: _, tokens } = args;
|
||||||
visit_delim_span(dspan, vis);
|
visit_delim_span(dspan, vis);
|
||||||
visit_tts(tokens, vis);
|
visit_tts(tokens, vis);
|
||||||
@ -435,7 +436,7 @@ pub fn noop_flat_map_pat_field<T: MutVisitor>(
|
|||||||
smallvec![fp]
|
smallvec![fp]
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_use_tree<T: MutVisitor>(use_tree: &mut UseTree, vis: &mut T) {
|
fn noop_visit_use_tree<T: MutVisitor>(use_tree: &mut UseTree, vis: &mut T) {
|
||||||
let UseTree { prefix, kind, span } = use_tree;
|
let UseTree { prefix, kind, span } = use_tree;
|
||||||
vis.visit_path(prefix);
|
vis.visit_path(prefix);
|
||||||
match kind {
|
match kind {
|
||||||
@ -462,7 +463,7 @@ pub fn noop_flat_map_arm<T: MutVisitor>(mut arm: Arm, vis: &mut T) -> SmallVec<[
|
|||||||
smallvec![arm]
|
smallvec![arm]
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_constraint<T: MutVisitor>(
|
fn noop_visit_constraint<T: MutVisitor>(
|
||||||
AssocConstraint { id, ident, gen_args, kind, span }: &mut AssocConstraint,
|
AssocConstraint { id, ident, gen_args, kind, span }: &mut AssocConstraint,
|
||||||
vis: &mut T,
|
vis: &mut T,
|
||||||
) {
|
) {
|
||||||
@ -541,7 +542,7 @@ pub fn noop_visit_ty<T: MutVisitor>(ty: &mut P<Ty>, vis: &mut T) {
|
|||||||
visit_lazy_tts(tokens, vis);
|
visit_lazy_tts(tokens, vis);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_foreign_mod<T: MutVisitor>(foreign_mod: &mut ForeignMod, vis: &mut T) {
|
fn noop_visit_foreign_mod<T: MutVisitor>(foreign_mod: &mut ForeignMod, vis: &mut T) {
|
||||||
let ForeignMod { unsafety, abi: _, items } = foreign_mod;
|
let ForeignMod { unsafety, abi: _, items } = foreign_mod;
|
||||||
visit_unsafety(unsafety, vis);
|
visit_unsafety(unsafety, vis);
|
||||||
items.flat_map_in_place(|item| vis.flat_map_foreign_item(item));
|
items.flat_map_in_place(|item| vis.flat_map_foreign_item(item));
|
||||||
@ -562,11 +563,11 @@ pub fn noop_flat_map_variant<T: MutVisitor>(
|
|||||||
smallvec![variant]
|
smallvec![variant]
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_ident<T: MutVisitor>(Ident { name: _, span }: &mut Ident, vis: &mut T) {
|
fn noop_visit_ident<T: MutVisitor>(Ident { name: _, span }: &mut Ident, vis: &mut T) {
|
||||||
vis.visit_span(span);
|
vis.visit_span(span);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_path<T: MutVisitor>(Path { segments, span, tokens }: &mut Path, vis: &mut T) {
|
fn noop_visit_path<T: MutVisitor>(Path { segments, span, tokens }: &mut Path, vis: &mut T) {
|
||||||
vis.visit_span(span);
|
vis.visit_span(span);
|
||||||
for PathSegment { ident, id, args } in segments {
|
for PathSegment { ident, id, args } in segments {
|
||||||
vis.visit_ident(ident);
|
vis.visit_ident(ident);
|
||||||
@ -576,7 +577,7 @@ pub fn noop_visit_path<T: MutVisitor>(Path { segments, span, tokens }: &mut Path
|
|||||||
visit_lazy_tts(tokens, vis);
|
visit_lazy_tts(tokens, vis);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_qself<T: MutVisitor>(qself: &mut Option<P<QSelf>>, vis: &mut T) {
|
fn noop_visit_qself<T: MutVisitor>(qself: &mut Option<P<QSelf>>, vis: &mut T) {
|
||||||
visit_opt(qself, |qself| {
|
visit_opt(qself, |qself| {
|
||||||
let QSelf { ty, path_span, position: _ } = &mut **qself;
|
let QSelf { ty, path_span, position: _ } = &mut **qself;
|
||||||
vis.visit_ty(ty);
|
vis.visit_ty(ty);
|
||||||
@ -584,14 +585,14 @@ pub fn noop_visit_qself<T: MutVisitor>(qself: &mut Option<P<QSelf>>, vis: &mut T
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_generic_args<T: MutVisitor>(generic_args: &mut GenericArgs, vis: &mut T) {
|
fn noop_visit_generic_args<T: MutVisitor>(generic_args: &mut GenericArgs, vis: &mut T) {
|
||||||
match generic_args {
|
match generic_args {
|
||||||
GenericArgs::AngleBracketed(data) => vis.visit_angle_bracketed_parameter_data(data),
|
GenericArgs::AngleBracketed(data) => vis.visit_angle_bracketed_parameter_data(data),
|
||||||
GenericArgs::Parenthesized(data) => vis.visit_parenthesized_parameter_data(data),
|
GenericArgs::Parenthesized(data) => vis.visit_parenthesized_parameter_data(data),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_generic_arg<T: MutVisitor>(arg: &mut GenericArg, vis: &mut T) {
|
fn noop_visit_generic_arg<T: MutVisitor>(arg: &mut GenericArg, vis: &mut T) {
|
||||||
match arg {
|
match arg {
|
||||||
GenericArg::Lifetime(lt) => vis.visit_lifetime(lt),
|
GenericArg::Lifetime(lt) => vis.visit_lifetime(lt),
|
||||||
GenericArg::Type(ty) => vis.visit_ty(ty),
|
GenericArg::Type(ty) => vis.visit_ty(ty),
|
||||||
@ -599,7 +600,7 @@ pub fn noop_visit_generic_arg<T: MutVisitor>(arg: &mut GenericArg, vis: &mut T)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_angle_bracketed_parameter_data<T: MutVisitor>(
|
fn noop_visit_angle_bracketed_parameter_data<T: MutVisitor>(
|
||||||
data: &mut AngleBracketedArgs,
|
data: &mut AngleBracketedArgs,
|
||||||
vis: &mut T,
|
vis: &mut T,
|
||||||
) {
|
) {
|
||||||
@ -611,7 +612,7 @@ pub fn noop_visit_angle_bracketed_parameter_data<T: MutVisitor>(
|
|||||||
vis.visit_span(span);
|
vis.visit_span(span);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_parenthesized_parameter_data<T: MutVisitor>(
|
fn noop_visit_parenthesized_parameter_data<T: MutVisitor>(
|
||||||
args: &mut ParenthesizedArgs,
|
args: &mut ParenthesizedArgs,
|
||||||
vis: &mut T,
|
vis: &mut T,
|
||||||
) {
|
) {
|
||||||
@ -621,7 +622,7 @@ pub fn noop_visit_parenthesized_parameter_data<T: MutVisitor>(
|
|||||||
vis.visit_span(span);
|
vis.visit_span(span);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_local<T: MutVisitor>(local: &mut P<Local>, vis: &mut T) {
|
fn noop_visit_local<T: MutVisitor>(local: &mut P<Local>, vis: &mut T) {
|
||||||
let Local { id, pat, ty, kind, span, colon_sp, attrs, tokens } = local.deref_mut();
|
let Local { id, pat, ty, kind, span, colon_sp, attrs, tokens } = local.deref_mut();
|
||||||
vis.visit_id(id);
|
vis.visit_id(id);
|
||||||
vis.visit_pat(pat);
|
vis.visit_pat(pat);
|
||||||
@ -642,7 +643,7 @@ pub fn noop_visit_local<T: MutVisitor>(local: &mut P<Local>, vis: &mut T) {
|
|||||||
visit_lazy_tts(tokens, vis);
|
visit_lazy_tts(tokens, vis);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_attribute<T: MutVisitor>(attr: &mut Attribute, vis: &mut T) {
|
fn noop_visit_attribute<T: MutVisitor>(attr: &mut Attribute, vis: &mut T) {
|
||||||
let Attribute { kind, id: _, style: _, span } = attr;
|
let Attribute { kind, id: _, style: _, span } = attr;
|
||||||
match kind {
|
match kind {
|
||||||
AttrKind::Normal(normal) => {
|
AttrKind::Normal(normal) => {
|
||||||
@ -658,25 +659,25 @@ pub fn noop_visit_attribute<T: MutVisitor>(attr: &mut Attribute, vis: &mut T) {
|
|||||||
vis.visit_span(span);
|
vis.visit_span(span);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_mac<T: MutVisitor>(mac: &mut MacCall, vis: &mut T) {
|
fn noop_visit_mac<T: MutVisitor>(mac: &mut MacCall, vis: &mut T) {
|
||||||
let MacCall { path, args } = mac;
|
let MacCall { path, args } = mac;
|
||||||
vis.visit_path(path);
|
vis.visit_path(path);
|
||||||
visit_delim_args(args, vis);
|
visit_delim_args(args, vis);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_macro_def<T: MutVisitor>(macro_def: &mut MacroDef, vis: &mut T) {
|
fn noop_visit_macro_def<T: MutVisitor>(macro_def: &mut MacroDef, vis: &mut T) {
|
||||||
let MacroDef { body, macro_rules: _ } = macro_def;
|
let MacroDef { body, macro_rules: _ } = macro_def;
|
||||||
visit_delim_args(body, vis);
|
visit_delim_args(body, vis);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_meta_list_item<T: MutVisitor>(li: &mut NestedMetaItem, vis: &mut T) {
|
fn noop_visit_meta_list_item<T: MutVisitor>(li: &mut NestedMetaItem, vis: &mut T) {
|
||||||
match li {
|
match li {
|
||||||
NestedMetaItem::MetaItem(mi) => vis.visit_meta_item(mi),
|
NestedMetaItem::MetaItem(mi) => vis.visit_meta_item(mi),
|
||||||
NestedMetaItem::Lit(_lit) => {}
|
NestedMetaItem::Lit(_lit) => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_meta_item<T: MutVisitor>(mi: &mut MetaItem, vis: &mut T) {
|
fn noop_visit_meta_item<T: MutVisitor>(mi: &mut MetaItem, vis: &mut T) {
|
||||||
let MetaItem { path: _, kind, span } = mi;
|
let MetaItem { path: _, kind, span } = mi;
|
||||||
match kind {
|
match kind {
|
||||||
MetaItemKind::Word => {}
|
MetaItemKind::Word => {}
|
||||||
@ -697,7 +698,7 @@ pub fn noop_flat_map_param<T: MutVisitor>(mut param: Param, vis: &mut T) -> Smal
|
|||||||
}
|
}
|
||||||
|
|
||||||
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
||||||
pub fn visit_attr_tt<T: MutVisitor>(tt: &mut AttrTokenTree, vis: &mut T) {
|
fn visit_attr_tt<T: MutVisitor>(tt: &mut AttrTokenTree, vis: &mut T) {
|
||||||
match tt {
|
match tt {
|
||||||
AttrTokenTree::Token(token, _) => {
|
AttrTokenTree::Token(token, _) => {
|
||||||
visit_token(token, vis);
|
visit_token(token, vis);
|
||||||
@ -724,7 +725,7 @@ pub fn visit_attr_tt<T: MutVisitor>(tt: &mut AttrTokenTree, vis: &mut T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
||||||
pub fn visit_tt<T: MutVisitor>(tt: &mut TokenTree, vis: &mut T) {
|
fn visit_tt<T: MutVisitor>(tt: &mut TokenTree, vis: &mut T) {
|
||||||
match tt {
|
match tt {
|
||||||
TokenTree::Token(token, _) => {
|
TokenTree::Token(token, _) => {
|
||||||
visit_token(token, vis);
|
visit_token(token, vis);
|
||||||
@ -738,24 +739,21 @@ pub fn visit_tt<T: MutVisitor>(tt: &mut TokenTree, vis: &mut T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
||||||
pub fn visit_tts<T: MutVisitor>(TokenStream(tts): &mut TokenStream, vis: &mut T) {
|
fn visit_tts<T: MutVisitor>(TokenStream(tts): &mut TokenStream, vis: &mut T) {
|
||||||
if T::VISIT_TOKENS && !tts.is_empty() {
|
if T::VISIT_TOKENS && !tts.is_empty() {
|
||||||
let tts = Lrc::make_mut(tts);
|
let tts = Lrc::make_mut(tts);
|
||||||
visit_vec(tts, |tree| visit_tt(tree, vis));
|
visit_vec(tts, |tree| visit_tt(tree, vis));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn visit_attr_tts<T: MutVisitor>(AttrTokenStream(tts): &mut AttrTokenStream, vis: &mut T) {
|
fn visit_attr_tts<T: MutVisitor>(AttrTokenStream(tts): &mut AttrTokenStream, vis: &mut T) {
|
||||||
if T::VISIT_TOKENS && !tts.is_empty() {
|
if T::VISIT_TOKENS && !tts.is_empty() {
|
||||||
let tts = Lrc::make_mut(tts);
|
let tts = Lrc::make_mut(tts);
|
||||||
visit_vec(tts, |tree| visit_attr_tt(tree, vis));
|
visit_vec(tts, |tree| visit_attr_tt(tree, vis));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn visit_lazy_tts_opt_mut<T: MutVisitor>(
|
fn visit_lazy_tts_opt_mut<T: MutVisitor>(lazy_tts: Option<&mut LazyAttrTokenStream>, vis: &mut T) {
|
||||||
lazy_tts: Option<&mut LazyAttrTokenStream>,
|
|
||||||
vis: &mut T,
|
|
||||||
) {
|
|
||||||
if T::VISIT_TOKENS {
|
if T::VISIT_TOKENS {
|
||||||
if let Some(lazy_tts) = lazy_tts {
|
if let Some(lazy_tts) = lazy_tts {
|
||||||
let mut tts = lazy_tts.to_attr_token_stream();
|
let mut tts = lazy_tts.to_attr_token_stream();
|
||||||
@ -765,7 +763,7 @@ pub fn visit_lazy_tts_opt_mut<T: MutVisitor>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn visit_lazy_tts<T: MutVisitor>(lazy_tts: &mut Option<LazyAttrTokenStream>, vis: &mut T) {
|
fn visit_lazy_tts<T: MutVisitor>(lazy_tts: &mut Option<LazyAttrTokenStream>, vis: &mut T) {
|
||||||
visit_lazy_tts_opt_mut(lazy_tts.as_mut(), vis);
|
visit_lazy_tts_opt_mut(lazy_tts.as_mut(), vis);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -818,7 +816,7 @@ pub fn visit_token<T: MutVisitor>(t: &mut Token, vis: &mut T) {
|
|||||||
// contain multiple items, but decided against it when I looked at
|
// contain multiple items, but decided against it when I looked at
|
||||||
// `parse_item_or_view_item` and tried to figure out what I would do with
|
// `parse_item_or_view_item` and tried to figure out what I would do with
|
||||||
// multiple items there....
|
// multiple items there....
|
||||||
pub fn visit_nonterminal<T: MutVisitor>(nt: &mut token::Nonterminal, vis: &mut T) {
|
fn visit_nonterminal<T: MutVisitor>(nt: &mut token::Nonterminal, vis: &mut T) {
|
||||||
match nt {
|
match nt {
|
||||||
token::NtItem(item) => visit_clobber(item, |item| {
|
token::NtItem(item) => visit_clobber(item, |item| {
|
||||||
// This is probably okay, because the only visitors likely to
|
// This is probably okay, because the only visitors likely to
|
||||||
@ -851,7 +849,7 @@ pub fn visit_nonterminal<T: MutVisitor>(nt: &mut token::Nonterminal, vis: &mut T
|
|||||||
}
|
}
|
||||||
|
|
||||||
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
||||||
pub fn visit_defaultness<T: MutVisitor>(defaultness: &mut Defaultness, vis: &mut T) {
|
fn visit_defaultness<T: MutVisitor>(defaultness: &mut Defaultness, vis: &mut T) {
|
||||||
match defaultness {
|
match defaultness {
|
||||||
Defaultness::Default(span) => vis.visit_span(span),
|
Defaultness::Default(span) => vis.visit_span(span),
|
||||||
Defaultness::Final => {}
|
Defaultness::Final => {}
|
||||||
@ -859,7 +857,7 @@ pub fn visit_defaultness<T: MutVisitor>(defaultness: &mut Defaultness, vis: &mut
|
|||||||
}
|
}
|
||||||
|
|
||||||
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
||||||
pub fn visit_unsafety<T: MutVisitor>(unsafety: &mut Unsafe, vis: &mut T) {
|
fn visit_unsafety<T: MutVisitor>(unsafety: &mut Unsafe, vis: &mut T) {
|
||||||
match unsafety {
|
match unsafety {
|
||||||
Unsafe::Yes(span) => vis.visit_span(span),
|
Unsafe::Yes(span) => vis.visit_span(span),
|
||||||
Unsafe::No => {}
|
Unsafe::No => {}
|
||||||
@ -867,7 +865,7 @@ pub fn visit_unsafety<T: MutVisitor>(unsafety: &mut Unsafe, vis: &mut T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
||||||
pub fn visit_polarity<T: MutVisitor>(polarity: &mut ImplPolarity, vis: &mut T) {
|
fn visit_polarity<T: MutVisitor>(polarity: &mut ImplPolarity, vis: &mut T) {
|
||||||
match polarity {
|
match polarity {
|
||||||
ImplPolarity::Positive => {}
|
ImplPolarity::Positive => {}
|
||||||
ImplPolarity::Negative(span) => vis.visit_span(span),
|
ImplPolarity::Negative(span) => vis.visit_span(span),
|
||||||
@ -875,14 +873,14 @@ pub fn visit_polarity<T: MutVisitor>(polarity: &mut ImplPolarity, vis: &mut T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
|
||||||
pub fn visit_constness<T: MutVisitor>(constness: &mut Const, vis: &mut T) {
|
fn visit_constness<T: MutVisitor>(constness: &mut Const, vis: &mut T) {
|
||||||
match constness {
|
match constness {
|
||||||
Const::Yes(span) => vis.visit_span(span),
|
Const::Yes(span) => vis.visit_span(span),
|
||||||
Const::No => {}
|
Const::No => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_closure_binder<T: MutVisitor>(binder: &mut ClosureBinder, vis: &mut T) {
|
fn noop_visit_closure_binder<T: MutVisitor>(binder: &mut ClosureBinder, vis: &mut T) {
|
||||||
match binder {
|
match binder {
|
||||||
ClosureBinder::NotPresent => {}
|
ClosureBinder::NotPresent => {}
|
||||||
ClosureBinder::For { span: _, generic_params } => {
|
ClosureBinder::For { span: _, generic_params } => {
|
||||||
@ -891,7 +889,7 @@ pub fn noop_visit_closure_binder<T: MutVisitor>(binder: &mut ClosureBinder, vis:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_coroutine_kind<T: MutVisitor>(coroutine_kind: &mut CoroutineKind, vis: &mut T) {
|
fn noop_visit_coroutine_kind<T: MutVisitor>(coroutine_kind: &mut CoroutineKind, vis: &mut T) {
|
||||||
match coroutine_kind {
|
match coroutine_kind {
|
||||||
CoroutineKind::Async { span, closure_id, return_impl_trait_id }
|
CoroutineKind::Async { span, closure_id, return_impl_trait_id }
|
||||||
| CoroutineKind::Gen { span, closure_id, return_impl_trait_id }
|
| CoroutineKind::Gen { span, closure_id, return_impl_trait_id }
|
||||||
@ -903,27 +901,27 @@ pub fn noop_visit_coroutine_kind<T: MutVisitor>(coroutine_kind: &mut CoroutineKi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_fn_decl<T: MutVisitor>(decl: &mut P<FnDecl>, vis: &mut T) {
|
fn noop_visit_fn_decl<T: MutVisitor>(decl: &mut P<FnDecl>, vis: &mut T) {
|
||||||
let FnDecl { inputs, output } = decl.deref_mut();
|
let FnDecl { inputs, output } = decl.deref_mut();
|
||||||
inputs.flat_map_in_place(|param| vis.flat_map_param(param));
|
inputs.flat_map_in_place(|param| vis.flat_map_param(param));
|
||||||
noop_visit_fn_ret_ty(output, vis);
|
noop_visit_fn_ret_ty(output, vis);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_fn_ret_ty<T: MutVisitor>(fn_ret_ty: &mut FnRetTy, vis: &mut T) {
|
fn noop_visit_fn_ret_ty<T: MutVisitor>(fn_ret_ty: &mut FnRetTy, vis: &mut T) {
|
||||||
match fn_ret_ty {
|
match fn_ret_ty {
|
||||||
FnRetTy::Default(span) => vis.visit_span(span),
|
FnRetTy::Default(span) => vis.visit_span(span),
|
||||||
FnRetTy::Ty(ty) => vis.visit_ty(ty),
|
FnRetTy::Ty(ty) => vis.visit_ty(ty),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_param_bound<T: MutVisitor>(pb: &mut GenericBound, vis: &mut T) {
|
fn noop_visit_param_bound<T: MutVisitor>(pb: &mut GenericBound, vis: &mut T) {
|
||||||
match pb {
|
match pb {
|
||||||
GenericBound::Trait(ty, _modifier) => vis.visit_poly_trait_ref(ty),
|
GenericBound::Trait(ty, _modifier) => vis.visit_poly_trait_ref(ty),
|
||||||
GenericBound::Outlives(lifetime) => noop_visit_lifetime(lifetime, vis),
|
GenericBound::Outlives(lifetime) => noop_visit_lifetime(lifetime, vis),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_precise_capturing_arg<T: MutVisitor>(arg: &mut PreciseCapturingArg, vis: &mut T) {
|
fn noop_visit_precise_capturing_arg<T: MutVisitor>(arg: &mut PreciseCapturingArg, vis: &mut T) {
|
||||||
match arg {
|
match arg {
|
||||||
PreciseCapturingArg::Lifetime(lt) => {
|
PreciseCapturingArg::Lifetime(lt) => {
|
||||||
vis.visit_lifetime(lt);
|
vis.visit_lifetime(lt);
|
||||||
@ -960,7 +958,7 @@ pub fn noop_flat_map_generic_param<T: MutVisitor>(
|
|||||||
smallvec![param]
|
smallvec![param]
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_label<T: MutVisitor>(Label { ident }: &mut Label, vis: &mut T) {
|
fn noop_visit_label<T: MutVisitor>(Label { ident }: &mut Label, vis: &mut T) {
|
||||||
vis.visit_ident(ident);
|
vis.visit_ident(ident);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -969,20 +967,20 @@ fn noop_visit_lifetime<T: MutVisitor>(Lifetime { id, ident }: &mut Lifetime, vis
|
|||||||
vis.visit_ident(ident);
|
vis.visit_ident(ident);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_generics<T: MutVisitor>(generics: &mut Generics, vis: &mut T) {
|
fn noop_visit_generics<T: MutVisitor>(generics: &mut Generics, vis: &mut T) {
|
||||||
let Generics { params, where_clause, span } = generics;
|
let Generics { params, where_clause, span } = generics;
|
||||||
params.flat_map_in_place(|param| vis.flat_map_generic_param(param));
|
params.flat_map_in_place(|param| vis.flat_map_generic_param(param));
|
||||||
vis.visit_where_clause(where_clause);
|
vis.visit_where_clause(where_clause);
|
||||||
vis.visit_span(span);
|
vis.visit_span(span);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_where_clause<T: MutVisitor>(wc: &mut WhereClause, vis: &mut T) {
|
fn noop_visit_where_clause<T: MutVisitor>(wc: &mut WhereClause, vis: &mut T) {
|
||||||
let WhereClause { has_where_token: _, predicates, span } = wc;
|
let WhereClause { has_where_token: _, predicates, span } = wc;
|
||||||
visit_thin_vec(predicates, |predicate| vis.visit_where_predicate(predicate));
|
visit_thin_vec(predicates, |predicate| vis.visit_where_predicate(predicate));
|
||||||
vis.visit_span(span);
|
vis.visit_span(span);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_where_predicate<T: MutVisitor>(pred: &mut WherePredicate, vis: &mut T) {
|
fn noop_visit_where_predicate<T: MutVisitor>(pred: &mut WherePredicate, vis: &mut T) {
|
||||||
match pred {
|
match pred {
|
||||||
WherePredicate::BoundPredicate(bp) => {
|
WherePredicate::BoundPredicate(bp) => {
|
||||||
let WhereBoundPredicate { span, bound_generic_params, bounded_ty, bounds } = bp;
|
let WhereBoundPredicate { span, bound_generic_params, bounded_ty, bounds } = bp;
|
||||||
@ -1006,7 +1004,7 @@ pub fn noop_visit_where_predicate<T: MutVisitor>(pred: &mut WherePredicate, vis:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_variant_data<T: MutVisitor>(vdata: &mut VariantData, vis: &mut T) {
|
fn noop_visit_variant_data<T: MutVisitor>(vdata: &mut VariantData, vis: &mut T) {
|
||||||
match vdata {
|
match vdata {
|
||||||
VariantData::Struct { fields, .. } => {
|
VariantData::Struct { fields, .. } => {
|
||||||
fields.flat_map_in_place(|field| vis.flat_map_field_def(field));
|
fields.flat_map_in_place(|field| vis.flat_map_field_def(field));
|
||||||
@ -1019,12 +1017,12 @@ pub fn noop_visit_variant_data<T: MutVisitor>(vdata: &mut VariantData, vis: &mut
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_trait_ref<T: MutVisitor>(TraitRef { path, ref_id }: &mut TraitRef, vis: &mut T) {
|
fn noop_visit_trait_ref<T: MutVisitor>(TraitRef { path, ref_id }: &mut TraitRef, vis: &mut T) {
|
||||||
vis.visit_path(path);
|
vis.visit_path(path);
|
||||||
vis.visit_id(ref_id);
|
vis.visit_id(ref_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_poly_trait_ref<T: MutVisitor>(p: &mut PolyTraitRef, vis: &mut T) {
|
fn noop_visit_poly_trait_ref<T: MutVisitor>(p: &mut PolyTraitRef, vis: &mut T) {
|
||||||
let PolyTraitRef { bound_generic_params, trait_ref, span } = p;
|
let PolyTraitRef { bound_generic_params, trait_ref, span } = p;
|
||||||
bound_generic_params.flat_map_in_place(|param| vis.flat_map_generic_param(param));
|
bound_generic_params.flat_map_in_place(|param| vis.flat_map_generic_param(param));
|
||||||
vis.visit_trait_ref(trait_ref);
|
vis.visit_trait_ref(trait_ref);
|
||||||
@ -1058,7 +1056,7 @@ pub fn noop_flat_map_expr_field<T: MutVisitor>(
|
|||||||
smallvec![f]
|
smallvec![f]
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_mt<T: MutVisitor>(MutTy { ty, mutbl: _ }: &mut MutTy, vis: &mut T) {
|
fn noop_visit_mt<T: MutVisitor>(MutTy { ty, mutbl: _ }: &mut MutTy, vis: &mut T) {
|
||||||
vis.visit_ty(ty);
|
vis.visit_ty(ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1225,7 +1223,7 @@ fn visit_const_item<T: MutVisitor>(
|
|||||||
visit_opt(expr, |expr| visitor.visit_expr(expr));
|
visit_opt(expr, |expr| visitor.visit_expr(expr));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_fn_header<T: MutVisitor>(header: &mut FnHeader, vis: &mut T) {
|
fn noop_visit_fn_header<T: MutVisitor>(header: &mut FnHeader, vis: &mut T) {
|
||||||
let FnHeader { unsafety, coroutine_kind, constness, ext: _ } = header;
|
let FnHeader { unsafety, coroutine_kind, constness, ext: _ } = header;
|
||||||
visit_constness(constness, vis);
|
visit_constness(constness, vis);
|
||||||
coroutine_kind.as_mut().map(|coroutine_kind| vis.visit_coroutine_kind(coroutine_kind));
|
coroutine_kind.as_mut().map(|coroutine_kind| vis.visit_coroutine_kind(coroutine_kind));
|
||||||
@ -1343,12 +1341,12 @@ pub fn noop_visit_pat<T: MutVisitor>(pat: &mut P<Pat>, vis: &mut T) {
|
|||||||
visit_lazy_tts(tokens, vis);
|
visit_lazy_tts(tokens, vis);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_anon_const<T: MutVisitor>(AnonConst { id, value }: &mut AnonConst, vis: &mut T) {
|
fn noop_visit_anon_const<T: MutVisitor>(AnonConst { id, value }: &mut AnonConst, vis: &mut T) {
|
||||||
vis.visit_id(id);
|
vis.visit_id(id);
|
||||||
vis.visit_expr(value);
|
vis.visit_expr(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_inline_asm<T: MutVisitor>(asm: &mut InlineAsm, vis: &mut T) {
|
fn noop_visit_inline_asm<T: MutVisitor>(asm: &mut InlineAsm, vis: &mut T) {
|
||||||
for (op, _) in &mut asm.operands {
|
for (op, _) in &mut asm.operands {
|
||||||
match op {
|
match op {
|
||||||
InlineAsmOperand::In { expr, .. }
|
InlineAsmOperand::In { expr, .. }
|
||||||
@ -1368,7 +1366,7 @@ pub fn noop_visit_inline_asm<T: MutVisitor>(asm: &mut InlineAsm, vis: &mut T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_inline_asm_sym<T: MutVisitor>(
|
fn noop_visit_inline_asm_sym<T: MutVisitor>(
|
||||||
InlineAsmSym { id, qself, path }: &mut InlineAsmSym,
|
InlineAsmSym { id, qself, path }: &mut InlineAsmSym,
|
||||||
vis: &mut T,
|
vis: &mut T,
|
||||||
) {
|
) {
|
||||||
@ -1377,7 +1375,7 @@ pub fn noop_visit_inline_asm_sym<T: MutVisitor>(
|
|||||||
vis.visit_path(path);
|
vis.visit_path(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_format_args<T: MutVisitor>(fmt: &mut FormatArgs, vis: &mut T) {
|
fn noop_visit_format_args<T: MutVisitor>(fmt: &mut FormatArgs, vis: &mut T) {
|
||||||
for arg in fmt.arguments.all_args_mut() {
|
for arg in fmt.arguments.all_args_mut() {
|
||||||
if let FormatArgumentKind::Named(name) = &mut arg.kind {
|
if let FormatArgumentKind::Named(name) = &mut arg.kind {
|
||||||
vis.visit_ident(name);
|
vis.visit_ident(name);
|
||||||
@ -1594,10 +1592,7 @@ pub fn noop_flat_map_stmt<T: MutVisitor>(
|
|||||||
stmts
|
stmts
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_flat_map_stmt_kind<T: MutVisitor>(
|
fn noop_flat_map_stmt_kind<T: MutVisitor>(kind: StmtKind, vis: &mut T) -> SmallVec<[StmtKind; 1]> {
|
||||||
kind: StmtKind,
|
|
||||||
vis: &mut T,
|
|
||||||
) -> SmallVec<[StmtKind; 1]> {
|
|
||||||
match kind {
|
match kind {
|
||||||
StmtKind::Let(mut local) => smallvec![StmtKind::Let({
|
StmtKind::Let(mut local) => smallvec![StmtKind::Let({
|
||||||
vis.visit_local(&mut local);
|
vis.visit_local(&mut local);
|
||||||
@ -1617,7 +1612,7 @@ pub fn noop_flat_map_stmt_kind<T: MutVisitor>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_vis<T: MutVisitor>(visibility: &mut Visibility, vis: &mut T) {
|
fn noop_visit_vis<T: MutVisitor>(visibility: &mut Visibility, vis: &mut T) {
|
||||||
match &mut visibility.kind {
|
match &mut visibility.kind {
|
||||||
VisibilityKind::Public | VisibilityKind::Inherited => {}
|
VisibilityKind::Public | VisibilityKind::Inherited => {}
|
||||||
VisibilityKind::Restricted { path, id, shorthand: _ } => {
|
VisibilityKind::Restricted { path, id, shorthand: _ } => {
|
||||||
@ -1628,7 +1623,7 @@ pub fn noop_visit_vis<T: MutVisitor>(visibility: &mut Visibility, vis: &mut T) {
|
|||||||
vis.visit_span(&mut visibility.span);
|
vis.visit_span(&mut visibility.span);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_capture_by<T: MutVisitor>(capture_by: &mut CaptureBy, vis: &mut T) {
|
fn noop_visit_capture_by<T: MutVisitor>(capture_by: &mut CaptureBy, vis: &mut T) {
|
||||||
match capture_by {
|
match capture_by {
|
||||||
CaptureBy::Ref => {}
|
CaptureBy::Ref => {}
|
||||||
CaptureBy::Value { move_kw } => {
|
CaptureBy::Value { move_kw } => {
|
||||||
|
@ -140,9 +140,8 @@ impl fmt::Debug for LazyAttrTokenStream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<S: SpanEncoder> Encodable<S> for LazyAttrTokenStream {
|
impl<S: SpanEncoder> Encodable<S> for LazyAttrTokenStream {
|
||||||
fn encode(&self, s: &mut S) {
|
fn encode(&self, _s: &mut S) {
|
||||||
// Used by AST json printing.
|
panic!("Attempted to encode LazyAttrTokenStream");
|
||||||
Encodable::encode(&self.to_attr_token_stream(), s);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -986,7 +986,7 @@ pub fn parse_repr_attr(sess: &Session, attr: &Attribute) -> Vec<ReprAttr> {
|
|||||||
recognised = true;
|
recognised = true;
|
||||||
acc.push(h);
|
acc.push(h);
|
||||||
}
|
}
|
||||||
} else if let Some((name, value)) = item.name_value_literal() {
|
} else if let Some((name, value)) = item.singleton_lit_list() {
|
||||||
let mut literal_error = None;
|
let mut literal_error = None;
|
||||||
let mut err_span = item.span();
|
let mut err_span = item.span();
|
||||||
if name == sym::align {
|
if name == sym::align {
|
||||||
|
@ -1527,7 +1527,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||||||
BorrowKind::Mut { kind: MutBorrowKind::Default | MutBorrowKind::TwoPhaseBorrow },
|
BorrowKind::Mut { kind: MutBorrowKind::Default | MutBorrowKind::TwoPhaseBorrow },
|
||||||
) => {
|
) => {
|
||||||
first_borrow_desc = "mutable ";
|
first_borrow_desc = "mutable ";
|
||||||
self.cannot_reborrow_already_borrowed(
|
let mut err = self.cannot_reborrow_already_borrowed(
|
||||||
span,
|
span,
|
||||||
&desc_place,
|
&desc_place,
|
||||||
&msg_place,
|
&msg_place,
|
||||||
@ -1537,7 +1537,15 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||||||
"mutable",
|
"mutable",
|
||||||
&msg_borrow,
|
&msg_borrow,
|
||||||
None,
|
None,
|
||||||
)
|
);
|
||||||
|
self.suggest_slice_method_if_applicable(
|
||||||
|
&mut err,
|
||||||
|
place,
|
||||||
|
issued_borrow.borrowed_place,
|
||||||
|
span,
|
||||||
|
issued_span,
|
||||||
|
);
|
||||||
|
err
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
BorrowKind::Mut { kind: MutBorrowKind::Default | MutBorrowKind::TwoPhaseBorrow },
|
BorrowKind::Mut { kind: MutBorrowKind::Default | MutBorrowKind::TwoPhaseBorrow },
|
||||||
@ -1555,6 +1563,13 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||||||
&msg_borrow,
|
&msg_borrow,
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
self.suggest_slice_method_if_applicable(
|
||||||
|
&mut err,
|
||||||
|
place,
|
||||||
|
issued_borrow.borrowed_place,
|
||||||
|
span,
|
||||||
|
issued_span,
|
||||||
|
);
|
||||||
self.suggest_binding_for_closure_capture_self(&mut err, &issued_spans);
|
self.suggest_binding_for_closure_capture_self(&mut err, &issued_spans);
|
||||||
self.suggest_using_closure_argument_instead_of_capture(
|
self.suggest_using_closure_argument_instead_of_capture(
|
||||||
&mut err,
|
&mut err,
|
||||||
@ -1581,6 +1596,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||||||
&mut err,
|
&mut err,
|
||||||
place,
|
place,
|
||||||
issued_borrow.borrowed_place,
|
issued_borrow.borrowed_place,
|
||||||
|
span,
|
||||||
|
issued_span,
|
||||||
);
|
);
|
||||||
self.suggest_using_closure_argument_instead_of_capture(
|
self.suggest_using_closure_argument_instead_of_capture(
|
||||||
&mut err,
|
&mut err,
|
||||||
@ -2011,40 +2028,47 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||||||
err: &mut Diag<'_>,
|
err: &mut Diag<'_>,
|
||||||
place: Place<'tcx>,
|
place: Place<'tcx>,
|
||||||
borrowed_place: Place<'tcx>,
|
borrowed_place: Place<'tcx>,
|
||||||
|
span: Span,
|
||||||
|
issued_span: Span,
|
||||||
) {
|
) {
|
||||||
let tcx = self.infcx.tcx;
|
let tcx = self.infcx.tcx;
|
||||||
let hir = tcx.hir();
|
let hir = tcx.hir();
|
||||||
|
|
||||||
|
let has_split_at_mut = |ty: Ty<'tcx>| {
|
||||||
|
let ty = ty.peel_refs();
|
||||||
|
match ty.kind() {
|
||||||
|
ty::Array(..) | ty::Slice(..) => true,
|
||||||
|
ty::Adt(def, _) if tcx.get_diagnostic_item(sym::Vec) == Some(def.did()) => true,
|
||||||
|
_ if ty == tcx.types.str_ => true,
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
|
};
|
||||||
if let ([ProjectionElem::Index(index1)], [ProjectionElem::Index(index2)])
|
if let ([ProjectionElem::Index(index1)], [ProjectionElem::Index(index2)])
|
||||||
| (
|
| (
|
||||||
[ProjectionElem::Deref, ProjectionElem::Index(index1)],
|
[ProjectionElem::Deref, ProjectionElem::Index(index1)],
|
||||||
[ProjectionElem::Deref, ProjectionElem::Index(index2)],
|
[ProjectionElem::Deref, ProjectionElem::Index(index2)],
|
||||||
) = (&place.projection[..], &borrowed_place.projection[..])
|
) = (&place.projection[..], &borrowed_place.projection[..])
|
||||||
{
|
{
|
||||||
|
let decl1 = &self.body.local_decls[*index1];
|
||||||
|
let decl2 = &self.body.local_decls[*index2];
|
||||||
|
|
||||||
let mut note_default_suggestion = || {
|
let mut note_default_suggestion = || {
|
||||||
err.help(
|
err.help(
|
||||||
"consider using `.split_at_mut(position)` or similar method to obtain \
|
"consider using `.split_at_mut(position)` or similar method to obtain two \
|
||||||
two mutable non-overlapping sub-slices",
|
mutable non-overlapping sub-slices",
|
||||||
)
|
)
|
||||||
.help("consider using `.swap(index_1, index_2)` to swap elements at the specified indices");
|
.help(
|
||||||
|
"consider using `.swap(index_1, index_2)` to swap elements at the specified \
|
||||||
|
indices",
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
let Some(body_id) = tcx.hir_node(self.mir_hir_id()).body_id() else {
|
let Some(index1) = self.find_expr(decl1.source_info.span) else {
|
||||||
note_default_suggestion();
|
note_default_suggestion();
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut expr_finder =
|
let Some(index2) = self.find_expr(decl2.source_info.span) else {
|
||||||
FindExprBySpan::new(self.body.local_decls[*index1].source_info.span, tcx);
|
|
||||||
expr_finder.visit_expr(hir.body(body_id).value);
|
|
||||||
let Some(index1) = expr_finder.result else {
|
|
||||||
note_default_suggestion();
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
expr_finder = FindExprBySpan::new(self.body.local_decls[*index2].source_info.span, tcx);
|
|
||||||
expr_finder.visit_expr(hir.body(body_id).value);
|
|
||||||
let Some(index2) = expr_finder.result else {
|
|
||||||
note_default_suggestion();
|
note_default_suggestion();
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
@ -2092,7 +2116,13 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
}) else {
|
}) else {
|
||||||
note_default_suggestion();
|
let hir::Node::Expr(parent) = tcx.parent_hir_node(index1.hir_id) else { return };
|
||||||
|
let hir::ExprKind::Index(_, idx1, _) = parent.kind else { return };
|
||||||
|
let hir::Node::Expr(parent) = tcx.parent_hir_node(index2.hir_id) else { return };
|
||||||
|
let hir::ExprKind::Index(_, idx2, _) = parent.kind else { return };
|
||||||
|
if !idx1.equivalent_for_indexing(idx2) {
|
||||||
|
err.help("use `.split_at_mut(position)` to obtain two mutable non-overlapping sub-slices");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2102,7 +2132,25 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||||||
format!("{obj_str}.swap({index1_str}, {index2_str})"),
|
format!("{obj_str}.swap({index1_str}, {index2_str})"),
|
||||||
Applicability::MachineApplicable,
|
Applicability::MachineApplicable,
|
||||||
);
|
);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
let place_ty = PlaceRef::ty(&place.as_ref(), self.body, tcx).ty;
|
||||||
|
let borrowed_place_ty = PlaceRef::ty(&borrowed_place.as_ref(), self.body, tcx).ty;
|
||||||
|
if !has_split_at_mut(place_ty) && !has_split_at_mut(borrowed_place_ty) {
|
||||||
|
// Only mention `split_at_mut` on `Vec`, array and slices.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let Some(index1) = self.find_expr(span) else { return };
|
||||||
|
let hir::Node::Expr(parent) = tcx.parent_hir_node(index1.hir_id) else { return };
|
||||||
|
let hir::ExprKind::Index(_, idx1, _) = parent.kind else { return };
|
||||||
|
let Some(index2) = self.find_expr(issued_span) else { return };
|
||||||
|
let hir::Node::Expr(parent) = tcx.parent_hir_node(index2.hir_id) else { return };
|
||||||
|
let hir::ExprKind::Index(_, idx2, _) = parent.kind else { return };
|
||||||
|
if idx1.equivalent_for_indexing(idx2) {
|
||||||
|
// `let a = &mut foo[0]` and `let b = &mut foo[0]`? Don't mention `split_at_mut`
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
err.help("use `.split_at_mut(position)` to obtain two mutable non-overlapping sub-slices");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Suggest using `while let` for call `next` on an iterator in a for loop.
|
/// Suggest using `while let` for call `next` on an iterator in a for loop.
|
||||||
@ -3743,7 +3791,6 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||||||
| None => (self.describe_any_place(place.as_ref()), assigned_span),
|
| None => (self.describe_any_place(place.as_ref()), assigned_span),
|
||||||
Some(decl) => (self.describe_any_place(err_place.as_ref()), decl.source_info.span),
|
Some(decl) => (self.describe_any_place(err_place.as_ref()), decl.source_info.span),
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut err = self.cannot_reassign_immutable(span, &place_description, from_arg);
|
let mut err = self.cannot_reassign_immutable(span, &place_description, from_arg);
|
||||||
let msg = if from_arg {
|
let msg = if from_arg {
|
||||||
"cannot assign to immutable argument"
|
"cannot assign to immutable argument"
|
||||||
@ -3763,6 +3810,22 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||||||
format!("mut {name}"),
|
format!("mut {name}"),
|
||||||
Applicability::MachineApplicable,
|
Applicability::MachineApplicable,
|
||||||
);
|
);
|
||||||
|
if !from_arg
|
||||||
|
&& matches!(
|
||||||
|
decl.local_info(),
|
||||||
|
LocalInfo::User(BindingForm::Var(VarBindingForm {
|
||||||
|
opt_match_place: Some((Some(_), _)),
|
||||||
|
..
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
{
|
||||||
|
err.span_suggestion(
|
||||||
|
decl.source_info.span,
|
||||||
|
"to modify the original value, take a borrow instead",
|
||||||
|
format!("ref mut {name}"),
|
||||||
|
Applicability::MaybeIncorrect,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
err.span_label(span, msg);
|
err.span_label(span, msg);
|
||||||
self.buffer_error(err);
|
self.buffer_error(err);
|
||||||
|
@ -7,7 +7,7 @@ use cranelift_codegen::binemit::CodeOffset;
|
|||||||
use cranelift_codegen::MachSrcLoc;
|
use cranelift_codegen::MachSrcLoc;
|
||||||
use gimli::write::{AttributeValue, FileId, FileInfo, LineProgram, LineString, LineStringTable};
|
use gimli::write::{AttributeValue, FileId, FileInfo, LineProgram, LineString, LineStringTable};
|
||||||
use rustc_span::{
|
use rustc_span::{
|
||||||
FileName, Pos, SourceFile, SourceFileAndLine, SourceFileHash, SourceFileHashAlgorithm,
|
hygiene, FileName, Pos, SourceFile, SourceFileAndLine, SourceFileHash, SourceFileHashAlgorithm,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::debuginfo::emit::address_for_func;
|
use crate::debuginfo::emit::address_for_func;
|
||||||
@ -63,11 +63,8 @@ impl DebugContext {
|
|||||||
function_span: Span,
|
function_span: Span,
|
||||||
span: Span,
|
span: Span,
|
||||||
) -> (FileId, u64, u64) {
|
) -> (FileId, u64, u64) {
|
||||||
// Based on https://github.com/rust-lang/rust/blob/e369d87b015a84653343032833d65d0545fd3f26/src/librustc_codegen_ssa/mir/mod.rs#L116-L131
|
// Match behavior of `FunctionCx::adjusted_span_and_dbg_scope`.
|
||||||
// In order to have a good line stepping behavior in debugger, we overwrite debug
|
let span = hygiene::walk_chain_collapsed(span, function_span);
|
||||||
// locations of macro expansions with that of the outermost expansion site (when the macro is
|
|
||||||
// annotated with `#[collapse_debuginfo]` or when `-Zdebug-macros` is provided).
|
|
||||||
let span = tcx.collapsed_debuginfo(span, function_span);
|
|
||||||
match tcx.sess.source_map().lookup_line(span.lo()) {
|
match tcx.sess.source_map().lookup_line(span.lo()) {
|
||||||
Ok(SourceFileAndLine { sf: file, line }) => {
|
Ok(SourceFileAndLine { sf: file, line }) => {
|
||||||
let file_id = self.add_source_file(&file);
|
let file_id = self.add_source_file(&file);
|
||||||
|
@ -2,6 +2,7 @@ use crate::attributes;
|
|||||||
use crate::builder::Builder;
|
use crate::builder::Builder;
|
||||||
use crate::context::CodegenCx;
|
use crate::context::CodegenCx;
|
||||||
use crate::llvm::{self, Attribute, AttributePlace};
|
use crate::llvm::{self, Attribute, AttributePlace};
|
||||||
|
use crate::llvm_util;
|
||||||
use crate::type_::Type;
|
use crate::type_::Type;
|
||||||
use crate::type_of::LayoutLlvmExt;
|
use crate::type_of::LayoutLlvmExt;
|
||||||
use crate::value::Value;
|
use crate::value::Value;
|
||||||
@ -425,6 +426,18 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
|
|||||||
cx.type_array(cx.type_i8(), self.ret.layout.size.bytes()),
|
cx.type_array(cx.type_i8(), self.ret.layout.size.bytes()),
|
||||||
);
|
);
|
||||||
attributes::apply_to_llfn(llfn, llvm::AttributePlace::Argument(i), &[sret]);
|
attributes::apply_to_llfn(llfn, llvm::AttributePlace::Argument(i), &[sret]);
|
||||||
|
if cx.sess().opts.optimize != config::OptLevel::No
|
||||||
|
&& llvm_util::get_version() >= (18, 0, 0)
|
||||||
|
{
|
||||||
|
attributes::apply_to_llfn(
|
||||||
|
llfn,
|
||||||
|
llvm::AttributePlace::Argument(i),
|
||||||
|
&[
|
||||||
|
llvm::AttributeKind::Writable.create_attr(cx.llcx),
|
||||||
|
llvm::AttributeKind::DeadOnUnwind.create_attr(cx.llcx),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
PassMode::Cast { cast, pad_i32: _ } => {
|
PassMode::Cast { cast, pad_i32: _ } => {
|
||||||
cast.attrs.apply_attrs_to_llfn(llvm::AttributePlace::ReturnValue, cx, llfn);
|
cast.attrs.apply_attrs_to_llfn(llvm::AttributePlace::ReturnValue, cx, llfn);
|
||||||
|
@ -200,6 +200,8 @@ pub enum AttributeKind {
|
|||||||
AllocAlign = 39,
|
AllocAlign = 39,
|
||||||
SanitizeSafeStack = 40,
|
SanitizeSafeStack = 40,
|
||||||
FnRetThunkExtern = 41,
|
FnRetThunkExtern = 41,
|
||||||
|
Writable = 42,
|
||||||
|
DeadOnUnwind = 43,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// LLVMIntPredicate
|
/// LLVMIntPredicate
|
||||||
|
@ -435,7 +435,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
|
|||||||
sym::repr => {
|
sym::repr => {
|
||||||
codegen_fn_attrs.alignment = if let Some(items) = attr.meta_item_list()
|
codegen_fn_attrs.alignment = if let Some(items) = attr.meta_item_list()
|
||||||
&& let [item] = items.as_slice()
|
&& let [item] = items.as_slice()
|
||||||
&& let Some((sym::align, literal)) = item.name_value_literal()
|
&& let Some((sym::align, literal)) = item.singleton_lit_list()
|
||||||
{
|
{
|
||||||
rustc_attr::parse_alignment(&literal.kind)
|
rustc_attr::parse_alignment(&literal.kind)
|
||||||
.map_err(|msg| {
|
.map_err(|msg| {
|
||||||
|
@ -4,13 +4,12 @@ use rustc_index::IndexVec;
|
|||||||
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
||||||
use rustc_middle::mir;
|
use rustc_middle::mir;
|
||||||
use rustc_middle::ty;
|
use rustc_middle::ty;
|
||||||
use rustc_middle::ty::layout::TyAndLayout;
|
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
|
||||||
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf};
|
|
||||||
use rustc_middle::ty::Instance;
|
use rustc_middle::ty::Instance;
|
||||||
use rustc_middle::ty::Ty;
|
use rustc_middle::ty::Ty;
|
||||||
use rustc_session::config::DebugInfo;
|
use rustc_session::config::DebugInfo;
|
||||||
use rustc_span::symbol::{kw, Symbol};
|
use rustc_span::symbol::{kw, Symbol};
|
||||||
use rustc_span::{BytePos, Span};
|
use rustc_span::{hygiene, BytePos, Span};
|
||||||
use rustc_target::abi::{Abi, FieldIdx, FieldsShape, Size, VariantIdx};
|
use rustc_target::abi::{Abi, FieldIdx, FieldsShape, Size, VariantIdx};
|
||||||
|
|
||||||
use super::operand::{OperandRef, OperandValue};
|
use super::operand::{OperandRef, OperandValue};
|
||||||
@ -220,26 +219,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||||||
&self,
|
&self,
|
||||||
source_info: mir::SourceInfo,
|
source_info: mir::SourceInfo,
|
||||||
) -> Option<(Bx::DIScope, Option<Bx::DILocation>, Span)> {
|
) -> Option<(Bx::DIScope, Option<Bx::DILocation>, Span)> {
|
||||||
let span = self.adjust_span_for_debugging(source_info.span);
|
|
||||||
let scope = &self.debug_context.as_ref()?.scopes[source_info.scope];
|
let scope = &self.debug_context.as_ref()?.scopes[source_info.scope];
|
||||||
|
let span = hygiene::walk_chain_collapsed(source_info.span, self.mir.span);
|
||||||
Some((scope.adjust_dbg_scope_for_span(self.cx, span), scope.inlined_at, span))
|
Some((scope.adjust_dbg_scope_for_span(self.cx, span), scope.inlined_at, span))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// In order to have a good line stepping behavior in debugger, we overwrite debug
|
|
||||||
/// locations of macro expansions with that of the outermost expansion site (when the macro is
|
|
||||||
/// annotated with `#[collapse_debuginfo]` or when `-Zdebug-macros` is provided).
|
|
||||||
fn adjust_span_for_debugging(&self, span: Span) -> Span {
|
|
||||||
// Bail out if debug info emission is not enabled.
|
|
||||||
if self.debug_context.is_none() {
|
|
||||||
return span;
|
|
||||||
}
|
|
||||||
// Walk up the macro expansion chain until we reach a non-expanded span.
|
|
||||||
// We also stop at the function body level because no line stepping can occur
|
|
||||||
// at the level above that.
|
|
||||||
// Use span of the outermost expansion site, while keeping the original lexical scope.
|
|
||||||
self.cx.tcx().collapsed_debuginfo(span, self.mir.span)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn spill_operand_to_stack(
|
fn spill_operand_to_stack(
|
||||||
operand: OperandRef<'tcx, Bx::Value>,
|
operand: OperandRef<'tcx, Bx::Value>,
|
||||||
name: Option<String>,
|
name: Option<String>,
|
||||||
|
@ -502,7 +502,7 @@ struct DiagCtxtInner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A key denoting where from a diagnostic was stashed.
|
/// A key denoting where from a diagnostic was stashed.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
|
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
|
||||||
pub enum StashKey {
|
pub enum StashKey {
|
||||||
ItemNoType,
|
ItemNoType,
|
||||||
UnderscoreForArrayLengths,
|
UnderscoreForArrayLengths,
|
||||||
@ -779,7 +779,7 @@ impl DiagCtxt {
|
|||||||
// We delay a bug here so that `-Ztreat-err-as-bug -Zeagerly-emit-delayed-bugs`
|
// We delay a bug here so that `-Ztreat-err-as-bug -Zeagerly-emit-delayed-bugs`
|
||||||
// can be used to create a backtrace at the stashing site insted of whenever the
|
// can be used to create a backtrace at the stashing site insted of whenever the
|
||||||
// diagnostic context is dropped and thus delayed bugs are emitted.
|
// diagnostic context is dropped and thus delayed bugs are emitted.
|
||||||
Error => Some(self.span_delayed_bug(span, "stashing {key:?}")),
|
Error => Some(self.span_delayed_bug(span, format!("stashing {key:?}"))),
|
||||||
DelayedBug => return self.inner.borrow_mut().emit_diagnostic(diag),
|
DelayedBug => return self.inner.borrow_mut().emit_diagnostic(diag),
|
||||||
ForceWarning(_) | Warning | Note | OnceNote | Help | OnceHelp | FailureNote | Allow
|
ForceWarning(_) | Warning | Note | OnceNote | Help | OnceHelp | FailureNote | Allow
|
||||||
| Expect(_) => None,
|
| Expect(_) => None,
|
||||||
|
@ -789,55 +789,50 @@ impl SyntaxExtension {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collapse_debuginfo_by_name(sess: &Session, attr: &Attribute) -> CollapseMacroDebuginfo {
|
fn collapse_debuginfo_by_name(attr: &Attribute) -> Result<CollapseMacroDebuginfo, Span> {
|
||||||
use crate::errors::CollapseMacroDebuginfoIllegal;
|
let list = attr.meta_item_list();
|
||||||
// #[collapse_debuginfo] without enum value (#[collapse_debuginfo(no/external/yes)])
|
let Some([NestedMetaItem::MetaItem(item)]) = list.as_deref() else {
|
||||||
// considered as `yes`
|
return Err(attr.span);
|
||||||
attr.meta_item_list().map_or(CollapseMacroDebuginfo::Yes, |l| {
|
};
|
||||||
let [NestedMetaItem::MetaItem(item)] = &l[..] else {
|
if !item.is_word() {
|
||||||
sess.dcx().emit_err(CollapseMacroDebuginfoIllegal { span: attr.span });
|
return Err(item.span);
|
||||||
return CollapseMacroDebuginfo::Unspecified;
|
}
|
||||||
};
|
|
||||||
if !item.is_word() {
|
match item.name_or_empty() {
|
||||||
sess.dcx().emit_err(CollapseMacroDebuginfoIllegal { span: item.span });
|
sym::no => Ok(CollapseMacroDebuginfo::No),
|
||||||
CollapseMacroDebuginfo::Unspecified
|
sym::external => Ok(CollapseMacroDebuginfo::External),
|
||||||
} else {
|
sym::yes => Ok(CollapseMacroDebuginfo::Yes),
|
||||||
match item.name_or_empty() {
|
_ => Err(item.path.span),
|
||||||
sym::no => CollapseMacroDebuginfo::No,
|
}
|
||||||
sym::external => CollapseMacroDebuginfo::External,
|
|
||||||
sym::yes => CollapseMacroDebuginfo::Yes,
|
|
||||||
_ => {
|
|
||||||
sess.dcx().emit_err(CollapseMacroDebuginfoIllegal { span: item.span });
|
|
||||||
CollapseMacroDebuginfo::Unspecified
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// if-ext - if macro from different crate (related to callsite code)
|
/// if-ext - if macro from different crate (related to callsite code)
|
||||||
/// | cmd \ attr | no | (unspecified) | external | yes |
|
/// | cmd \ attr | no | (unspecified) | external | yes |
|
||||||
/// | no | no | no | no | no |
|
/// | no | no | no | no | no |
|
||||||
/// | (unspecified) | no | no | if-ext | yes |
|
/// | (unspecified) | no | if-ext | if-ext | yes |
|
||||||
/// | external | no | if-ext | if-ext | yes |
|
/// | external | no | if-ext | if-ext | yes |
|
||||||
/// | yes | yes | yes | yes | yes |
|
/// | yes | yes | yes | yes | yes |
|
||||||
fn get_collapse_debuginfo(sess: &Session, attrs: &[ast::Attribute], is_local: bool) -> bool {
|
fn get_collapse_debuginfo(sess: &Session, attrs: &[ast::Attribute], ext: bool) -> bool {
|
||||||
let mut collapse_debuginfo_attr = attr::find_by_name(attrs, sym::collapse_debuginfo)
|
let flag = sess.opts.cg.collapse_macro_debuginfo;
|
||||||
.map(|v| Self::collapse_debuginfo_by_name(sess, v))
|
let attr = attr::find_by_name(attrs, sym::collapse_debuginfo)
|
||||||
.unwrap_or(CollapseMacroDebuginfo::Unspecified);
|
.and_then(|attr| {
|
||||||
if collapse_debuginfo_attr == CollapseMacroDebuginfo::Unspecified
|
Self::collapse_debuginfo_by_name(attr)
|
||||||
&& attr::contains_name(attrs, sym::rustc_builtin_macro)
|
.map_err(|span| {
|
||||||
{
|
sess.dcx().emit_err(errors::CollapseMacroDebuginfoIllegal { span })
|
||||||
collapse_debuginfo_attr = CollapseMacroDebuginfo::Yes;
|
})
|
||||||
}
|
.ok()
|
||||||
|
})
|
||||||
let flag = sess.opts.unstable_opts.collapse_macro_debuginfo;
|
.unwrap_or_else(|| {
|
||||||
let attr = collapse_debuginfo_attr;
|
if attr::contains_name(attrs, sym::rustc_builtin_macro) {
|
||||||
let ext = !is_local;
|
CollapseMacroDebuginfo::Yes
|
||||||
|
} else {
|
||||||
|
CollapseMacroDebuginfo::Unspecified
|
||||||
|
}
|
||||||
|
});
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
let collapse_table = [
|
let collapse_table = [
|
||||||
[false, false, false, false],
|
[false, false, false, false],
|
||||||
[false, false, ext, true],
|
[false, ext, ext, true],
|
||||||
[false, ext, ext, true],
|
[false, ext, ext, true],
|
||||||
[true, true, true, true],
|
[true, true, true, true],
|
||||||
];
|
];
|
||||||
@ -864,7 +859,7 @@ impl SyntaxExtension {
|
|||||||
let local_inner_macros = attr::find_by_name(attrs, sym::macro_export)
|
let local_inner_macros = attr::find_by_name(attrs, sym::macro_export)
|
||||||
.and_then(|macro_export| macro_export.meta_item_list())
|
.and_then(|macro_export| macro_export.meta_item_list())
|
||||||
.is_some_and(|l| attr::list_contains_name(&l, sym::local_inner_macros));
|
.is_some_and(|l| attr::list_contains_name(&l, sym::local_inner_macros));
|
||||||
let collapse_debuginfo = Self::get_collapse_debuginfo(sess, attrs, is_local);
|
let collapse_debuginfo = Self::get_collapse_debuginfo(sess, attrs, !is_local);
|
||||||
tracing::debug!(?name, ?local_inner_macros, ?collapse_debuginfo, ?allow_internal_unsafe);
|
tracing::debug!(?name, ?local_inner_macros, ?collapse_debuginfo, ?allow_internal_unsafe);
|
||||||
|
|
||||||
let (builtin_name, helper_attrs) = attr::find_by_name(attrs, sym::rustc_builtin_macro)
|
let (builtin_name, helper_attrs) = attr::find_by_name(attrs, sym::rustc_builtin_macro)
|
||||||
|
@ -98,6 +98,8 @@ declare_features! (
|
|||||||
(accepted, closure_to_fn_coercion, "1.19.0", Some(39817)),
|
(accepted, closure_to_fn_coercion, "1.19.0", Some(39817)),
|
||||||
/// Allows using the CMPXCHG16B target feature.
|
/// Allows using the CMPXCHG16B target feature.
|
||||||
(accepted, cmpxchg16b_target_feature, "1.69.0", Some(44839)),
|
(accepted, cmpxchg16b_target_feature, "1.69.0", Some(44839)),
|
||||||
|
/// Allows use of the `#[collapse_debuginfo]` attribute.
|
||||||
|
(accepted, collapse_debuginfo, "CURRENT_RUSTC_VERSION", Some(100758)),
|
||||||
/// Allows usage of the `compile_error!` macro.
|
/// Allows usage of the `compile_error!` macro.
|
||||||
(accepted, compile_error, "1.20.0", Some(40872)),
|
(accepted, compile_error, "1.20.0", Some(40872)),
|
||||||
/// Allows `impl Trait` in function return types.
|
/// Allows `impl Trait` in function return types.
|
||||||
|
@ -450,6 +450,9 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
|
|||||||
template!(List: r#"natvis_file = "...", gdb_script_file = "...""#),
|
template!(List: r#"natvis_file = "...", gdb_script_file = "...""#),
|
||||||
DuplicatesOk, EncodeCrossCrate::No
|
DuplicatesOk, EncodeCrossCrate::No
|
||||||
),
|
),
|
||||||
|
ungated!(collapse_debuginfo, Normal, template!(List: "no|external|yes"), ErrorFollowing,
|
||||||
|
EncodeCrossCrate::Yes
|
||||||
|
),
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// Unstable attributes:
|
// Unstable attributes:
|
||||||
@ -516,12 +519,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
|
|||||||
EncodeCrossCrate::Yes, experimental!(deprecated_safe),
|
EncodeCrossCrate::Yes, experimental!(deprecated_safe),
|
||||||
),
|
),
|
||||||
|
|
||||||
// `#[collapse_debuginfo]`
|
|
||||||
gated!(
|
|
||||||
collapse_debuginfo, Normal, template!(Word, List: "no|external|yes"), ErrorFollowing,
|
|
||||||
EncodeCrossCrate::No, experimental!(collapse_debuginfo)
|
|
||||||
),
|
|
||||||
|
|
||||||
// RFC 2397
|
// RFC 2397
|
||||||
gated!(
|
gated!(
|
||||||
do_not_recommend, Normal, template!(Word), WarnFollowing,
|
do_not_recommend, Normal, template!(Word), WarnFollowing,
|
||||||
|
@ -395,8 +395,6 @@ declare_features! (
|
|||||||
(unstable, closure_track_caller, "1.57.0", Some(87417)),
|
(unstable, closure_track_caller, "1.57.0", Some(87417)),
|
||||||
/// Allows to use the `#[cmse_nonsecure_entry]` attribute.
|
/// Allows to use the `#[cmse_nonsecure_entry]` attribute.
|
||||||
(unstable, cmse_nonsecure_entry, "1.48.0", Some(75835)),
|
(unstable, cmse_nonsecure_entry, "1.48.0", Some(75835)),
|
||||||
/// Allows use of the `#[collapse_debuginfo]` attribute.
|
|
||||||
(unstable, collapse_debuginfo, "1.65.0", Some(100758)),
|
|
||||||
/// Allows `async {}` expressions in const contexts.
|
/// Allows `async {}` expressions in const contexts.
|
||||||
(unstable, const_async_blocks, "1.53.0", Some(85368)),
|
(unstable, const_async_blocks, "1.53.0", Some(85368)),
|
||||||
/// Allows `const || {}` closures in const contexts.
|
/// Allows `const || {}` closures in const contexts.
|
||||||
|
@ -1811,6 +1811,44 @@ impl Expr<'_> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Whether this and the `other` expression are the same for purposes of an indexing operation.
|
||||||
|
///
|
||||||
|
/// This is only used for diagnostics to see if we have things like `foo[i]` where `foo` is
|
||||||
|
/// borrowed multiple times with `i`.
|
||||||
|
pub fn equivalent_for_indexing(&self, other: &Expr<'_>) -> bool {
|
||||||
|
match (self.kind, other.kind) {
|
||||||
|
(ExprKind::Lit(lit1), ExprKind::Lit(lit2)) => lit1.node == lit2.node,
|
||||||
|
(
|
||||||
|
ExprKind::Path(QPath::LangItem(item1, _)),
|
||||||
|
ExprKind::Path(QPath::LangItem(item2, _)),
|
||||||
|
) => item1 == item2,
|
||||||
|
(
|
||||||
|
ExprKind::Path(QPath::Resolved(None, path1)),
|
||||||
|
ExprKind::Path(QPath::Resolved(None, path2)),
|
||||||
|
) => path1.res == path2.res,
|
||||||
|
(
|
||||||
|
ExprKind::Struct(QPath::LangItem(LangItem::RangeTo, _), [val1], None),
|
||||||
|
ExprKind::Struct(QPath::LangItem(LangItem::RangeTo, _), [val2], None),
|
||||||
|
)
|
||||||
|
| (
|
||||||
|
ExprKind::Struct(QPath::LangItem(LangItem::RangeToInclusive, _), [val1], None),
|
||||||
|
ExprKind::Struct(QPath::LangItem(LangItem::RangeToInclusive, _), [val2], None),
|
||||||
|
)
|
||||||
|
| (
|
||||||
|
ExprKind::Struct(QPath::LangItem(LangItem::RangeFrom, _), [val1], None),
|
||||||
|
ExprKind::Struct(QPath::LangItem(LangItem::RangeFrom, _), [val2], None),
|
||||||
|
) => val1.expr.equivalent_for_indexing(val2.expr),
|
||||||
|
(
|
||||||
|
ExprKind::Struct(QPath::LangItem(LangItem::Range, _), [val1, val3], None),
|
||||||
|
ExprKind::Struct(QPath::LangItem(LangItem::Range, _), [val2, val4], None),
|
||||||
|
) => {
|
||||||
|
val1.expr.equivalent_for_indexing(val2.expr)
|
||||||
|
&& val3.expr.equivalent_for_indexing(val4.expr)
|
||||||
|
}
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn method_ident(&self) -> Option<Ident> {
|
pub fn method_ident(&self) -> Option<Ident> {
|
||||||
match self.kind {
|
match self.kind {
|
||||||
ExprKind::MethodCall(receiver_method, ..) => Some(receiver_method.ident),
|
ExprKind::MethodCall(receiver_method, ..) => Some(receiver_method.ident),
|
||||||
|
@ -992,7 +992,7 @@ fn lower_variant(
|
|||||||
.inspect(|f| {
|
.inspect(|f| {
|
||||||
has_unnamed_fields |= f.ident.name == kw::Underscore;
|
has_unnamed_fields |= f.ident.name == kw::Underscore;
|
||||||
// We only check named ADT here because anonymous ADTs are checked inside
|
// We only check named ADT here because anonymous ADTs are checked inside
|
||||||
// the nammed ADT in which they are defined.
|
// the named ADT in which they are defined.
|
||||||
if !is_anonymous {
|
if !is_anonymous {
|
||||||
field_uniqueness_check_ctx.check_field(f);
|
field_uniqueness_check_ctx.check_field(f);
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ use rustc_hir::lang_items::LangItem;
|
|||||||
use rustc_hir_analysis::check::{check_function_signature, forbid_intrinsic_abi};
|
use rustc_hir_analysis::check::{check_function_signature, forbid_intrinsic_abi};
|
||||||
use rustc_infer::infer::type_variable::TypeVariableOrigin;
|
use rustc_infer::infer::type_variable::TypeVariableOrigin;
|
||||||
use rustc_infer::infer::RegionVariableOrigin;
|
use rustc_infer::infer::RegionVariableOrigin;
|
||||||
|
use rustc_infer::traits::WellFormedLoc;
|
||||||
use rustc_middle::ty::{self, Binder, Ty, TyCtxt};
|
use rustc_middle::ty::{self, Binder, Ty, TyCtxt};
|
||||||
use rustc_span::def_id::LocalDefId;
|
use rustc_span::def_id::LocalDefId;
|
||||||
use rustc_span::symbol::sym;
|
use rustc_span::symbol::sym;
|
||||||
@ -71,6 +72,18 @@ pub(super) fn check_fn<'a, 'tcx>(
|
|||||||
let inputs_hir = hir.fn_decl_by_hir_id(fn_id).map(|decl| &decl.inputs);
|
let inputs_hir = hir.fn_decl_by_hir_id(fn_id).map(|decl| &decl.inputs);
|
||||||
let inputs_fn = fn_sig.inputs().iter().copied();
|
let inputs_fn = fn_sig.inputs().iter().copied();
|
||||||
for (idx, (param_ty, param)) in inputs_fn.chain(maybe_va_list).zip(body.params).enumerate() {
|
for (idx, (param_ty, param)) in inputs_fn.chain(maybe_va_list).zip(body.params).enumerate() {
|
||||||
|
// We checked the root's signature during wfcheck, but not the child.
|
||||||
|
if fcx.tcx.is_typeck_child(fn_def_id.to_def_id()) {
|
||||||
|
fcx.register_wf_obligation(
|
||||||
|
param_ty.into(),
|
||||||
|
param.span,
|
||||||
|
traits::WellFormed(Some(WellFormedLoc::Param {
|
||||||
|
function: fn_def_id,
|
||||||
|
param_idx: idx,
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Check the pattern.
|
// Check the pattern.
|
||||||
let ty: Option<&hir::Ty<'_>> = inputs_hir.and_then(|h| h.get(idx));
|
let ty: Option<&hir::Ty<'_>> = inputs_hir.and_then(|h| h.get(idx));
|
||||||
let ty_span = ty.map(|ty| ty.span);
|
let ty_span = ty.map(|ty| ty.span);
|
||||||
@ -108,7 +121,13 @@ pub(super) fn check_fn<'a, 'tcx>(
|
|||||||
hir::FnRetTy::DefaultReturn(_) => body.value.span,
|
hir::FnRetTy::DefaultReturn(_) => body.value.span,
|
||||||
hir::FnRetTy::Return(ty) => ty.span,
|
hir::FnRetTy::Return(ty) => ty.span,
|
||||||
};
|
};
|
||||||
|
|
||||||
fcx.require_type_is_sized(declared_ret_ty, return_or_body_span, traits::SizedReturnType);
|
fcx.require_type_is_sized(declared_ret_ty, return_or_body_span, traits::SizedReturnType);
|
||||||
|
// We checked the root's signature during wfcheck, but not the child.
|
||||||
|
if fcx.tcx.is_typeck_child(fn_def_id.to_def_id()) {
|
||||||
|
fcx.require_type_is_sized(declared_ret_ty, return_or_body_span, traits::WellFormed(None));
|
||||||
|
}
|
||||||
|
|
||||||
fcx.is_whole_body.set(true);
|
fcx.is_whole_body.set(true);
|
||||||
fcx.check_return_expr(body.value, false);
|
fcx.check_return_expr(body.value, false);
|
||||||
|
|
||||||
|
@ -600,6 +600,7 @@ fn test_codegen_options_tracking_hash() {
|
|||||||
// Make sure that changing a [TRACKED] option changes the hash.
|
// Make sure that changing a [TRACKED] option changes the hash.
|
||||||
// tidy-alphabetical-start
|
// tidy-alphabetical-start
|
||||||
tracked!(code_model, Some(CodeModel::Large));
|
tracked!(code_model, Some(CodeModel::Large));
|
||||||
|
tracked!(collapse_macro_debuginfo, CollapseMacroDebuginfo::Yes);
|
||||||
tracked!(control_flow_guard, CFGuard::Checks);
|
tracked!(control_flow_guard, CFGuard::Checks);
|
||||||
tracked!(debug_assertions, Some(true));
|
tracked!(debug_assertions, Some(true));
|
||||||
tracked!(debuginfo, DebugInfo::Limited);
|
tracked!(debuginfo, DebugInfo::Limited);
|
||||||
@ -760,12 +761,10 @@ fn test_unstable_options_tracking_hash() {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
tracked!(codegen_backend, Some("abc".to_string()));
|
tracked!(codegen_backend, Some("abc".to_string()));
|
||||||
tracked!(collapse_macro_debuginfo, CollapseMacroDebuginfo::Yes);
|
|
||||||
tracked!(coverage_options, CoverageOptions { branch: true, mcdc: true });
|
tracked!(coverage_options, CoverageOptions { branch: true, mcdc: true });
|
||||||
tracked!(crate_attr, vec!["abc".to_string()]);
|
tracked!(crate_attr, vec!["abc".to_string()]);
|
||||||
tracked!(cross_crate_inline_threshold, InliningThreshold::Always);
|
tracked!(cross_crate_inline_threshold, InliningThreshold::Always);
|
||||||
tracked!(debug_info_for_profiling, true);
|
tracked!(debug_info_for_profiling, true);
|
||||||
tracked!(debug_macros, true);
|
|
||||||
tracked!(default_hidden_visibility, Some(true));
|
tracked!(default_hidden_visibility, Some(true));
|
||||||
tracked!(dep_info_omit_d_target, true);
|
tracked!(dep_info_omit_d_target, true);
|
||||||
tracked!(direct_access_external_data, Some(true));
|
tracked!(direct_access_external_data, Some(true));
|
||||||
|
@ -630,7 +630,7 @@ impl Cursor<'_> {
|
|||||||
// with a number
|
// with a number
|
||||||
self.bump();
|
self.bump();
|
||||||
let mut empty_exponent = false;
|
let mut empty_exponent = false;
|
||||||
if self.first().is_digit(10) {
|
if self.first().is_ascii_digit() {
|
||||||
self.eat_decimal_digits();
|
self.eat_decimal_digits();
|
||||||
match self.first() {
|
match self.first() {
|
||||||
'e' | 'E' => {
|
'e' | 'E' => {
|
||||||
@ -661,7 +661,7 @@ impl Cursor<'_> {
|
|||||||
// If the first symbol is valid for identifier, it can be a lifetime.
|
// If the first symbol is valid for identifier, it can be a lifetime.
|
||||||
// Also check if it's a number for a better error reporting (so '0 will
|
// Also check if it's a number for a better error reporting (so '0 will
|
||||||
// be reported as invalid lifetime and not as unterminated char literal).
|
// be reported as invalid lifetime and not as unterminated char literal).
|
||||||
is_id_start(self.first()) || self.first().is_digit(10)
|
is_id_start(self.first()) || self.first().is_ascii_digit()
|
||||||
};
|
};
|
||||||
|
|
||||||
if !can_be_a_lifetime {
|
if !can_be_a_lifetime {
|
||||||
@ -677,7 +677,7 @@ impl Cursor<'_> {
|
|||||||
// Either a lifetime or a character literal with
|
// Either a lifetime or a character literal with
|
||||||
// length greater than 1.
|
// length greater than 1.
|
||||||
|
|
||||||
let starts_with_number = self.first().is_digit(10);
|
let starts_with_number = self.first().is_ascii_digit();
|
||||||
|
|
||||||
// Skip the literal contents.
|
// Skip the literal contents.
|
||||||
// First symbol can be a number (which isn't a valid identifier start),
|
// First symbol can be a number (which isn't a valid identifier start),
|
||||||
|
@ -259,7 +259,7 @@ fn scan_escape<T: From<char> + From<u8>>(
|
|||||||
} else {
|
} else {
|
||||||
// This may be a high byte, but that will only happen if `T` is
|
// This may be a high byte, but that will only happen if `T` is
|
||||||
// `MixedUnit`, because of the `allow_high_bytes` check above.
|
// `MixedUnit`, because of the `allow_high_bytes` check above.
|
||||||
Ok(T::from(value as u8))
|
Ok(T::from(value))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
'u' => return scan_unicode(chars, mode.allow_unicode_escapes()).map(T::from),
|
'u' => return scan_unicode(chars, mode.allow_unicode_escapes()).map(T::from),
|
||||||
@ -300,7 +300,7 @@ fn scan_unicode(chars: &mut Chars<'_>, allow_unicode_escapes: bool) -> Result<ch
|
|||||||
return Err(EscapeError::UnicodeEscapeInByte);
|
return Err(EscapeError::UnicodeEscapeInByte);
|
||||||
}
|
}
|
||||||
|
|
||||||
break std::char::from_u32(value).ok_or_else(|| {
|
break std::char::from_u32(value).ok_or({
|
||||||
if value > 0x10FFFF {
|
if value > 0x10FFFF {
|
||||||
EscapeError::OutOfRangeUnicodeEscape
|
EscapeError::OutOfRangeUnicodeEscape
|
||||||
} else {
|
} else {
|
||||||
|
@ -50,7 +50,7 @@ fn detect_llvm_link() -> (&'static str, &'static str) {
|
|||||||
fn restore_library_path() {
|
fn restore_library_path() {
|
||||||
let key = tracked_env_var_os("REAL_LIBRARY_PATH_VAR").expect("REAL_LIBRARY_PATH_VAR");
|
let key = tracked_env_var_os("REAL_LIBRARY_PATH_VAR").expect("REAL_LIBRARY_PATH_VAR");
|
||||||
if let Some(env) = tracked_env_var_os("REAL_LIBRARY_PATH") {
|
if let Some(env) = tracked_env_var_os("REAL_LIBRARY_PATH") {
|
||||||
env::set_var(&key, &env);
|
env::set_var(&key, env);
|
||||||
} else {
|
} else {
|
||||||
env::remove_var(&key);
|
env::remove_var(&key);
|
||||||
}
|
}
|
||||||
|
@ -91,6 +91,8 @@ enum LLVMRustAttribute {
|
|||||||
AllocAlign = 39,
|
AllocAlign = 39,
|
||||||
SanitizeSafeStack = 40,
|
SanitizeSafeStack = 40,
|
||||||
FnRetThunkExtern = 41,
|
FnRetThunkExtern = 41,
|
||||||
|
Writable = 42,
|
||||||
|
DeadOnUnwind = 43,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct OpaqueRustString *RustStringRef;
|
typedef struct OpaqueRustString *RustStringRef;
|
||||||
|
@ -312,6 +312,16 @@ static Attribute::AttrKind fromRust(LLVMRustAttribute Kind) {
|
|||||||
return Attribute::SafeStack;
|
return Attribute::SafeStack;
|
||||||
case FnRetThunkExtern:
|
case FnRetThunkExtern:
|
||||||
return Attribute::FnRetThunkExtern;
|
return Attribute::FnRetThunkExtern;
|
||||||
|
#if LLVM_VERSION_GE(18, 0)
|
||||||
|
case Writable:
|
||||||
|
return Attribute::Writable;
|
||||||
|
case DeadOnUnwind:
|
||||||
|
return Attribute::DeadOnUnwind;
|
||||||
|
#else
|
||||||
|
case Writable:
|
||||||
|
case DeadOnUnwind:
|
||||||
|
report_fatal_error("Not supported on this LLVM version");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
report_fatal_error("bad AttributeKind");
|
report_fatal_error("bad AttributeKind");
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
println!("cargo:rerun-if-changed=build.rs");
|
println!("cargo:rerun-if-changed=build.rs");
|
||||||
println!("cargo:rerun-if-env-changed=RUSTC_BOOTSTRAP");
|
println!("cargo:rerun-if-env-changed=RUSTC_BOOTSTRAP");
|
||||||
if !std::env::var("RUSTC_BOOTSTRAP").is_ok() {
|
if std::env::var("RUSTC_BOOTSTRAP").is_err() {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"error: you are attempting to build the compiler without going through bootstrap"
|
"error: you are attempting to build the compiler without going through bootstrap"
|
||||||
);
|
);
|
||||||
|
@ -328,11 +328,16 @@ pub enum ObligationCauseCode<'tcx> {
|
|||||||
/// `static` items must have `Sync` type.
|
/// `static` items must have `Sync` type.
|
||||||
SharedStatic,
|
SharedStatic,
|
||||||
|
|
||||||
|
/// Derived obligation (i.e. theoretical `where` clause) on a built-in
|
||||||
|
/// implementation like `Copy` or `Sized`.
|
||||||
BuiltinDerivedObligation(DerivedObligationCause<'tcx>),
|
BuiltinDerivedObligation(DerivedObligationCause<'tcx>),
|
||||||
|
|
||||||
|
/// Derived obligation (i.e. `where` clause) on an user-provided impl
|
||||||
|
/// or a trait alias.
|
||||||
ImplDerivedObligation(Box<ImplDerivedObligationCause<'tcx>>),
|
ImplDerivedObligation(Box<ImplDerivedObligationCause<'tcx>>),
|
||||||
|
|
||||||
DerivedObligation(DerivedObligationCause<'tcx>),
|
/// Derived obligation for WF goals.
|
||||||
|
WellFormedDerivedObligation(DerivedObligationCause<'tcx>),
|
||||||
|
|
||||||
FunctionArgumentObligation {
|
FunctionArgumentObligation {
|
||||||
/// The node of the relevant argument in the function call.
|
/// The node of the relevant argument in the function call.
|
||||||
@ -487,7 +492,7 @@ pub enum WellFormedLoc {
|
|||||||
/// The index of the parameter to use.
|
/// The index of the parameter to use.
|
||||||
/// Parameters are indexed from 0, with the return type
|
/// Parameters are indexed from 0, with the return type
|
||||||
/// being the last 'parameter'
|
/// being the last 'parameter'
|
||||||
param_idx: u16,
|
param_idx: usize,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -534,7 +539,7 @@ impl<'tcx> ObligationCauseCode<'tcx> {
|
|||||||
match self {
|
match self {
|
||||||
FunctionArgumentObligation { parent_code, .. } => Some((parent_code, None)),
|
FunctionArgumentObligation { parent_code, .. } => Some((parent_code, None)),
|
||||||
BuiltinDerivedObligation(derived)
|
BuiltinDerivedObligation(derived)
|
||||||
| DerivedObligation(derived)
|
| WellFormedDerivedObligation(derived)
|
||||||
| ImplDerivedObligation(box ImplDerivedObligationCause { derived, .. }) => {
|
| ImplDerivedObligation(box ImplDerivedObligationCause { derived, .. }) => {
|
||||||
Some((&derived.parent_code, Some(derived.parent_trait_pred)))
|
Some((&derived.parent_code, Some(derived.parent_trait_pred)))
|
||||||
}
|
}
|
||||||
|
@ -58,30 +58,6 @@ pub enum TreatParams {
|
|||||||
/// This also treats projections with inference variables as infer vars
|
/// This also treats projections with inference variables as infer vars
|
||||||
/// since they could be further normalized.
|
/// since they could be further normalized.
|
||||||
ForLookup,
|
ForLookup,
|
||||||
/// Treat parameters as placeholders in the given environment. This is the
|
|
||||||
/// correct mode for *lookup*, as during candidate selection.
|
|
||||||
///
|
|
||||||
/// N.B. during deep rejection, this acts identically to `ForLookup`.
|
|
||||||
///
|
|
||||||
/// FIXME(-Znext-solver): Remove this variant and cleanup
|
|
||||||
/// the code.
|
|
||||||
NextSolverLookup,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// During fast-rejection, we have the choice of treating projection types
|
|
||||||
/// as either simplifiable or not, depending on whether we expect the projection
|
|
||||||
/// to be normalized/rigid.
|
|
||||||
#[derive(PartialEq, Eq, Debug, Clone, Copy)]
|
|
||||||
pub enum TreatProjections {
|
|
||||||
/// In the old solver we don't try to normalize projections
|
|
||||||
/// when looking up impls and only access them by using the
|
|
||||||
/// current self type. This means that if the self type is
|
|
||||||
/// a projection which could later be normalized, we must not
|
|
||||||
/// treat it as rigid.
|
|
||||||
ForLookup,
|
|
||||||
/// We can treat projections in the self type as opaque as
|
|
||||||
/// we separately look up impls for the normalized self type.
|
|
||||||
NextSolverLookup,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Tries to simplify a type by only returning the outermost injective¹ layer, if one exists.
|
/// Tries to simplify a type by only returning the outermost injective¹ layer, if one exists.
|
||||||
@ -139,21 +115,17 @@ pub fn simplify_type<'tcx>(
|
|||||||
ty::FnPtr(f) => Some(SimplifiedType::Function(f.skip_binder().inputs().len())),
|
ty::FnPtr(f) => Some(SimplifiedType::Function(f.skip_binder().inputs().len())),
|
||||||
ty::Placeholder(..) => Some(SimplifiedType::Placeholder),
|
ty::Placeholder(..) => Some(SimplifiedType::Placeholder),
|
||||||
ty::Param(_) => match treat_params {
|
ty::Param(_) => match treat_params {
|
||||||
TreatParams::ForLookup | TreatParams::NextSolverLookup => {
|
TreatParams::ForLookup => Some(SimplifiedType::Placeholder),
|
||||||
Some(SimplifiedType::Placeholder)
|
|
||||||
}
|
|
||||||
TreatParams::AsCandidateKey => None,
|
TreatParams::AsCandidateKey => None,
|
||||||
},
|
},
|
||||||
ty::Alias(..) => match treat_params {
|
ty::Alias(..) => match treat_params {
|
||||||
// When treating `ty::Param` as a placeholder, projections also
|
// When treating `ty::Param` as a placeholder, projections also
|
||||||
// don't unify with anything else as long as they are fully normalized.
|
// don't unify with anything else as long as they are fully normalized.
|
||||||
//
|
// FIXME(-Znext-solver): Can remove this `if` and always simplify to `Placeholder`
|
||||||
// We will have to be careful with lazy normalization here.
|
// when the new solver is enabled by default.
|
||||||
// FIXME(lazy_normalization): This is probably not right...
|
|
||||||
TreatParams::ForLookup if !ty.has_non_region_infer() => {
|
TreatParams::ForLookup if !ty.has_non_region_infer() => {
|
||||||
Some(SimplifiedType::Placeholder)
|
Some(SimplifiedType::Placeholder)
|
||||||
}
|
}
|
||||||
TreatParams::NextSolverLookup => Some(SimplifiedType::Placeholder),
|
|
||||||
TreatParams::ForLookup | TreatParams::AsCandidateKey => None,
|
TreatParams::ForLookup | TreatParams::AsCandidateKey => None,
|
||||||
},
|
},
|
||||||
ty::Foreign(def_id) => Some(SimplifiedType::Foreign(def_id)),
|
ty::Foreign(def_id) => Some(SimplifiedType::Foreign(def_id)),
|
||||||
@ -331,7 +303,7 @@ impl DeepRejectCtxt {
|
|||||||
// Depending on the value of `treat_obligation_params`, we either
|
// Depending on the value of `treat_obligation_params`, we either
|
||||||
// treat generic parameters like placeholders or like inference variables.
|
// treat generic parameters like placeholders or like inference variables.
|
||||||
ty::Param(_) => match self.treat_obligation_params {
|
ty::Param(_) => match self.treat_obligation_params {
|
||||||
TreatParams::ForLookup | TreatParams::NextSolverLookup => false,
|
TreatParams::ForLookup => false,
|
||||||
TreatParams::AsCandidateKey => true,
|
TreatParams::AsCandidateKey => true,
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -373,7 +345,7 @@ impl DeepRejectCtxt {
|
|||||||
let k = impl_ct.kind();
|
let k = impl_ct.kind();
|
||||||
match obligation_ct.kind() {
|
match obligation_ct.kind() {
|
||||||
ty::ConstKind::Param(_) => match self.treat_obligation_params {
|
ty::ConstKind::Param(_) => match self.treat_obligation_params {
|
||||||
TreatParams::ForLookup | TreatParams::NextSolverLookup => false,
|
TreatParams::ForLookup => false,
|
||||||
TreatParams::AsCandidateKey => true,
|
TreatParams::AsCandidateKey => true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ use rustc_session::lint::LintBuffer;
|
|||||||
pub use rustc_session::lint::RegisteredTools;
|
pub use rustc_session::lint::RegisteredTools;
|
||||||
use rustc_span::hygiene::MacroKind;
|
use rustc_span::hygiene::MacroKind;
|
||||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||||
use rustc_span::{hygiene, ExpnId, ExpnKind, Span};
|
use rustc_span::{ExpnId, ExpnKind, Span};
|
||||||
use rustc_target::abi::{Align, FieldIdx, Integer, IntegerType, VariantIdx};
|
use rustc_target::abi::{Align, FieldIdx, Integer, IntegerType, VariantIdx};
|
||||||
pub use rustc_target::abi::{ReprFlags, ReprOptions};
|
pub use rustc_target::abi::{ReprFlags, ReprOptions};
|
||||||
pub use rustc_type_ir::{DebugWithInfcx, InferCtxtLike, WithInfcx};
|
pub use rustc_type_ir::{DebugWithInfcx, InferCtxtLike, WithInfcx};
|
||||||
@ -2013,22 +2013,6 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||||||
(ident, scope)
|
(ident, scope)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns corrected span if the debuginfo for `span` should be collapsed to the outermost
|
|
||||||
/// expansion site (with collapse_debuginfo attribute if the corresponding feature enabled).
|
|
||||||
/// Only applies when `Span` is the result of macro expansion.
|
|
||||||
///
|
|
||||||
/// - If the `collapse_debuginfo` feature is enabled then debuginfo is not collapsed by default
|
|
||||||
/// and only when a (some enclosing) macro definition is annotated with `#[collapse_debuginfo]`.
|
|
||||||
/// - If `collapse_debuginfo` is not enabled, then debuginfo is collapsed by default.
|
|
||||||
///
|
|
||||||
/// When `-Zdebug-macros` is provided then debuginfo will never be collapsed.
|
|
||||||
pub fn collapsed_debuginfo(self, span: Span, upto: Span) -> Span {
|
|
||||||
if self.sess.opts.unstable_opts.debug_macros || !span.from_expansion() {
|
|
||||||
return span;
|
|
||||||
}
|
|
||||||
hygiene::walk_chain_collapsed(span, upto, self.features().collapse_debuginfo)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_const_fn_raw(self, def_id: DefId) -> bool {
|
pub fn is_const_fn_raw(self, def_id: DefId) -> bool {
|
||||||
matches!(
|
matches!(
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use crate::traits::specialization_graph;
|
use crate::traits::specialization_graph;
|
||||||
use crate::ty::fast_reject::{self, SimplifiedType, TreatParams, TreatProjections};
|
use crate::ty::fast_reject::{self, SimplifiedType, TreatParams};
|
||||||
use crate::ty::{Ident, Ty, TyCtxt};
|
use crate::ty::{Ident, Ty, TyCtxt};
|
||||||
use hir::def_id::LOCAL_CRATE;
|
use hir::def_id::LOCAL_CRATE;
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
@ -135,21 +135,6 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||||||
self,
|
self,
|
||||||
trait_def_id: DefId,
|
trait_def_id: DefId,
|
||||||
self_ty: Ty<'tcx>,
|
self_ty: Ty<'tcx>,
|
||||||
f: impl FnMut(DefId),
|
|
||||||
) {
|
|
||||||
self.for_each_relevant_impl_treating_projections(
|
|
||||||
trait_def_id,
|
|
||||||
self_ty,
|
|
||||||
TreatProjections::ForLookup,
|
|
||||||
f,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn for_each_relevant_impl_treating_projections(
|
|
||||||
self,
|
|
||||||
trait_def_id: DefId,
|
|
||||||
self_ty: Ty<'tcx>,
|
|
||||||
treat_projections: TreatProjections,
|
|
||||||
mut f: impl FnMut(DefId),
|
mut f: impl FnMut(DefId),
|
||||||
) {
|
) {
|
||||||
// FIXME: This depends on the set of all impls for the trait. That is
|
// FIXME: This depends on the set of all impls for the trait. That is
|
||||||
@ -163,17 +148,13 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||||||
f(impl_def_id);
|
f(impl_def_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that we're using `TreatParams::ForLookup` to query `non_blanket_impls` while using
|
|
||||||
// `TreatParams::AsCandidateKey` while actually adding them.
|
|
||||||
let treat_params = match treat_projections {
|
|
||||||
TreatProjections::NextSolverLookup => TreatParams::NextSolverLookup,
|
|
||||||
TreatProjections::ForLookup => TreatParams::ForLookup,
|
|
||||||
};
|
|
||||||
// This way, when searching for some impl for `T: Trait`, we do not look at any impls
|
// This way, when searching for some impl for `T: Trait`, we do not look at any impls
|
||||||
// whose outer level is not a parameter or projection. Especially for things like
|
// whose outer level is not a parameter or projection. Especially for things like
|
||||||
// `T: Clone` this is incredibly useful as we would otherwise look at all the impls
|
// `T: Clone` this is incredibly useful as we would otherwise look at all the impls
|
||||||
// of `Clone` for `Option<T>`, `Vec<T>`, `ConcreteType` and so on.
|
// of `Clone` for `Option<T>`, `Vec<T>`, `ConcreteType` and so on.
|
||||||
if let Some(simp) = fast_reject::simplify_type(self, self_ty, treat_params) {
|
// Note that we're using `TreatParams::ForLookup` to query `non_blanket_impls` while using
|
||||||
|
// `TreatParams::AsCandidateKey` while actually adding them.
|
||||||
|
if let Some(simp) = fast_reject::simplify_type(self, self_ty, TreatParams::ForLookup) {
|
||||||
if let Some(impls) = impls.non_blanket_impls.get(&simp) {
|
if let Some(impls) = impls.non_blanket_impls.get(&simp) {
|
||||||
for &impl_def_id in impls {
|
for &impl_def_id in impls {
|
||||||
f(impl_def_id);
|
f(impl_def_id);
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use crate::config::*;
|
use crate::config::*;
|
||||||
|
|
||||||
use crate::search_paths::SearchPath;
|
use crate::search_paths::SearchPath;
|
||||||
use crate::utils::NativeLib;
|
use crate::utils::NativeLib;
|
||||||
use crate::{lint, EarlyDiagCtxt};
|
use crate::{lint, EarlyDiagCtxt};
|
||||||
@ -8,20 +7,17 @@ use rustc_data_structures::profiling::TimePassesFormat;
|
|||||||
use rustc_data_structures::stable_hasher::Hash64;
|
use rustc_data_structures::stable_hasher::Hash64;
|
||||||
use rustc_errors::ColorConfig;
|
use rustc_errors::ColorConfig;
|
||||||
use rustc_errors::{LanguageIdentifier, TerminalUrl};
|
use rustc_errors::{LanguageIdentifier, TerminalUrl};
|
||||||
|
use rustc_feature::UnstableFeatures;
|
||||||
|
use rustc_span::edition::Edition;
|
||||||
|
use rustc_span::RealFileName;
|
||||||
|
use rustc_span::SourceFileHashAlgorithm;
|
||||||
use rustc_target::spec::{
|
use rustc_target::spec::{
|
||||||
CodeModel, LinkerFlavorCli, MergeFunctions, PanicStrategy, SanitizerSet, WasmCAbi,
|
CodeModel, LinkerFlavorCli, MergeFunctions, PanicStrategy, SanitizerSet, WasmCAbi,
|
||||||
};
|
};
|
||||||
use rustc_target::spec::{
|
use rustc_target::spec::{
|
||||||
RelocModel, RelroLevel, SplitDebuginfo, StackProtector, TargetTriple, TlsModel,
|
RelocModel, RelroLevel, SplitDebuginfo, StackProtector, TargetTriple, TlsModel,
|
||||||
};
|
};
|
||||||
|
|
||||||
use rustc_feature::UnstableFeatures;
|
|
||||||
use rustc_span::edition::Edition;
|
|
||||||
use rustc_span::RealFileName;
|
|
||||||
use rustc_span::SourceFileHashAlgorithm;
|
|
||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use std::hash::{DefaultHasher, Hasher};
|
use std::hash::{DefaultHasher, Hasher};
|
||||||
use std::num::{IntErrorKind, NonZero};
|
use std::num::{IntErrorKind, NonZero};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
@ -118,8 +114,8 @@ top_level_options!(
|
|||||||
/// incremental compilation cache before proceeding.
|
/// incremental compilation cache before proceeding.
|
||||||
///
|
///
|
||||||
/// - `[TRACKED_NO_CRATE_HASH]`
|
/// - `[TRACKED_NO_CRATE_HASH]`
|
||||||
/// Same as `[TRACKED]`, but will not affect the crate hash. This is useful for options that only
|
/// Same as `[TRACKED]`, but will not affect the crate hash. This is useful for options that
|
||||||
/// affect the incremental cache.
|
/// only affect the incremental cache.
|
||||||
///
|
///
|
||||||
/// - `[UNTRACKED]`
|
/// - `[UNTRACKED]`
|
||||||
/// Incremental compilation is not influenced by this option.
|
/// Incremental compilation is not influenced by this option.
|
||||||
@ -1362,10 +1358,20 @@ mod parse {
|
|||||||
slot: &mut CollapseMacroDebuginfo,
|
slot: &mut CollapseMacroDebuginfo,
|
||||||
v: Option<&str>,
|
v: Option<&str>,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
if v.is_some() {
|
||||||
|
let mut bool_arg = None;
|
||||||
|
if parse_opt_bool(&mut bool_arg, v) {
|
||||||
|
*slot = if bool_arg.unwrap() {
|
||||||
|
CollapseMacroDebuginfo::Yes
|
||||||
|
} else {
|
||||||
|
CollapseMacroDebuginfo::No
|
||||||
|
};
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*slot = match v {
|
*slot = match v {
|
||||||
Some("no") => CollapseMacroDebuginfo::No,
|
|
||||||
Some("external") => CollapseMacroDebuginfo::External,
|
Some("external") => CollapseMacroDebuginfo::External,
|
||||||
Some("yes") => CollapseMacroDebuginfo::Yes,
|
|
||||||
_ => return false,
|
_ => return false,
|
||||||
};
|
};
|
||||||
true
|
true
|
||||||
@ -1464,6 +1470,9 @@ options! {
|
|||||||
"choose the code model to use (`rustc --print code-models` for details)"),
|
"choose the code model to use (`rustc --print code-models` for details)"),
|
||||||
codegen_units: Option<usize> = (None, parse_opt_number, [UNTRACKED],
|
codegen_units: Option<usize> = (None, parse_opt_number, [UNTRACKED],
|
||||||
"divide crate into N units to optimize in parallel"),
|
"divide crate into N units to optimize in parallel"),
|
||||||
|
collapse_macro_debuginfo: CollapseMacroDebuginfo = (CollapseMacroDebuginfo::Unspecified,
|
||||||
|
parse_collapse_macro_debuginfo, [TRACKED],
|
||||||
|
"set option to collapse debuginfo for macros"),
|
||||||
control_flow_guard: CFGuard = (CFGuard::Disabled, parse_cfguard, [TRACKED],
|
control_flow_guard: CFGuard = (CFGuard::Disabled, parse_cfguard, [TRACKED],
|
||||||
"use Windows Control Flow Guard (default: no)"),
|
"use Windows Control Flow Guard (default: no)"),
|
||||||
debug_assertions: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
debug_assertions: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
||||||
@ -1611,9 +1620,6 @@ options! {
|
|||||||
"show all expected values in check-cfg diagnostics (default: no)"),
|
"show all expected values in check-cfg diagnostics (default: no)"),
|
||||||
codegen_backend: Option<String> = (None, parse_opt_string, [TRACKED],
|
codegen_backend: Option<String> = (None, parse_opt_string, [TRACKED],
|
||||||
"the backend to use"),
|
"the backend to use"),
|
||||||
collapse_macro_debuginfo: CollapseMacroDebuginfo = (CollapseMacroDebuginfo::Unspecified,
|
|
||||||
parse_collapse_macro_debuginfo, [TRACKED],
|
|
||||||
"set option to collapse debuginfo for macros"),
|
|
||||||
combine_cgu: bool = (false, parse_bool, [TRACKED],
|
combine_cgu: bool = (false, parse_bool, [TRACKED],
|
||||||
"combine CGUs into a single one"),
|
"combine CGUs into a single one"),
|
||||||
coverage_options: CoverageOptions = (CoverageOptions::default(), parse_coverage_options, [TRACKED],
|
coverage_options: CoverageOptions = (CoverageOptions::default(), parse_coverage_options, [TRACKED],
|
||||||
@ -1624,8 +1630,6 @@ options! {
|
|||||||
"threshold to allow cross crate inlining of functions"),
|
"threshold to allow cross crate inlining of functions"),
|
||||||
debug_info_for_profiling: bool = (false, parse_bool, [TRACKED],
|
debug_info_for_profiling: bool = (false, parse_bool, [TRACKED],
|
||||||
"emit discriminators and other data necessary for AutoFDO"),
|
"emit discriminators and other data necessary for AutoFDO"),
|
||||||
debug_macros: bool = (false, parse_bool, [TRACKED],
|
|
||||||
"emit line numbers debug info inside macros (default: no)"),
|
|
||||||
debuginfo_compression: DebugInfoCompression = (DebugInfoCompression::None, parse_debuginfo_compression, [TRACKED],
|
debuginfo_compression: DebugInfoCompression = (DebugInfoCompression::None, parse_debuginfo_compression, [TRACKED],
|
||||||
"compress debug info sections (none, zlib, zstd, default: none)"),
|
"compress debug info sections (none, zlib, zstd, default: none)"),
|
||||||
deduplicate_diagnostics: bool = (true, parse_bool, [UNTRACKED],
|
deduplicate_diagnostics: bool = (true, parse_bool, [UNTRACKED],
|
||||||
|
@ -459,28 +459,21 @@ impl HygieneData {
|
|||||||
span
|
span
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to walk up and update return span if we meet macro instantiation to be collapsed
|
fn walk_chain_collapsed(&self, mut span: Span, to: Span) -> Span {
|
||||||
fn walk_chain_collapsed(
|
|
||||||
&self,
|
|
||||||
mut span: Span,
|
|
||||||
to: Span,
|
|
||||||
collapse_debuginfo_feature_enabled: bool,
|
|
||||||
) -> Span {
|
|
||||||
let orig_span = span;
|
let orig_span = span;
|
||||||
let mut ret_span = span;
|
let mut ret_span = span;
|
||||||
|
debug!("walk_chain_collapsed({:?}, {:?})", span, to);
|
||||||
debug!(
|
|
||||||
"walk_chain_collapsed({:?}, {:?}), feature_enable={}",
|
|
||||||
span, to, collapse_debuginfo_feature_enabled,
|
|
||||||
);
|
|
||||||
debug!("walk_chain_collapsed: span ctxt = {:?}", span.ctxt());
|
debug!("walk_chain_collapsed: span ctxt = {:?}", span.ctxt());
|
||||||
while !span.eq_ctxt(to) && span.from_expansion() {
|
while let ctxt = span.ctxt()
|
||||||
let outer_expn = self.outer_expn(span.ctxt());
|
&& !ctxt.is_root()
|
||||||
|
&& ctxt != to.ctxt()
|
||||||
|
{
|
||||||
|
let outer_expn = self.outer_expn(ctxt);
|
||||||
debug!("walk_chain_collapsed({:?}): outer_expn={:?}", span, outer_expn);
|
debug!("walk_chain_collapsed({:?}): outer_expn={:?}", span, outer_expn);
|
||||||
let expn_data = self.expn_data(outer_expn);
|
let expn_data = self.expn_data(outer_expn);
|
||||||
debug!("walk_chain_collapsed({:?}): expn_data={:?}", span, expn_data);
|
debug!("walk_chain_collapsed({:?}): expn_data={:?}", span, expn_data);
|
||||||
span = expn_data.call_site;
|
span = expn_data.call_site;
|
||||||
if !collapse_debuginfo_feature_enabled || expn_data.collapse_debuginfo {
|
if expn_data.collapse_debuginfo {
|
||||||
ret_span = span;
|
ret_span = span;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -604,14 +597,13 @@ pub fn walk_chain(span: Span, to: SyntaxContext) -> Span {
|
|||||||
HygieneData::with(|data| data.walk_chain(span, to))
|
HygieneData::with(|data| data.walk_chain(span, to))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn walk_chain_collapsed(
|
/// In order to have good line stepping behavior in debugger, for the given span we return its
|
||||||
span: Span,
|
/// outermost macro call site that still has a `#[collapse_debuginfo(yes)]` property on it.
|
||||||
to: Span,
|
/// We also stop walking call sites at the function body level because no line stepping can occur
|
||||||
collapse_debuginfo_feature_enabled: bool,
|
/// at the level above that.
|
||||||
) -> Span {
|
/// The returned span can then be used in emitted debuginfo.
|
||||||
HygieneData::with(|hdata| {
|
pub fn walk_chain_collapsed(span: Span, to: Span) -> Span {
|
||||||
hdata.walk_chain_collapsed(span, to, collapse_debuginfo_feature_enabled)
|
HygieneData::with(|data| data.walk_chain_collapsed(span, to))
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_dollar_crate_names(mut get_name: impl FnMut(SyntaxContext) -> Symbol) {
|
pub fn update_dollar_crate_names(mut get_name: impl FnMut(SyntaxContext) -> Symbol) {
|
||||||
|
@ -14,7 +14,7 @@ use rustc_middle::traits::solve::{
|
|||||||
CandidateSource, CanonicalResponse, Certainty, Goal, QueryResult,
|
CandidateSource, CanonicalResponse, Certainty, Goal, QueryResult,
|
||||||
};
|
};
|
||||||
use rustc_middle::traits::{BuiltinImplSource, Reveal};
|
use rustc_middle::traits::{BuiltinImplSource, Reveal};
|
||||||
use rustc_middle::ty::fast_reject::{DeepRejectCtxt, TreatParams, TreatProjections};
|
use rustc_middle::ty::fast_reject::{DeepRejectCtxt, TreatParams};
|
||||||
use rustc_middle::ty::{self, ToPredicate, Ty, TyCtxt};
|
use rustc_middle::ty::{self, ToPredicate, Ty, TyCtxt};
|
||||||
use rustc_middle::ty::{TraitPredicate, TypeVisitableExt};
|
use rustc_middle::ty::{TraitPredicate, TypeVisitableExt};
|
||||||
use rustc_span::{ErrorGuaranteed, DUMMY_SP};
|
use rustc_span::{ErrorGuaranteed, DUMMY_SP};
|
||||||
@ -1045,6 +1045,12 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we still have an alias here, it must be rigid. For opaques, it's always
|
||||||
|
// okay to consider auto traits because that'll reveal its hidden type. For
|
||||||
|
// non-opaque aliases, we will not assemble any candidates since there's no way
|
||||||
|
// to further look into its type.
|
||||||
|
ty::Alias(..) => None,
|
||||||
|
|
||||||
// For rigid types, any possible implementation that could apply to
|
// For rigid types, any possible implementation that could apply to
|
||||||
// the type (even if after unification and processing nested goals
|
// the type (even if after unification and processing nested goals
|
||||||
// it does not hold) will disqualify the built-in auto impl.
|
// it does not hold) will disqualify the built-in auto impl.
|
||||||
@ -1072,15 +1078,11 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|
|||||||
| ty::CoroutineWitness(..)
|
| ty::CoroutineWitness(..)
|
||||||
| ty::Never
|
| ty::Never
|
||||||
| ty::Tuple(_)
|
| ty::Tuple(_)
|
||||||
| ty::Adt(_, _)
|
| ty::Adt(_, _) => {
|
||||||
// FIXME: Handling opaques here is kinda sus. Especially because we
|
|
||||||
// simplify them to SimplifiedType::Placeholder.
|
|
||||||
| ty::Alias(ty::Opaque, _) => {
|
|
||||||
let mut disqualifying_impl = None;
|
let mut disqualifying_impl = None;
|
||||||
self.tcx().for_each_relevant_impl_treating_projections(
|
self.tcx().for_each_relevant_impl(
|
||||||
goal.predicate.def_id(),
|
goal.predicate.def_id(),
|
||||||
goal.predicate.self_ty(),
|
goal.predicate.self_ty(),
|
||||||
TreatProjections::NextSolverLookup,
|
|
||||||
|impl_def_id| {
|
|impl_def_id| {
|
||||||
disqualifying_impl = Some(impl_def_id);
|
disqualifying_impl = Some(impl_def_id);
|
||||||
},
|
},
|
||||||
|
@ -128,7 +128,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||||||
match obligation.cause.code() {
|
match obligation.cause.code() {
|
||||||
ObligationCauseCode::BuiltinDerivedObligation(..)
|
ObligationCauseCode::BuiltinDerivedObligation(..)
|
||||||
| ObligationCauseCode::ImplDerivedObligation(..)
|
| ObligationCauseCode::ImplDerivedObligation(..)
|
||||||
| ObligationCauseCode::DerivedObligation(..) => {}
|
| ObligationCauseCode::WellFormedDerivedObligation(..) => {}
|
||||||
_ => {
|
_ => {
|
||||||
// this is a "direct", user-specified, rather than derived,
|
// this is a "direct", user-specified, rather than derived,
|
||||||
// obligation.
|
// obligation.
|
||||||
|
@ -2294,7 +2294,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||||||
|
|
||||||
next_code = Some(&cause.derived.parent_code);
|
next_code = Some(&cause.derived.parent_code);
|
||||||
}
|
}
|
||||||
ObligationCauseCode::DerivedObligation(derived_obligation)
|
ObligationCauseCode::WellFormedDerivedObligation(derived_obligation)
|
||||||
| ObligationCauseCode::BuiltinDerivedObligation(derived_obligation) => {
|
| ObligationCauseCode::BuiltinDerivedObligation(derived_obligation) => {
|
||||||
let ty = derived_obligation.parent_trait_pred.skip_binder().self_ty();
|
let ty = derived_obligation.parent_trait_pred.skip_binder().self_ty();
|
||||||
debug!(
|
debug!(
|
||||||
@ -3423,7 +3423,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||||||
)
|
)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
ObligationCauseCode::DerivedObligation(ref data) => {
|
ObligationCauseCode::WellFormedDerivedObligation(ref data) => {
|
||||||
let parent_trait_ref = self.resolve_vars_if_possible(data.parent_trait_pred);
|
let parent_trait_ref = self.resolve_vars_if_possible(data.parent_trait_pred);
|
||||||
let parent_predicate = parent_trait_ref;
|
let parent_predicate = parent_trait_ref;
|
||||||
// #74711: avoid a stack overflow
|
// #74711: avoid a stack overflow
|
||||||
|
@ -381,7 +381,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
|
|||||||
if let Some(parent_trait_pred) = predicate.to_opt_poly_trait_pred() {
|
if let Some(parent_trait_pred) = predicate.to_opt_poly_trait_pred() {
|
||||||
cause = cause.derived_cause(
|
cause = cause.derived_cause(
|
||||||
parent_trait_pred,
|
parent_trait_pred,
|
||||||
traits::ObligationCauseCode::DerivedObligation,
|
traits::ObligationCauseCode::WellFormedDerivedObligation,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
extend_cause_with_original_assoc_item_obligation(tcx, item, &mut cause, predicate);
|
extend_cause_with_original_assoc_item_obligation(tcx, item, &mut cause, predicate);
|
||||||
|
@ -101,18 +101,11 @@ fn resolve_associated_item<'tcx>(
|
|||||||
|
|
||||||
let vtbl = match tcx.codegen_select_candidate((param_env, trait_ref)) {
|
let vtbl = match tcx.codegen_select_candidate((param_env, trait_ref)) {
|
||||||
Ok(vtbl) => vtbl,
|
Ok(vtbl) => vtbl,
|
||||||
Err(CodegenObligationError::Ambiguity) => {
|
Err(
|
||||||
let reported = tcx.dcx().span_delayed_bug(
|
CodegenObligationError::Ambiguity
|
||||||
tcx.def_span(trait_item_id),
|
| CodegenObligationError::Unimplemented
|
||||||
format!(
|
| CodegenObligationError::FulfillmentError,
|
||||||
"encountered ambiguity selecting `{trait_ref:?}` during codegen, presuming due to \
|
) => return Ok(None),
|
||||||
overflow or prior type error",
|
|
||||||
),
|
|
||||||
);
|
|
||||||
return Err(reported);
|
|
||||||
}
|
|
||||||
Err(CodegenObligationError::Unimplemented) => return Ok(None),
|
|
||||||
Err(CodegenObligationError::FulfillmentError) => return Ok(None),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Now that we know which impl is being used, we can dispatch to
|
// Now that we know which impl is being used, we can dispatch to
|
||||||
|
@ -515,9 +515,7 @@ macro_rules! spec_int_ranges_r {
|
|||||||
unsafe impl StepByBackImpl<Range<$t>> for StepBy<Range<$t>> {
|
unsafe impl StepByBackImpl<Range<$t>> for StepBy<Range<$t>> {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn spec_next_back(&mut self) -> Option<Self::Item>
|
fn spec_next_back(&mut self) -> Option<Self::Item> {
|
||||||
where Range<$t>: DoubleEndedIterator + ExactSizeIterator,
|
|
||||||
{
|
|
||||||
let step = self.original_step().get() as $t;
|
let step = self.original_step().get() as $t;
|
||||||
let remaining = self.iter.end;
|
let remaining = self.iter.end;
|
||||||
if remaining > 0 {
|
if remaining > 0 {
|
||||||
@ -533,9 +531,7 @@ macro_rules! spec_int_ranges_r {
|
|||||||
// We have to repeat them here so that the specialization overrides the StepByImplBack defaults
|
// We have to repeat them here so that the specialization overrides the StepByImplBack defaults
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn spec_nth_back(&mut self, n: usize) -> Option<Self::Item>
|
fn spec_nth_back(&mut self, n: usize) -> Option<Self::Item> {
|
||||||
where Self: DoubleEndedIterator,
|
|
||||||
{
|
|
||||||
if self.advance_back_by(n).is_err() {
|
if self.advance_back_by(n).is_err() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@ -544,10 +540,9 @@ macro_rules! spec_int_ranges_r {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn spec_try_rfold<Acc, F, R>(&mut self, init: Acc, mut f: F) -> R
|
fn spec_try_rfold<Acc, F, R>(&mut self, init: Acc, mut f: F) -> R
|
||||||
where
|
where
|
||||||
Self: DoubleEndedIterator,
|
F: FnMut(Acc, Self::Item) -> R,
|
||||||
F: FnMut(Acc, Self::Item) -> R,
|
R: Try<Output = Acc>
|
||||||
R: Try<Output = Acc>
|
|
||||||
{
|
{
|
||||||
let mut accum = init;
|
let mut accum = init;
|
||||||
while let Some(x) = self.next_back() {
|
while let Some(x) = self.next_back() {
|
||||||
@ -558,9 +553,8 @@ macro_rules! spec_int_ranges_r {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn spec_rfold<Acc, F>(mut self, init: Acc, mut f: F) -> Acc
|
fn spec_rfold<Acc, F>(mut self, init: Acc, mut f: F) -> Acc
|
||||||
where
|
where
|
||||||
Self: DoubleEndedIterator,
|
F: FnMut(Acc, Self::Item) -> Acc
|
||||||
F: FnMut(Acc, Self::Item) -> Acc
|
|
||||||
{
|
{
|
||||||
let mut accum = init;
|
let mut accum = init;
|
||||||
while let Some(x) = self.next_back() {
|
while let Some(x) = self.next_back() {
|
||||||
|
@ -869,8 +869,6 @@ impl Error {
|
|||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(io_error_downcast)]
|
|
||||||
///
|
|
||||||
/// use std::fmt;
|
/// use std::fmt;
|
||||||
/// use std::io;
|
/// use std::io;
|
||||||
/// use std::error::Error;
|
/// use std::error::Error;
|
||||||
@ -923,7 +921,7 @@ impl Error {
|
|||||||
/// assert!(io_error.raw_os_error().is_none());
|
/// assert!(io_error.raw_os_error().is_none());
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "io_error_downcast", issue = "99262")]
|
#[stable(feature = "io_error_downcast", since = "CURRENT_RUSTC_VERSION")]
|
||||||
pub fn downcast<E>(self) -> result::Result<E, Self>
|
pub fn downcast<E>(self) -> result::Result<E, Self>
|
||||||
where
|
where
|
||||||
E: error::Error + Send + Sync + 'static,
|
E: error::Error + Send + Sync + 'static,
|
||||||
|
@ -43,7 +43,7 @@ pub struct Std {
|
|||||||
/// This shouldn't be used from other steps; see the comment on [`Rustc`].
|
/// This shouldn't be used from other steps; see the comment on [`Rustc`].
|
||||||
crates: Vec<String>,
|
crates: Vec<String>,
|
||||||
/// When using download-rustc, we need to use a new build of `std` for running unit tests of Std itself,
|
/// When using download-rustc, we need to use a new build of `std` for running unit tests of Std itself,
|
||||||
/// but we need to use the downloaded copy of std for linking to rustdoc. Allow this to be overriden by `builder.ensure` from other steps.
|
/// but we need to use the downloaded copy of std for linking to rustdoc. Allow this to be overridden by `builder.ensure` from other steps.
|
||||||
force_recompile: bool,
|
force_recompile: bool,
|
||||||
extra_rust_args: &'static [&'static str],
|
extra_rust_args: &'static [&'static str],
|
||||||
is_for_mir_opt_tests: bool,
|
is_for_mir_opt_tests: bool,
|
||||||
|
@ -17,10 +17,13 @@ from typing import List, Dict, Any, Optional
|
|||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
CI_DIR = Path(__file__).absolute().parent.parent
|
||||||
JOBS_YAML_PATH = Path(__file__).absolute().parent / "jobs.yml"
|
JOBS_YAML_PATH = Path(__file__).absolute().parent / "jobs.yml"
|
||||||
|
|
||||||
|
Job = Dict[str, Any]
|
||||||
|
|
||||||
def name_jobs(jobs: List[Dict], prefix: str) -> List[Dict]:
|
|
||||||
|
def name_jobs(jobs: List[Dict], prefix: str) -> List[Job]:
|
||||||
"""
|
"""
|
||||||
Add a `name` attribute to each job, based on its image and the given `prefix`.
|
Add a `name` attribute to each job, based on its image and the given `prefix`.
|
||||||
"""
|
"""
|
||||||
@ -29,7 +32,7 @@ def name_jobs(jobs: List[Dict], prefix: str) -> List[Dict]:
|
|||||||
return jobs
|
return jobs
|
||||||
|
|
||||||
|
|
||||||
def add_base_env(jobs: List[Dict], environment: Dict[str, str]) -> List[Dict]:
|
def add_base_env(jobs: List[Job], environment: Dict[str, str]) -> List[Job]:
|
||||||
"""
|
"""
|
||||||
Prepends `environment` to the `env` attribute of each job.
|
Prepends `environment` to the `env` attribute of each job.
|
||||||
The `env` of each job has higher precedence than `environment`.
|
The `env` of each job has higher precedence than `environment`.
|
||||||
@ -77,7 +80,7 @@ def find_job_type(ctx: GitHubCtx) -> Optional[JobType]:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def calculate_jobs(job_type: JobType, job_data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
def calculate_jobs(job_type: JobType, job_data: Dict[str, Any]) -> List[Job]:
|
||||||
if job_type == JobType.PR:
|
if job_type == JobType.PR:
|
||||||
return add_base_env(name_jobs(job_data["pr"], "PR"), job_data["envs"]["pr"])
|
return add_base_env(name_jobs(job_data["pr"], "PR"), job_data["envs"]["pr"])
|
||||||
elif job_type == JobType.Try:
|
elif job_type == JobType.Try:
|
||||||
@ -88,6 +91,13 @@ def calculate_jobs(job_type: JobType, job_data: Dict[str, Any]) -> List[Dict[str
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
def skip_jobs(jobs: List[Dict[str, Any]], channel: str) -> List[Job]:
|
||||||
|
"""
|
||||||
|
Skip CI jobs that are not supposed to be executed on the given `channel`.
|
||||||
|
"""
|
||||||
|
return [j for j in jobs if j.get("only_on_channel", channel) == channel]
|
||||||
|
|
||||||
|
|
||||||
def get_github_ctx() -> GitHubCtx:
|
def get_github_ctx() -> GitHubCtx:
|
||||||
return GitHubCtx(
|
return GitHubCtx(
|
||||||
event_name=os.environ["GITHUB_EVENT_NAME"],
|
event_name=os.environ["GITHUB_EVENT_NAME"],
|
||||||
@ -107,9 +117,13 @@ if __name__ == "__main__":
|
|||||||
job_type = find_job_type(github_ctx)
|
job_type = find_job_type(github_ctx)
|
||||||
logging.info(f"Job type: {job_type}")
|
logging.info(f"Job type: {job_type}")
|
||||||
|
|
||||||
|
with open(CI_DIR / "channel") as f:
|
||||||
|
channel = f.read().strip()
|
||||||
|
|
||||||
jobs = []
|
jobs = []
|
||||||
if job_type is not None:
|
if job_type is not None:
|
||||||
jobs = calculate_jobs(job_type, data)
|
jobs = calculate_jobs(job_type, data)
|
||||||
|
jobs = skip_jobs(jobs, channel)
|
||||||
|
|
||||||
logging.info(f"Output:\n{yaml.dump(jobs, indent=4)}")
|
logging.info(f"Output:\n{yaml.dump(jobs, indent=4)}")
|
||||||
print(f"jobs={json.dumps(jobs)}")
|
print(f"jobs={json.dumps(jobs)}")
|
||||||
|
@ -107,9 +107,6 @@ x--expand-yaml-anchors--remove:
|
|||||||
- &job-aarch64-linux
|
- &job-aarch64-linux
|
||||||
os: [self-hosted, ARM64, linux]
|
os: [self-hosted, ARM64, linux]
|
||||||
|
|
||||||
- &step
|
|
||||||
if: success() && !env.SKIP_JOB
|
|
||||||
|
|
||||||
- &base-ci-job
|
- &base-ci-job
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
@ -151,7 +148,7 @@ x--expand-yaml-anchors--remove:
|
|||||||
run: echo "[CI_PR_NUMBER=$num]"
|
run: echo "[CI_PR_NUMBER=$num]"
|
||||||
env:
|
env:
|
||||||
num: ${{ github.event.number }}
|
num: ${{ github.event.number }}
|
||||||
if: success() && !env.SKIP_JOB && github.event_name == 'pull_request'
|
if: success() && github.event_name == 'pull_request'
|
||||||
|
|
||||||
- name: add extra environment variables
|
- name: add extra environment variables
|
||||||
run: src/ci/scripts/setup-environment.sh
|
run: src/ci/scripts/setup-environment.sh
|
||||||
@ -161,71 +158,51 @@ x--expand-yaml-anchors--remove:
|
|||||||
# are passed to the `setup-environment.sh` script encoded in JSON,
|
# are passed to the `setup-environment.sh` script encoded in JSON,
|
||||||
# which then uses log commands to actually set them.
|
# which then uses log commands to actually set them.
|
||||||
EXTRA_VARIABLES: ${{ toJson(matrix.env) }}
|
EXTRA_VARIABLES: ${{ toJson(matrix.env) }}
|
||||||
<<: *step
|
|
||||||
|
|
||||||
- name: decide whether to skip this job
|
|
||||||
run: src/ci/scripts/should-skip-this.sh
|
|
||||||
<<: *step
|
|
||||||
|
|
||||||
- name: ensure the channel matches the target branch
|
- name: ensure the channel matches the target branch
|
||||||
run: src/ci/scripts/verify-channel.sh
|
run: src/ci/scripts/verify-channel.sh
|
||||||
<<: *step
|
|
||||||
|
|
||||||
- name: collect CPU statistics
|
- name: collect CPU statistics
|
||||||
run: src/ci/scripts/collect-cpu-stats.sh
|
run: src/ci/scripts/collect-cpu-stats.sh
|
||||||
<<: *step
|
|
||||||
|
|
||||||
- name: show the current environment
|
- name: show the current environment
|
||||||
run: src/ci/scripts/dump-environment.sh
|
run: src/ci/scripts/dump-environment.sh
|
||||||
<<: *step
|
|
||||||
|
|
||||||
- name: install awscli
|
- name: install awscli
|
||||||
run: src/ci/scripts/install-awscli.sh
|
run: src/ci/scripts/install-awscli.sh
|
||||||
<<: *step
|
|
||||||
|
|
||||||
- name: install sccache
|
- name: install sccache
|
||||||
run: src/ci/scripts/install-sccache.sh
|
run: src/ci/scripts/install-sccache.sh
|
||||||
<<: *step
|
|
||||||
|
|
||||||
- name: select Xcode
|
- name: select Xcode
|
||||||
run: src/ci/scripts/select-xcode.sh
|
run: src/ci/scripts/select-xcode.sh
|
||||||
<<: *step
|
|
||||||
|
|
||||||
- name: install clang
|
- name: install clang
|
||||||
run: src/ci/scripts/install-clang.sh
|
run: src/ci/scripts/install-clang.sh
|
||||||
<<: *step
|
|
||||||
|
|
||||||
- name: install tidy
|
- name: install tidy
|
||||||
run: src/ci/scripts/install-tidy.sh
|
run: src/ci/scripts/install-tidy.sh
|
||||||
<<: *step
|
|
||||||
|
|
||||||
- name: install WIX
|
- name: install WIX
|
||||||
run: src/ci/scripts/install-wix.sh
|
run: src/ci/scripts/install-wix.sh
|
||||||
<<: *step
|
|
||||||
|
|
||||||
- name: disable git crlf conversion
|
- name: disable git crlf conversion
|
||||||
run: src/ci/scripts/disable-git-crlf-conversion.sh
|
run: src/ci/scripts/disable-git-crlf-conversion.sh
|
||||||
<<: *step
|
|
||||||
|
|
||||||
- name: checkout submodules
|
- name: checkout submodules
|
||||||
run: src/ci/scripts/checkout-submodules.sh
|
run: src/ci/scripts/checkout-submodules.sh
|
||||||
<<: *step
|
|
||||||
|
|
||||||
- name: install MSYS2
|
- name: install MSYS2
|
||||||
run: src/ci/scripts/install-msys2.sh
|
run: src/ci/scripts/install-msys2.sh
|
||||||
<<: *step
|
|
||||||
|
|
||||||
- name: install MinGW
|
- name: install MinGW
|
||||||
run: src/ci/scripts/install-mingw.sh
|
run: src/ci/scripts/install-mingw.sh
|
||||||
<<: *step
|
|
||||||
|
|
||||||
- name: install ninja
|
- name: install ninja
|
||||||
run: src/ci/scripts/install-ninja.sh
|
run: src/ci/scripts/install-ninja.sh
|
||||||
<<: *step
|
|
||||||
|
|
||||||
- name: enable ipv6 on Docker
|
- name: enable ipv6 on Docker
|
||||||
run: src/ci/scripts/enable-docker-ipv6.sh
|
run: src/ci/scripts/enable-docker-ipv6.sh
|
||||||
<<: *step
|
|
||||||
|
|
||||||
# Disable automatic line ending conversion (again). On Windows, when we're
|
# Disable automatic line ending conversion (again). On Windows, when we're
|
||||||
# installing dependencies, something switches the git configuration directory or
|
# installing dependencies, something switches the git configuration directory or
|
||||||
@ -234,19 +211,15 @@ x--expand-yaml-anchors--remove:
|
|||||||
# appropriate line endings.
|
# appropriate line endings.
|
||||||
- name: disable git crlf conversion
|
- name: disable git crlf conversion
|
||||||
run: src/ci/scripts/disable-git-crlf-conversion.sh
|
run: src/ci/scripts/disable-git-crlf-conversion.sh
|
||||||
<<: *step
|
|
||||||
|
|
||||||
- name: ensure line endings are correct
|
- name: ensure line endings are correct
|
||||||
run: src/ci/scripts/verify-line-endings.sh
|
run: src/ci/scripts/verify-line-endings.sh
|
||||||
<<: *step
|
|
||||||
|
|
||||||
- name: ensure backported commits are in upstream branches
|
- name: ensure backported commits are in upstream branches
|
||||||
run: src/ci/scripts/verify-backported-commits.sh
|
run: src/ci/scripts/verify-backported-commits.sh
|
||||||
<<: *step
|
|
||||||
|
|
||||||
- name: ensure the stable version number is correct
|
- name: ensure the stable version number is correct
|
||||||
run: src/ci/scripts/verify-stable-version-number.sh
|
run: src/ci/scripts/verify-stable-version-number.sh
|
||||||
<<: *step
|
|
||||||
|
|
||||||
- name: run the build
|
- name: run the build
|
||||||
# Redirect stderr to stdout to avoid reordering the two streams in the GHA logs.
|
# Redirect stderr to stdout to avoid reordering the two streams in the GHA logs.
|
||||||
@ -255,11 +228,9 @@ x--expand-yaml-anchors--remove:
|
|||||||
AWS_ACCESS_KEY_ID: ${{ env.CACHES_AWS_ACCESS_KEY_ID }}
|
AWS_ACCESS_KEY_ID: ${{ env.CACHES_AWS_ACCESS_KEY_ID }}
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}
|
||||||
TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
|
TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
|
||||||
<<: *step
|
|
||||||
|
|
||||||
- name: create github artifacts
|
- name: create github artifacts
|
||||||
run: src/ci/scripts/create-doc-artifacts.sh
|
run: src/ci/scripts/create-doc-artifacts.sh
|
||||||
<<: *step
|
|
||||||
|
|
||||||
- name: upload artifacts to github
|
- name: upload artifacts to github
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
@ -269,7 +240,6 @@ x--expand-yaml-anchors--remove:
|
|||||||
path: obj/artifacts/doc
|
path: obj/artifacts/doc
|
||||||
if-no-files-found: ignore
|
if-no-files-found: ignore
|
||||||
retention-days: 5
|
retention-days: 5
|
||||||
<<: *step
|
|
||||||
|
|
||||||
- name: upload artifacts to S3
|
- name: upload artifacts to S3
|
||||||
run: src/ci/scripts/upload-artifacts.sh
|
run: src/ci/scripts/upload-artifacts.sh
|
||||||
@ -281,8 +251,7 @@ x--expand-yaml-anchors--remove:
|
|||||||
# adding the condition is helpful as this way CI will not silently skip
|
# adding the condition is helpful as this way CI will not silently skip
|
||||||
# deploying artifacts from a dist builder if the variables are misconfigured,
|
# deploying artifacts from a dist builder if the variables are misconfigured,
|
||||||
# erroring about invalid credentials instead.
|
# erroring about invalid credentials instead.
|
||||||
if: success() && !env.SKIP_JOB && (github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1')
|
if: success() && (github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1')
|
||||||
<<: *step
|
|
||||||
|
|
||||||
# These snippets are used by the try-success, try-failure, auto-success and auto-failure jobs.
|
# These snippets are used by the try-success, try-failure, auto-success and auto-failure jobs.
|
||||||
# Check out their documentation for more information on why they're needed.
|
# Check out their documentation for more information on why they're needed.
|
||||||
@ -399,7 +368,6 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
|
TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
|
||||||
<<: *step
|
|
||||||
|
|
||||||
# These jobs don't actually test anything, but they're used to tell bors the
|
# These jobs don't actually test anything, but they're used to tell bors the
|
||||||
# build completed, as there is no practical way to detect when a workflow is
|
# build completed, as there is no practical way to detect when a workflow is
|
||||||
|
@ -79,7 +79,7 @@ pr:
|
|||||||
<<: *job-linux-16c
|
<<: *job-linux-16c
|
||||||
|
|
||||||
# Jobs that run when you perform a try build (@bors try)
|
# Jobs that run when you perform a try build (@bors try)
|
||||||
# These jobs automatically inherit envs.production, to avoid repeating
|
# These jobs automatically inherit envs.try, to avoid repeating
|
||||||
# it in each job definition.
|
# it in each job definition.
|
||||||
try:
|
try:
|
||||||
- image: dist-x86_64-linux
|
- image: dist-x86_64-linux
|
||||||
@ -88,7 +88,7 @@ try:
|
|||||||
<<: *job-linux-16c
|
<<: *job-linux-16c
|
||||||
|
|
||||||
# Main CI jobs that have to be green to merge a commit into master
|
# Main CI jobs that have to be green to merge a commit into master
|
||||||
# These jobs automatically inherit envs.production, to avoid repeating
|
# These jobs automatically inherit envs.auto, to avoid repeating
|
||||||
# it in each job definition.
|
# it in each job definition.
|
||||||
auto:
|
auto:
|
||||||
#############################
|
#############################
|
||||||
@ -200,24 +200,23 @@ auto:
|
|||||||
# channel name on the output), and this builder prevents landing
|
# channel name on the output), and this builder prevents landing
|
||||||
# changes that would result in broken builds after a promotion.
|
# changes that would result in broken builds after a promotion.
|
||||||
- image: x86_64-gnu-stable
|
- image: x86_64-gnu-stable
|
||||||
|
# Only run this job on the nightly channel. Running this on beta
|
||||||
|
# could cause failures when `dev: 1` in `stage0.txt`, and running
|
||||||
|
# this on stable is useless.
|
||||||
|
only_on_channel: nightly
|
||||||
env:
|
env:
|
||||||
IMAGE: x86_64-gnu
|
IMAGE: x86_64-gnu
|
||||||
RUST_CI_OVERRIDE_RELEASE_CHANNEL: stable
|
RUST_CI_OVERRIDE_RELEASE_CHANNEL: stable
|
||||||
# Only run this job on the nightly channel. Running this on beta
|
|
||||||
# could cause failures when `dev: 1` in `stage0.txt`, and running
|
|
||||||
# this on stable is useless.
|
|
||||||
CI_ONLY_WHEN_CHANNEL: nightly
|
|
||||||
<<: *job-linux-4c
|
<<: *job-linux-4c
|
||||||
|
|
||||||
- image: x86_64-gnu-aux
|
- image: x86_64-gnu-aux
|
||||||
<<: *job-linux-4c
|
<<: *job-linux-4c
|
||||||
|
|
||||||
- image: x86_64-gnu-integration
|
- image: x86_64-gnu-integration
|
||||||
env:
|
# Only run this job on the nightly channel. Fuchsia requires
|
||||||
# Only run this job on the nightly channel. Fuchsia requires
|
# nightly features to compile, and this job would fail if
|
||||||
# nightly features to compile, and this job would fail if
|
# executed on beta and stable.
|
||||||
# executed on beta and stable.
|
only_on_channel: nightly
|
||||||
CI_ONLY_WHEN_CHANNEL: nightly
|
|
||||||
<<: *job-linux-8c
|
<<: *job-linux-8c
|
||||||
|
|
||||||
- image: x86_64-gnu-debug
|
- image: x86_64-gnu-debug
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Set the SKIP_JOB environment variable if this job is not supposed to run on the current builder.
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
IFS=$'\n\t'
|
|
||||||
|
|
||||||
source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
|
|
||||||
|
|
||||||
if [[ -n "${CI_ONLY_WHEN_CHANNEL-}" ]]; then
|
|
||||||
if [[ "${CI_ONLY_WHEN_CHANNEL}" = "$(cat src/ci/channel)" ]]; then
|
|
||||||
echo "The channel is the expected one"
|
|
||||||
else
|
|
||||||
echo "Not executing this job as the channel is not the expected one"
|
|
||||||
ciCommandSetEnv SKIP_JOB 1
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
echo "Executing the job since there is no skip rule preventing the execution"
|
|
||||||
exit 0
|
|
@ -42,6 +42,18 @@ generated code, but may be slower to compile.
|
|||||||
The default value, if not specified, is 16 for non-incremental builds. For
|
The default value, if not specified, is 16 for non-incremental builds. For
|
||||||
incremental builds the default is 256 which allows caching to be more granular.
|
incremental builds the default is 256 which allows caching to be more granular.
|
||||||
|
|
||||||
|
## collapse-macro-debuginfo
|
||||||
|
|
||||||
|
This flag controls whether code locations from a macro definition are collapsed into a single
|
||||||
|
location associated with that macro's call site, when generating debuginfo for this crate.
|
||||||
|
|
||||||
|
This option, if passed, overrides both default collapsing behavior and `#[collapse_debuginfo]`
|
||||||
|
attributes in code.
|
||||||
|
|
||||||
|
* `y`, `yes`, `on`, `true`: collapse code locations in debuginfo.
|
||||||
|
* `n`, `no`, `off` or `false`: do not collapse code locations in debuginfo.
|
||||||
|
* `external`: collapse code locations in debuginfo only if the macro comes from a different crate.
|
||||||
|
|
||||||
## control-flow-guard
|
## control-flow-guard
|
||||||
|
|
||||||
This flag controls whether LLVM enables the Windows [Control Flow
|
This flag controls whether LLVM enables the Windows [Control Flow
|
||||||
|
@ -1420,7 +1420,7 @@ impl LinkCollector<'_, '_> {
|
|||||||
//
|
//
|
||||||
// Otherwise, check if 2 links are same, if so, skip the resolve process.
|
// Otherwise, check if 2 links are same, if so, skip the resolve process.
|
||||||
//
|
//
|
||||||
// Notice that this algorithm is passive, might possibly miss actual redudant cases.
|
// Notice that this algorithm is passive, might possibly miss actual redundant cases.
|
||||||
let explicit_link = explicit_link.to_string();
|
let explicit_link = explicit_link.to_string();
|
||||||
let display_text = ori_link.display_text.as_ref().unwrap();
|
let display_text = ori_link.display_text.as_ref().unwrap();
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ use crate::*;
|
|||||||
use rustc_ast::ast::Mutability;
|
use rustc_ast::ast::Mutability;
|
||||||
use rustc_middle::ty::layout::LayoutOf as _;
|
use rustc_middle::ty::layout::LayoutOf as _;
|
||||||
use rustc_middle::ty::{self, Instance, Ty};
|
use rustc_middle::ty::{self, Instance, Ty};
|
||||||
use rustc_span::{BytePos, Loc, Symbol};
|
use rustc_span::{hygiene, BytePos, Loc, Symbol};
|
||||||
use rustc_target::{abi::Size, spec::abi::Abi};
|
use rustc_target::{abi::Size, spec::abi::Abi};
|
||||||
|
|
||||||
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriInterpCx<'mir, 'tcx> {}
|
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriInterpCx<'mir, 'tcx> {}
|
||||||
@ -45,12 +45,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
|||||||
|
|
||||||
let mut data = Vec::new();
|
let mut data = Vec::new();
|
||||||
for frame in this.active_thread_stack().iter().rev() {
|
for frame in this.active_thread_stack().iter().rev() {
|
||||||
let mut span = frame.current_span();
|
// Match behavior of debuginfo (`FunctionCx::adjusted_span_and_dbg_scope`).
|
||||||
// Match the behavior of runtime backtrace spans
|
let span = hygiene::walk_chain_collapsed(frame.current_span(), frame.body.span);
|
||||||
// by using a non-macro span in our backtrace. See `FunctionCx::debug_loc`.
|
|
||||||
if span.from_expansion() && !tcx.sess.opts.unstable_opts.debug_macros {
|
|
||||||
span = rustc_span::hygiene::walk_chain(span, frame.body.span.ctxt())
|
|
||||||
}
|
|
||||||
data.push((frame.instance, span.lo()));
|
data.push((frame.instance, span.lo()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
$DIR/backtrace-api-v0.rs:24:14 (func_d)
|
$DIR/backtrace-api-v0.rs:24:14 (func_d)
|
||||||
$DIR/backtrace-api-v0.rs:20:5 (func_c)
|
$DIR/backtrace-api-v0.rs:14:9 (func_c)
|
||||||
$DIR/backtrace-api-v0.rs:9:5 (func_b::<u8>)
|
$DIR/backtrace-api-v0.rs:9:5 (func_b::<u8>)
|
||||||
$DIR/backtrace-api-v0.rs:5:5 (func_a)
|
$DIR/backtrace-api-v0.rs:5:5 (func_a)
|
||||||
$DIR/backtrace-api-v0.rs:29:18 (main)
|
$DIR/backtrace-api-v0.rs:29:18 (main)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
$DIR/backtrace-api-v1.rs:27:9 (func_d)
|
$DIR/backtrace-api-v1.rs:27:9 (func_d)
|
||||||
$DIR/backtrace-api-v1.rs:20:5 (func_c)
|
$DIR/backtrace-api-v1.rs:14:9 (func_c)
|
||||||
$DIR/backtrace-api-v1.rs:9:5 (func_b::<u8>)
|
$DIR/backtrace-api-v1.rs:9:5 (func_b::<u8>)
|
||||||
$DIR/backtrace-api-v1.rs:5:5 (func_a)
|
$DIR/backtrace-api-v1.rs:5:5 (func_a)
|
||||||
$DIR/backtrace-api-v1.rs:34:18 (main)
|
$DIR/backtrace-api-v1.rs:34:18 (main)
|
||||||
|
@ -5,5 +5,6 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
object = "0.34.0"
|
object = "0.34.0"
|
||||||
|
similar = "2.5.0"
|
||||||
wasmparser = "0.118.2"
|
wasmparser = "0.118.2"
|
||||||
regex = "1.8" # 1.8 to avoid memchr 2.6.0, as 2.5.0 is pinned in the workspace
|
regex = "1.8" # 1.8 to avoid memchr 2.6.0, as 2.5.0 is pinned in the workspace
|
||||||
|
81
src/tools/run-make-support/src/diff/mod.rs
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
use similar::TextDiff;
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests;
|
||||||
|
|
||||||
|
pub fn diff() -> Diff {
|
||||||
|
Diff::new()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct Diff {
|
||||||
|
expected: Option<String>,
|
||||||
|
expected_name: Option<String>,
|
||||||
|
actual: Option<String>,
|
||||||
|
actual_name: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Diff {
|
||||||
|
/// Construct a bare `diff` invocation.
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self { expected: None, expected_name: None, actual: None, actual_name: None }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Specify the expected output for the diff from a file.
|
||||||
|
pub fn expected_file<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
|
||||||
|
let path = path.as_ref();
|
||||||
|
let content = std::fs::read_to_string(path).expect("failed to read file");
|
||||||
|
let name = path.to_string_lossy().to_string();
|
||||||
|
|
||||||
|
self.expected = Some(content);
|
||||||
|
self.expected_name = Some(name);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Specify the expected output for the diff from a given text string.
|
||||||
|
pub fn expected_text<T: AsRef<[u8]>>(&mut self, name: &str, text: T) -> &mut Self {
|
||||||
|
self.expected = Some(String::from_utf8_lossy(text.as_ref()).to_string());
|
||||||
|
self.expected_name = Some(name.to_string());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Specify the actual output for the diff from a file.
|
||||||
|
pub fn actual_file<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
|
||||||
|
let path = path.as_ref();
|
||||||
|
let content = std::fs::read_to_string(path).expect("failed to read file");
|
||||||
|
let name = path.to_string_lossy().to_string();
|
||||||
|
|
||||||
|
self.actual = Some(content);
|
||||||
|
self.actual_name = Some(name);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Specify the actual output for the diff from a given text string.
|
||||||
|
pub fn actual_text<T: AsRef<[u8]>>(&mut self, name: &str, text: T) -> &mut Self {
|
||||||
|
self.actual = Some(String::from_utf8_lossy(text.as_ref()).to_string());
|
||||||
|
self.actual_name = Some(name.to_string());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Executes the diff process, prints any differences to the standard error.
|
||||||
|
#[track_caller]
|
||||||
|
pub fn run(&self) {
|
||||||
|
let expected = self.expected.as_ref().expect("expected text not set");
|
||||||
|
let actual = self.actual.as_ref().expect("actual text not set");
|
||||||
|
let expected_name = self.expected_name.as_ref().unwrap();
|
||||||
|
let actual_name = self.actual_name.as_ref().unwrap();
|
||||||
|
|
||||||
|
let output = TextDiff::from_lines(expected, actual)
|
||||||
|
.unified_diff()
|
||||||
|
.header(expected_name, actual_name)
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
if !output.is_empty() {
|
||||||
|
panic!(
|
||||||
|
"test failed: `{}` is different from `{}`\n\n{}",
|
||||||
|
expected_name, actual_name, output
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
39
src/tools/run-make-support/src/diff/tests.rs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_diff() {
|
||||||
|
let expected = "foo\nbar\nbaz\n";
|
||||||
|
let actual = "foo\nbar\nbaz\n";
|
||||||
|
diff().expected_text("EXPECTED_TEXT", expected).actual_text("ACTUAL_TEXT", actual).run();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_should_panic() {
|
||||||
|
let expected = "foo\nbar\nbaz\n";
|
||||||
|
let actual = "foo\nbaz\nbar\n";
|
||||||
|
|
||||||
|
let output = std::panic::catch_unwind(|| {
|
||||||
|
diff()
|
||||||
|
.expected_text("EXPECTED_TEXT", expected)
|
||||||
|
.actual_text("ACTUAL_TEXT", actual)
|
||||||
|
.run();
|
||||||
|
})
|
||||||
|
.unwrap_err();
|
||||||
|
|
||||||
|
let expected_output = "\
|
||||||
|
test failed: `EXPECTED_TEXT` is different from `ACTUAL_TEXT`
|
||||||
|
|
||||||
|
--- EXPECTED_TEXT
|
||||||
|
+++ ACTUAL_TEXT
|
||||||
|
@@ -1,3 +1,3 @@
|
||||||
|
foo
|
||||||
|
+baz
|
||||||
|
bar
|
||||||
|
-baz
|
||||||
|
";
|
||||||
|
|
||||||
|
assert_eq!(output.downcast_ref::<String>().unwrap(), expected_output);
|
||||||
|
}
|
||||||
|
}
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
pub mod cc;
|
pub mod cc;
|
||||||
pub mod clang;
|
pub mod clang;
|
||||||
|
pub mod diff;
|
||||||
pub mod llvm_readobj;
|
pub mod llvm_readobj;
|
||||||
pub mod run;
|
pub mod run;
|
||||||
pub mod rustc;
|
pub mod rustc;
|
||||||
@ -20,6 +21,7 @@ pub use wasmparser;
|
|||||||
|
|
||||||
pub use cc::{cc, extra_c_flags, extra_cxx_flags, Cc};
|
pub use cc::{cc, extra_c_flags, extra_cxx_flags, Cc};
|
||||||
pub use clang::{clang, Clang};
|
pub use clang::{clang, Clang};
|
||||||
|
pub use diff::{diff, Diff};
|
||||||
pub use llvm_readobj::{llvm_readobj, LlvmReadobj};
|
pub use llvm_readobj::{llvm_readobj, LlvmReadobj};
|
||||||
pub use run::{run, run_fail};
|
pub use run::{run, run_fail};
|
||||||
pub use rustc::{aux_build, rustc, Rustc};
|
pub use rustc::{aux_build, rustc, Rustc};
|
||||||
|
@ -148,6 +148,13 @@ impl Rustc {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Specify the print request.
|
||||||
|
pub fn print(&mut self, request: &str) -> &mut Self {
|
||||||
|
self.cmd.arg("--print");
|
||||||
|
self.cmd.arg(request);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Add an extra argument to the linker invocation, via `-Clink-arg`.
|
/// Add an extra argument to the linker invocation, via `-Clink-arg`.
|
||||||
pub fn link_arg(&mut self, link_arg: &str) -> &mut Self {
|
pub fn link_arg(&mut self, link_arg: &str) -> &mut Self {
|
||||||
self.cmd.arg(format!("-Clink-arg={link_arg}"));
|
self.cmd.arg(format!("-Clink-arg={link_arg}"));
|
||||||
|
@ -189,7 +189,6 @@ run-make/no-builtins-attribute/Makefile
|
|||||||
run-make/no-builtins-lto/Makefile
|
run-make/no-builtins-lto/Makefile
|
||||||
run-make/no-cdylib-as-rdylib/Makefile
|
run-make/no-cdylib-as-rdylib/Makefile
|
||||||
run-make/no-duplicate-libs/Makefile
|
run-make/no-duplicate-libs/Makefile
|
||||||
run-make/no-input-file/Makefile
|
|
||||||
run-make/no-intermediate-extras/Makefile
|
run-make/no-intermediate-extras/Makefile
|
||||||
run-make/obey-crate-type-flag/Makefile
|
run-make/obey-crate-type-flag/Makefile
|
||||||
run-make/optimization-remarks-dir-pgo/Makefile
|
run-make/optimization-remarks-dir-pgo/Makefile
|
||||||
|
@ -197,7 +197,7 @@ pub fn notunpin_box(x: Box<NotUnpin>) -> Box<NotUnpin> {
|
|||||||
x
|
x
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK: @struct_return(ptr noalias nocapture noundef sret([32 x i8]) align 4 dereferenceable(32){{( %_0)?}})
|
// CHECK: @struct_return(ptr{{( dead_on_unwind)?}} noalias nocapture noundef{{( writable)?}} sret([32 x i8]) align 4 dereferenceable(32){{( %_0)?}})
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn struct_return() -> S {
|
pub fn struct_return() -> S {
|
||||||
S {
|
S {
|
||||||
|
@ -260,7 +260,7 @@ pub struct IntDoubleInt {
|
|||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn f_int_double_int_s_arg(a: IntDoubleInt) {}
|
pub extern "C" fn f_int_double_int_s_arg(a: IntDoubleInt) {}
|
||||||
|
|
||||||
// CHECK: define void @f_ret_int_double_int_s(ptr noalias nocapture noundef sret([24 x i8]) align 8 dereferenceable(24) %_0)
|
// CHECK: define void @f_ret_int_double_int_s(ptr{{( dead_on_unwind)?}} noalias nocapture noundef{{( writable)?}} sret([24 x i8]) align 8 dereferenceable(24) %_0)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn f_ret_int_double_int_s() -> IntDoubleInt {
|
pub extern "C" fn f_ret_int_double_int_s() -> IntDoubleInt {
|
||||||
IntDoubleInt { a: 1, b: 2., c: 3 }
|
IntDoubleInt { a: 1, b: 2., c: 3 }
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
//@ compile-flags: -O
|
//@ compile-flags: -O
|
||||||
|
//@ needs-unwind
|
||||||
|
//@ min-llvm-version: 18
|
||||||
#![feature(c_unwind)]
|
#![feature(c_unwind)]
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
@ -23,8 +25,8 @@ extern "C-unwind" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_from_uninit_unwind() -> Foo {
|
pub fn new_from_uninit_unwind() -> Foo {
|
||||||
// CHECK-LABEL: new_from_uninit
|
// CHECK-LABEL: new_from_uninit_unwind
|
||||||
// CHECK: call void @llvm.memcpy.
|
// CHECK-NOT: call void @llvm.memcpy.
|
||||||
let mut x = std::mem::MaybeUninit::uninit();
|
let mut x = std::mem::MaybeUninit::uninit();
|
||||||
unsafe {
|
unsafe {
|
||||||
init_unwind(x.as_mut_ptr());
|
init_unwind(x.as_mut_ptr());
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
//@ known-bug: #123461
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let _: [_; unsafe { std::mem::transmute(|o_b: Option<_>| {}) }];
|
|
||||||
}
|
|
@ -1,5 +1,4 @@
|
|||||||
//@ ignore-lldb
|
//@ ignore-lldb
|
||||||
#![feature(collapse_debuginfo)]
|
|
||||||
|
|
||||||
// Test that local macro debug info is not collapsed with #[collapse_debuginfo(external)]
|
// Test that local macro debug info is not collapsed with #[collapse_debuginfo(external)]
|
||||||
|
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
//@ ignore-lldb
|
//@ ignore-lldb
|
||||||
#![feature(collapse_debuginfo)]
|
|
||||||
|
|
||||||
// Test that macro attribute #[collapse_debuginfo(no)]
|
// Test that macro attribute #[collapse_debuginfo(no)]
|
||||||
// overrides "collapse_macro_debuginfo=external" flag
|
// overrides "collapse_macro_debuginfo=external" flag
|
||||||
|
|
||||||
//@ compile-flags:-g -Z collapse_macro_debuginfo=external
|
//@ compile-flags:-g -C collapse_macro_debuginfo=external
|
||||||
|
|
||||||
// === GDB TESTS ===================================================================================
|
// === GDB TESTS ===================================================================================
|
||||||
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
//@ ignore-lldb
|
//@ ignore-lldb
|
||||||
#![feature(collapse_debuginfo)]
|
|
||||||
|
|
||||||
// Test that println macro debug info is collapsed with "collapse_macro_debuginfo=external" flag
|
// Test that println macro debug info is collapsed with "collapse_macro_debuginfo=external" flag
|
||||||
|
|
||||||
//@ compile-flags:-g -Z collapse_macro_debuginfo=external
|
//@ compile-flags:-g -C collapse_macro_debuginfo=external
|
||||||
|
|
||||||
// === GDB TESTS ===================================================================================
|
// === GDB TESTS ===================================================================================
|
||||||
|
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
//@ ignore-lldb
|
//@ ignore-lldb
|
||||||
#![feature(collapse_debuginfo)]
|
|
||||||
|
|
||||||
// Test that statement, skipped/added/reordered by macros, is correctly processed in debuginfo.
|
// Test that statement, skipped/added/reordered by macros, is correctly processed in debuginfo.
|
||||||
// When nested macros instantiations are tagged with collapse_debuginfo attribute,
|
// When nested macros instantiations are tagged with collapse_debuginfo attribute,
|
||||||
// debug info should be corrected to the first outer macro instantiation
|
// debug info should be corrected to the first outer macro instantiation
|
||||||
// without collapse_debuginfo attribute.
|
// without collapse_debuginfo attribute.
|
||||||
// collapse_debuginfo feature enabled.
|
|
||||||
|
|
||||||
//@ compile-flags:-g
|
//@ compile-flags:-g
|
||||||
|
|
||||||
@ -61,7 +59,7 @@ fn myprintln_impl(text: &str) {
|
|||||||
println!("{}", text)
|
println!("{}", text)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
macro_rules! myprintln {
|
macro_rules! myprintln {
|
||||||
($($arg:tt)*) => {{
|
($($arg:tt)*) => {{
|
||||||
myprintln_impl($($arg)*);
|
myprintln_impl($($arg)*);
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
//@ ignore-lldb
|
|
||||||
#![feature(collapse_debuginfo)]
|
|
||||||
|
|
||||||
// Test that line numbers are not replaced with those of the outermost expansion site when the
|
|
||||||
// `collapse_debuginfo` is active, `-Zdebug-macros` is provided and `#[collapse_debuginfo]` not
|
|
||||||
// being used.
|
|
||||||
|
|
||||||
//@ compile-flags:-g -Zdebug-macros
|
|
||||||
|
|
||||||
// === GDB TESTS ===================================================================================
|
|
||||||
|
|
||||||
// gdb-command:run
|
|
||||||
// gdb-command:next
|
|
||||||
// gdb-command:frame
|
|
||||||
// gdb-check:[...]#loc1[...]
|
|
||||||
// gdb-command:next
|
|
||||||
// gdb-command:frame
|
|
||||||
// gdb-check:[...]#loc2[...]
|
|
||||||
// gdb-command:next
|
|
||||||
// gdb-command:frame
|
|
||||||
// gdb-check:[...]#loc3[...]
|
|
||||||
// gdb-command:next
|
|
||||||
// gdb-command:frame
|
|
||||||
// gdb-check:[...]#loc4[...]
|
|
||||||
// gdb-command:continue
|
|
||||||
|
|
||||||
fn one() {
|
|
||||||
println!("one");
|
|
||||||
}
|
|
||||||
fn two() {
|
|
||||||
println!("two");
|
|
||||||
}
|
|
||||||
fn three() {
|
|
||||||
println!("three");
|
|
||||||
}
|
|
||||||
fn four() {
|
|
||||||
println!("four");
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! outer {
|
|
||||||
($b:block) => {
|
|
||||||
one(); // #loc1
|
|
||||||
inner!();
|
|
||||||
$b
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! inner {
|
|
||||||
() => {
|
|
||||||
two(); // #loc2
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let ret = 0; // #break
|
|
||||||
outer!({
|
|
||||||
three(); // #loc3
|
|
||||||
four(); // #loc4
|
|
||||||
});
|
|
||||||
std::process::exit(ret);
|
|
||||||
}
|
|
@ -1,10 +1,9 @@
|
|||||||
//@ ignore-lldb
|
//@ ignore-lldb
|
||||||
#![feature(collapse_debuginfo)]
|
|
||||||
|
|
||||||
// Test that line numbers are not replaced with those of the outermost expansion site when the
|
// Test that line numbers are not replaced with those of the outermost expansion site when
|
||||||
// `collapse_debuginfo` feature is active and the attribute is not provided.
|
// `#[collapse_debuginfo]` attribute us not used.
|
||||||
|
|
||||||
//@ compile-flags:-g -Z collapse_macro_debuginfo=no
|
//@ compile-flags:-g
|
||||||
|
|
||||||
// === GDB TESTS ===================================================================================
|
// === GDB TESTS ===================================================================================
|
||||||
|
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
//@ ignore-lldb
|
//@ ignore-lldb
|
||||||
#![feature(collapse_debuginfo)]
|
|
||||||
|
|
||||||
// Test that line numbers are not replaced with those of the outermost expansion site when the
|
// Test that line numbers are not replaced with those of the outermost expansion site when
|
||||||
// `collapse_debuginfo` is active and `-Zdebug-macros` is provided, despite `#[collapse_debuginfo]`
|
// `-C collapse-macro-debuginfo=false` is passed, despite `#[collapse_debuginfo]` being used.
|
||||||
// being used.
|
|
||||||
|
|
||||||
//@ compile-flags:-g -Zdebug-macros
|
//@ compile-flags:-g -C collapse-macro-debuginfo=false
|
||||||
|
|
||||||
// === GDB TESTS ===================================================================================
|
// === GDB TESTS ===================================================================================
|
||||||
|
|
||||||
@ -37,7 +35,7 @@ fn four() {
|
|||||||
println!("four");
|
println!("four");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
macro_rules! outer {
|
macro_rules! outer {
|
||||||
($b:block) => {
|
($b:block) => {
|
||||||
one(); // #loc1
|
one(); // #loc1
|
||||||
@ -46,7 +44,7 @@ macro_rules! outer {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
macro_rules! inner {
|
macro_rules! inner {
|
||||||
() => {
|
() => {
|
||||||
two(); // #loc2
|
two(); // #loc2
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
//@ ignore-lldb
|
//@ ignore-lldb
|
||||||
#![feature(collapse_debuginfo)]
|
|
||||||
|
|
||||||
// Test that line numbers are replaced with those of the outermost expansion site when the
|
// Test that line numbers are replaced with those of the outermost expansion site when the
|
||||||
// `collapse_debuginfo` feature is active and the attribute is provided.
|
// `collapse_debuginfo` feature is active and the attribute is provided.
|
||||||
@ -33,7 +32,7 @@ fn four() {
|
|||||||
println!("four");
|
println!("four");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
macro_rules! outer {
|
macro_rules! outer {
|
||||||
($b:block) => {
|
($b:block) => {
|
||||||
one();
|
one();
|
||||||
@ -42,7 +41,7 @@ macro_rules! outer {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
macro_rules! inner {
|
macro_rules! inner {
|
||||||
() => {
|
() => {
|
||||||
two();
|
two();
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
//@ ignore-lldb
|
//@ ignore-lldb
|
||||||
#![feature(collapse_debuginfo)]
|
|
||||||
|
|
||||||
// Test that line numbers are replaced with those of the outermost expansion site when the
|
// Test that line numbers are replaced with those of the outermost expansion site when the
|
||||||
// `collapse_debuginfo` feature is active and the command line flag is provided.
|
// the command line flag is passed.
|
||||||
|
|
||||||
//@ compile-flags:-g -Z collapse_macro_debuginfo=yes
|
//@ compile-flags:-g -C collapse_macro_debuginfo=yes
|
||||||
|
|
||||||
// === GDB TESTS ===================================================================================
|
// === GDB TESTS ===================================================================================
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//@ min-lldb-version: 310
|
//@ min-lldb-version: 310
|
||||||
//@ ignore-lldb FIXME #48807
|
//@ ignore-lldb FIXME #48807
|
||||||
|
|
||||||
//@ compile-flags:-g -Zdebug-macros
|
//@ compile-flags:-g
|
||||||
|
|
||||||
// === GDB TESTS ===================================================================================
|
// === GDB TESTS ===================================================================================
|
||||||
|
|
||||||
|
@ -87,6 +87,7 @@ extern crate macro_stepping; // exports new_scope!()
|
|||||||
// lldb-command:frame select
|
// lldb-command:frame select
|
||||||
// lldb-check:[...] #inc-loc3 [...]
|
// lldb-check:[...] #inc-loc3 [...]
|
||||||
|
|
||||||
|
#[collapse_debuginfo(yes)]
|
||||||
macro_rules! foo {
|
macro_rules! foo {
|
||||||
() => {
|
() => {
|
||||||
let a = 1; opaque(a);
|
let a = 1; opaque(a);
|
||||||
@ -95,6 +96,7 @@ macro_rules! foo {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[collapse_debuginfo(yes)]
|
||||||
macro_rules! foo2 {
|
macro_rules! foo2 {
|
||||||
() => {
|
() => {
|
||||||
foo!();
|
foo!();
|
||||||
|
@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
// Test that statement, skipped/added/reordered by macros, is correctly processed in debuginfo.
|
// Test that statement, skipped/added/reordered by macros, is correctly processed in debuginfo.
|
||||||
// Performed step-over and step-into debug stepping through call statements.
|
// Performed step-over and step-into debug stepping through call statements.
|
||||||
// collapse_debuginfo feature disabled.
|
|
||||||
|
|
||||||
//@ compile-flags:-g
|
//@ compile-flags:-g -C collapse-macro-debuginfo=yes
|
||||||
|
|
||||||
// === GDB TESTS ===================================================================================
|
// === GDB TESTS ===================================================================================
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
//@ ignore-lldb
|
//@ ignore-lldb
|
||||||
#![feature(collapse_debuginfo)]
|
|
||||||
|
|
||||||
// Test that statement, skipped/added/reordered by macros, is correctly processed in debuginfo
|
// Test that statement, skipped/added/reordered by macros, is correctly processed in debuginfo
|
||||||
// Performed step-over and step-into debug stepping through call statements.
|
// Performed step-over and step-into debug stepping through call statements.
|
||||||
// collapse_debuginfo feature enabled.
|
|
||||||
|
|
||||||
//@ compile-flags:-g
|
//@ compile-flags:-g
|
||||||
|
|
||||||
@ -94,7 +92,7 @@ fn myprintln_impl(text: &str) {
|
|||||||
println!("{}", text)
|
println!("{}", text)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
macro_rules! myprintln {
|
macro_rules! myprintln {
|
||||||
($($arg:tt)*) => {{
|
($($arg:tt)*) => {{
|
||||||
myprintln_impl($($arg)*);
|
myprintln_impl($($arg)*);
|
||||||
|
@ -63,7 +63,10 @@ fn main() {
|
|||||||
.env("RUSTC", rustc)
|
.env("RUSTC", rustc)
|
||||||
.env("RUSTFLAGS", "-Copt-level=0 -Cdebug-assertions=yes")
|
.env("RUSTFLAGS", "-Copt-level=0 -Cdebug-assertions=yes")
|
||||||
.env("CARGO_TARGET_DIR", &target_dir)
|
.env("CARGO_TARGET_DIR", &target_dir)
|
||||||
.env("RUSTC_BOOTSTRAP", "1");
|
.env("RUSTC_BOOTSTRAP", "1")
|
||||||
|
// Visual Studio 2022 requires that the LIB env var be set so it can
|
||||||
|
// find the Windows SDK.
|
||||||
|
.env("LIB", std::env::var("LIB").unwrap_or_default());
|
||||||
set_host_rpath(&mut cmd);
|
set_host_rpath(&mut cmd);
|
||||||
|
|
||||||
let status = cmd.status().unwrap();
|
let status = cmd.status().unwrap();
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
include ../tools.mk
|
|
||||||
|
|
||||||
all:
|
|
||||||
$(RUSTC) --print crate-name 2>&1 | diff - no-input-file.stderr
|
|
9
tests/run-make/no-input-file/rmake.rs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
extern crate run_make_support;
|
||||||
|
|
||||||
|
use run_make_support::{diff, rustc};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let output = rustc().print("crate-name").run_fail_assert_exit_code(1);
|
||||||
|
|
||||||
|
diff().expected_file("no-input-file.stderr").actual_text("output", output.stderr).run();
|
||||||
|
}
|
@ -1,84 +1,83 @@
|
|||||||
#![feature(collapse_debuginfo)]
|
|
||||||
#![feature(stmt_expr_attributes)]
|
#![feature(stmt_expr_attributes)]
|
||||||
#![feature(type_alias_impl_trait)]
|
#![feature(type_alias_impl_trait)]
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
// Test that the `#[collapse_debuginfo]` attribute can only be used on macro definitions.
|
// Test that the `#[collapse_debuginfo]` attribute can only be used on macro definitions.
|
||||||
|
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
extern crate std;
|
extern crate std;
|
||||||
|
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
static FOO: u32 = 3;
|
static FOO: u32 = 3;
|
||||||
|
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
const BAR: u32 = 3;
|
const BAR: u32 = 3;
|
||||||
|
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
fn foo() {
|
fn foo() {
|
||||||
let _ = #[collapse_debuginfo] || { };
|
let _ = #[collapse_debuginfo(yes)] || { };
|
||||||
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
let _ = 3;
|
let _ = 3;
|
||||||
let _ = #[collapse_debuginfo] 3;
|
let _ = #[collapse_debuginfo(yes)] 3;
|
||||||
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
match (3, 4) {
|
match (3, 4) {
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
mod bar {
|
mod bar {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
type Map = HashMap<u32, u32>;
|
type Map = HashMap<u32, u32>;
|
||||||
|
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
enum Foo {
|
enum Foo {
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
Variant,
|
Variant,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
struct Bar {
|
struct Bar {
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
field: u32,
|
field: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
union Qux {
|
union Qux {
|
||||||
a: u32,
|
a: u32,
|
||||||
b: u16
|
b: u16
|
||||||
}
|
}
|
||||||
|
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
trait Foobar {
|
trait Foobar {
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
type Bar;
|
type Bar;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
type AFoobar = impl Foobar;
|
type AFoobar = impl Foobar;
|
||||||
|
|
||||||
@ -90,19 +89,19 @@ fn constraining() -> AFoobar {
|
|||||||
Bar { field: 3 }
|
Bar { field: 3 }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
impl Bar {
|
impl Bar {
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
const FOO: u32 = 3;
|
const FOO: u32 = 3;
|
||||||
|
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
fn bar(&self) {}
|
fn bar(&self) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[collapse_debuginfo]
|
#[collapse_debuginfo(yes)]
|
||||||
macro_rules! finally {
|
macro_rules! finally {
|
||||||
($e:expr) => { $e }
|
($e:expr) => { $e }
|
||||||
}
|
}
|
||||||
|
@ -1,152 +1,152 @@
|
|||||||
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
--> $DIR/collapse-debuginfo-invalid.rs:8:1
|
--> $DIR/collapse-debuginfo-invalid.rs:7:1
|
||||||
|
|
|
|
||||||
LL | #[collapse_debuginfo]
|
LL | #[collapse_debuginfo(yes)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
LL |
|
LL |
|
||||||
LL | extern crate std;
|
LL | extern crate std;
|
||||||
| ----------------- not a macro definition
|
| ----------------- not a macro definition
|
||||||
|
|
||||||
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
--> $DIR/collapse-debuginfo-invalid.rs:12:1
|
--> $DIR/collapse-debuginfo-invalid.rs:11:1
|
||||||
|
|
|
|
||||||
LL | #[collapse_debuginfo]
|
LL | #[collapse_debuginfo(yes)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
LL |
|
LL |
|
||||||
LL | use std::collections::HashMap;
|
LL | use std::collections::HashMap;
|
||||||
| ------------------------------ not a macro definition
|
| ------------------------------ not a macro definition
|
||||||
|
|
||||||
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
--> $DIR/collapse-debuginfo-invalid.rs:16:1
|
--> $DIR/collapse-debuginfo-invalid.rs:15:1
|
||||||
|
|
|
|
||||||
LL | #[collapse_debuginfo]
|
LL | #[collapse_debuginfo(yes)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
LL |
|
LL |
|
||||||
LL | static FOO: u32 = 3;
|
LL | static FOO: u32 = 3;
|
||||||
| -------------------- not a macro definition
|
| -------------------- not a macro definition
|
||||||
|
|
||||||
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
--> $DIR/collapse-debuginfo-invalid.rs:20:1
|
--> $DIR/collapse-debuginfo-invalid.rs:19:1
|
||||||
|
|
|
|
||||||
LL | #[collapse_debuginfo]
|
LL | #[collapse_debuginfo(yes)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
LL |
|
LL |
|
||||||
LL | const BAR: u32 = 3;
|
LL | const BAR: u32 = 3;
|
||||||
| ------------------- not a macro definition
|
| ------------------- not a macro definition
|
||||||
|
|
||||||
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
--> $DIR/collapse-debuginfo-invalid.rs:24:1
|
--> $DIR/collapse-debuginfo-invalid.rs:23:1
|
||||||
|
|
|
|
||||||
LL | #[collapse_debuginfo]
|
LL | #[collapse_debuginfo(yes)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
LL |
|
LL |
|
||||||
LL | / fn foo() {
|
LL | / fn foo() {
|
||||||
LL | | let _ = #[collapse_debuginfo] || { };
|
LL | | let _ = #[collapse_debuginfo(yes)] || { };
|
||||||
LL | |
|
LL | |
|
||||||
LL | | #[collapse_debuginfo]
|
LL | | #[collapse_debuginfo(yes)]
|
||||||
... |
|
... |
|
||||||
LL | | }
|
LL | | }
|
||||||
LL | | }
|
LL | | }
|
||||||
| |_- not a macro definition
|
| |_- not a macro definition
|
||||||
|
|
||||||
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
--> $DIR/collapse-debuginfo-invalid.rs:27:13
|
--> $DIR/collapse-debuginfo-invalid.rs:26:13
|
||||||
|
|
|
|
||||||
LL | let _ = #[collapse_debuginfo] || { };
|
LL | let _ = #[collapse_debuginfo(yes)] || { };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^ ------ not a macro definition
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ------ not a macro definition
|
||||||
|
|
||||||
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
--> $DIR/collapse-debuginfo-invalid.rs:29:5
|
--> $DIR/collapse-debuginfo-invalid.rs:28:5
|
||||||
|
|
|
|
||||||
LL | #[collapse_debuginfo]
|
LL | #[collapse_debuginfo(yes)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
LL |
|
LL |
|
||||||
LL | let _ = 3;
|
LL | let _ = 3;
|
||||||
| ---------- not a macro definition
|
| ---------- not a macro definition
|
||||||
|
|
||||||
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
--> $DIR/collapse-debuginfo-invalid.rs:32:13
|
--> $DIR/collapse-debuginfo-invalid.rs:31:13
|
||||||
|
|
|
|
||||||
LL | let _ = #[collapse_debuginfo] 3;
|
LL | let _ = #[collapse_debuginfo(yes)] 3;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^ - not a macro definition
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ - not a macro definition
|
||||||
|
|
||||||
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
--> $DIR/collapse-debuginfo-invalid.rs:35:9
|
--> $DIR/collapse-debuginfo-invalid.rs:34:9
|
||||||
|
|
|
|
||||||
LL | #[collapse_debuginfo]
|
LL | #[collapse_debuginfo(yes)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
LL |
|
LL |
|
||||||
LL | _ => (),
|
LL | _ => (),
|
||||||
| ------- not a macro definition
|
| ------- not a macro definition
|
||||||
|
|
||||||
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
--> $DIR/collapse-debuginfo-invalid.rs:41:1
|
--> $DIR/collapse-debuginfo-invalid.rs:40:1
|
||||||
|
|
|
|
||||||
LL | #[collapse_debuginfo]
|
LL | #[collapse_debuginfo(yes)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
LL |
|
LL |
|
||||||
LL | / mod bar {
|
LL | / mod bar {
|
||||||
LL | | }
|
LL | | }
|
||||||
| |_- not a macro definition
|
| |_- not a macro definition
|
||||||
|
|
||||||
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
--> $DIR/collapse-debuginfo-invalid.rs:46:1
|
--> $DIR/collapse-debuginfo-invalid.rs:45:1
|
||||||
|
|
|
|
||||||
LL | #[collapse_debuginfo]
|
LL | #[collapse_debuginfo(yes)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
LL |
|
LL |
|
||||||
LL | type Map = HashMap<u32, u32>;
|
LL | type Map = HashMap<u32, u32>;
|
||||||
| ----------------------------- not a macro definition
|
| ----------------------------- not a macro definition
|
||||||
|
|
||||||
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
--> $DIR/collapse-debuginfo-invalid.rs:50:1
|
--> $DIR/collapse-debuginfo-invalid.rs:49:1
|
||||||
|
|
|
|
||||||
LL | #[collapse_debuginfo]
|
LL | #[collapse_debuginfo(yes)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
LL |
|
LL |
|
||||||
LL | / enum Foo {
|
LL | / enum Foo {
|
||||||
LL | | #[collapse_debuginfo]
|
LL | | #[collapse_debuginfo(yes)]
|
||||||
LL | |
|
LL | |
|
||||||
LL | | Variant,
|
LL | | Variant,
|
||||||
LL | | }
|
LL | | }
|
||||||
| |_- not a macro definition
|
| |_- not a macro definition
|
||||||
|
|
||||||
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
--> $DIR/collapse-debuginfo-invalid.rs:53:5
|
--> $DIR/collapse-debuginfo-invalid.rs:52:5
|
||||||
|
|
|
|
||||||
LL | #[collapse_debuginfo]
|
LL | #[collapse_debuginfo(yes)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
LL |
|
LL |
|
||||||
LL | Variant,
|
LL | Variant,
|
||||||
| ------- not a macro definition
|
| ------- not a macro definition
|
||||||
|
|
||||||
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
--> $DIR/collapse-debuginfo-invalid.rs:58:1
|
--> $DIR/collapse-debuginfo-invalid.rs:57:1
|
||||||
|
|
|
|
||||||
LL | #[collapse_debuginfo]
|
LL | #[collapse_debuginfo(yes)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
LL |
|
LL |
|
||||||
LL | / struct Bar {
|
LL | / struct Bar {
|
||||||
LL | | #[collapse_debuginfo]
|
LL | | #[collapse_debuginfo(yes)]
|
||||||
LL | |
|
LL | |
|
||||||
LL | | field: u32,
|
LL | | field: u32,
|
||||||
LL | | }
|
LL | | }
|
||||||
| |_- not a macro definition
|
| |_- not a macro definition
|
||||||
|
|
||||||
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
--> $DIR/collapse-debuginfo-invalid.rs:61:5
|
--> $DIR/collapse-debuginfo-invalid.rs:60:5
|
||||||
|
|
|
|
||||||
LL | #[collapse_debuginfo]
|
LL | #[collapse_debuginfo(yes)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
LL |
|
LL |
|
||||||
LL | field: u32,
|
LL | field: u32,
|
||||||
| ---------- not a macro definition
|
| ---------- not a macro definition
|
||||||
|
|
||||||
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
--> $DIR/collapse-debuginfo-invalid.rs:66:1
|
--> $DIR/collapse-debuginfo-invalid.rs:65:1
|
||||||
|
|
|
|
||||||
LL | #[collapse_debuginfo]
|
LL | #[collapse_debuginfo(yes)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
LL |
|
LL |
|
||||||
LL | / union Qux {
|
LL | / union Qux {
|
||||||
LL | | a: u32,
|
LL | | a: u32,
|
||||||
@ -155,35 +155,35 @@ LL | | }
|
|||||||
| |_- not a macro definition
|
| |_- not a macro definition
|
||||||
|
|
||||||
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
--> $DIR/collapse-debuginfo-invalid.rs:73:1
|
--> $DIR/collapse-debuginfo-invalid.rs:72:1
|
||||||
|
|
|
|
||||||
LL | #[collapse_debuginfo]
|
LL | #[collapse_debuginfo(yes)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
LL |
|
LL |
|
||||||
LL | / trait Foobar {
|
LL | / trait Foobar {
|
||||||
LL | | #[collapse_debuginfo]
|
LL | | #[collapse_debuginfo(yes)]
|
||||||
LL | |
|
LL | |
|
||||||
LL | | type Bar;
|
LL | | type Bar;
|
||||||
LL | | }
|
LL | | }
|
||||||
| |_- not a macro definition
|
| |_- not a macro definition
|
||||||
|
|
||||||
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
--> $DIR/collapse-debuginfo-invalid.rs:81:1
|
--> $DIR/collapse-debuginfo-invalid.rs:80:1
|
||||||
|
|
|
|
||||||
LL | #[collapse_debuginfo]
|
LL | #[collapse_debuginfo(yes)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
LL |
|
LL |
|
||||||
LL | type AFoobar = impl Foobar;
|
LL | type AFoobar = impl Foobar;
|
||||||
| --------------------------- not a macro definition
|
| --------------------------- not a macro definition
|
||||||
|
|
||||||
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
--> $DIR/collapse-debuginfo-invalid.rs:93:1
|
--> $DIR/collapse-debuginfo-invalid.rs:92:1
|
||||||
|
|
|
|
||||||
LL | #[collapse_debuginfo]
|
LL | #[collapse_debuginfo(yes)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
LL |
|
LL |
|
||||||
LL | / impl Bar {
|
LL | / impl Bar {
|
||||||
LL | | #[collapse_debuginfo]
|
LL | | #[collapse_debuginfo(yes)]
|
||||||
LL | |
|
LL | |
|
||||||
LL | | const FOO: u32 = 3;
|
LL | | const FOO: u32 = 3;
|
||||||
... |
|
... |
|
||||||
@ -192,28 +192,28 @@ LL | | }
|
|||||||
| |_- not a macro definition
|
| |_- not a macro definition
|
||||||
|
|
||||||
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
--> $DIR/collapse-debuginfo-invalid.rs:76:5
|
--> $DIR/collapse-debuginfo-invalid.rs:75:5
|
||||||
|
|
|
|
||||||
LL | #[collapse_debuginfo]
|
LL | #[collapse_debuginfo(yes)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
LL |
|
LL |
|
||||||
LL | type Bar;
|
LL | type Bar;
|
||||||
| --------- not a macro definition
|
| --------- not a macro definition
|
||||||
|
|
||||||
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
--> $DIR/collapse-debuginfo-invalid.rs:96:5
|
--> $DIR/collapse-debuginfo-invalid.rs:95:5
|
||||||
|
|
|
|
||||||
LL | #[collapse_debuginfo]
|
LL | #[collapse_debuginfo(yes)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
LL |
|
LL |
|
||||||
LL | const FOO: u32 = 3;
|
LL | const FOO: u32 = 3;
|
||||||
| ------------------- not a macro definition
|
| ------------------- not a macro definition
|
||||||
|
|
||||||
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
error: `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
--> $DIR/collapse-debuginfo-invalid.rs:100:5
|
--> $DIR/collapse-debuginfo-invalid.rs:99:5
|
||||||
|
|
|
|
||||||
LL | #[collapse_debuginfo]
|
LL | #[collapse_debuginfo(yes)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
LL |
|
LL |
|
||||||
LL | fn bar(&self) {}
|
LL | fn bar(&self) {}
|
||||||
| ---------------- not a macro definition
|
| ---------------- not a macro definition
|
||||||
|
@ -2,56 +2,86 @@ error[E0384]: cannot assign twice to immutable variable `x`
|
|||||||
--> $DIR/borrowck-match-binding-is-assignment.rs:14:13
|
--> $DIR/borrowck-match-binding-is-assignment.rs:14:13
|
||||||
|
|
|
|
||||||
LL | x => {
|
LL | x => {
|
||||||
| -
|
| - first assignment to `x`
|
||||||
| |
|
|
||||||
| first assignment to `x`
|
|
||||||
| help: consider making this binding mutable: `mut x`
|
|
||||||
LL | x += 1;
|
LL | x += 1;
|
||||||
| ^^^^^^ cannot assign twice to immutable variable
|
| ^^^^^^ cannot assign twice to immutable variable
|
||||||
|
|
|
||||||
|
help: consider making this binding mutable
|
||||||
|
|
|
||||||
|
LL | mut x => {
|
||||||
|
| ~~~~~
|
||||||
|
help: to modify the original value, take a borrow instead
|
||||||
|
|
|
||||||
|
LL | ref mut x => {
|
||||||
|
| ~~~~~~~~~
|
||||||
|
|
||||||
error[E0384]: cannot assign twice to immutable variable `x`
|
error[E0384]: cannot assign twice to immutable variable `x`
|
||||||
--> $DIR/borrowck-match-binding-is-assignment.rs:20:13
|
--> $DIR/borrowck-match-binding-is-assignment.rs:20:13
|
||||||
|
|
|
|
||||||
LL | E::Foo(x) => {
|
LL | E::Foo(x) => {
|
||||||
| -
|
| - first assignment to `x`
|
||||||
| |
|
|
||||||
| first assignment to `x`
|
|
||||||
| help: consider making this binding mutable: `mut x`
|
|
||||||
LL | x += 1;
|
LL | x += 1;
|
||||||
| ^^^^^^ cannot assign twice to immutable variable
|
| ^^^^^^ cannot assign twice to immutable variable
|
||||||
|
|
|
||||||
|
help: consider making this binding mutable
|
||||||
|
|
|
||||||
|
LL | E::Foo(mut x) => {
|
||||||
|
| ~~~~~
|
||||||
|
help: to modify the original value, take a borrow instead
|
||||||
|
|
|
||||||
|
LL | E::Foo(ref mut x) => {
|
||||||
|
| ~~~~~~~~~
|
||||||
|
|
||||||
error[E0384]: cannot assign twice to immutable variable `x`
|
error[E0384]: cannot assign twice to immutable variable `x`
|
||||||
--> $DIR/borrowck-match-binding-is-assignment.rs:26:13
|
--> $DIR/borrowck-match-binding-is-assignment.rs:26:13
|
||||||
|
|
|
|
||||||
LL | S { bar: x } => {
|
LL | S { bar: x } => {
|
||||||
| -
|
| - first assignment to `x`
|
||||||
| |
|
|
||||||
| first assignment to `x`
|
|
||||||
| help: consider making this binding mutable: `mut x`
|
|
||||||
LL | x += 1;
|
LL | x += 1;
|
||||||
| ^^^^^^ cannot assign twice to immutable variable
|
| ^^^^^^ cannot assign twice to immutable variable
|
||||||
|
|
|
||||||
|
help: consider making this binding mutable
|
||||||
|
|
|
||||||
|
LL | S { bar: mut x } => {
|
||||||
|
| ~~~~~
|
||||||
|
help: to modify the original value, take a borrow instead
|
||||||
|
|
|
||||||
|
LL | S { bar: ref mut x } => {
|
||||||
|
| ~~~~~~~~~
|
||||||
|
|
||||||
error[E0384]: cannot assign twice to immutable variable `x`
|
error[E0384]: cannot assign twice to immutable variable `x`
|
||||||
--> $DIR/borrowck-match-binding-is-assignment.rs:32:13
|
--> $DIR/borrowck-match-binding-is-assignment.rs:32:13
|
||||||
|
|
|
|
||||||
LL | (x,) => {
|
LL | (x,) => {
|
||||||
| -
|
| - first assignment to `x`
|
||||||
| |
|
|
||||||
| first assignment to `x`
|
|
||||||
| help: consider making this binding mutable: `mut x`
|
|
||||||
LL | x += 1;
|
LL | x += 1;
|
||||||
| ^^^^^^ cannot assign twice to immutable variable
|
| ^^^^^^ cannot assign twice to immutable variable
|
||||||
|
|
|
||||||
|
help: consider making this binding mutable
|
||||||
|
|
|
||||||
|
LL | (mut x,) => {
|
||||||
|
| ~~~~~
|
||||||
|
help: to modify the original value, take a borrow instead
|
||||||
|
|
|
||||||
|
LL | (ref mut x,) => {
|
||||||
|
| ~~~~~~~~~
|
||||||
|
|
||||||
error[E0384]: cannot assign twice to immutable variable `x`
|
error[E0384]: cannot assign twice to immutable variable `x`
|
||||||
--> $DIR/borrowck-match-binding-is-assignment.rs:38:13
|
--> $DIR/borrowck-match-binding-is-assignment.rs:38:13
|
||||||
|
|
|
|
||||||
LL | [x,_,_] => {
|
LL | [x,_,_] => {
|
||||||
| -
|
| - first assignment to `x`
|
||||||
| |
|
|
||||||
| first assignment to `x`
|
|
||||||
| help: consider making this binding mutable: `mut x`
|
|
||||||
LL | x += 1;
|
LL | x += 1;
|
||||||
| ^^^^^^ cannot assign twice to immutable variable
|
| ^^^^^^ cannot assign twice to immutable variable
|
||||||
|
|
|
||||||
|
help: consider making this binding mutable
|
||||||
|
|
|
||||||
|
LL | [mut x,_,_] => {
|
||||||
|
| ~~~~~
|
||||||
|
help: to modify the original value, take a borrow instead
|
||||||
|
|
|
||||||
|
LL | [ref mut x,_,_] => {
|
||||||
|
| ~~~~~~~~~
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
error: aborting due to 5 previous errors
|
||||||
|
|
||||||
|
11
tests/ui/borrowck/suggest-ref-mut-issue-118596.rs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fn main() {
|
||||||
|
let y = Some(0);
|
||||||
|
if let Some(x) = y {
|
||||||
|
x = 2; //~ ERROR cannot assign twice to immutable variable `x`
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut arr = [1, 2, 3];
|
||||||
|
let [x, ref xs_hold @ ..] = arr;
|
||||||
|
x = 0; //~ ERROR cannot assign twice to immutable variable `x`
|
||||||
|
eprintln!("{:?}", arr);
|
||||||
|
}
|
37
tests/ui/borrowck/suggest-ref-mut-issue-118596.stderr
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
error[E0384]: cannot assign twice to immutable variable `x`
|
||||||
|
--> $DIR/suggest-ref-mut-issue-118596.rs:4:9
|
||||||
|
|
|
||||||
|
LL | if let Some(x) = y {
|
||||||
|
| - first assignment to `x`
|
||||||
|
LL | x = 2;
|
||||||
|
| ^^^^^ cannot assign twice to immutable variable
|
||||||
|
|
|
||||||
|
help: consider making this binding mutable
|
||||||
|
|
|
||||||
|
LL | if let Some(mut x) = y {
|
||||||
|
| ~~~~~
|
||||||
|
help: to modify the original value, take a borrow instead
|
||||||
|
|
|
||||||
|
LL | if let Some(ref mut x) = y {
|
||||||
|
| ~~~~~~~~~
|
||||||
|
|
||||||
|
error[E0384]: cannot assign twice to immutable variable `x`
|
||||||
|
--> $DIR/suggest-ref-mut-issue-118596.rs:9:5
|
||||||
|
|
|
||||||
|
LL | let [x, ref xs_hold @ ..] = arr;
|
||||||
|
| - first assignment to `x`
|
||||||
|
LL | x = 0;
|
||||||
|
| ^^^^^ cannot assign twice to immutable variable
|
||||||
|
|
|
||||||
|
help: consider making this binding mutable
|
||||||
|
|
|
||||||
|
LL | let [mut x, ref xs_hold @ ..] = arr;
|
||||||
|
| ~~~~~
|
||||||
|
help: to modify the original value, take a borrow instead
|
||||||
|
|
|
||||||
|
LL | let [ref mut x, ref xs_hold @ ..] = arr;
|
||||||
|
| ~~~~~~~~~
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0384`.
|
@ -1,7 +1,5 @@
|
|||||||
//@ compile-flags: --error-format=human --color=always
|
//@ compile-flags: --error-format=human --color=always
|
||||||
//@ ignore-windows
|
//@ ignore-windows
|
||||||
// Temporary until next release:
|
|
||||||
//@ ignore-stage2
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _ = match true {
|
let _ = match true {
|
||||||
true => (
|
true => (
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<svg width="750px" height="848px" xmlns="http://www.w3.org/2000/svg">
|
<svg width="740px" height="848px" xmlns="http://www.w3.org/2000/svg">
|
||||||
<style>
|
<style>
|
||||||
.fg { fill: #AAAAAA }
|
.fg { fill: #AAAAAA }
|
||||||
.bg { background: #000000 }
|
.bg { background: #000000 }
|
||||||
@ -21,7 +21,7 @@
|
|||||||
<text xml:space="preserve" class="container fg">
|
<text xml:space="preserve" class="container fg">
|
||||||
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0308]</tspan><tspan class="bold">: `match` arms have incompatible types</tspan>
|
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0308]</tspan><tspan class="bold">: `match` arms have incompatible types</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/huge_multispan_highlight.rs:98:18</tspan>
|
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/huge_multispan_highlight.rs:96:18</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
@ -59,7 +59,7 @@
|
|||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="370px"><tspan class="fg-ansi256-009 bold">error[E0308]</tspan><tspan class="bold">: `match` arms have incompatible types</tspan>
|
<tspan x="10px" y="370px"><tspan class="fg-ansi256-009 bold">error[E0308]</tspan><tspan class="bold">: `match` arms have incompatible types</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="388px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/huge_multispan_highlight.rs:215:18</tspan>
|
<tspan x="10px" y="388px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/huge_multispan_highlight.rs:213:18</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="406px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
<tspan x="10px" y="406px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
@ -27,6 +27,7 @@ macro_rules! pos {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[collapse_debuginfo(yes)]
|
||||||
macro_rules! check {
|
macro_rules! check {
|
||||||
($($pos:expr),*) => ({
|
($($pos:expr),*) => ({
|
||||||
verify(&[$($pos,)* pos!()]);
|
verify(&[$($pos,)* pos!()]);
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
//@ check-pass
|
//@ check-pass
|
||||||
//@ ignore-windows
|
//@ ignore-windows
|
||||||
//@ compile-flags: -Cremark=foo --error-format=human --color=always
|
//@ compile-flags: -Cremark=foo --error-format=human --color=always
|
||||||
// Temporary until next release:
|
|
||||||
//@ ignore-stage2
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
//@ compile-flags: --error-format=human --color=always
|
//@ compile-flags: --error-format=human --color=always
|
||||||
//@ error-pattern:[35mfor<'a> [0m
|
//@ error-pattern:[35mfor<'a> [0m
|
||||||
//@ edition:2018
|
//@ edition:2018
|
||||||
// Temporary until next release:
|
|
||||||
//@ ignore-stage2
|
|
||||||
|
|
||||||
use core::pin::Pin;
|
use core::pin::Pin;
|
||||||
use core::future::Future;
|
use core::future::Future;
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<text xml:space="preserve" class="container fg">
|
<text xml:space="preserve" class="container fg">
|
||||||
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0308]</tspan><tspan class="bold">: mismatched types</tspan>
|
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0308]</tspan><tspan class="bold">: mismatched types</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/highlighting.rs:24:11</tspan>
|
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/highlighting.rs:22:11</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
@ -43,7 +43,7 @@
|
|||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="208px"><tspan class="fg-ansi256-010 bold">note</tspan><tspan>: function defined here</tspan>
|
<tspan x="10px" y="208px"><tspan class="fg-ansi256-010 bold">note</tspan><tspan>: function defined here</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="226px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/highlighting.rs:13:4</tspan>
|
<tspan x="10px" y="226px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/highlighting.rs:11:4</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="244px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
<tspan x="10px" y="244px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
@ -24,7 +24,7 @@
|
|||||||
<text xml:space="preserve" class="container fg">
|
<text xml:space="preserve" class="container fg">
|
||||||
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0308]</tspan><tspan class="fg-ansi256-015 bold">: mismatched types</tspan>
|
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0308]</tspan><tspan class="fg-ansi256-015 bold">: mismatched types</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--> </tspan><tspan>$DIR/highlighting.rs:24:11</tspan>
|
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--> </tspan><tspan>$DIR/highlighting.rs:22:11</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan>
|
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
@ -44,7 +44,7 @@
|
|||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="208px"><tspan class="fg-ansi256-010 bold">note</tspan><tspan>: function defined here</tspan>
|
<tspan x="10px" y="208px"><tspan class="fg-ansi256-010 bold">note</tspan><tspan>: function defined here</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="226px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--> </tspan><tspan>$DIR/highlighting.rs:13:4</tspan>
|
<tspan x="10px" y="226px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--> </tspan><tspan>$DIR/highlighting.rs:11:4</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="244px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan>
|
<tspan x="10px" y="244px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
@ -1,7 +1,5 @@
|
|||||||
//@ compile-flags: --error-format=human --color=always
|
//@ compile-flags: --error-format=human --color=always
|
||||||
//@ error-pattern: missing lifetime specifier
|
//@ error-pattern: missing lifetime specifier
|
||||||
// Temporary until next release:
|
|
||||||
//@ ignore-stage2
|
|
||||||
|
|
||||||
fn short(foo_bar: &Vec<&i32>) -> &i32 {
|
fn short(foo_bar: &Vec<&i32>) -> &i32 {
|
||||||
&12
|
&12
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<text xml:space="preserve" class="container fg">
|
<text xml:space="preserve" class="container fg">
|
||||||
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="bold">: missing lifetime specifier</tspan>
|
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="bold">: missing lifetime specifier</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:6:34</tspan>
|
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:4:34</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
@ -47,7 +47,7 @@
|
|||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="244px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="bold">: missing lifetime specifier</tspan>
|
<tspan x="10px" y="244px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="bold">: missing lifetime specifier</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="262px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:13:6</tspan>
|
<tspan x="10px" y="262px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:11:6</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="280px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
<tspan x="10px" y="280px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
@ -83,7 +83,7 @@
|
|||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="568px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="bold">: missing lifetime specifier</tspan>
|
<tspan x="10px" y="568px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="bold">: missing lifetime specifier</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="586px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:18:29</tspan>
|
<tspan x="10px" y="586px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:16:29</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="604px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
<tspan x="10px" y="604px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
|
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 9.0 KiB |
@ -23,7 +23,7 @@
|
|||||||
<text xml:space="preserve" class="container fg">
|
<text xml:space="preserve" class="container fg">
|
||||||
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="fg-ansi256-015 bold">: missing lifetime specifier</tspan>
|
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="fg-ansi256-015 bold">: missing lifetime specifier</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--> </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:6:34</tspan>
|
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--> </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:4:34</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan>
|
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
@ -47,7 +47,7 @@
|
|||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="244px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="fg-ansi256-015 bold">: missing lifetime specifier</tspan>
|
<tspan x="10px" y="244px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="fg-ansi256-015 bold">: missing lifetime specifier</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="262px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--> </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:13:6</tspan>
|
<tspan x="10px" y="262px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--> </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:11:6</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="280px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan>
|
<tspan x="10px" y="280px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
@ -83,7 +83,7 @@
|
|||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="568px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="fg-ansi256-015 bold">: missing lifetime specifier</tspan>
|
<tspan x="10px" y="568px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="fg-ansi256-015 bold">: missing lifetime specifier</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="586px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--> </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:18:29</tspan>
|
<tspan x="10px" y="586px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--> </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:16:29</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
<tspan x="10px" y="604px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan>
|
<tspan x="10px" y="604px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan>
|
||||||
</tspan>
|
</tspan>
|
||||||
|
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.1 KiB |
@ -1,7 +0,0 @@
|
|||||||
#[collapse_debuginfo]
|
|
||||||
//~^ ERROR the `#[collapse_debuginfo]` attribute is an experimental feature
|
|
||||||
macro_rules! foo {
|
|
||||||
($e:expr) => { $e }
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {}
|
|
@ -1,13 +0,0 @@
|
|||||||
error[E0658]: the `#[collapse_debuginfo]` attribute is an experimental feature
|
|
||||||
--> $DIR/feature-gate-collapse_debuginfo.rs:1:1
|
|
||||||
|
|
|
||||||
LL | #[collapse_debuginfo]
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: see issue #100758 <https://github.com/rust-lang/rust/issues/100758> for more information
|
|
||||||
= help: add `#![feature(collapse_debuginfo)]` 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 1 previous error
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0658`.
|
|
20
tests/ui/inference/issue-80409.compat.stderr
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
error[E0277]: the trait bound `usize: Fsm` is not satisfied
|
||||||
|
--> $DIR/issue-80409.rs:36:31
|
||||||
|
|
|
||||||
|
LL | builder.state().on_entry(|_| {});
|
||||||
|
| ^ the trait `Fsm` is not implemented for `usize`
|
||||||
|
|
|
||||||
|
help: this trait has no implementations, consider adding one
|
||||||
|
--> $DIR/issue-80409.rs:26:1
|
||||||
|
|
|
||||||
|
LL | trait Fsm {
|
||||||
|
| ^^^^^^^^^
|
||||||
|
note: required by a bound in `StateContext`
|
||||||
|
--> $DIR/issue-80409.rs:30:31
|
||||||
|
|
|
||||||
|
LL | struct StateContext<'a, TFsm: Fsm> {
|
||||||
|
| ^^^ required by this bound in `StateContext`
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0277`.
|
@ -1,14 +1,20 @@
|
|||||||
error: internal compiler error: error performing operation: fully_perform
|
error[E0277]: the trait bound `usize: Fsm` is not satisfied
|
||||||
--> $DIR/issue-80409.rs:49:30
|
--> $DIR/issue-80409.rs:36:31
|
||||||
|
|
|
|
||||||
LL | builder.state().on_entry(|_| {});
|
LL | builder.state().on_entry(|_| {});
|
||||||
| ^^^
|
| ^ the trait `Fsm` is not implemented for `usize`
|
||||||
|
|
|
|
||||||
note:
|
help: this trait has no implementations, consider adding one
|
||||||
--> $DIR/issue-80409.rs:49:30
|
--> $DIR/issue-80409.rs:26:1
|
||||||
|
|
|
|
||||||
LL | builder.state().on_entry(|_| {});
|
LL | trait Fsm {
|
||||||
| ^^^
|
| ^^^^^^^^^
|
||||||
|
note: required by a bound in `StateContext`
|
||||||
|
--> $DIR/issue-80409.rs:30:31
|
||||||
|
|
|
||||||
|
LL | struct StateContext<'a, TFsm: Fsm> {
|
||||||
|
| ^^^ required by this bound in `StateContext`
|
||||||
|
|
||||||
query stack during panic:
|
error: aborting due to 1 previous error
|
||||||
end of query stack
|
|
||||||
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
|
@ -1,18 +1,5 @@
|
|||||||
// This should not pass, because `usize: Fsm` does not hold. However, it currently ICEs.
|
|
||||||
|
|
||||||
// ignore-tidy-linelength
|
|
||||||
|
|
||||||
//@ revisions: compat no-compat
|
//@ revisions: compat no-compat
|
||||||
//@[compat] check-pass
|
|
||||||
//@[no-compat] compile-flags: -Zno-implied-bounds-compat
|
//@[no-compat] compile-flags: -Zno-implied-bounds-compat
|
||||||
//@[no-compat] check-fail
|
|
||||||
//@[no-compat] known-bug: #80409
|
|
||||||
//@[no-compat] failure-status: 101
|
|
||||||
//@[no-compat] normalize-stderr-test "delayed at.*" -> ""
|
|
||||||
//@[no-compat] normalize-stderr-test "note: .*\n\n" -> ""
|
|
||||||
//@[no-compat] normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
|
|
||||||
//@[no-compat] normalize-stderr-test "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: "
|
|
||||||
//@[no-compat] rustc-env:RUST_BACKTRACE=0
|
|
||||||
|
|
||||||
#![allow(unreachable_code, unused)]
|
#![allow(unreachable_code, unused)]
|
||||||
|
|
||||||
@ -47,4 +34,5 @@ struct StateContext<'a, TFsm: Fsm> {
|
|||||||
fn main() {
|
fn main() {
|
||||||
let mut builder: FsmBuilder<usize> = todo!();
|
let mut builder: FsmBuilder<usize> = todo!();
|
||||||
builder.state().on_entry(|_| {});
|
builder.state().on_entry(|_| {});
|
||||||
|
//~^ ERROR the trait bound `usize: Fsm` is not satisfied
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ fn b() {
|
|||||||
fn c() {
|
fn c() {
|
||||||
[0; [|&_: _ &_| {}; 0 ].len()]
|
[0; [|&_: _ &_| {}; 0 ].len()]
|
||||||
//~^ ERROR expected `,`, found `&`
|
//~^ ERROR expected `,`, found `&`
|
||||||
|
//~| ERROR type annotations needed
|
||||||
}
|
}
|
||||||
|
|
||||||
fn d() {
|
fn d() {
|
||||||
|
@ -21,7 +21,7 @@ LL | [0; [|&_: _ &_| {}; 0 ].len()]
|
|||||||
| help: missing `,`
|
| help: missing `,`
|
||||||
|
|
||||||
error: expected identifier, found reserved identifier `_`
|
error: expected identifier, found reserved identifier `_`
|
||||||
--> $DIR/issue-66706.rs:18:26
|
--> $DIR/issue-66706.rs:19:26
|
||||||
|
|
|
|
||||||
LL | [0; match [|f @ &ref _| () ] {} ]
|
LL | [0; match [|f @ &ref _| () ] {} ]
|
||||||
| ----- ^ expected identifier, found reserved identifier
|
| ----- ^ expected identifier, found reserved identifier
|
||||||
@ -34,6 +34,12 @@ error[E0282]: type annotations needed
|
|||||||
LL | [0; [|_: _ &_| ()].len()]
|
LL | [0; [|_: _ &_| ()].len()]
|
||||||
| ^ cannot infer type
|
| ^ cannot infer type
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
error[E0282]: type annotations needed
|
||||||
|
--> $DIR/issue-66706.rs:13:11
|
||||||
|
|
|
||||||
|
LL | [0; [|&_: _ &_| {}; 0 ].len()]
|
||||||
|
| ^^^^^ cannot infer type
|
||||||
|
|
||||||
|
error: aborting due to 6 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0282`.
|
For more information about this error, try `rustc --explain E0282`.
|
||||||
|
@ -19,5 +19,4 @@ impl TraitB for B { //~ ERROR not all trait items implemented, missing: `MyA`
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _ = [0; B::VALUE];
|
let _ = [0; B::VALUE];
|
||||||
//~^ constant
|
|
||||||
}
|
}
|
||||||
|