76,653 matches across 25 files for error lang:Rust
snippet_mode: grep · sorted by relevance
compiler/rustc/build.rs RUST 1 matches view file →
37 println!("cargo:rustc-link-arg-bin=rustc-main=/MANIFEST:EMBED");
38 println!("cargo:rustc-link-arg-bin=rustc-main=/MANIFESTINPUT:{}", manifest.to_str().unwrap());
39 // Turn linker warnings into errors.
40 println!("cargo:rustc-link-arg-bin=rustc-main=/WX");
41}
compiler/rustc_abi/src/callconv.rs RUST 1 matches view file →
17}
18
19/// Error from the `homogeneous_aggregate` test function, indicating
20/// there are distinct leaf fields passed in different ways,
21/// or this is uninhabited.
compiler/rustc_abi/src/canon_abi.rs RUST 1 matches view file →
71 // convert to the ExternAbi that *shares a string* with this CanonAbi.
72 // FIXME: ideally we'd avoid printing `CanonAbi`, and preserve `ExternAbi` everywhere
73 // that we need to generate error messages.
74 let erased_abi = match self {
75 CanonAbi::C => ExternAbi::C { unwind: false },
compiler/rustc_abi/src/extern_abi.rs RUST 1 matches view file →
257
258#[cfg(feature = "nightly")]
259rustc_error_messages::into_diag_arg_using_display!(ExternAbi);
260
261#[cfg(feature = "nightly")]
compiler/rustc_abi/src/layout.rs RUST 20 matches · showing 5 view file →
106
107#[derive(Copy, Clone, Debug, PartialEq, Eq)]
108pub enum LayoutCalculatorError<F> {
109 /// An unsized type was found in a location where a sized type was expected.
110 ///
· · ·
111 /// This is not always a compile error, for example if there is a `[T]: Sized`
112 /// bound in a where clause.
113 ///
· · ·
134}
135
136impl<F> LayoutCalculatorError<F> {
137 pub fn without_payload(&self) -> LayoutCalculatorError<()> {
138 use LayoutCalculatorError::*;
· · ·
137 pub fn without_payload(&self) -> LayoutCalculatorError<()> {
138 use LayoutCalculatorError::*;
139 match *self {
· · ·
138 use LayoutCalculatorError::*;
139 match *self {
140 UnexpectedUnsized(_) => UnexpectedUnsized(()),
+ 15 more matches in this file
compiler/rustc_abi/src/lib.rs RUST 39 matches · showing 5 view file →
40#[cfg(feature = "nightly")]
41use std::iter::Step;
42use std::num::{NonZeroUsize, ParseIntError};
43use std::ops::{Add, AddAssign, Deref, Mul, RangeFull, RangeInclusive, Sub};
44use std::str::FromStr;
· · ·
48use rustc_data_structures::stable_hasher::StableOrd;
49#[cfg(feature = "nightly")]
50use rustc_error_messages::{DiagArgValue, IntoDiagArg};
51#[cfg(feature = "nightly")]
52use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, msg};
· · ·
52use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, msg};
53use rustc_hashes::Hash64;
54use rustc_index::{Idx, IndexSlice, IndexVec};
· · ·
70pub use extern_abi::CVariadicStatus;
71pub use extern_abi::{ExternAbi, all_names};
72pub use layout::{FIRST_VARIANT, FieldIdx, LayoutCalculator, LayoutCalculatorError, VariantIdx};
73#[cfg(feature = "nightly")]
74pub use layout::{Layout, TyAbiInterface, TyAndLayout};
· · ·
327}
328
329pub enum TargetDataLayoutError<'a> {
330 InvalidAddressSpace { addr_space: &'a str, cause: &'a str, err: ParseIntError },
331 InvalidBits { kind: &'a str, bit: &'a str, cause: &'a str, err: ParseIntError },
+ 34 more matches in this file
compiler/rustc_ast/src/ast.rs RUST 19 matches · showing 5 view file →
32pub use rustc_span::AttrId;
33use rustc_span::{
34 ByteSymbol, DUMMY_SP, ErrorGuaranteed, Ident, Span, Spanned, Symbol, kw, respan, sym,
35};
36use thin_vec::{ThinVec, thin_vec};
· · ·
724
725 /// Whether this could be a never pattern, taking into account that a macro invocation can
726 /// return a never pattern. Used to inform errors during parsing.
727 pub fn could_be_never_pattern(&self) -> bool {
728 let mut could_be_never_pattern = false;
· · ·
741 }
742
743 /// Whether this contains a `!` pattern. This in particular means that a feature gate error will
744 /// be raised if the feature is off. Used to avoid gating the feature twice.
745 pub fn contains_never_pattern(&self) -> bool {
· · ·
948
949 /// Placeholder for a pattern that wasn't syntactically well formed in some way.
950 Err(ErrorGuaranteed),
951}
952
· · ·
956 /// `module::StructName { field, ..}`
957 Rest(Span),
958 /// `module::StructName { field, syntax error }`
959 Recovered(ErrorGuaranteed),
960 /// `module::StructName { field }`
+ 14 more matches in this file
compiler/rustc_ast/src/attr/mod.rs RUST 1 matches view file →
602 AttrArgs::Eq { expr, .. } => match expr.kind {
603 ExprKind::Lit(token_lit) => {
604 // Turn failures to `None`, we'll get parse errors elsewhere.
605 MetaItemLit::from_token_lit(token_lit, expr.span)
606 .ok()
compiler/rustc_ast/src/expand/allocator.rs RUST 1 matches view file →
18}
19
20pub const ALLOC_ERROR_HANDLER: Symbol = sym::alloc_error_handler;
21pub const NO_ALLOC_SHIM_IS_UNSTABLE: &str = "__rust_no_alloc_shim_is_unstable_v2";
22
compiler/rustc_ast/src/expand/autodiff_attrs.rs RUST 7 matches · showing 5 view file →
23#[derive(Clone, Copy, Eq, PartialEq, Encodable, Decodable, Debug, StableHash)]
24pub enum DiffMode {
25 /// No autodiff is applied (used during error handling).
26 Error,
27 /// The primal function which we will differentiate.
· · ·
26 Error,
27 /// The primal function which we will differentiate.
28 Source,
· · ·
113 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
114 match self {
115 DiffMode::Error => write!(f, "Error"),
116 DiffMode::Source => write!(f, "Source"),
117 DiffMode::Forward => write!(f, "Forward"),
· · ·
125/// Const is valid for all cases and means that we don't compute derivatives wrt. this output.
126/// That usually means we have a &mut or *mut T output and compute derivatives wrt. that arg,
127/// but this is too complex to verify here. Also it's just a logic error if users get this wrong.
128pub fn valid_ret_activity(mode: DiffMode, activity: DiffActivity) -> bool {
129 if activity == DiffActivity::None {
· · ·
132 }
133 match mode {
134 DiffMode::Error => false,
135 DiffMode::Source => false,
136 DiffMode::Forward => activity.is_dual_or_const(),
+ 2 more matches in this file
compiler/rustc_ast/src/format.rs RUST 1 matches view file →
97 } else if self.names.is_empty() {
98 // Only count the unnamed args before the first named arg.
99 // (Any later ones are errors.)
100 self.num_unnamed_args += 1;
101 }
compiler/rustc_ast/src/token.rs RUST 6 matches · showing 5 view file →
9use rustc_span::edition::Edition;
10use rustc_span::symbol::IdentPrintMode;
11use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span, kw, sym};
12#[allow(clippy::useless_attribute)] // FIXME: following use of `hidden_glob_reexports` incorrectly triggers `useless_attribute` lint.
13#[allow(hidden_glob_reexports)]
· · ·
202 CStr,
203 CStrRaw(u8),
204 Err(ErrorGuaranteed),
205}
206
· · ·
302 ByteStr | ByteStrRaw(..) => "byte string",
303 CStr | CStrRaw(..) => "C string",
304 Err(_) => "error",
305 }
306 }
· · ·
580
581 /// Returns tokens that are likely to be typed accidentally instead of the current token.
582 /// Enables better error recovery when the wrong token is found.
583 pub fn similar_tokens(&self) -> &[TokenKind] {
584 match self {
· · ·
682 And | // reference
683 AndAnd | // double reference
684 // DotDotDot is no longer supported, but we need some way to display the error
685 DotDot | DotDotDot | DotDotEq | // range notation
686 Lt | Shl | // associated path
+ 1 more matches in this file
compiler/rustc_ast/src/util/literal.rs RUST 11 matches · showing 5 view file →
33
34#[derive(Debug)]
35pub enum LitError {
36 InvalidSuffix(Symbol),
37 InvalidIntSuffix(Symbol),
· · ·
43impl LitKind {
44 /// Converts literal token into a semantic literal.
45 pub fn from_token_lit(lit: token::Lit) -> Result<LitKind, LitError> {
46 let token::Lit { kind, symbol, suffix } = lit;
47 if let Some(suffix) = suffix
· · ·
48 && !kind.may_have_suffix()
49 {
50 return Err(LitError::InvalidSuffix(suffix));
51 }
52
· · ·
217impl MetaItemLit {
218 /// Converts a token literal into a meta item literal.
219 pub fn from_token_lit(token_lit: token::Lit, span: Span) -> Result<MetaItemLit, LitError> {
220 Ok(MetaItemLit {
221 symbol: token_lit.symbol,
· · ·
268 suffix: Option<Symbol>,
269 base: u32,
270) -> Result<LitKind, LitError> {
271 debug!("filtered_float_lit: {:?}, {:?}, {:?}", symbol, suffix, base);
272 if base != 10 {
+ 6 more matches in this file
compiler/rustc_ast/src/util/parser.rs RUST 2 matches view file →
64 token::OrOr => Some(Binary(BinOpKind::Or)),
65 token::DotDot => Some(Range(RangeLimits::HalfOpen)),
66 // DotDotDot is no longer supported, but we need some way to display the error
67 token::DotDotEq | token::DotDotDot => Some(Range(RangeLimits::Closed)),
68 // `<-` should probably be `< -`
· · ·
114 /// This operator could be used to follow a block unambiguously.
115 ///
116 /// This is used for error recovery at the moment, providing a suggestion to wrap blocks with
117 /// parentheses while having a high degree of confidence on the correctness of the suggestion.
118 pub fn can_continue_expr_unambiguously(&self) -> bool {
compiler/rustc_ast/src/visit.rs RUST 4 matches view file →
370 Mutability,
371 Pinnedness,
372 Result<(), rustc_span::ErrorGuaranteed>,
373 rustc_data_structures::fx::FxHashMap<Symbol, usize>,
374 rustc_span::ErrorGuaranteed,
· · ·
374 rustc_span::ErrorGuaranteed,
375 std::borrow::Cow<'_, str>,
376 Symbol,
· · ·
508 ///
509 /// Every `walk_*` method uses deconstruction to access fields of structs and
510 /// enums. This will result in a compile error if a field is added, which makes
511 /// it more likely the appropriate visit call will be added for it.
512 pub trait $Visitor<$($lt)?> : Sized $(${ignore($mut)} + MutVisitorResult<Result = ()>)? {
· · ·
542 // As well as being more concise, the former is explicit about which fields
543 // are skipped. Furthermore, if a new field is added, the destructuring
544 // version will cause a compile error, which is good. In comparison, the
545 // field access version will continue working and it would be easy to
546 // forget to add handling for it.
compiler/rustc_ast_lowering/src/asm.rs RUST 8 matches · showing 5 view file →
3use rustc_ast::*;
4use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
5use rustc_errors::msg;
6use rustc_hir as hir;
7use rustc_hir::def::{DefKind, Res};
· · ·
8use rustc_session::errors::feature_err;
9use rustc_span::{Span, sym};
10use rustc_target::asm;
· · ·
11
12use super::LoweringContext;
13use super::errors::{
14 AbiSpecifiedMultipleTimes, AttSyntaxOnlyX86, ClobberAbiNotSupported,
15 InlineAsmUnsupportedTarget, InvalidAbiClobberAbi, InvalidAsmTemplateModifierConst,
· · ·
97 ) {
98 Ok(abi) => {
99 // If the abi was already in the list, emit an error
100 match clobber_abis.get(&abi) {
101 Some((prev_name, prev_sp)) => {
· · ·
131 }
132
133 // Lower operands to HIR. We use dummy register classes if an error
134 // occurs during lowering because we still need to be able to produce a
135 // valid HIR.
+ 3 more matches in this file
compiler/rustc_ast_lowering/src/block.rs RUST 1 matches view file →
86
87 /// Return an `ImplTraitContext` that allows impl trait in bindings if
88 /// the feature gate is enabled, or issues a feature error if it is not.
89 fn impl_trait_in_bindings_ctxt(&self, position: ImplTraitPosition) -> ImplTraitContext {
90 if self.tcx.features().impl_trait_in_bindings() {
compiler/rustc_ast_lowering/src/delegation.rs RUST 12 matches · showing 5 view file →
34//!
35//! Similarly generics, predicates and header are set to the "default" values.
36//! In case of discrepancy with callee function the `UnsupportedDelegation` error will
37//! also be emitted during HIR ty lowering.
38
· · ·
46use rustc_ast::*;
47use rustc_data_structures::fx::FxHashSet;
48use rustc_errors::ErrorGuaranteed;
49use rustc_hir::attrs::{AttributeKind, InlineAttr};
50use rustc_hir::def_id::DefId;
· · ·
57
58use crate::delegation::generics::{GenericsGenerationResult, GenericsGenerationResults};
59use crate::errors::{CycleInDelegationSignatureResolution, UnresolvedDelegationCallee};
60use crate::{
61 AllowReturnTypeNotation, GenericArgsMode, ImplTraitContext, ImplTraitPosition, LoweringContext,
· · ·
133 );
134
135 return self.generate_delegation_error(span, delegation);
136 };
137
· · ·
171 DelegationResults { body_id, sig, ident, generics }
172 }
173 Err(_) => self.generate_delegation_error(span, delegation),
174 }
175 }
+ 7 more matches in this file
compiler/rustc_ast_lowering/src/delegation/generics.rs RUST 1 matches view file →
344 // applies to traits, `trait Trait<Self> {}` will be represented as
345 // `trait Trait {}` in HIR and "unexpected keyword `Self` in generic parameters"
346 // error will be emitted.
347 // Note that we do not rename `Self` to `This` after non-recursive reuse
348 // from Trait, in this case the `Self` should not be propagated
compiler/rustc_ast_lowering/src/errors.rs RUST 4 matches view file →
1use rustc_errors::codes::*;
2use rustc_errors::{DiagArgFromDisplay, DiagSymbolList};
3use rustc_macros::{Diagnostic, Subdiagnostic};
· · ·
2use rustc_errors::{DiagArgFromDisplay, DiagSymbolList};
3use rustc_macros::{Diagnostic, Subdiagnostic};
4use rustc_span::{Ident, Span, Symbol};
· · ·
199
200#[derive(Diagnostic)]
201#[diag("invalid register `{$reg}`: {$error}")]
202pub(crate) struct InvalidRegister<'a> {
203 #[primary_span]
· · ·
204 pub op_span: Span,
205 pub reg: Symbol,
206 pub error: &'a str,
207}
208
compiler/rustc_ast_lowering/src/expr.rs RUST 22 matches · showing 5 view file →
6use rustc_ast_pretty::pprust::expr_to_string;
7use rustc_data_structures::stack::ensure_sufficient_stack;
8use rustc_errors::msg;
9use rustc_hir as hir;
10use rustc_hir::def::{DefKind, Res};
· · ·
12use rustc_middle::span_bug;
13use rustc_middle::ty::TyCtxt;
14use rustc_session::errors::report_lit_error;
15use rustc_span::{ByteSymbol, DUMMY_SP, DesugaringKind, Ident, Span, Spanned, Symbol, respan, sym};
16use thin_vec::{ThinVec, thin_vec};
· · ·
17use visit::{Visitor, walk_expr};
18
19use super::errors::{
20 AsyncCoroutinesNotSupported, AwaitOnlyInAsyncFnAndBlocks, ClosureCannotBeStatic,
21 CoroutineTooManyParameters, FunctionalRecordUpdateDestructuringAssignment,
· · ·
26 GenericArgsMode, ImplTraitContext, LoweringContext, ParamMode, ResolverAstLoweringExt,
27};
28use crate::errors::{InvalidLegacyConstGenericArg, UseConstGenericArg, YieldInClosure};
29use crate::{AllowReturnTypeNotation, FnDeclKind, ImplTraitPosition, TryBlockScope};
30
· · ·
346 }
347 StructRest::None => hir::StructTailExpr::None,
348 StructRest::NoneWithError(guar) => hir::StructTailExpr::NoneWithError(guar),
349 };
350 hir::ExprKind::Struct(
+ 17 more matches in this file
compiler/rustc_ast_lowering/src/item.rs RUST 17 matches · showing 5 view file →
3use rustc_ast::*;
4use rustc_data_structures::fx::FxIndexMap;
5use rustc_errors::{E0570, ErrorGuaranteed, struct_span_code_err};
6use rustc_hir::attrs::{AttributeKind, EiiImplResolution};
7use rustc_hir::def::{DefKind, PerNS, Res};
· · ·
20use tracing::instrument;
21
22use super::errors::{InvalidAbi, InvalidAbiSuggestion, TupleStructWithDefault, UnionWithDefault};
23use super::stability::{enabled_names, gate_unstable_abi};
24use super::{
· · ·
192 EiiImplResolution::Macro(macro_did)
193 } else {
194 EiiImplResolution::Error(
195 self.dcx().span_delayed_bug(*span, "eii never resolved without errors given"),
196 )
· · ·
195 self.dcx().span_delayed_bug(*span, "eii never resolved without errors given"),
196 )
197 };
· · ·
635 let res = self.get_partial_res(id)?;
636 let Some(did) = res.expect_full_res().opt_def_id() else {
637 self.dcx().span_delayed_bug(path.span, "should have errored in resolve");
638 return None;
639 };
+ 12 more matches in this file
compiler/rustc_ast_lowering/src/lib.rs RUST 31 matches · showing 5 view file →
20//! If you do, you must then set the new node's ID to a fresh one.
21//!
22//! Spans are used for error messages and for tools to map semantics back to
23//! source code. It is therefore not as important with spans as IDs to be strict
24//! about use (you can't break the compiler by screwing up a span). Obviously, a
· · ·
49use rustc_data_structures::steal::Steal;
50use rustc_data_structures::tagged_ptr::TaggedRef;
51use rustc_errors::{DiagArgFromDisplay, DiagCtxtHandle};
52use rustc_hir::def::{DefKind, LifetimeRes, Namespace, PartialRes, PerNS, Res};
53use rustc_hir::def_id::{CRATE_DEF_ID, LOCAL_CRATE, LocalDefId};
· · ·
63use rustc_middle::span_bug;
64use rustc_middle::ty::{DelegationInfo, ResolverAstLowering, TyCtxt};
65use rustc_session::errors::add_feature_diagnostics;
66use rustc_span::symbol::{Ident, Symbol, kw, sym};
67use rustc_span::{DUMMY_SP, DesugaringKind, Span};
· · ·
70use tracing::{debug, instrument, trace};
71
72use crate::errors::{AssocTyParentheses, AssocTyParenthesesSub, MisplacedImplTrait};
73use crate::item::Owners;
74
· · ·
83mod contract;
84mod delegation;
85mod errors;
86mod expr;
87mod format;
+ 26 more matches in this file
compiler/rustc_ast_lowering/src/pat.rs RUST 5 matches view file →
8use rustc_span::{DesugaringKind, Ident, Span, Spanned, respan};
9
10use super::errors::{
11 ArbitraryExpressionInPattern, ExtraDoubleDot, MisplacedDoubleDot, SubTupleBinding,
12};
· · ·
199 // There was a previous sub-tuple pattern; make sure we don't allow more...
200 if pat.is_rest() {
201 // ...but there was one again, so error.
202 self.ban_extra_rest_pat(pat.span, rest.unwrap().1, ctx);
203 } else {
· · ·
214 /// When encountering `($binding_mode $ident @)? ..` (`slice`),
215 /// this is interpreted as a sub-slice pattern semantically.
216 /// Patterns that follow, which are not like `slice` -- or an error occurs, are in `after`.
217 fn lower_pat_slice(&mut self, pats: &[Pat]) -> hir::PatKind<'hir> {
218 let mut before = Vec::new();
· · ·
266 };
267 if let Some(rest_span) = rest_span {
268 // We have e.g., `[a, .., b, ..]`. That's no good, error!
269 self.ban_extra_rest_pat(rest_span, prev_rest_span.unwrap(), "slice");
270 } else {
· · ·
352 }
353
354 /// Emit a friendly error for extra `..` patterns in a tuple/tuple struct/slice pattern.
355 pub(crate) fn ban_extra_rest_pat(&self, sp: Span, prev_sp: Span, ctx: &str) {
356 self.dcx().emit_err(ExtraDoubleDot { span: sp, prev_span: prev_sp, ctx });
compiler/rustc_ast_lowering/src/path.rs RUST 7 matches · showing 5 view file →
2
3use rustc_ast::{self as ast, *};
4use rustc_errors::StashKey;
5use rustc_hir::def::{DefKind, PartialRes, PerNS, Res};
6use rustc_hir::def_id::DefId;
· · ·
7use rustc_hir::{self as hir, GenericArg};
8use rustc_middle::{span_bug, ty};
9use rustc_session::errors::add_feature_diagnostics;
10use rustc_span::{BytePos, DUMMY_SP, DesugaringKind, Ident, Span, Symbol, sym};
11use smallvec::smallvec;
· · ·
12use tracing::{debug, instrument};
13
14use super::errors::{
15 AsyncBoundNotOnTrait, AsyncBoundOnlyForFnTraits, BadReturnTypeNotation,
16 GenericTypeWithParentheses, RTNSuggestion, UseAngleBrackets,
· · ·
59 }
60 Res::Err => {
61 // No additional error.
62 }
63 _ => {
· · ·
64 // This error isn't actually emitted AFAICT, but it's best to keep
65 // it around in case the resolver doesn't always check the defkind
66 // of an item or something.
+ 2 more matches in this file
Search syntax
auth loginboth terms (AND is implicit)
auth OR logineither term
NOT path:vendorexclude matches
"exact phrase"quoted exact match
/func\s+Test/regex
handler~1fuzzy (Levenshtein 1)
file:*_test.gofilename glob
path:pkg/auth/**full path glob
lang:golanguage filter

Search any public repo from your terminal

This page calls POST /api/v1/code_search. Same tool, available over MCP for Claude/Cursor/Copilot.