Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #109384

Merged
merged 20 commits into from
Mar 20, 2023
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d10b113
Set CMAKE_SYSTEM_NAME for Linux targets
eggyal Mar 15, 2023
5e0fc04
rustdoc: Correctly merge import's and its target's docs in one more case
petrochenkov Mar 17, 2023
d808bc2
Add tests for configure.py
jyn514 Mar 17, 2023
c7eccda
Use python3.11 in CI to make sure toml is validated
jyn514 Mar 17, 2023
0d53565
Make `slice::is_sorted_by` impl nicer
WaffleLapkin Mar 17, 2023
c2ccdfa
Switch impls of `is_sorted_by` between slices and slice iters
WaffleLapkin Mar 17, 2023
9139ed0
Fix impl_trait_ty_to_ty substs
spastorino Mar 17, 2023
640c202
Fix generics_of for impl's RPITIT synthesized associated type
spastorino Mar 17, 2023
be8b323
Ignore `Inlined` spans when computing caller location.
cjgillot Mar 18, 2023
18ea16c
Update mdbook
ehuss Mar 19, 2023
252fa78
Only expect a GAT const arg
compiler-errors Mar 19, 2023
dbedf40
Reformat type_of
compiler-errors Mar 19, 2023
96d5dd6
Rollup merge of #109170 - eggyal:xc-linux-cmake, r=Mark-Simulacrum
matthiaskrgr Mar 20, 2023
0e8085a
Rollup merge of #109266 - petrochenkov:docice4, r=petrochenkov
matthiaskrgr Mar 20, 2023
023079f
Rollup merge of #109267 - jyn514:test-configure, r=Mark-Simulacrum
matthiaskrgr Mar 20, 2023
88caa29
Rollup merge of #109273 - WaffleLapkin:slice_is_sorted_by_array_windo…
matthiaskrgr Mar 20, 2023
d86fd83
Rollup merge of #109277 - spastorino:new-rpitit-14, r=compiler-errors
matthiaskrgr Mar 20, 2023
3efecba
Rollup merge of #109307 - cjgillot:inline-location, r=compiler-errors
matthiaskrgr Mar 20, 2023
f21c435
Rollup merge of #109364 - compiler-errors:gat-const-arg, r=BoxyUwU
matthiaskrgr Mar 20, 2023
58ffabb
Rollup merge of #109365 - ehuss:update-mdbook, r=Mark-Simulacrum
matthiaskrgr Mar 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
@@ -3103,9 +3103,9 @@ dependencies = [

[[package]]
name = "mdbook"
version = "0.4.25"
version = "0.4.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d1ed28d5903dde77bd5182645078a37ee57014cac6ccb2d54e1d6496386648e4"
checksum = "764dcbfc2e5f868bc1b566eb179dff1a06458fd0cff846aae2579392dd3f01a0"
dependencies = [
"ammonia",
"anyhow",
6 changes: 5 additions & 1 deletion compiler/rustc_codegen_ssa/src/mir/block.rs
Original file line number Diff line number Diff line change
@@ -1475,7 +1475,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
) -> OperandRef<'tcx, Bx::Value> {
let tcx = bx.tcx();

let mut span_to_caller_location = |span: Span| {
let mut span_to_caller_location = |mut span: Span| {
// Remove `Inlined` marks as they pollute `expansion_cause`.
while span.is_inlined() {
span.remove_mark();
}
let topmost = span.ctxt().outer_expn().expansion_cause().unwrap_or(span);
let caller = tcx.sess.source_map().lookup_char_pos(topmost.lo());
let const_loc = tcx.const_caller_location((
Original file line number Diff line number Diff line change
@@ -111,7 +111,11 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
location
}

pub(crate) fn location_triple_for_span(&self, span: Span) -> (Symbol, u32, u32) {
pub(crate) fn location_triple_for_span(&self, mut span: Span) -> (Symbol, u32, u32) {
// Remove `Inlined` marks as they pollute `expansion_cause`.
while span.is_inlined() {
span.remove_mark();
}
let topmost = span.ctxt().outer_expn().expansion_cause().unwrap_or(span);
let caller = self.tcx.sess.source_map().lookup_char_pos(topmost.lo());
(
8 changes: 6 additions & 2 deletions compiler/rustc_hir_analysis/src/astconv/mod.rs
Original file line number Diff line number Diff line change
@@ -3152,8 +3152,12 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {

debug!("impl_trait_ty_to_ty: generics={:?}", generics);
let substs = InternalSubsts::for_item(tcx, def_id, |param, _| {
if let Some(i) = (param.index as usize).checked_sub(generics.parent_count) {
// Our own parameters are the resolved lifetimes.
// We use `generics.count() - lifetimes.len()` here instead of `generics.parent_count`
// since return-position impl trait in trait squashes all of the generics from its source fn
// into its own generics, so the opaque's "own" params isn't always just lifetimes.
if let Some(i) = (param.index as usize).checked_sub(generics.count() - lifetimes.len())
{
// Resolve our own lifetime parameters.
let GenericParamDefKind::Lifetime { .. } = param.kind else { bug!() };
let hir::GenericArg::Lifetime(lifetime) = &lifetimes[i] else { bug!() };
self.ast_region_to_region(lifetime, None).into()
68 changes: 40 additions & 28 deletions compiler/rustc_hir_analysis/src/collect/type_of.rs
Original file line number Diff line number Diff line change
@@ -278,8 +278,11 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::EarlyBinder<Ty<'_>>
}
TraitItemKind::Const(ty, body_id) => body_id
.and_then(|body_id| {
is_suggestable_infer_ty(ty)
.then(|| infer_placeholder_type(tcx, def_id, body_id, ty.span, item.ident, "constant",))
is_suggestable_infer_ty(ty).then(|| {
infer_placeholder_type(
tcx, def_id, body_id, ty.span, item.ident, "constant",
)
})
})
.unwrap_or_else(|| icx.to_ty(ty)),
TraitItemKind::Type(_, Some(ty)) => icx.to_ty(ty),
@@ -335,14 +338,15 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::EarlyBinder<Ty<'_>>
}
}
ItemKind::TyAlias(self_ty, _) => icx.to_ty(self_ty),
ItemKind::Impl(hir::Impl { self_ty, .. }) => {
match self_ty.find_self_aliases() {
spans if spans.len() > 0 => {
let guar = tcx.sess.emit_err(crate::errors::SelfInImplSelf { span: spans.into(), note: () });
tcx.ty_error(guar)
},
_ => icx.to_ty(*self_ty),
ItemKind::Impl(hir::Impl { self_ty, .. }) => match self_ty.find_self_aliases() {
spans if spans.len() > 0 => {
let guar = tcx.sess.emit_err(crate::errors::SelfInImplSelf {
span: spans.into(),
note: (),
});
tcx.ty_error(guar)
}
_ => icx.to_ty(*self_ty),
},
ItemKind::Fn(..) => {
let substs = InternalSubsts::identity_for_item(tcx, def_id.to_def_id());
@@ -364,7 +368,10 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::EarlyBinder<Ty<'_>>
..
}) => {
if in_trait && !tcx.impl_defaultness(owner).has_value() {
span_bug!(tcx.def_span(def_id), "tried to get type of this RPITIT with no definition");
span_bug!(
tcx.def_span(def_id),
"tried to get type of this RPITIT with no definition"
);
}
find_opaque_ty_constraints_for_rpit(tcx, def_id, owner)
}
@@ -453,15 +460,12 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::EarlyBinder<Ty<'_>>
tcx.adt_def(tcx.hir().get_parent_item(hir_id)).repr().discr_type().to_ty(tcx)
}

Node::TypeBinding(
TypeBinding {
hir_id: binding_id,
kind: TypeBindingKind::Equality { term: Term::Const(e) },
ident,
..
},
) if let Node::TraitRef(trait_ref) =
tcx.hir().get_parent(*binding_id)
Node::TypeBinding(TypeBinding {
hir_id: binding_id,
kind: TypeBindingKind::Equality { term: Term::Const(e) },
ident,
..
}) if let Node::TraitRef(trait_ref) = tcx.hir().get_parent(*binding_id)
&& e.hir_id == hir_id =>
{
let Some(trait_def_id) = trait_ref.trait_def_id() else {
@@ -475,7 +479,9 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::EarlyBinder<Ty<'_>>
def_id.to_def_id(),
);
if let Some(assoc_item) = assoc_item {
tcx.type_of(assoc_item.def_id).subst_identity()
tcx.type_of(assoc_item.def_id)
.no_bound_vars()
.expect("const parameter types cannot be generic")
} else {
// FIXME(associated_const_equality): add a useful error message here.
tcx.ty_error_with_message(
@@ -485,10 +491,13 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::EarlyBinder<Ty<'_>>
}
}

Node::TypeBinding(
TypeBinding { hir_id: binding_id, gen_args, kind, ident, .. },
) if let Node::TraitRef(trait_ref) =
tcx.hir().get_parent(*binding_id)
Node::TypeBinding(TypeBinding {
hir_id: binding_id,
gen_args,
kind,
ident,
..
}) if let Node::TraitRef(trait_ref) = tcx.hir().get_parent(*binding_id)
&& let Some((idx, _)) =
gen_args.args.iter().enumerate().find(|(_, arg)| {
if let GenericArg::Const(ct) = arg {
@@ -517,15 +526,18 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::EarlyBinder<Ty<'_>>
},
def_id.to_def_id(),
);
if let Some(param)
= assoc_item.map(|item| &tcx.generics_of(item.def_id).params[idx]).filter(|param| param.kind.is_ty_or_const())
if let Some(assoc_item) = assoc_item
&& let param = &tcx.generics_of(assoc_item.def_id).params[idx]
&& matches!(param.kind, ty::GenericParamDefKind::Const { .. })
{
tcx.type_of(param.def_id).subst_identity()
tcx.type_of(param.def_id)
.no_bound_vars()
.expect("const parameter types cannot be generic")
} else {
// FIXME(associated_const_equality): add a useful error message here.
tcx.ty_error_with_message(
DUMMY_SP,
"Could not find associated const on trait",
"Could not find const param on associated item",
)
}
}
2 changes: 1 addition & 1 deletion compiler/rustc_span/src/hygiene.rs
Original file line number Diff line number Diff line change
@@ -880,7 +880,7 @@ impl Span {
pub fn fresh_expansion(self, expn_id: LocalExpnId) -> Span {
HygieneData::with(|data| {
self.with_ctxt(data.apply_mark(
SyntaxContext::root(),
self.ctxt(),
expn_id.to_expn_id(),
Transparency::Transparent,
))
10 changes: 3 additions & 7 deletions compiler/rustc_ty_utils/src/assoc.rs
Original file line number Diff line number Diff line change
@@ -396,6 +396,8 @@ fn associated_type_for_impl_trait_in_impl(
impl_assoc_ty.impl_defaultness(tcx.impl_defaultness(impl_fn_def_id));

// Copy generics_of the trait's associated item but the impl as the parent.
// FIXME(-Zlower-impl-trait-in-trait-to-assoc-ty) resolves to the trait instead of the impl
// generics.
impl_assoc_ty.generics_of({
let trait_assoc_generics = tcx.generics_of(trait_assoc_def_id);
let trait_assoc_parent_count = trait_assoc_generics.parent_count;
@@ -404,16 +406,10 @@ fn associated_type_for_impl_trait_in_impl(
let parent_generics = tcx.generics_of(impl_def_id);
let parent_count = parent_generics.parent_count + parent_generics.params.len();

let mut impl_fn_params = tcx.generics_of(impl_fn_def_id).params.clone();

for param in &mut params {
param.index = param.index + parent_count as u32 + impl_fn_params.len() as u32
- trait_assoc_parent_count as u32;
param.index = param.index + parent_count as u32 - trait_assoc_parent_count as u32;
}

impl_fn_params.extend(params);
params = impl_fn_params;

let param_def_id_to_index =
params.iter().map(|param| (param.def_id, param.index)).collect();

4 changes: 1 addition & 3 deletions library/core/src/slice/iter.rs
Original file line number Diff line number Diff line change
@@ -132,9 +132,7 @@ iterator! {struct Iter -> *const T, &'a T, const, {/* no mut */}, {
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Option<Ordering>,
{
self.as_slice().windows(2).all(|w| {
compare(&&w[0], &&w[1]).map(|o| o != Ordering::Greater).unwrap_or(false)
})
self.as_slice().is_sorted_by(|a, b| compare(&a, &b))
}
}}

2 changes: 1 addition & 1 deletion library/core/src/slice/mod.rs
Original file line number Diff line number Diff line change
@@ -3822,7 +3822,7 @@ impl<T> [T] {
where
F: FnMut(&'a T, &'a T) -> Option<Ordering>,
{
self.iter().is_sorted_by(|a, b| compare(*a, *b))
self.array_windows().all(|[a, b]| compare(a, b).map_or(false, Ordering::is_le))
}

/// Checks if the elements of this slice are sorted using the given key extraction function.
39 changes: 39 additions & 0 deletions src/bootstrap/bootstrap_test.py
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@
from shutil import rmtree

import bootstrap
import configure


class VerifyTestCase(unittest.TestCase):
@@ -74,12 +75,50 @@ def test_same_dates(self):
self.assertFalse(self.build.program_out_of_date(self.rustc_stamp_path, self.key))


class GenerateAndParseConfig(unittest.TestCase):
"""Test that we can serialize and deserialize a config.toml file"""
def serialize_and_parse(self, args):
from io import StringIO

section_order, sections, targets = configure.parse_args(args)
buffer = StringIO()
configure.write_config_toml(buffer, section_order, targets, sections)
build = bootstrap.RustBuild()
build.config_toml = buffer.getvalue()

try:
import tomllib
# Verify this is actually valid TOML.
tomllib.loads(build.config_toml)
except ImportError:
print("warning: skipping TOML validation, need at least python 3.11", file=sys.stderr)
return build

def test_no_args(self):
build = self.serialize_and_parse([])
self.assertEqual(build.get_toml("changelog-seen"), '2')
self.assertIsNone(build.get_toml("llvm.download-ci-llvm"))

def test_set_section(self):
build = self.serialize_and_parse(["--set", "llvm.download-ci-llvm"])
self.assertEqual(build.get_toml("download-ci-llvm", section="llvm"), 'true')

def test_set_target(self):
build = self.serialize_and_parse(["--set", "target.x86_64-unknown-linux-gnu.cc=gcc"])
self.assertEqual(build.get_toml("cc", section="target.x86_64-unknown-linux-gnu"), 'gcc')

# Uncomment when #108928 is fixed.
# def test_set_top_level(self):
# build = self.serialize_and_parse(["--set", "profile=compiler"])
# self.assertEqual(build.get_toml("profile"), 'compiler')

if __name__ == '__main__':
SUITE = unittest.TestSuite()
TEST_LOADER = unittest.TestLoader()
SUITE.addTest(doctest.DocTestSuite(bootstrap))
SUITE.addTests([
TEST_LOADER.loadTestsFromTestCase(VerifyTestCase),
TEST_LOADER.loadTestsFromTestCase(GenerateAndParseConfig),
TEST_LOADER.loadTestsFromTestCase(ProgramOutOfDate)])

RUNNER = unittest.TextTestRunner(stream=sys.stdout, verbosity=2)
417 changes: 219 additions & 198 deletions src/bootstrap/configure.py

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
@@ -567,6 +567,8 @@ fn configure_cmake(
cfg.define("CMAKE_SYSTEM_NAME", "Haiku");
} else if target.contains("solaris") || target.contains("illumos") {
cfg.define("CMAKE_SYSTEM_NAME", "SunOS");
} else if target.contains("linux") {
cfg.define("CMAKE_SYSTEM_NAME", "Linux");
}
// When cross-compiling we should also set CMAKE_SYSTEM_VERSION, but in
// that case like CMake we cannot easily determine system version either.
5 changes: 4 additions & 1 deletion src/ci/docker/host-x86_64/mingw-check-tidy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
FROM ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive
# NOTE: intentionally uses python2 for x.py so we can test it still works.
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
python2.7 \
python3 \
python3-pip \
python3-pkg-resources \
@@ -30,4 +33,4 @@ RUN pip3 install --no-deps --no-cache-dir --require-hashes -r /tmp/reuse-require
COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/

ENV SCRIPT python3 ../x.py test --stage 0 src/tools/tidy tidyselftest
ENV SCRIPT python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest
4 changes: 1 addition & 3 deletions src/ci/docker/host-x86_64/x86_64-gnu-llvm-14/Dockerfile
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@ FROM ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive

# NOTE: intentionally installs both python2 and python3 so we can test support for both.
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
gcc-multilib \
@@ -11,8 +10,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
file \
curl \
ca-certificates \
python2.7 \
python3 \
python3.11 \
git \
cmake \
sudo \
14 changes: 8 additions & 6 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@ use std::hash::Hash;
use std::mem;
use thin_vec::ThinVec;

use crate::clean::inline::merge_attrs;
use crate::core::{self, DocContext, ImplTraitParam};
use crate::formats::item_type::ItemType;
use crate::visit_ast::Module as DocModule;
@@ -2373,21 +2374,22 @@ fn clean_maybe_renamed_item<'tcx>(
_ => unreachable!("not yet converted"),
};

let mut extra_attrs = Vec::new();
let mut import_attrs = Vec::new();
let mut target_attrs = Vec::new();
if let Some(import_id) = import_id &&
let Some(hir::Node::Item(use_node)) = cx.tcx.hir().find_by_def_id(import_id)
{
let is_inline = inline::load_attrs(cx, import_id.to_def_id()).lists(sym::doc).get_word_attr(sym::inline).is_some();
// Then we get all the various imports' attributes.
get_all_import_attributes(use_node, cx.tcx, item.owner_id.def_id, &mut extra_attrs, is_inline);
add_without_unwanted_attributes(&mut extra_attrs, inline::load_attrs(cx, def_id), is_inline);
get_all_import_attributes(use_node, cx.tcx, item.owner_id.def_id, &mut import_attrs, is_inline);
add_without_unwanted_attributes(&mut target_attrs, inline::load_attrs(cx, def_id), is_inline);
} else {
// We only keep the item's attributes.
extra_attrs.extend_from_slice(inline::load_attrs(cx, def_id));
target_attrs.extend_from_slice(inline::load_attrs(cx, def_id));
}

let attrs = Attributes::from_ast(&extra_attrs);
let cfg = extra_attrs.cfg(cx.tcx, &cx.cache.hidden_cfg);
let import_parent = import_id.map(|import_id| cx.tcx.local_parent(import_id).to_def_id());
let (attrs, cfg) = merge_attrs(cx, import_parent, &target_attrs, Some(&import_attrs));

let mut item =
Item::from_def_id_and_attrs_and_parts(def_id, Some(name), kind, Box::new(attrs), cfg);
2 changes: 1 addition & 1 deletion src/tools/rustbook/Cargo.toml
Original file line number Diff line number Diff line change
@@ -9,6 +9,6 @@ clap = "4.0.32"
env_logger = "0.7.1"

[dependencies.mdbook]
version = "0.4.25"
version = "0.4.28"
default-features = false
features = ["search"]
16 changes: 16 additions & 0 deletions tests/rustdoc-ui/intra-doc/import-inline-merge.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Import for `A` is inlined and doc comments on the import and `A` itself are merged.
// After the merge they still have correct parent scopes to resolve both `[A]` and `[B]`.

// check-pass

#![allow(rustdoc::private_intra_doc_links)]

mod m {
/// [B]
pub struct A {}

pub struct B {}
}

/// [A]
pub use m::A;
2 changes: 2 additions & 0 deletions tests/ui/async-await/in-trait/issue-102310.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// check-pass
// edition:2021
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/lifetime-mismatch.rs:3:12
--> $DIR/lifetime-mismatch.rs:5:12
|
LL | #![feature(async_fn_in_trait)]
| ^^^^^^^^^^^^^^^^^
@@ -8,7 +8,7 @@ LL | #![feature(async_fn_in_trait)]
= note: `#[warn(incomplete_features)]` on by default

error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration
--> $DIR/lifetime-mismatch.rs:12:17
--> $DIR/lifetime-mismatch.rs:14:17
|
LL | async fn foo<'a>(&self);
| ---- lifetimes in impl do not match this method in trait
21 changes: 21 additions & 0 deletions tests/ui/async-await/in-trait/lifetime-mismatch.next.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/lifetime-mismatch.rs:5:12
|
LL | #![feature(async_fn_in_trait)]
| ^^^^^^^^^^^^^^^^^
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
= note: `#[warn(incomplete_features)]` on by default

error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration
--> $DIR/lifetime-mismatch.rs:14:17
|
LL | async fn foo<'a>(&self);
| ---- lifetimes in impl do not match this method in trait
...
LL | async fn foo(&self) {}
| ^ lifetimes do not match method in trait

error: aborting due to previous error; 1 warning emitted

For more information about this error, try `rustc --explain E0195`.
2 changes: 2 additions & 0 deletions tests/ui/async-await/in-trait/lifetime-mismatch.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// edition:2021
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(async_fn_in_trait)]
//~^ WARN the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#![feature(generic_const_exprs)]
//~^ WARN the feature `generic_const_exprs` is incomplete

trait B {
type U<T>;
}

fn f<T: B<U<1i32> = ()>>() {}
//~^ ERROR constant provided when a type was expected

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/mismatched-gat-subst-kind.rs:1:12
|
LL | #![feature(generic_const_exprs)]
| ^^^^^^^^^^^^^^^^^^^
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
= note: `#[warn(incomplete_features)]` on by default

error[E0747]: constant provided when a type was expected
--> $DIR/mismatched-gat-subst-kind.rs:8:13
|
LL | fn f<T: B<U<1i32> = ()>>() {}
| ^^^^

error: aborting due to previous error; 1 warning emitted

For more information about this error, try `rustc --explain E0747`.
2 changes: 2 additions & 0 deletions tests/ui/impl-trait/in-trait/early.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// check-pass
// edition:2021
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
2 changes: 2 additions & 0 deletions tests/ui/impl-trait/in-trait/issue-102301.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// check-pass
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
2 changes: 2 additions & 0 deletions tests/ui/impl-trait/in-trait/opaque-in-impl.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// check-pass
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0049]: method `bar` has 0 type parameters but its trait declaration has 1 type parameter
--> $DIR/trait-more-generics-than-impl.rs:11:11
--> $DIR/trait-more-generics-than-impl.rs:14:11
|
LL | fn bar<T>() -> impl Sized;
| - expected 1 type parameter
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error[E0049]: method `bar` has 0 type parameters but its trait declaration has 1 type parameter
--> $DIR/trait-more-generics-than-impl.rs:14:11
|
LL | fn bar<T>() -> impl Sized;
| - expected 1 type parameter
...
LL | fn bar() -> impl Sized {}
| ^ found 0 type parameters

error: aborting due to previous error

For more information about this error, try `rustc --explain E0049`.
3 changes: 3 additions & 0 deletions tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]

2 changes: 2 additions & 0 deletions tests/ui/impl-trait/in-trait/where-clause.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// check-pass
// edition: 2021
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
5 changes: 3 additions & 2 deletions tests/ui/rfc-2091-track-caller/intrinsic-wrapper.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// run-pass
// revisions: default mir-opt
//[default] compile-flags: -Zinline-mir=no
//[mir-opt] compile-flags: -Zmir-opt-level=4

macro_rules! caller_location_from_macro {
@@ -9,13 +10,13 @@ macro_rules! caller_location_from_macro {
fn main() {
let loc = core::panic::Location::caller();
assert_eq!(loc.file(), file!());
assert_eq!(loc.line(), 10);
assert_eq!(loc.line(), 11);
assert_eq!(loc.column(), 15);

// `Location::caller()` in a macro should behave similarly to `file!` and `line!`,
// i.e. point to where the macro was invoked, instead of the macro itself.
let loc2 = caller_location_from_macro!();
assert_eq!(loc2.file(), file!());
assert_eq!(loc2.line(), 17);
assert_eq!(loc2.line(), 18);
assert_eq!(loc2.column(), 16);
}
23 changes: 23 additions & 0 deletions tests/ui/rfc-2091-track-caller/mir-inlined-macro.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// run-pass
// revisions: default mir-opt
//[default] compile-flags: -Zinline-mir=no
//[mir-opt] compile-flags: -Zmir-opt-level=4

use std::panic::Location;

macro_rules! f {
() => {
Location::caller()
};
}

#[inline(always)]
fn g() -> &'static Location<'static> {
f!()
}

fn main() {
let loc = g();
assert_eq!(loc.line(), 16);
assert_eq!(loc.column(), 5);
}